refactor(LOY-175): rewrite reward types according to new api endpoints
This commit is contained in:
@@ -19,10 +19,10 @@ import Redeem from "../Redeem"
|
||||
import styles from "./current.module.css"
|
||||
|
||||
import type { CurrentRewardsClientProps } from "@/types/components/myPages/myPage/accountPage"
|
||||
import type {
|
||||
Reward,
|
||||
RewardWithRedeem,
|
||||
} from "@/server/routers/contentstack/reward/output"
|
||||
import {
|
||||
type Reward,
|
||||
type RewardWithRedeem,
|
||||
} from "@/types/components/myPages/rewards"
|
||||
|
||||
export default function ClientCurrentRewards({
|
||||
rewards: initialData,
|
||||
@@ -70,21 +70,15 @@ export default function ClientCurrentRewards({
|
||||
<div ref={containerRef} className={styles.container}>
|
||||
<Grids.Stackable>
|
||||
{paginatedRewards.map((reward, idx) => {
|
||||
const earliestExpirationDate =
|
||||
"coupons" in reward
|
||||
? getEarliestExpirationDate(reward.coupons)
|
||||
: null
|
||||
const earliestExpirationDate = getEarliestExpirationDate(
|
||||
reward.data.coupon
|
||||
)
|
||||
|
||||
return (
|
||||
<article className={styles.card} key={`${reward.reward_id}-${idx}`}>
|
||||
<div className={styles.content}>
|
||||
<RewardIcon rewardId={reward.reward_id} />
|
||||
{showRedeem && (
|
||||
<ScriptedRewardText
|
||||
rewardType={reward.rewardType}
|
||||
rewardTierLevel={reward.rewardTierLevel}
|
||||
/>
|
||||
)}
|
||||
{showRedeem && <ScriptedRewardText reward={reward} />}
|
||||
<Title
|
||||
as="h4"
|
||||
level="h3"
|
||||
|
||||
Reference in New Issue
Block a user