refactor: url management in hotel reservation flow

This commit is contained in:
Christel Westerberg
2025-01-13 14:26:38 +01:00
parent 23ff0970e9
commit b2935114e3
48 changed files with 407 additions and 418 deletions
@@ -1,17 +1,11 @@
import type { Child, Room } from "../hotelReservation/selectRate/selectRate"
export type ChildBed = {
label: string
value: number
}
export type Child = {
age: number
bed: number
}
export type TGuestsRoom = {
adults: number
child: Child[]
}
export type TGuestsRoom = Required<Pick<Room, "adults" | "children">>
export type GuestsRoomPickerProps = {
index: number
+5 -4
View File
@@ -1,6 +1,7 @@
import type { VariantProps } from "class-variance-authority"
import type { z } from "zod"
import type { SearchParams } from "@/types/params"
import type { Locations } from "@/types/trpc/routers/hotel/locations"
import type { bookingWidgetSchema } from "@/components/Forms/BookingWidget/schema"
import type { bookingWidgetVariants } from "@/components/Forms/BookingWidget/variants"
@@ -8,12 +9,12 @@ import type { TGuestsRoom } from "./guestsRoomsPicker"
export type BookingWidgetSchema = z.output<typeof bookingWidgetSchema>
export type BookingWidgetSearchParams = {
export type BookingWidgetSearchData = {
city?: string
hotel?: string
fromDate?: string
toDate?: string
room?: TGuestsRoom[]
rooms?: TGuestsRoom[]
}
export type BookingWidgetType = VariantProps<
@@ -22,13 +23,13 @@ export type BookingWidgetType = VariantProps<
export interface BookingWidgetProps {
type?: BookingWidgetType
searchParams?: URLSearchParams
bookingWidgetSearchParams: SearchParams<BookingWidgetSearchData>["searchParams"]
}
export interface BookingWidgetClientProps {
locations: Locations
type?: BookingWidgetType
searchParams?: URLSearchParams
bookingWidgetSearchParams: SearchParams<BookingWidgetSearchData>["searchParams"]
}
export interface BookingWidgetToggleButtonProps {