feat: add mobile summary
This commit is contained in:
@@ -23,6 +23,11 @@ import { BreakfastPackageEnum } from "@/types/enums/breakfast"
|
||||
|
||||
const SESSION_STORAGE_KEY = "enterDetails"
|
||||
|
||||
type TotalPrice = {
|
||||
local: { price: number; currency: string }
|
||||
euro: { price: number; currency: string }
|
||||
}
|
||||
|
||||
interface EnterDetailsState {
|
||||
userData: {
|
||||
bedType: BedTypeSchema | undefined
|
||||
@@ -32,6 +37,8 @@ interface EnterDetailsState {
|
||||
steps: StepEnum[]
|
||||
selectRateUrl: string
|
||||
currentStep: StepEnum
|
||||
totalPrice: TotalPrice
|
||||
isSummaryOpen: boolean
|
||||
isValid: Record<StepEnum, boolean>
|
||||
completeStep: (updatedData: Partial<EnterDetailsState["userData"]>) => void
|
||||
navigate: (
|
||||
@@ -42,6 +49,8 @@ interface EnterDetailsState {
|
||||
>
|
||||
) => void
|
||||
setCurrentStep: (step: StepEnum) => void
|
||||
toggleSummaryOpen: () => void
|
||||
setTotalPrice: (totalPrice: TotalPrice) => void
|
||||
}
|
||||
|
||||
export function initEditDetailsState(
|
||||
@@ -129,6 +138,11 @@ export function initEditDetailsState(
|
||||
roomData,
|
||||
selectRateUrl,
|
||||
steps: Object.values(StepEnum),
|
||||
totalPrice: {
|
||||
local: { price: 0, currency: "" },
|
||||
euro: { price: 0, currency: "" },
|
||||
},
|
||||
isSummaryOpen: false,
|
||||
setCurrentStep: (step) => set({ currentStep: step }),
|
||||
navigate: (step, updatedData) =>
|
||||
set(
|
||||
@@ -166,6 +180,8 @@ export function initEditDetailsState(
|
||||
get().navigate(nextStep, updatedData)
|
||||
})
|
||||
),
|
||||
toggleSummaryOpen: () => set({ isSummaryOpen: !get().isSummaryOpen }),
|
||||
setTotalPrice: (totalPrice) => set({ totalPrice: totalPrice }),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user