feat: SW-2028 Fix after rebase

This commit is contained in:
Hrishikesh Vaipurkar
2025-03-31 13:28:23 +02:00
parent 03deea1102
commit 4e9ee82efa
4 changed files with 31 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ interface RedemptionsProps extends SharedRateCardProps {
export default function Redemptions({
handleSelectRate,
redemptions,
roomTypeCode,
}: RedemptionsProps) {
const intl = useIntl()
const rateTitles = useRateTitles()
@@ -39,7 +40,10 @@ export default function Redemptions({
let selectedRateCode = ""
if (selectedRate?.product && "redemption" in selectedRate.product) {
selectedRateCode = selectedRate.product.redemption.rateCode
selectedRateCode =
selectedRate.roomTypeCode === roomTypeCode
? selectedRate.product.redemption.rateCode
: ""
}
function handleSelect(rateCode: string) {
@@ -61,10 +65,12 @@ export default function Redemptions({
}
: undefined,
currency: "PTS",
isDisabled: !!r.redemption.localPrice.pointsPerNight, // TODO: FIX
points: r.redemption.localPrice.pointsPerNight.toString(),
isDisabled: !r.redemption.hasEnoughPoints,
points: r.redemption.localPrice.pointsPerStay.toString(),
rateCode: r.redemption.rateCode,
}))
const notEnoughPoints = rates.every((rate) => rate.isDisabled)
const firstRedemption = redemptions[0]
const bannerText = firstRedemption.breakfastIncluded
? `${rewardNight}${breakfastIncluded}`
@@ -79,6 +85,8 @@ export default function Redemptions({
rates={rates}
rateTitle={rateTitles[firstRedemption.rate].title}
selectedRate={selectedRateCode}
isNotEnoughPoints={notEnoughPoints}
notEnoughPointsText={intl.formatMessage({ id: "Not enough points" })}
/>
)
}