feat(SW-589) Updated after comments

This commit is contained in:
Pontus Dreij
2024-11-18 16:41:02 +01:00
committed by Joakim Jäderberg
parent dac345371b
commit 43d760eedb

View File

@@ -59,13 +59,11 @@ export default function RoomCard({
?.generalTerms ?.generalTerms
} }
function getBreakfastInformation(rate: RateDefinition | undefined) { const getBreakfastMessage = (rate: RateDefinition | undefined) => {
return rateDefinitions.find((def) => def.rateCode === rate?.rateCode) const breakfastInfo = rateDefinitions.find(
?.breakfastIncluded (def) => def.rateCode === rate?.rateCode
} )?.breakfastIncluded
const breakfastMessage = (rate: RateDefinition | undefined) => {
const breakfastInfo = getBreakfastInformation(rate)
switch (breakfastInfo) { switch (breakfastInfo) {
case true: case true:
return intl.formatMessage({ id: "Breakfast is included." }) return intl.formatMessage({ id: "Breakfast is included." })
@@ -187,7 +185,7 @@ export default function RoomCard({
</div> </div>
<div className={styles.container}> <div className={styles.container}>
<Caption color="uiTextHighContrast" type="bold"> <Caption color="uiTextHighContrast" type="bold">
{breakfastMessage(rates.flexRate)} {getBreakfastMessage(rates.flexRate)}
</Caption> </Caption>
{roomConfiguration.status === "NotAvailable" ? ( {roomConfiguration.status === "NotAvailable" ? (
<div className={styles.noRoomsContainer}> <div className={styles.noRoomsContainer}>