implement logic to select compared levels based on membershipLevel

This commit is contained in:
Arvid Norlin
2024-06-05 15:28:51 +02:00
parent 79af3dba65
commit 24810eaee6
8 changed files with 125 additions and 48 deletions

View File

@@ -1,7 +1,10 @@
import { get } from "http"
import { serverClient } from "@/lib/trpc/server"
import Header from "@/components/MyPages/Blocks/Header"
import { getIntl } from "@/i18n"
import { getMembership } from "@/utils/user"
import styles from "./currentPointsBalance.module.css"
@@ -15,6 +18,7 @@ async function CurrentPointsBalance({
}: AccountPageComponentProps) {
const user = await serverClient().user.get()
const { formatMessage } = await getIntl()
const membership = getMembership(user.memberships)
return (
<div>
<Header title={title} link={link} subtitle={subtitle} />
@@ -23,7 +27,7 @@ async function CurrentPointsBalance({
<h2>{`${formatMessage({ id: "Total points" })}*`}</h2>
<p
className={styles.points}
>{`${formatMessage({ id: "Points" })}: ${user.membership?.currentPoints || "N/A"}`}</p>
>{`${formatMessage({ id: "Points" })}: ${membership?.currentPoints || "N/A"}`}</p>
<p className={styles.disclaimer}>
{`*${formatMessage({ id: "Points may take up to 10 days to be displayed." })}`}
</p>