feat: add initial mobile layout for earn and burn
This commit is contained in:
@@ -35,13 +35,13 @@ function DynamicComponent({ component, props }: AccountPageContentProps) {
|
|||||||
case DynamicContentComponents.next_benefits:
|
case DynamicContentComponents.next_benefits:
|
||||||
return <NextLevelBenefitsBlock {...props} />
|
return <NextLevelBenefitsBlock {...props} />
|
||||||
case DynamicContentComponents.my_points:
|
case DynamicContentComponents.my_points:
|
||||||
return <CurrentPointsBalance />
|
return <CurrentPointsBalance {...props} />
|
||||||
case DynamicContentComponents.expiring_points:
|
case DynamicContentComponents.expiring_points:
|
||||||
// TODO: Add once available
|
// TODO: Add once available
|
||||||
// return <ExpiringPoints />
|
// return <ExpiringPoints />
|
||||||
return null
|
return null
|
||||||
case DynamicContentComponents.earn_and_burn:
|
case DynamicContentComponents.earn_and_burn:
|
||||||
return <EarnAndBurn lang={props.lang} />
|
return <EarnAndBurn {...props} />
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
.card {
|
.card {
|
||||||
background-color: var(--Base-Fill-Normal);
|
background-color: var(--Main-Grey-10);
|
||||||
border-radius: 16px;
|
border-radius: var(--Corner-radius-xLarge);
|
||||||
color: var(--Theme-Primary-Light-On-Surface-Text);
|
color: var(--Main-Brand-Burgundy);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 16px;
|
gap: var(--Spacing-x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.points {
|
.points {
|
||||||
font-size: var(--typography-Title2-Desktop-fontSize);
|
font-size: var(--typography-Title-2-Desktop-fontSize);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
import { _ } from "@/lib/translation"
|
import { _ } from "@/lib/translation"
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
|
import Header from "@/components/MyPages/Blocks/Header"
|
||||||
|
|
||||||
import styles from "./currentPointsBalance.module.css"
|
import styles from "./currentPointsBalance.module.css"
|
||||||
|
|
||||||
async function CurrentPointsBalance() {
|
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
|
||||||
|
|
||||||
|
async function CurrentPointsBalance({
|
||||||
|
title,
|
||||||
|
subtitle,
|
||||||
|
link,
|
||||||
|
lang,
|
||||||
|
}: AccountPageComponentProps) {
|
||||||
const user = await serverClient().user.get()
|
const user = await serverClient().user.get()
|
||||||
return (
|
return (
|
||||||
|
<div>
|
||||||
|
<Header title={title} link={link} subtitle={subtitle} />
|
||||||
|
|
||||||
<div className={styles.card}>
|
<div className={styles.card}>
|
||||||
<h2>{`${_("Total points")}*`}</h2>
|
<h2>{`${_("Total points")}*`}</h2>
|
||||||
<p
|
<p
|
||||||
@@ -15,6 +27,7 @@ async function CurrentPointsBalance() {
|
|||||||
{`*${_("Points may take up to 10 days to be displayed.")}`}
|
{`*${_("Points may take up to 10 days to be displayed.")}`}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,29 @@
|
|||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: grid;
|
||||||
flex-direction: column;
|
gap: var(--Spacing-x3);
|
||||||
gap: 16px;
|
}
|
||||||
overflow-x: auto;
|
|
||||||
|
.mobileTable {
|
||||||
|
border-spacing: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobileThead {
|
||||||
|
background-color: var(--Main-Grey-10);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobileTh {
|
||||||
|
padding: var(--Spacing-x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobilePlaceholder {
|
||||||
|
text-align: center;
|
||||||
|
padding: var(--Spacing-x4);
|
||||||
|
border: 1px solid var(--Main-Grey-10);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tableContainer {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
@@ -12,9 +33,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.thead {
|
.thead {
|
||||||
background-color: var(--Base-Fill-Normal);
|
background-color: var(--Main-Grey-10);
|
||||||
border-left: 1px solid var(--Base-Fill-Normal);
|
border-left: 1px solid var(--Main-Grey-10);
|
||||||
border-right: 1px solid var(--Base-Fill-Normal);
|
border-right: 1px solid var(--Main-Grey-10);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tr {
|
.tr {
|
||||||
@@ -35,5 +56,18 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid var(--Base-Fill-Normal);
|
border: 1px solid var(--Main-Grey-10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 950px) {
|
||||||
|
.mobileTableContainer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tableContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,13 @@ import { dt } from "@/lib/dt"
|
|||||||
import { _ } from "@/lib/translation"
|
import { _ } from "@/lib/translation"
|
||||||
import { trpc } from "@/lib/trpc/client"
|
import { trpc } from "@/lib/trpc/client"
|
||||||
|
|
||||||
|
import Header from "@/components/MyPages/Blocks/Header"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
|
|
||||||
import styles from "./earnAndBurn.module.css"
|
import styles from "./earnAndBurn.module.css"
|
||||||
|
|
||||||
import {
|
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
|
||||||
EarnAndBurnProps,
|
import { Page, RowProps } from "@/types/components/myPages/myPage/earnAndBurn"
|
||||||
Page,
|
|
||||||
RowProps,
|
|
||||||
} from "@/types/components/myPages/myPage/earnAndBurn"
|
|
||||||
|
|
||||||
const tableHeadings = [
|
const tableHeadings = [
|
||||||
_("Arrival date"),
|
_("Arrival date"),
|
||||||
@@ -22,7 +20,12 @@ const tableHeadings = [
|
|||||||
_("Points"),
|
_("Points"),
|
||||||
]
|
]
|
||||||
|
|
||||||
function EarnAndBurn({ lang }: EarnAndBurnProps) {
|
function EarnAndBurn({
|
||||||
|
lang,
|
||||||
|
title,
|
||||||
|
subtitle,
|
||||||
|
link,
|
||||||
|
}: AccountPageComponentProps) {
|
||||||
const { data, hasNextPage, isFetching, fetchNextPage } =
|
const { data, hasNextPage, isFetching, fetchNextPage } =
|
||||||
trpc.user.transaction.friendTransactions.useInfiniteQuery(
|
trpc.user.transaction.friendTransactions.useInfiniteQuery(
|
||||||
{ limit: 5 },
|
{ limit: 5 },
|
||||||
@@ -38,8 +41,36 @@ function EarnAndBurn({ lang }: EarnAndBurnProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const transactions = data?.pages.flatMap((page) => page.data) ?? []
|
const transactions = data?.pages.flatMap((page) => page.data) ?? []
|
||||||
return transactions.length ? (
|
return (
|
||||||
<div className={styles.container}>
|
<div>
|
||||||
|
<Header title={title} link={link} subtitle={subtitle} />
|
||||||
|
|
||||||
|
<div className={styles.mobileTableContainer}>
|
||||||
|
<table className={styles.mobileTable}>
|
||||||
|
<thead className={styles.mobileThead}>
|
||||||
|
<th className={styles.mobileTh}>{_("Transactions")}</th>
|
||||||
|
<th className={styles.mobileTh}>{_("Points")}</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{transactions.length ? (
|
||||||
|
transactions.map((transaction) => (
|
||||||
|
<tr key={transaction.confirmationNumber}>
|
||||||
|
<td>{transaction.hotelName}</td>
|
||||||
|
<td>{transaction.awardPoints}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td className={styles.mobilePlaceholder} colSpan={2}>
|
||||||
|
Empty
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div className={styles.tableContainer}>
|
||||||
|
{transactions.length ? (
|
||||||
<table className={styles.table}>
|
<table className={styles.table}>
|
||||||
<thead className={styles.thead}>
|
<thead className={styles.thead}>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -60,19 +91,17 @@ function EarnAndBurn({ lang }: EarnAndBurnProps) {
|
|||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{/* TODO: add once pagination is available through API */}
|
|
||||||
{/* <Button
|
|
||||||
disabled={isFetching}
|
|
||||||
intent="primary"
|
|
||||||
bgcolor="white"
|
|
||||||
type="button"
|
|
||||||
onClick={loadMoreData}
|
|
||||||
>
|
|
||||||
{_("See more transactions")}
|
|
||||||
</Button> */}
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div className={styles.container}>
|
// TODO: add once pagination is available through API
|
||||||
|
// <Button
|
||||||
|
// disabled={isFetching}
|
||||||
|
// intent="primary"
|
||||||
|
// bgcolor="white"
|
||||||
|
// type="button"
|
||||||
|
// onClick={loadMoreData}
|
||||||
|
// >
|
||||||
|
// {_("See more transactions")}
|
||||||
|
// </Button>
|
||||||
<table className={styles.table}>
|
<table className={styles.table}>
|
||||||
<thead className={styles.thead}>
|
<thead className={styles.thead}>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -83,14 +112,14 @@ function EarnAndBurn({ lang }: EarnAndBurnProps) {
|
|||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={tableHeadings.length} className={styles.placeholder}>
|
<td colSpan={tableHeadings.length} className={styles.placeholder}>
|
||||||
{_("No transactions available")}
|
{_("No transactions available")}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
|
||||||
</table>
|
</table>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user