Files
web/components/Blocks/DynamicContent/Rewards/CurrentLevel/index.tsx
2024-12-06 12:56:54 +01:00

37 lines
1001 B
TypeScript

import { env } from "@/env/server"
import { serverClient } from "@/lib/trpc/server"
import SectionContainer from "@/components/Section/Container"
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 initialCurrentRewards =
await serverClient().contentstack.rewards.current({
limit: 3,
})
if (!initialCurrentRewards) {
return null
}
return (
<SectionContainer>
<SectionHeader title={title} link={link} preamble={subtitle} />
<ClientCurrentRewards
initialCurrentRewards={initialCurrentRewards}
showRedeem={env.USE_NEW_REWARDS_ENDPOINT}
/>
<SectionLink link={link} variant="mobile" />
</SectionContainer>
)
}