Files
web/apps/scandic-web/components/Blocks/DynamicContent/Points/Overview/index.tsx
Erik Tiekstra 339e7195dc fix(BOOK-436): Added new section component and deprecated the other
Approved-by: Chuma Mcphoy (We Ahead)
2025-10-13 08:31:26 +00:00

61 lines
1.8 KiB
TypeScript

import { Divider } from "@scandic-hotels/design-system/Divider"
import { env } from "@/env/server"
import { getProfile } from "@/lib/trpc/memoizedRequests"
import LevelProgressCard from "@/components/MyPages/LevelProgressCard"
import { Section } from "@/components/Section"
import SectionHeader from "@/components/Section/Header/Deprecated"
import SectionLink from "@/components/Section/Link"
import Friend from "../../Overview/Friend"
import Hero from "../../Overview/Friend/Hero"
import MembershipNumber from "../../Overview/Friend/MembershipNumber"
import Stats from "../../Overview/Stats"
import PointsToSpendCard from "../PointsToSpendCard"
import styles from "./overview.module.css"
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function PointsOverview({
link,
subtitle,
title,
}: AccountPageComponentProps) {
const user = await getProfile()
if (!user || "error" in user) {
return null
}
return (
<Section>
<SectionHeader
link={link}
preamble={subtitle}
title={title}
headingAs={"h3"}
headingLevel={"h1"}
/>
{env.ENABLE_NEW_OVERVIEW_SECTION ? (
<div className={styles.membershipCardsContainer}>
<PointsToSpendCard user={user} />
<LevelProgressCard
color="Surface/Brand/Primary 1/Default"
user={user}
/>
</div>
) : (
<Hero color="burgundy">
<Friend membership={user.membership} name={user.name}>
<MembershipNumber color="red" membership={user.membership} />
</Friend>
<Divider className={styles.divider} color="peach" />
<Stats user={user} />
</Hero>
)}
<SectionLink link={link} variant="mobile" />
</Section>
)
}