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
This commit is contained in:
@@ -12,6 +12,7 @@ import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum"
|
|||||||
import { CancellationRuleEnum } from "@/constants/booking"
|
import { CancellationRuleEnum } from "@/constants/booking"
|
||||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||||
|
|
||||||
|
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
||||||
import Modal from "@/components/Modal"
|
import Modal from "@/components/Modal"
|
||||||
import { formatPrice } from "@/utils/numberFormatting"
|
import { formatPrice } from "@/utils/numberFormatting"
|
||||||
|
|
||||||
@@ -178,7 +179,11 @@ export default function ReceiptRoom({
|
|||||||
<div>
|
<div>
|
||||||
<Typography variant="Body/Paragraph/mdRegular">
|
<Typography variant="Body/Paragraph/mdRegular">
|
||||||
<p className={styles.uiTextHighContrast}>
|
<p className={styles.uiTextHighContrast}>
|
||||||
{feature.description}
|
{getFeatureDescription(
|
||||||
|
feature.code,
|
||||||
|
feature.description,
|
||||||
|
intl
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|||||||
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
||||||
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
||||||
|
|
||||||
|
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
||||||
import { formatPrice } from "@/utils/numberFormatting"
|
import { formatPrice } from "@/utils/numberFormatting"
|
||||||
|
|
||||||
import styles from "./priceChangeSummary.module.css"
|
import styles from "./priceChangeSummary.module.css"
|
||||||
@@ -156,7 +157,11 @@ export default function PriceChangeSummary({
|
|||||||
key={feature.itemCode}
|
key={feature.itemCode}
|
||||||
>
|
>
|
||||||
<Caption color="uiTextMediumContrast">
|
<Caption color="uiTextMediumContrast">
|
||||||
{feature.description}
|
{getFeatureDescription(
|
||||||
|
feature.code,
|
||||||
|
feature.description,
|
||||||
|
intl
|
||||||
|
)}
|
||||||
</Caption>
|
</Caption>
|
||||||
<Caption color="uiTextMediumContrast">
|
<Caption color="uiTextMediumContrast">
|
||||||
{formatPrice(
|
{formatPrice(
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||||
|
|
||||||
|
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
||||||
import Modal from "@/components/Modal"
|
import Modal from "@/components/Modal"
|
||||||
import { formatPrice } from "@/utils/numberFormatting"
|
import { formatPrice } from "@/utils/numberFormatting"
|
||||||
|
|
||||||
@@ -224,7 +225,13 @@ export default function Room({
|
|||||||
? room.roomFeatures.map((feature) => (
|
? room.roomFeatures.map((feature) => (
|
||||||
<Typography key={feature.code} variant="Body/Paragraph/mdRegular">
|
<Typography key={feature.code} variant="Body/Paragraph/mdRegular">
|
||||||
<div className={styles.entry}>
|
<div className={styles.entry}>
|
||||||
<p>{feature.description}</p>
|
<p>
|
||||||
|
{getFeatureDescription(
|
||||||
|
feature.code,
|
||||||
|
feature.description,
|
||||||
|
intl
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
|
||||||
<div className={styles.prices}>
|
<div className={styles.prices}>
|
||||||
<span className={styles.price}>
|
<span className={styles.price}>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
|||||||
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
|
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
||||||
|
|
||||||
import Row from "./Row"
|
import Row from "./Row"
|
||||||
|
|
||||||
export default function Packages() {
|
export default function Packages() {
|
||||||
@@ -17,7 +19,9 @@ export default function Packages() {
|
|||||||
item.code as RoomPackageCodeEnum
|
item.code as RoomPackageCodeEnum
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.map((item) => item.description) || []
|
.map((item) =>
|
||||||
|
getFeatureDescription(item.code, item.description, intl)
|
||||||
|
) || []
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!packages.length) {
|
if (!packages.length) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
||||||
import { formatPrice } from "@/utils/numberFormatting"
|
import { formatPrice } from "@/utils/numberFormatting"
|
||||||
|
|
||||||
import RegularRow from "../Regular"
|
import RegularRow from "../Regular"
|
||||||
@@ -21,7 +22,7 @@ export default function PackagesRow({ packages }: PackagesProps) {
|
|||||||
return packages?.map((pkg) => (
|
return packages?.map((pkg) => (
|
||||||
<RegularRow
|
<RegularRow
|
||||||
key={pkg.code}
|
key={pkg.code}
|
||||||
label={pkg.description}
|
label={getFeatureDescription(pkg.code, pkg.description, intl)}
|
||||||
value={formatPrice(
|
value={formatPrice(
|
||||||
intl,
|
intl,
|
||||||
+pkg.localPrice.totalPrice,
|
+pkg.localPrice.totalPrice,
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
|
import type { IntlShape } from "react-intl"
|
||||||
|
|
||||||
|
export function getFeatureDescription(
|
||||||
|
code: string,
|
||||||
|
description: string,
|
||||||
|
intl: IntlShape
|
||||||
|
): string {
|
||||||
|
const roomFeatureDescriptions: Record<string, string> = {
|
||||||
|
[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
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails"
|
|||||||
import PriceType from "@/components/HotelReservation/MyStay/PriceType"
|
import PriceType from "@/components/HotelReservation/MyStay/PriceType"
|
||||||
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"
|
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
import { sumPackages } from "@/components/HotelReservation/utils"
|
||||||
|
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
||||||
import ImageGallery from "@/components/ImageGallery"
|
import ImageGallery from "@/components/ImageGallery"
|
||||||
import Accordion from "@/components/TempDesignSystem/Accordion"
|
import Accordion from "@/components/TempDesignSystem/Accordion"
|
||||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||||
@@ -351,7 +352,13 @@ export default function BookedRoomSidePeek({
|
|||||||
item.code as RoomPackageCodeEnum
|
item.code as RoomPackageCodeEnum
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.map((item) => item.description)
|
.map((item) =>
|
||||||
|
getFeatureDescription(
|
||||||
|
item.code,
|
||||||
|
item.description,
|
||||||
|
intl
|
||||||
|
)
|
||||||
|
)
|
||||||
.join(", ")}
|
.join(", ")}
|
||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
Reference in New Issue
Block a user