Files
web/apps/scandic-web/components/HotelReservation/SelectRate/index.tsx
Joakim Jäderberg e3067331c6 Merged in fix/remove-old-select-rate (pull request #2647)
Fix/remove old select rate

* remove old select-rate

* Fix imports

* renamed SelectRate2 -> SelectRate
2025-08-13 13:43:48 +00:00

55 lines
1.5 KiB
TypeScript

import { cookies } from "next/headers"
import { FamilyAndFriendsCodes } from "@/constants/booking"
import { HotelInfoCard } from "@/components/HotelReservation/SelectRate/HotelInfoCard"
import { RoomsContainer } from "@/components/HotelReservation/SelectRate/RoomsContainer"
import FnFNotAllowedAlert from "../FnFNotAllowedAlert/FnFNotAllowedAlert"
import AvailabilityError from "./AvailabilityError"
import Tracking from "./Tracking"
import type { RouterOutput } from "@scandic-hotels/trpc/client"
import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate"
export default async function SelectRatePage({
booking,
hotelData,
}: {
hotelData: NonNullable<RouterOutput["hotel"]["get"]>
booking: SelectRateBooking
}) {
const bookingCode = booking.bookingCode
let isInValidFNF = false
if (bookingCode && FamilyAndFriendsCodes.includes(bookingCode)) {
const cookieStore = await cookies()
isInValidFNF = cookieStore.get("sc")?.value !== "1"
}
return (
<>
<HotelInfoCard hotel={hotelData.hotel} booking={booking} />
{isInValidFNF ? (
<FnFNotAllowedAlert />
) : (
<RoomsContainer
hotelType={hotelData.hotel.hotelType}
roomCategories={hotelData.roomCategories}
vat={hotelData.hotel.vat}
/>
)}
<Tracking
hotelId={hotelData.hotel.id}
hotelName={hotelData.hotel.name}
country={hotelData.hotel.address.country}
city={hotelData.hotel.address.city}
/>
<AvailabilityError />
</>
)
}