feat(SW-415): Normalize roomSchema
This commit is contained in:
@@ -22,20 +22,20 @@ export function Rooms({ rooms }: RoomsProps) {
|
||||
|
||||
const mappedRooms = rooms
|
||||
.map((room) => {
|
||||
const size = `${room.attributes.roomSize.min} - ${room.attributes.roomSize.max} m²`
|
||||
const size = `${room.roomSize.min} - ${room.roomSize.max} m²`
|
||||
const personLabel =
|
||||
room.attributes.occupancy.total === 1
|
||||
room.occupancy.total === 1
|
||||
? intl.formatMessage({ id: "hotelPages.rooms.roomCard.person" })
|
||||
: intl.formatMessage({ id: "hotelPages.rooms.roomCard.persons" })
|
||||
|
||||
const subtitle = `${size} (${room.attributes.occupancy.total} ${personLabel})`
|
||||
const subtitle = `${size} (${room.occupancy.total} ${personLabel})`
|
||||
|
||||
return {
|
||||
id: room.id,
|
||||
images: room.attributes.content.images,
|
||||
title: room.attributes.name,
|
||||
images: room.images,
|
||||
title: room.name,
|
||||
subtitle: subtitle,
|
||||
sortOrder: room.attributes.sortOrder,
|
||||
sortOrder: room.sortOrder,
|
||||
popularChoice: null,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -53,16 +53,16 @@ export default function RoomCard({
|
||||
}
|
||||
|
||||
const roomSize = roomCategories.find(
|
||||
(category) => category.attributes.name === roomConfiguration.roomType
|
||||
)?.attributes.roomSize
|
||||
(category) => category.name === roomConfiguration.roomType
|
||||
)?.roomSize
|
||||
|
||||
const occupancy = roomCategories.find(
|
||||
(category) => category.attributes.name === roomConfiguration.roomType
|
||||
)?.attributes.occupancy.total
|
||||
(category) => category.name === roomConfiguration.roomType
|
||||
)?.occupancy.total
|
||||
|
||||
const roomDescription = roomCategories.find(
|
||||
(room) => room.attributes.name === roomConfiguration.roomType
|
||||
)?.attributes.content.texts.descriptions.short
|
||||
(room) => room.name === roomConfiguration.roomType
|
||||
)?.descriptions.short
|
||||
|
||||
return (
|
||||
<div className={styles.card}>
|
||||
|
||||
Reference in New Issue
Block a user