fix: temp disable features using unavailable data

This commit is contained in:
Arvid Norlin
2024-05-16 10:10:58 +02:00
parent 795fe400cb
commit 607334aad5
4 changed files with 42 additions and 11 deletions

View File

@@ -37,7 +37,9 @@ function DynamicComponent({ component, props }: AccountPageContentProps) {
case DynamicContentComponents.my_points: case DynamicContentComponents.my_points:
return <CurrentPointsBalance /> return <CurrentPointsBalance />
case DynamicContentComponents.expiring_points: case DynamicContentComponents.expiring_points:
return <ExpiringPoints /> // TODO: Add once available
// return <ExpiringPoints />
return null
case DynamicContentComponents.earn_and_burn: case DynamicContentComponents.earn_and_burn:
return <EarnAndBurn lang={props.lang} /> return <EarnAndBurn lang={props.lang} />
default: default:

View File

@@ -1,16 +1,18 @@
import { _ } from "@/lib/translation" import { _ } from "@/lib/translation"
import { serverClient } from "@/lib/trpc/server"
import styles from "./currentPointsBalance.module.css" import styles from "./currentPointsBalance.module.css"
function CurrentPointsBalance() { async function CurrentPointsBalance() {
const points = 30000 const user = await serverClient().user.get()
return ( return (
<div className={styles.card}> <div className={styles.card}>
<h2>{_("Total points*")}</h2> <h2>{`${_("Total points")}*`}</h2>
<p className={styles.points}>{`${_("Points")}: ${points}`}</p> <p
className={styles.points}
>{`${_("Points")}: ${user.membership.currentPoints}`}</p>
<p className={styles.disclaimer}> <p className={styles.disclaimer}>
{_("*Points may take up to 10 days to be displayed.")} {`*${_("Points may take up to 10 days to be displayed.")}`}
</p> </p>
</div> </div>
) )

View File

@@ -30,3 +30,13 @@
text-align: left; text-align: left;
padding: 16px 32px; padding: 16px 32px;
} }
.emptyPlaceholder {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
font-size: var(--typography-Title5-Desktop-fontSize);
border: 1px solid var(--Base-Fill-Normal);
border-top: none;
}

View File

@@ -38,8 +38,7 @@ 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 className={styles.container}>
<table className={styles.table}> <table className={styles.table}>
<thead className={styles.thead}> <thead className={styles.thead}>
@@ -61,7 +60,8 @@ function EarnAndBurn({ lang }: EarnAndBurnProps) {
))} ))}
</tbody> </tbody>
</table> </table>
<Button {/* TODO: add once pagination is available through API */}
{/* <Button
disabled={isFetching} disabled={isFetching}
intent="primary" intent="primary"
bgcolor="white" bgcolor="white"
@@ -69,7 +69,24 @@ function EarnAndBurn({ lang }: EarnAndBurnProps) {
onClick={loadMoreData} onClick={loadMoreData}
> >
{_("See more transactions")} {_("See more transactions")}
</Button> </Button> */}
</div>
) : (
<div>
<table className={styles.table}>
<thead className={styles.thead}>
<tr>
{tableHeadings.map((heading) => (
<th key={heading} className={styles.th}>
{heading}
</th>
))}
</tr>
</thead>
</table>
<div className={styles.emptyPlaceholder}>
{_("No transactions available")}
</div>
</div> </div>
) )
} }