From 9f4e2b3c454eb26794849f833bd83f2493ef2a66 Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Wed, 6 Aug 2025 14:09:32 +0000 Subject: [PATCH] Merged in fix/SW-2425-filter-label-lokalise (pull request #2602) fix(SW-2425): filter description should be translated with lokalise * fix(SW-2425): filter description should be translated with lokalise Approved-by: Anton Gunnarsson --- .../Receipt/Room/index.tsx | 7 +++++- .../PriceChangeSummary/index.tsx | 7 +++++- .../EnterDetails/Summary/UI/Room/index.tsx | 9 +++++++- .../Rooms/SingleRoom/Details/Packages.tsx | 6 ++++- .../PriceDetailsTable/Row/Price/Packages.tsx | 3 ++- .../utils/getRoomFeatureDescription.ts | 23 +++++++++++++++++++ .../SidePeeks/BookedRoomSidePeek/index.tsx | 9 +++++++- 7 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 apps/scandic-web/components/HotelReservation/utils/getRoomFeatureDescription.ts diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx index cfef22d0f..16b2bad9d 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx @@ -12,6 +12,7 @@ import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum" import { CancellationRuleEnum } from "@/constants/booking" import { useBookingConfirmationStore } from "@/stores/booking-confirmation" +import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import Modal from "@/components/Modal" import { formatPrice } from "@/utils/numberFormatting" @@ -178,7 +179,11 @@ export default function ReceiptRoom({

- {feature.description} + {getFeatureDescription( + feature.code, + feature.description, + intl + )}

diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx index 32803f92c..ae35b8601 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx @@ -16,6 +16,7 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import Subtitle from "@scandic-hotels/design-system/Subtitle" +import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import { formatPrice } from "@/utils/numberFormatting" import styles from "./priceChangeSummary.module.css" @@ -156,7 +157,11 @@ export default function PriceChangeSummary({ key={feature.itemCode} > - {feature.description} + {getFeatureDescription( + feature.code, + feature.description, + intl + )} {formatPrice( diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx index 64df761e1..a6da7cb87 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx @@ -7,6 +7,7 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" +import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import Modal from "@/components/Modal" import { formatPrice } from "@/utils/numberFormatting" @@ -224,7 +225,13 @@ export default function Room({ ? room.roomFeatures.map((feature) => (
-

{feature.description}

+

+ {getFeatureDescription( + feature.code, + feature.description, + intl + )} +

diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx index 01b83daa0..8c1791a7c 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx @@ -4,6 +4,8 @@ import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { useMyStayStore } from "@/stores/my-stay" +import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" + import Row from "./Row" export default function Packages() { @@ -17,7 +19,9 @@ export default function Packages() { item.code as RoomPackageCodeEnum ) ) - .map((item) => item.description) || [] + .map((item) => + getFeatureDescription(item.code, item.description, intl) + ) || [] ) if (!packages.length) { diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx index 8a9e48730..d640f15c3 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx @@ -1,6 +1,7 @@ "use client" import { useIntl } from "react-intl" +import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import { formatPrice } from "@/utils/numberFormatting" import RegularRow from "../Regular" @@ -21,7 +22,7 @@ export default function PackagesRow({ packages }: PackagesProps) { return packages?.map((pkg) => ( = { + [RoomPackageCodeEnum.ACCESSIBILITY_ROOM]: intl.formatMessage({ + defaultMessage: "Accessible room", + }), + [RoomPackageCodeEnum.ALLERGY_ROOM]: intl.formatMessage({ + defaultMessage: "Allergy-friendly room", + }), + [RoomPackageCodeEnum.PET_ROOM]: intl.formatMessage({ + defaultMessage: "Pet-friendly room", + }), + } + + return roomFeatureDescriptions[code] ?? description +} diff --git a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx index 28793bd75..7a759ae0c 100644 --- a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx +++ b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx @@ -12,6 +12,7 @@ import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails" import PriceType from "@/components/HotelReservation/MyStay/PriceType" import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils" import { sumPackages } from "@/components/HotelReservation/utils" +import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import ImageGallery from "@/components/ImageGallery" import Accordion from "@/components/TempDesignSystem/Accordion" import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem" @@ -351,7 +352,13 @@ export default function BookedRoomSidePeek({ item.code as RoomPackageCodeEnum ) ) - .map((item) => item.description) + .map((item) => + getFeatureDescription( + item.code, + item.description, + intl + ) + ) .join(", ")}