Files
web/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Footer/index.tsx
Joakim Jäderberg aafad9781f Merged in feat/lokalise-rebuild (pull request #2993)
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
2025-10-22 11:00:03 +00:00

219 lines
6.9 KiB
TypeScript

import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { getNumberOfNights } from "@scandic-hotels/common/utils/dateFormatting"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import styles from "./footer.module.css"
import type { FooterProps } from "@/types/components/hotelReservation/myStay/receipt"
export default async function Footer({ booking, room }: FooterProps) {
const intl = await getIntl()
const lang = await getLang()
const petRoomPackage = booking.packages.find(
(p) => p.code === RoomPackageCodeEnum.PET_ROOM
)
return (
<dl className={styles.dl}>
<div>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "common.bookingNumber",
defaultMessage: "Booking number",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>{booking.confirmationNumber}</dd>
</Typography>
</div>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "common.room",
defaultMessage: "Room",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>{room?.name}</dd>
</Typography>
</div>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "myStay.receipt.rate",
defaultMessage: "Rate",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>{booking.rateDefinition.title}</dd>
</Typography>
</div>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "common.checkIn",
defaultMessage: "Check-in",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>
{dt(booking.checkInDate)
.locale(lang)
.format(longDateWithYearFormat[lang])}
</dd>
</Typography>
</div>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "common.checkOut",
defaultMessage: "Check-out",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>
{dt(booking.checkOutDate)
.locale(lang)
.format(longDateWithYearFormat[lang])}
</dd>
</Typography>
</div>
</div>
<div className={styles.rightColumn}>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "myStay.receipt.numberOfNights",
defaultMessage: "Number of nights",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>
{getNumberOfNights(booking.checkInDate, booking.checkOutDate)}
</dd>
</Typography>
</div>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "myStay.receipt.numberOfGuests",
defaultMessage: "Number of guests",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>
{intl.formatMessage(
{
id: "booking.numberOfAdults",
defaultMessage:
"{adults, plural, one {# adult} other {# adults}}",
},
{ adults: booking.adults }
)}
{booking.childrenAges.length > 0 && (
<>
{", "}
{intl.formatMessage(
{
id: "booking.numberOfChildren",
defaultMessage:
"{children, plural, one {# child} other {# children}}",
},
{ children: booking.childrenAges.length }
)}
</>
)}
</dd>
</Typography>
</div>
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "myStay.receipt.bedType",
defaultMessage: "Bed type",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>{room?.bedType.mainBed.description}</dd>
</Typography>
</div>
{petRoomPackage && (
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "booking.roomClassification",
defaultMessage: "Room classification",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>
{intl.formatMessage({
id: "common.petFriendly",
defaultMessage: "Pet-friendly",
})}
</dd>
</Typography>
</div>
)}
<div>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dt>
{intl.formatMessage({
id: "common.breakfast",
defaultMessage: "Breakfast",
})}
</dt>
</Typography>
<Typography variant="Body/Supporting text (caption)/smRegular">
<dd>
{booking.rateDefinition.breakfastIncluded
? intl.formatMessage({
id: "common.included",
defaultMessage: "Included",
})
: intl.formatMessage({
id: "common.notIncluded",
defaultMessage: "Not included",
})}
</dd>
</Typography>
</div>
</div>
</dl>
)
}