feat: use correct description for beds in sidepeek
This commit is contained in:
committed by
Simon.Emanuelsson
parent
38f937f948
commit
07a764211f
@@ -25,9 +25,6 @@ export default function RoomOne({ user }: { user: SafeUser }) {
|
|||||||
breakfastPackages: state.breakfastPackages,
|
breakfastPackages: state.breakfastPackages,
|
||||||
isMultiroom: state.rooms.length > 1,
|
isMultiroom: state.rooms.length > 1,
|
||||||
}))
|
}))
|
||||||
const {
|
|
||||||
room: { bedTypes },
|
|
||||||
} = useRoomContext()
|
|
||||||
|
|
||||||
const hasChildWithExtraBed = room.childrenInRoom?.some(
|
const hasChildWithExtraBed = room.childrenInRoom?.some(
|
||||||
(child) => Number(child.bed) === ChildBedMapEnum.IN_EXTRA_BED
|
(child) => Number(child.bed) === ChildBedMapEnum.IN_EXTRA_BED
|
||||||
@@ -36,7 +33,7 @@ export default function RoomOne({ user }: { user: SafeUser }) {
|
|||||||
const bedTypeInfoText = getBedTypeInfoText(
|
const bedTypeInfoText = getBedTypeInfoText(
|
||||||
intl,
|
intl,
|
||||||
!!hasChildWithExtraBed,
|
!!hasChildWithExtraBed,
|
||||||
bedTypes.length > 1
|
room.bedTypes.length > 1
|
||||||
)
|
)
|
||||||
|
|
||||||
const showBreakfastStep =
|
const showBreakfastStep =
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { BED_TYPE_ICONS, type BedTypes } from "@/constants/booking"
|
||||||
|
|
||||||
import ImageGallery from "@/components/ImageGallery"
|
import ImageGallery from "@/components/ImageGallery"
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
@@ -8,7 +8,6 @@ import Caption from "@/components/TempDesignSystem/Text/Caption"
|
|||||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||||
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
||||||
|
|
||||||
import { getBedIconName } from "../bedIcon"
|
|
||||||
import { FacilityIcon } from "../facilityIcon"
|
import { FacilityIcon } from "../facilityIcon"
|
||||||
|
|
||||||
import styles from "./roomSidePeekContent.module.css"
|
import styles from "./roomSidePeekContent.module.css"
|
||||||
@@ -121,12 +120,19 @@ export function RoomSidePeekContent({ room }: RoomSidePeekContentProps) {
|
|||||||
</Body>
|
</Body>
|
||||||
<ul className={styles.bedOptions}>
|
<ul className={styles.bedOptions}>
|
||||||
{room.roomTypes.map((roomType) => {
|
{room.roomTypes.map((roomType) => {
|
||||||
const bedIcon = getBedIconName(roomType.mainBed.type)
|
const description =
|
||||||
|
roomType.description || roomType.mainBed.description
|
||||||
|
const MainBedIcon =
|
||||||
|
BED_TYPE_ICONS[roomType.mainBed.type as BedTypes]
|
||||||
|
const ExtraBedIcon = roomType.fixedExtraBed
|
||||||
|
? BED_TYPE_ICONS[roomType.fixedExtraBed.type as BedTypes]
|
||||||
|
: null
|
||||||
return (
|
return (
|
||||||
<li key={roomType.code}>
|
<li key={roomType.code}>
|
||||||
<MaterialIcon icon={bedIcon} color="Icon/Feedback/Neutral" />
|
{MainBedIcon ? <MainBedIcon height={24} width={24} /> : null}
|
||||||
|
{ExtraBedIcon ? <ExtraBedIcon height={24} width={30} /> : null}
|
||||||
<Body color="uiTextMediumContrast" asChild>
|
<Body color="uiTextMediumContrast" asChild>
|
||||||
<span>{roomType.mainBed.description}</span>
|
<span>{description}</span>
|
||||||
</Body>
|
</Body>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export enum ExtraBedTypeEnum {
|
|||||||
BunkBed = "BunkBed",
|
BunkBed = "BunkBed",
|
||||||
}
|
}
|
||||||
|
|
||||||
type BedTypes = keyof typeof BedTypeEnum | keyof typeof ExtraBedTypeEnum
|
export type BedTypes = keyof typeof BedTypeEnum | keyof typeof ExtraBedTypeEnum
|
||||||
|
|
||||||
export const BED_TYPE_ICONS: Record<
|
export const BED_TYPE_ICONS: Record<
|
||||||
BedTypes,
|
BedTypes,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const roomContentSchema = z.object({
|
|||||||
const roomTypesSchema = z.object({
|
const roomTypesSchema = z.object({
|
||||||
code: nullableStringValidator,
|
code: nullableStringValidator,
|
||||||
description: nullableStringValidator,
|
description: nullableStringValidator,
|
||||||
fixedExtraBed: bedTypeSchema,
|
fixedExtraBed: bedTypeSchema.optional(),
|
||||||
isLackingCribs: z.boolean(),
|
isLackingCribs: z.boolean(),
|
||||||
isLackingExtraBeds: z.boolean(),
|
isLackingExtraBeds: z.boolean(),
|
||||||
mainBed: bedTypeSchema,
|
mainBed: bedTypeSchema,
|
||||||
@@ -81,7 +81,16 @@ export function transformRoomCategories(
|
|||||||
occupancy: data.attributes.occupancy,
|
occupancy: data.attributes.occupancy,
|
||||||
roomFacilities: data.attributes.roomFacilities,
|
roomFacilities: data.attributes.roomFacilities,
|
||||||
roomSize: data.attributes.roomSize,
|
roomSize: data.attributes.roomSize,
|
||||||
roomTypes: data.attributes.roomTypes,
|
roomTypes: data.attributes.roomTypes.map((roomType) => {
|
||||||
|
if (!roomType || roomType.fixedExtraBed?.type.toLowerCase() === "none") {
|
||||||
|
return {
|
||||||
|
...roomType,
|
||||||
|
fixedExtraBed: undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return roomType
|
||||||
|
}),
|
||||||
sortOrder: data.attributes.sortOrder,
|
sortOrder: data.attributes.sortOrder,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
totalOccupancy:
|
totalOccupancy:
|
||||||
|
|||||||
Reference in New Issue
Block a user