Merged in fix/remove-old-select-rate (pull request #2647)
Fix/remove old select rate * remove old select-rate * Fix imports * renamed SelectRate2 -> SelectRate
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import { HotelInfoCardSkeleton } from "@/components/HotelReservation/SelectRate/HotelInfoCard"
|
||||
import { RoomsContainerSkeleton } from "@/components/HotelReservation/SelectRate/RoomsContainer/RoomsContainerSkeleton"
|
||||
|
||||
// Select Rate loading doesn't need a layout and wrapper
|
||||
// to force loading.tsx to show again since refetch of
|
||||
// availability happens client-side and only the RoomCards
|
||||
// display a loading state since we already have the hotel
|
||||
// data
|
||||
export default function LoadingSelectRate() {
|
||||
return (
|
||||
<>
|
||||
<HotelInfoCardSkeleton />
|
||||
<RoomsContainerSkeleton />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { parseSelectRateSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import { combineRegExps, rateTypeRegex } from "@/constants/booking"
|
||||
|
||||
import SelectRate from "@/components/HotelReservation/SelectRate"
|
||||
|
||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||
|
||||
const singleRoomRateTypes = combineRegExps(
|
||||
[rateTypeRegex.ARB, rateTypeRegex.VOUCHER],
|
||||
"i"
|
||||
)
|
||||
|
||||
export default async function SelectRatePage(
|
||||
props: PageArgs<LangParams & { section: string }, NextSearchParams>
|
||||
) {
|
||||
const params = await props.params
|
||||
const searchParams = await props.searchParams
|
||||
const booking = parseSelectRateSearchParams(searchParams)
|
||||
|
||||
if (!booking) return notFound()
|
||||
|
||||
const isMultiRoom = booking.rooms.length > 1
|
||||
const isRedemption = booking.searchType === SEARCH_TYPE_REDEMPTION
|
||||
const isArbOrVoucher = booking.bookingCode
|
||||
? singleRoomRateTypes.test(booking.bookingCode)
|
||||
: false
|
||||
|
||||
if ((isMultiRoom && isRedemption) || (isMultiRoom && isArbOrVoucher)) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
// If someone tries to update the url with
|
||||
// a bookingCode also, then we need to remove it
|
||||
if (isRedemption && searchParams.bookingCode) {
|
||||
delete searchParams.bookingCode
|
||||
}
|
||||
|
||||
return <SelectRate lang={params.lang} booking={booking} />
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
import { HotelInfoCardSkeleton } from "@/components/HotelReservation/SelectRate/HotelInfoCard"
|
||||
import { RoomsContainerSkeleton } from "@/components/HotelReservation/SelectRate/RoomsContainer/RoomsContainerSkeleton"
|
||||
|
||||
// Select Rate loading doesn't need a layout and wrapper
|
||||
// to force loading.tsx to show again since refetch of
|
||||
// availability happens client-side and only the RoomCards
|
||||
// display a loading state since we already have the hotel
|
||||
// data
|
||||
export default function LoadingSelectRate() {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
import { combineRegExps, rateTypeRegex } from "@/constants/booking"
|
||||
import { getHotel } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import SelectRate from "@/components/HotelReservation/SelectRate2"
|
||||
import SelectRate from "@/components/HotelReservation/SelectRate"
|
||||
import { SelectRateProvider } from "@/contexts/SelectRate/SelectRateContext"
|
||||
|
||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||
|
||||
Reference in New Issue
Block a user