Files
web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/map/page.tsx
2025-01-14 11:09:42 +01:00

52 lines
1.6 KiB
TypeScript

import { notFound } from "next/navigation"
import { Suspense } from "react"
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
import { MapContainer } from "@/components/MapContainer"
import { setLang } from "@/i18n/serverContext"
import { getHotelSearchDetails } from "../../utils"
import styles from "./page.module.css"
import type { SelectHotelSearchParams } from "@/types/components/hotelReservation/selectHotel/selectHotelSearchParams"
import type { LangParams, PageArgs } from "@/types/params"
export default async function SelectHotelMapPage({
params,
searchParams,
}: PageArgs<LangParams, SelectHotelSearchParams>) {
setLang(params.lang)
const searchDetails = await getHotelSearchDetails({ searchParams })
if (!searchDetails) return notFound()
const {
city,
adultsInRoom,
childrenInRoom,
childrenInRoomArray,
selectHotelParams,
} = searchDetails
if (!city) return notFound()
return (
<div className={styles.main}>
<MapContainer>
<Suspense
key={city.name}
fallback={<SelectHotelMapContainerSkeleton />}
>
<SelectHotelMapContainer
city={city}
selectHotelParams={selectHotelParams}
adultsInRoom={adultsInRoom}
childrenInRoom={childrenInRoom}
child={childrenInRoomArray}
/>
</Suspense>
</MapContainer>
</div>
)
}