feat(SW-589): Added correct breakfastMessage, also fixed some small issues

This commit is contained in:
Pontus Dreij
2024-11-18 15:22:13 +01:00
parent dc5746a902
commit 800d40a606
9 changed files with 34 additions and 16 deletions

View File

@@ -59,6 +59,25 @@ export default function RoomCard({
?.generalTerms
}
function getBreakfastInformation(rate: RateDefinition | undefined) {
return rateDefinitions.find((def) => def.rateCode === rate?.rateCode)
?.breakfastIncluded
}
const breakfastMessage = (rate: RateDefinition | undefined) => {
const breakfastInfo = getBreakfastInformation(rate)
switch (breakfastInfo) {
case true:
return intl.formatMessage({ id: "Breakfast is included." })
case false:
return intl.formatMessage({ id: "Breakfast selection in next step." })
default:
return intl.formatMessage({
id: "Breakfast deal can be purchased at the hotel.",
})
}
}
const petRoomPackage =
(selectedPackages.includes(RoomPackageCodeEnum.PET_ROOM) &&
packages?.find((pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM)) ||
@@ -168,9 +187,7 @@ export default function RoomCard({
</div>
<div className={styles.container}>
<Caption color="uiTextHighContrast" type="bold">
{intl.formatMessage({
id: "Breakfast selection in next step.",
})}
{breakfastMessage(rates.flexRate)}
</Caption>
{roomConfiguration.status === "NotAvailable" ? (
<div className={styles.noRoomsContainer}>