refactor: url management in hotel reservation flow
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import type { RoomPackageCodeEnum } from "../selectRate/roomFilter"
|
||||
import type { Child } from "../selectRate/selectRate"
|
||||
|
||||
interface Room {
|
||||
adults: number
|
||||
roomTypeCode: string
|
||||
rateCode: string
|
||||
counterRateCode?: string
|
||||
children?: Child[]
|
||||
packages?: RoomPackageCodeEnum[]
|
||||
}
|
||||
export interface BookingData {
|
||||
hotel: string
|
||||
fromDate: string
|
||||
toDate: string
|
||||
rooms: Room[]
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import type { z } from "zod"
|
||||
import type { Coordinates } from "@/types/components/maps/coordinates"
|
||||
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
||||
import type { imageSchema } from "@/server/routers/hotels/schemas/image"
|
||||
import type { Child } from "../../bookingWidget/guestsRoomsPicker"
|
||||
import type { Child } from "../selectRate/selectRate"
|
||||
import type { HotelData } from "./hotelCardListingProps"
|
||||
import type { CategorizedFilters, Filter } from "./hotelFilters"
|
||||
import type { SelectHotelSearchParams } from "./selectHotelSearchParams"
|
||||
@@ -66,7 +66,7 @@ export interface HotelCardDialogListingProps {
|
||||
|
||||
export type SelectHotelMapContainerProps = {
|
||||
city: Location
|
||||
searchParams: SelectHotelSearchParams
|
||||
selectHotelParams: SelectHotelSearchParams
|
||||
adultsInRoom: number
|
||||
childrenInRoom: string | undefined
|
||||
child: Child[] | undefined
|
||||
|
||||
@@ -46,8 +46,7 @@ export interface SelectHotelProps {
|
||||
lang: Lang
|
||||
}
|
||||
reservationParams: {
|
||||
selectHotelParams: URLSearchParams | undefined
|
||||
searchParams: SelectHotelSearchParams
|
||||
selectHotelParams: SelectHotelSearchParams
|
||||
adultsInRoom: number
|
||||
childrenInRoom: string | undefined
|
||||
childrenInRoomArray: Child[] | undefined
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
interface Child {
|
||||
bed: string
|
||||
age: number
|
||||
}
|
||||
|
||||
interface Room {
|
||||
adults: number
|
||||
child?: Child[]
|
||||
}
|
||||
import type { Room } from "../selectRate/selectRate"
|
||||
|
||||
export interface SelectHotelSearchParams {
|
||||
city: string
|
||||
fromDate: string
|
||||
toDate: string
|
||||
room: Room[]
|
||||
[key: string]: string | string[] | Room[]
|
||||
rooms: Pick<Room, "adults" | "children">[]
|
||||
[key: string]: string | string[] | Pick<Room, "adults" | "children">[]
|
||||
}
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
import type { Product, RoomConfiguration } from "@/server/routers/hotels/output"
|
||||
import type { ChildBedMapEnum } from "../../bookingWidget/enums"
|
||||
import type { RoomPackageCodeEnum } from "./roomFilter"
|
||||
|
||||
export interface Child {
|
||||
bed: ChildBedMapEnum
|
||||
age: number
|
||||
}
|
||||
|
||||
interface Room {
|
||||
export interface Room {
|
||||
adults: number
|
||||
roomtype: string
|
||||
ratecode: string
|
||||
counterratecode: string
|
||||
child?: Child[]
|
||||
packages?: string
|
||||
roomTypeCode: string
|
||||
rateCode: string
|
||||
counterRateCode: string
|
||||
children?: Child[]
|
||||
packages?: RoomPackageCodeEnum[]
|
||||
}
|
||||
|
||||
export interface SelectRateSearchParams {
|
||||
hotel: string
|
||||
city?: string
|
||||
hotelId: string
|
||||
fromDate: string
|
||||
toDate: string
|
||||
room: Room[]
|
||||
[key: string]: string | string[] | Room[]
|
||||
rooms: Room[]
|
||||
}
|
||||
|
||||
export interface Rate {
|
||||
|
||||
Reference in New Issue
Block a user