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,5 +1,6 @@
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getMembership } from "@/utils/user"
import Label from "../Label"
@@ -9,18 +10,19 @@ import type { UserProps } from "@/types/components/myPages/user"
export default async function Points({ user }: UserProps) {
const { formatMessage } = await getIntl()
const membership = getMembership(user.memberships)
return (
<section className={styles.points}>
<article>
<Label>{formatMessage({ id: "Total Points" })}</Label>
<Title color="pale" level="h2">
{user.membership ? user.membership.currentPoints : "N/A"}
{membership ? membership.currentPoints : "N/A"}
</Title>
</article>
<article>
<Label>{formatMessage({ id: "Points until next level" })}</Label>
<Title color="pale" level="h2">
{user.membership ? user.membership.currentPoints : "N/A"}
{membership ? membership.currentPoints : "N/A"}
</Title>
</article>
</section>