chore (SW-834): Upgrade to Next 15 * wip: apply codemod and upgrade swc plugin * wip: design-system to react 19, fix issues from async (search)params * wip: fix remaining issues from codemod serverClient is now async because context use headers() getLang is now async because it uses headers() * Minor cleanup * Inline react-material-symbols package Package is seemingly not maintained any more and doesn't support React 19. This copies the package source into `design-system`, makes the necessary changes for 19 and export it for others to use. * Fix missing awaits * Disable modal exit animations Enabling modal exit animations via isExiting prop is causing modals to be rendered in "hidden" state and never unmount. Seems to be an issue with react-aria-components, see https://github.com/adobe/react-spectrum/issues/7563. Can probably be fixed by rewriting to a solution similar to https://react-spectrum.adobe.com/react-aria/examples/framer-modal-sheet.html * Remove unstable cache implementation and use in memory cache locally * Fix ref type in SelectFilter * Use cloneElement to add key prop to element Approved-by: Linus Flood
200 lines
6.1 KiB
TypeScript
200 lines
6.1 KiB
TypeScript
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import { dt } from "@/lib/dt"
|
|
|
|
import { getIntl } from "@/i18n"
|
|
import { getLang } from "@/i18n/serverContext"
|
|
import { getNumberOfNights } from "@/utils/dateFormatting"
|
|
|
|
import styles from "./footer.module.css"
|
|
|
|
import type { FooterProps } from "@/types/components/hotelReservation/myStay/receipt"
|
|
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
|
|
|
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({
|
|
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({
|
|
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({
|
|
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({
|
|
defaultMessage: "Check-in",
|
|
})}
|
|
</dt>
|
|
</Typography>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dd>
|
|
{dt(booking.checkInDate).locale(lang).format("ddd, D MMM YYYY")}
|
|
</dd>
|
|
</Typography>
|
|
</div>
|
|
|
|
<div>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dt>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Check-out",
|
|
})}
|
|
</dt>
|
|
</Typography>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dd>
|
|
{dt(booking.checkOutDate).locale(lang).format("ddd, D MMM YYYY")}
|
|
</dd>
|
|
</Typography>
|
|
</div>
|
|
</div>
|
|
|
|
<div className={styles.rightColumn}>
|
|
<div>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dt>
|
|
{intl.formatMessage({
|
|
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({
|
|
defaultMessage: "Number of guests",
|
|
})}
|
|
</dt>
|
|
</Typography>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dd>
|
|
{intl.formatMessage(
|
|
{
|
|
defaultMessage:
|
|
"{adults, plural, one {# adult} other {# adults}}",
|
|
},
|
|
{ adults: booking.adults }
|
|
)}
|
|
{booking.childrenAges.length > 0 && (
|
|
<>
|
|
{", "}
|
|
{intl.formatMessage(
|
|
{
|
|
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({
|
|
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({
|
|
defaultMessage: "Room classification",
|
|
})}
|
|
</dt>
|
|
</Typography>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dd>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Pet-friendly",
|
|
})}
|
|
</dd>
|
|
</Typography>
|
|
</div>
|
|
)}
|
|
|
|
<div>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dt>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Breakfast",
|
|
})}
|
|
</dt>
|
|
</Typography>
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<dd>
|
|
{booking.rateDefinition.breakfastIncluded
|
|
? intl.formatMessage({
|
|
defaultMessage: "Included",
|
|
})
|
|
: intl.formatMessage({
|
|
defaultMessage: "Not included",
|
|
})}
|
|
</dd>
|
|
</Typography>
|
|
</div>
|
|
</div>
|
|
</dl>
|
|
)
|
|
}
|