Files
web/apps/scandic-web/components/HotelReservation/SelectRate/index.tsx
Bianca Widstam 42c7fb8510 Merged in fix/SW-3289-sidepeek-cta-hotel (pull request #2697)
fix(SW-3289): add cta to sidepeek hotel

* fix(SW-3289): add cta to sidepeek hotel

* fix(SW-3289): add cta hotel card


Approved-by: Joakim Jäderberg
Approved-by: Matilda Landström
2025-08-25 13:05:58 +00:00

60 lines
1.7 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, url: hotelData.url }}
restaurants={hotelData.restaurants}
additionalData={hotelData.additionalData}
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 />
</>
)
}