Merge branch 'master' into feature/tracking

This commit is contained in:
Linus Flood
2024-12-03 07:48:59 +01:00
159 changed files with 2609 additions and 1227 deletions

View File

@@ -36,6 +36,7 @@ import { setLang } from "@/i18n/serverContext"
import styles from "./page.module.css"
import type { HotelData } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
import {
TrackingChannelEnum,
@@ -69,6 +70,14 @@ export default async function SelectHotelPage({
const selectHotelParams = new URLSearchParams(searchParams)
const selectHotelParamsObject =
getHotelReservationQueryParams(selectHotelParams)
if (
!selectHotelParamsObject.room ||
selectHotelParamsObject.room.length === 0
) {
return notFound()
}
const adults = selectHotelParamsObject.room[0].adults // TODO: Handle multiple rooms
const child = selectHotelParamsObject.room[0].child // TODO: Handle multiple rooms
const children = child ? generateChildrenString(child) : undefined
@@ -84,7 +93,11 @@ export default async function SelectHotelPage({
const arrivalDate = new Date(searchParams.fromDate)
const departureDate = new Date(searchParams.toDate)
const filterList = getFiltersFromHotels(hotels)
const validHotels = hotels.filter(
(hotel): hotel is HotelData => hotel !== null
)
const filterList = getFiltersFromHotels(validHotels)
const breadcrumbs = [
{
title: intl.formatMessage({ id: "Home" }),
@@ -132,8 +145,8 @@ export default async function SelectHotelPage({
leadTime: differenceInCalendarDays(arrivalDate, new Date()),
searchType: "destination",
bookingTypeofDay: isWeekend(arrivalDate) ? "weekend" : "weekday",
country: hotels?.[0].hotelData.address.country,
region: hotels?.[0].hotelData.address.city,
country: validHotels?.[0].hotelData.address.country,
region: validHotels?.[0].hotelData.address.city,
}
return (
@@ -206,7 +219,7 @@ export default async function SelectHotelPage({
})}
/>
)}
<HotelCardListing hotelData={hotels} />
<HotelCardListing hotelData={validHotels} />
</div>
<TrackingSDK
pageData={pageTrackingData}