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,
|
||||
isMultiroom: state.rooms.length > 1,
|
||||
}))
|
||||
const {
|
||||
room: { bedTypes },
|
||||
} = useRoomContext()
|
||||
|
||||
const hasChildWithExtraBed = room.childrenInRoom?.some(
|
||||
(child) => Number(child.bed) === ChildBedMapEnum.IN_EXTRA_BED
|
||||
@@ -36,7 +33,7 @@ export default function RoomOne({ user }: { user: SafeUser }) {
|
||||
const bedTypeInfoText = getBedTypeInfoText(
|
||||
intl,
|
||||
!!hasChildWithExtraBed,
|
||||
bedTypes.length > 1
|
||||
room.bedTypes.length > 1
|
||||
)
|
||||
|
||||
const showBreakfastStep =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 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 { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
||||
|
||||
import { getBedIconName } from "../bedIcon"
|
||||
import { FacilityIcon } from "../facilityIcon"
|
||||
|
||||
import styles from "./roomSidePeekContent.module.css"
|
||||
@@ -121,12 +120,19 @@ export function RoomSidePeekContent({ room }: RoomSidePeekContentProps) {
|
||||
</Body>
|
||||
<ul className={styles.bedOptions}>
|
||||
{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 (
|
||||
<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>
|
||||
<span>{roomType.mainBed.description}</span>
|
||||
<span>{description}</span>
|
||||
</Body>
|
||||
</li>
|
||||
)
|
||||
|
||||
@@ -142,7 +142,7 @@ export enum ExtraBedTypeEnum {
|
||||
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<
|
||||
BedTypes,
|
||||
|
||||
@@ -38,7 +38,7 @@ const roomContentSchema = z.object({
|
||||
const roomTypesSchema = z.object({
|
||||
code: nullableStringValidator,
|
||||
description: nullableStringValidator,
|
||||
fixedExtraBed: bedTypeSchema,
|
||||
fixedExtraBed: bedTypeSchema.optional(),
|
||||
isLackingCribs: z.boolean(),
|
||||
isLackingExtraBeds: z.boolean(),
|
||||
mainBed: bedTypeSchema,
|
||||
@@ -81,7 +81,16 @@ export function transformRoomCategories(
|
||||
occupancy: data.attributes.occupancy,
|
||||
roomFacilities: data.attributes.roomFacilities,
|
||||
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,
|
||||
type: data.type,
|
||||
totalOccupancy:
|
||||
|
||||
Reference in New Issue
Block a user