feat: merge stores, fix auto navigation, split summary
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { RoomPackageCodeEnum } from "../selectRate/roomFilter"
|
||||
import { Child } from "../selectRate/selectRate"
|
||||
|
||||
import { Packages } from "@/types/requests/packages"
|
||||
import type { RoomPackageCodeEnum } from "../selectRate/roomFilter"
|
||||
import type { Child } from "../selectRate/selectRate"
|
||||
|
||||
interface Room {
|
||||
adults: number
|
||||
@@ -17,29 +15,3 @@ export interface BookingData {
|
||||
toDate: string
|
||||
rooms: Room[]
|
||||
}
|
||||
|
||||
type Price = {
|
||||
amount: number
|
||||
currency: string
|
||||
}
|
||||
|
||||
export type RoomsData = {
|
||||
roomType: string
|
||||
prices: {
|
||||
public: {
|
||||
local: Price
|
||||
euro: Price | undefined
|
||||
}
|
||||
member:
|
||||
| {
|
||||
local: Price
|
||||
euro: Price | undefined
|
||||
}
|
||||
| undefined
|
||||
}
|
||||
adults: number
|
||||
children?: Child[]
|
||||
rateDetails?: string[]
|
||||
cancellationText: string
|
||||
packages: Packages | null
|
||||
}
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { guestDetailsSchema } from "@/components/HotelReservation/EnterDetails/Details/schema"
|
||||
import {
|
||||
guestDetailsSchema,
|
||||
signedInDetailsSchema,
|
||||
} from "@/components/HotelReservation/EnterDetails/Details/schema"
|
||||
|
||||
import type { SafeUser } from "@/types/user"
|
||||
|
||||
export type DetailsSchema = z.output<typeof guestDetailsSchema>
|
||||
export type SignedInDetailsSchema = z.output<typeof signedInDetailsSchema>
|
||||
|
||||
type MemberPrice = { price: number; currency: string }
|
||||
type MemberPrice = {
|
||||
currency: string
|
||||
price: number
|
||||
}
|
||||
|
||||
export interface DetailsProps {
|
||||
user: SafeUser
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { RouterOutput } from "@/lib/trpc/client"
|
||||
|
||||
type HotelDataGet = RouterOutput["hotel"]["hotelData"]["get"]
|
||||
|
||||
export interface HotelHeaderProps {
|
||||
hotel: NonNullable<HotelDataGet>["data"]["attributes"]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { StepEnum } from "@/types/enums/step"
|
||||
|
||||
export const StepStoreKeys: Record<StepEnum, "bedType" | "breakfast" | null> = {
|
||||
"select-bed": "bedType",
|
||||
breakfast: "breakfast",
|
||||
details: null,
|
||||
payment: null,
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
import type { RoomsData } from "./bookingData"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
import type { RoomAvailability } from "@/types/trpc/routers/hotel/availability"
|
||||
|
||||
export interface SummaryProps {
|
||||
showMemberPrice: boolean
|
||||
room: RoomsData
|
||||
export interface ClientSummaryProps
|
||||
extends Pick<
|
||||
RoomAvailability,
|
||||
"cancellationText" | "memberRate" | "rateDetails"
|
||||
>,
|
||||
Pick<RoomAvailability["selectedRoom"], "roomType"> {
|
||||
adults: number
|
||||
isMember: boolean
|
||||
kids: Child[] | undefined
|
||||
}
|
||||
|
||||
39
types/components/hotelReservation/summary.ts
Normal file
39
types/components/hotelReservation/summary.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { RoomPackageCodeEnum } from "./selectRate/roomFilter"
|
||||
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
import type { DetailsState, Price } from "@/types/stores/enter-details"
|
||||
import type { RoomAvailability } from "@/types/trpc/routers/hotel/availability"
|
||||
import type { BedTypeSchema } from "./enterDetails/bedType"
|
||||
import type { BreakfastPackage } from "./enterDetails/breakfast"
|
||||
import type { Child } from "./selectRate/selectRate"
|
||||
|
||||
export type RoomsData = Pick<DetailsState, "roomPrice"> &
|
||||
Pick<RoomAvailability, "cancellationText" | "rateDetails"> &
|
||||
Pick<RoomAvailability["selectedRoom"], "roomType"> & {
|
||||
adults: number
|
||||
children?: Child[]
|
||||
packages: Packages | null
|
||||
}
|
||||
|
||||
interface SharedSummaryProps {
|
||||
fromDate: string
|
||||
toDate: string
|
||||
}
|
||||
|
||||
export interface SummaryProps extends SharedSummaryProps {
|
||||
bedType: BedTypeSchema | undefined
|
||||
breakfast: BreakfastPackage | false | undefined
|
||||
showMemberPrice: boolean
|
||||
room: RoomsData
|
||||
toggleSummaryOpen?: () => void
|
||||
totalPrice: Price
|
||||
}
|
||||
|
||||
export interface SummaryPageProps extends SharedSummaryProps {
|
||||
adults: number
|
||||
hotelId: string
|
||||
kids: Child[] | undefined
|
||||
packageCodes: RoomPackageCodeEnum[] | undefined
|
||||
rateCode: string
|
||||
roomTypeCode: string
|
||||
}
|
||||
Reference in New Issue
Block a user