Feat/lokalise rebuild * chore(lokalise): update translation ids * chore(lokalise): easier to switch between projects * chore(lokalise): update translation ids * . * . * . * . * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * . * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * chore(lokalise): new translations * merge * switch to errors for missing id's * merge * sync translations Approved-by: Linus Flood
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { useIntl } from "react-intl"
|
|
|
|
import { useMyStayStore } from "@/stores/my-stay"
|
|
|
|
import Row from "./Row"
|
|
|
|
export default function BedPreference() {
|
|
const intl = useIntl()
|
|
|
|
const bedType = useMyStayStore((state) => state.bookedRoom.room?.bedType)
|
|
|
|
if (!bedType) {
|
|
return null
|
|
}
|
|
|
|
const mainBedWidthValueMsg = intl.formatMessage(
|
|
{
|
|
id: "room.bedSize",
|
|
defaultMessage: "{value} cm",
|
|
},
|
|
{
|
|
value: bedType.mainBed.widthRange.min,
|
|
}
|
|
)
|
|
|
|
const mainBedWidthRangeMsg = intl.formatMessage(
|
|
{
|
|
id: "room.bedSizeRange",
|
|
defaultMessage: "{min}-{max} cm",
|
|
},
|
|
{
|
|
min: bedType.mainBed.widthRange.min,
|
|
max: bedType.mainBed.widthRange.max,
|
|
}
|
|
)
|
|
|
|
const sameWidth =
|
|
bedType.mainBed.widthRange.min === bedType.mainBed.widthRange.max
|
|
const widthMsg = sameWidth ? mainBedWidthValueMsg : mainBedWidthRangeMsg
|
|
const text = `${bedType.mainBed.description} (${widthMsg})`
|
|
|
|
return (
|
|
<Row
|
|
icon="bed"
|
|
text={text}
|
|
title={intl.formatMessage({
|
|
id: "booking.bedPreference",
|
|
defaultMessage: "Bed preference",
|
|
})}
|
|
/>
|
|
)
|
|
}
|