Chore/BOOK-708 replace title component * chore(BOOK-708): replace title with typography * chore(BOOK-708): replace title with typography * chore(BOOK-708): remove Title from package.json Approved-by: Linus Flood Approved-by: Anton Gunnarsson
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import {
|
|
getCurrentRewards,
|
|
getMembershipLevel,
|
|
} from "@/lib/trpc/memoizedRequests"
|
|
|
|
import { Section } from "@/components/Section"
|
|
import { SectionHeader } from "@/components/Section/Header"
|
|
import SectionLink from "@/components/Section/Link"
|
|
|
|
import ClientCurrentRewards from "./Client"
|
|
|
|
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
|
|
|
|
export default async function CurrentRewardsBlock({
|
|
title,
|
|
subtitle,
|
|
link,
|
|
}: AccountPageComponentProps) {
|
|
const [rewardsResponse, membershipLevel] = await Promise.all([
|
|
getCurrentRewards(),
|
|
getMembershipLevel(),
|
|
])
|
|
|
|
if (!rewardsResponse?.rewards.length) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Section>
|
|
<SectionHeader heading={title} link={link} preamble={subtitle} />
|
|
<ClientCurrentRewards
|
|
rewards={rewardsResponse.rewards}
|
|
showRedeem={true}
|
|
membershipNumber={membershipLevel?.membershipNumber}
|
|
/>
|
|
<SectionLink link={link} variant="mobile" />
|
|
</Section>
|
|
)
|
|
}
|