Files
web/apps/scandic-web/components/Blocks/DynamicContent/Rewards/ScriptedRewardText/index.tsx
Joakim Jäderberg aafad9781f Merged in feat/lokalise-rebuild (pull request #2993)
Feat/lokalise rebuild

* chore(lokalise): update translation ids

* chore(lokalise): easier to switch between projects

* chore(lokalise): update translation ids

* .

* .

* .

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* chore(lokalise): new translations

* merge

* switch to errors for missing id's

* merge

* sync translations


Approved-by: Linus Flood
2025-10-22 11:00:03 +00:00

54 lines
1.3 KiB
TypeScript

import { useIntl } from "react-intl"
import { isMembershipLevel } from "@scandic-hotels/common/utils/membershipLevels"
import { TIER_TO_FRIEND_MAP } from "@/constants/membershipLevels"
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
import type { ScriptedRewardTextProps } from "@/types/components/myPages/myPage/accountPage"
export default function ScriptedRewardText({
reward,
}: ScriptedRewardTextProps) {
const intl = useIntl()
function getLabel() {
switch (reward.rewardType) {
case "Tier": {
const { rewardTierLevel } = reward
return rewardTierLevel && isMembershipLevel(rewardTierLevel)
? TIER_TO_FRIEND_MAP[rewardTierLevel]
: null
}
case "Campaign":
return intl.formatMessage({
id: "booking.campaign",
defaultMessage: "Campaign",
})
case "Surprise":
return intl.formatMessage({
id: "rewards.surprise",
defaultMessage: "Surprise!",
})
case "Member-voucher":
return intl.formatMessage({
id: "rewards.voucher",
defaultMessage: "Voucher",
})
default:
return null
}
}
const label = getLabel()
if (!label) return null
return (
<BiroScript type="two" color="red" tilted="small">
{label}
</BiroScript>
)
}