Files
web/components/Blocks/DynamicContent/Rewards/CurrentRewards/index.tsx
Christian Andolf 4b51b5aff6 Merged in fix/hide-cs-rewards-flag (pull request #1065)
fix: hide new cs rewards model behind feature flag

Approved-by: Michael Zetterberg
Approved-by: Chuma Mcphoy (We Ahead)
2024-12-11 08:55:46 +00:00

35 lines
1015 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 rewardsResponse = await serverClient().contentstack.rewards.current()
if (!rewardsResponse?.rewards.length) {
return null
}
return (
<SectionContainer>
<SectionHeader title={title} link={link} preamble={subtitle} />
<ClientCurrentRewards
rewards={rewardsResponse.rewards}
pageSize={6}
showRedeem={env.USE_NEW_REWARDS_ENDPOINT && env.USE_NEW_REWARD_MODEL}
/>
<SectionLink link={link} variant="mobile" />
</SectionContainer>
)
}