Files
web/components/Blocks/DynamicContent/Rewards/CurrentLevel/index.tsx
Christian Andolf e6db1b17c6 fix(SW-556): now fetching surprises separately in component.
also showing surprises on any account page
2024-10-25 14:02:32 +02:00

33 lines
902 B
TypeScript

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} />
<SectionLink link={link} variant="mobile" />
</SectionContainer>
)
}