Files
web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx
2024-12-13 12:19:47 +01:00

41 lines
1.2 KiB
TypeScript

import { Suspense } from "react"
import SelectHotel from "@/components/HotelReservation/SelectHotel"
import { SelectHotelSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelSkeleton"
import { setLang } from "@/i18n/serverContext"
import { getHotelSearchDetails } from "../utils"
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
import type { LangParams, PageArgs } from "@/types/params"
export default async function SelectHotelPage({
params,
searchParams,
}: PageArgs<LangParams, SelectHotelSearchParams>) {
setLang(params.lang)
const searchDetails = await getHotelSearchDetails({ searchParams })
if (!searchDetails) return null
const { city, urlSearchParams, adultsInRoom, childrenInRoom } = searchDetails
const reservationParams = {
selectHotelParams: urlSearchParams,
searchParams,
adultsInRoom,
childrenInRoom,
}
return (
<Suspense
key={`${city.name}-${searchParams.fromDate}-${searchParams.toDate}-${adultsInRoom}-${childrenInRoom}`}
fallback={<SelectHotelSkeleton />}
>
<SelectHotel
city={city}
params={params}
reservationParams={reservationParams}
/>
</Suspense>
)
}