feat(SW-713): remove undefined check
This commit is contained in:
@@ -70,7 +70,7 @@ export function RoomCard({ room }: RoomCardProps) {
|
|||||||
</Subtitle>
|
</Subtitle>
|
||||||
<Body color="grey">{subtitle}</Body>
|
<Body color="grey">{subtitle}</Body>
|
||||||
</div>
|
</div>
|
||||||
<RoomSidePeek selectedRoom={room} buttonSize="medium" />
|
<RoomSidePeek room={room} buttonSize="medium" />
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export default function RoomCard({
|
|||||||
m²
|
m²
|
||||||
</Caption>
|
</Caption>
|
||||||
{selectedRoom && (
|
{selectedRoom && (
|
||||||
<RoomSidePeek selectedRoom={selectedRoom} buttonSize="small" />
|
<RoomSidePeek room={selectedRoom} buttonSize="small" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
|
|||||||
@@ -14,17 +14,14 @@ import styles from "./roomSidePeek.module.css"
|
|||||||
|
|
||||||
import type { RoomSidePeekProps } from "@/types/components/sidePeeks/roomSidePeek"
|
import type { RoomSidePeekProps } from "@/types/components/sidePeeks/roomSidePeek"
|
||||||
|
|
||||||
export default function RoomSidePeek({
|
export default function RoomSidePeek({ room, buttonSize }: RoomSidePeekProps) {
|
||||||
selectedRoom,
|
|
||||||
buttonSize,
|
|
||||||
}: RoomSidePeekProps) {
|
|
||||||
const [isSidePeekOpen, setIsSidePeekOpen] = useState(false)
|
const [isSidePeekOpen, setIsSidePeekOpen] = useState(false)
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
|
||||||
const roomSize = selectedRoom?.roomSize
|
const roomSize = room.roomSize
|
||||||
const occupancy = selectedRoom?.occupancy.total
|
const occupancy = room.occupancy.total
|
||||||
const roomDescription = selectedRoom?.descriptions.medium
|
const roomDescription = room.descriptions.medium
|
||||||
const images = selectedRoom?.images
|
const images = room.images
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -41,16 +38,16 @@ export default function RoomSidePeek({
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<SidePeek
|
<SidePeek
|
||||||
title={selectedRoom.name}
|
title={room.name}
|
||||||
isOpen={isSidePeekOpen}
|
isOpen={isSidePeekOpen}
|
||||||
handleClose={() => setIsSidePeekOpen(false)}
|
handleClose={() => setIsSidePeekOpen(false)}
|
||||||
>
|
>
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<div className={styles.mainContent}>
|
<div className={styles.mainContent}>
|
||||||
<Body color="baseTextMediumContrast">
|
<Body color="baseTextMediumContrast">
|
||||||
{roomSize?.min === roomSize?.max
|
{roomSize.min === roomSize.max
|
||||||
? roomSize?.min
|
? roomSize.min
|
||||||
: `${roomSize?.min} - ${roomSize?.max}`}
|
: `${roomSize.min} - ${roomSize.max}`}
|
||||||
m².{" "}
|
m².{" "}
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
{ id: "booking.accommodatesUpTo" },
|
{ id: "booking.accommodatesUpTo" },
|
||||||
@@ -59,7 +56,7 @@ export default function RoomSidePeek({
|
|||||||
</Body>
|
</Body>
|
||||||
{images && (
|
{images && (
|
||||||
<div className={styles.imageContainer}>
|
<div className={styles.imageContainer}>
|
||||||
<ImageGallery images={images} title={selectedRoom.name} />
|
<ImageGallery images={images} title={room.name} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Body color="uiTextHighContrast">{roomDescription}</Body>
|
<Body color="uiTextHighContrast">{roomDescription}</Body>
|
||||||
@@ -69,7 +66,7 @@ export default function RoomSidePeek({
|
|||||||
{intl.formatMessage({ id: "booking.thisRoomIsEquippedWith" })}
|
{intl.formatMessage({ id: "booking.thisRoomIsEquippedWith" })}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<ul className={styles.facilityList}>
|
<ul className={styles.facilityList}>
|
||||||
{selectedRoom?.roomFacilities
|
{room.roomFacilities
|
||||||
.sort((a, b) => a.sortOrder - b.sortOrder)
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||||
.map((facility) => {
|
.map((facility) => {
|
||||||
const Icon = getFacilityIcon(facility.name)
|
const Icon = getFacilityIcon(facility.name)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { RoomData } from "@/types/hotel"
|
import { RoomData } from "@/types/hotel"
|
||||||
|
|
||||||
export type RoomSidePeekProps = {
|
export type RoomSidePeekProps = {
|
||||||
selectedRoom: RoomData
|
room: RoomData
|
||||||
buttonSize: "small" | "medium"
|
buttonSize: "small" | "medium"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user