feat(WEB-304): remaning UI from design system primitives
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import Header from "@/components/MyPages/Blocks/Header"
|
||||
import CardGrid from "@/components/TempDesignSystem/CardGrid"
|
||||
import Grids from "@/components/TempDesignSystem/Grids"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
|
||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||
|
||||
import levelsData from "../data"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./current.module.css"
|
||||
|
||||
@@ -19,45 +17,36 @@ export default async function CurrentBenefitsBlock({
|
||||
link,
|
||||
}: AccountPageComponentProps) {
|
||||
const user = await serverClient().user.get()
|
||||
const { formatMessage } = await getIntl()
|
||||
// TODO: level should be fetched from the `user` object once available
|
||||
// TAKE NOTE: we need clarification on how benefits stack from different levels
|
||||
// in order to determine if a benefit is specific to a level or if it is a cumulative benefit
|
||||
// we might have to add a new boolean property "exclusive" or similar
|
||||
const userLevel = 1
|
||||
|
||||
const currentLevel = levelsData[Lang.en].levels.find(
|
||||
(level) => level.tier === userLevel
|
||||
)
|
||||
if (!currentLevel) {
|
||||
// TODO: handle this case?
|
||||
return null
|
||||
}
|
||||
const currentLevel = Array.of(...Array(3).keys())
|
||||
|
||||
return (
|
||||
<section className={styles.container}>
|
||||
<Header title={title} link={link} subtitle={subtitle} />
|
||||
|
||||
<CardGrid isMobileCarousel={true}>
|
||||
{currentLevel.benefits.map((benefit, idx) => (
|
||||
<Link
|
||||
href={benefit.href}
|
||||
key={`${currentLevel}-${idx}`}
|
||||
className={styles.card}
|
||||
>
|
||||
<Title as="h5" level="h3" className={styles.title}>
|
||||
<span className={styles.titleValue}>{benefit.value}</span>
|
||||
{benefit.explaination ? (
|
||||
<span className={styles.titleExplanation}>
|
||||
{benefit.explaination}
|
||||
</span>
|
||||
) : null}
|
||||
<Grids.Scrollable>
|
||||
{currentLevel.map((benefit) => (
|
||||
<Link className={styles.card} href="#" key={benefit}>
|
||||
<BiroScript
|
||||
className={styles.script}
|
||||
color="primaryLightOnSurfaceAccent"
|
||||
type="two"
|
||||
>
|
||||
{formatMessage({ id: "As our Close Friend" })}
|
||||
</BiroScript>
|
||||
<Title as="h5" level="h3" textAlign="center">
|
||||
{formatMessage({
|
||||
id: "Free soft drink voucher for the kids when staying",
|
||||
})}
|
||||
</Title>
|
||||
<Subtitle className={styles.subtitle}>
|
||||
{benefit.description}
|
||||
</Subtitle>
|
||||
</Link>
|
||||
))}
|
||||
</CardGrid>
|
||||
</Grids.Scrollable>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user