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