feat(SW-1717): rewrite select-rate to show all variants of rate-cards

This commit is contained in:
Simon Emanuelsson
2025-03-25 11:25:44 +01:00
committed by Michael Zetterberg
parent adde77eaa9
commit ebaea78fb3
118 changed files with 4601 additions and 4374 deletions

View File

@@ -1,9 +1,13 @@
import stringify from "json-stable-stringify-without-jsonify"
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { REDEMPTION } from "@/constants/booking"
import SelectRate from "@/components/HotelReservation/SelectRate"
import { HotelInfoCardSkeleton } from "@/components/HotelReservation/SelectRate/HotelInfoCard"
import { RoomsContainerSkeleton } from "@/components/HotelReservation/SelectRate/RoomsContainer/RoomsContainerSkeleton"
import { convertSearchParamsToObj } from "@/utils/url"
import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { LangParams, PageArgs } from "@/types/params"
@@ -13,6 +17,17 @@ export default async function SelectRatePage({
searchParams,
}: PageArgs<LangParams & { section: string }, SelectRateSearchParams>) {
const suspenseKey = stringify(searchParams)
const booking = convertSearchParamsToObj<SelectRateSearchParams>(searchParams)
const isMultiRoom = booking.rooms.length > 1
const isRedemption = booking.searchType === REDEMPTION
const isVoucher = booking.bookingCode
? /(^VO[0-9a-z]*$)/i.test(booking.bookingCode)
: false
if ((isMultiRoom && isRedemption) || (isMultiRoom && isVoucher)) {
return notFound()
}
return (
<Suspense