From 9e42cf0f375cb9fbc7471171fa115097089af7e2 Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Tue, 10 Dec 2024 08:13:13 +0000 Subject: [PATCH] Merged in fix/SW-1153-correct-breakfast-message (pull request #1060) fix(SW-1153): fix breakfast message for ScandicGo hotels Approved-by: Pontus Dreij --- .../RoomSelection/RoomCard/index.tsx | 19 +++++++++---------- .../SelectRate/RoomSelection/index.tsx | 2 ++ .../SelectRate/Rooms/RoomsContainer.tsx | 1 + .../SelectRate/Rooms/index.tsx | 2 ++ .../hotelReservation/selectRate/roomCard.ts | 1 + .../selectRate/roomSelection.ts | 2 ++ 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/components/HotelReservation/SelectRate/RoomSelection/RoomCard/index.tsx b/components/HotelReservation/SelectRate/RoomSelection/RoomCard/index.tsx index 4b8c47928..1b90ed5af 100644 --- a/components/HotelReservation/SelectRate/RoomSelection/RoomCard/index.tsx +++ b/components/HotelReservation/SelectRate/RoomSelection/RoomCard/index.tsx @@ -20,9 +20,11 @@ import styles from "./roomCard.module.css" import type { RoomCardProps } from "@/types/components/hotelReservation/selectRate/roomCard" import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" +import { HotelTypeEnum } from "@/types/enums/hotelType" export default function RoomCard({ hotelId, + hotelType, rateDefinitions, roomConfiguration, roomCategories, @@ -59,17 +61,14 @@ export default function RoomCard({ } const getBreakfastMessage = (rate: RateDefinition | undefined) => { - const breakfastIncluded = getRateDefinitionForRate(rate)?.breakfastIncluded - switch (breakfastIncluded) { - 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.", - }) + if (hotelType === HotelTypeEnum.ScandicGo) { + return intl.formatMessage({ + id: "Breakfast deal can be purchased at the hotel.", + }) } + return getRateDefinitionForRate(rate)?.breakfastIncluded + ? intl.formatMessage({ id: "Breakfast is included." }) + : intl.formatMessage({ id: "Breakfast selection in next step." }) } const petRoomPackage = diff --git a/components/HotelReservation/SelectRate/RoomSelection/index.tsx b/components/HotelReservation/SelectRate/RoomSelection/index.tsx index 18e2389c4..9f63b4923 100644 --- a/components/HotelReservation/SelectRate/RoomSelection/index.tsx +++ b/components/HotelReservation/SelectRate/RoomSelection/index.tsx @@ -18,6 +18,7 @@ export default function RoomSelection({ selectedPackages, setRateCode, rateSummary, + hotelType, }: RoomSelectionProps) { const router = useRouter() const searchParams = useSearchParams() @@ -67,6 +68,7 @@ export default function RoomSelection({
  • ) } diff --git a/components/HotelReservation/SelectRate/Rooms/index.tsx b/components/HotelReservation/SelectRate/Rooms/index.tsx index 584e0195a..e9cb10fa1 100644 --- a/components/HotelReservation/SelectRate/Rooms/index.tsx +++ b/components/HotelReservation/SelectRate/Rooms/index.tsx @@ -25,6 +25,7 @@ export default function Rooms({ roomCategories = [], user, availablePackages, + hotelType, }: SelectRateProps) { const visibleRooms: RoomConfiguration[] = filterDuplicateRoomTypesByLowestPrice(roomsAvailability.roomConfigurations) @@ -165,6 +166,7 @@ export default function Rooms({ selectedPackages={selectedPackages} setRateCode={setSelectedRate} rateSummary={rateSummary} + hotelType={hotelType} /> ) diff --git a/types/components/hotelReservation/selectRate/roomCard.ts b/types/components/hotelReservation/selectRate/roomCard.ts index 41f0391e6..9f50eec23 100644 --- a/types/components/hotelReservation/selectRate/roomCard.ts +++ b/types/components/hotelReservation/selectRate/roomCard.ts @@ -14,6 +14,7 @@ import type { RateCode } from "./selectRate" export type RoomCardProps = { hotelId: string + hotelType: string | undefined roomConfiguration: RoomConfiguration rateDefinitions: RateDefinition[] roomCategories: RoomData[] diff --git a/types/components/hotelReservation/selectRate/roomSelection.ts b/types/components/hotelReservation/selectRate/roomSelection.ts index 31781dfc2..3993176f9 100644 --- a/types/components/hotelReservation/selectRate/roomSelection.ts +++ b/types/components/hotelReservation/selectRate/roomSelection.ts @@ -12,6 +12,7 @@ export interface RoomSelectionProps { selectedPackages: RoomPackageCodes[] setRateCode: React.Dispatch> rateSummary: Rate | null + hotelType: string | undefined } export interface SelectRateProps { @@ -19,4 +20,5 @@ export interface SelectRateProps { roomCategories: RoomData[] user: SafeUser availablePackages: RoomPackageData + hotelType: string | undefined }