Merged in feat/SW-965-select-rate-modify-room (pull request #1326)
Feat/SW-965 select rate modify room * feat(SW-965): added new state for modify room and smaller fixes * feat(SW-965): update state handling of modifyRateIndex * fix: adjust scroll animation to handle modifyRateIndex * fix: room state logic and removed unused css class Approved-by: Pontus Dreij Approved-by: Arvid Norlin
This commit is contained in:
@@ -26,7 +26,9 @@ interface RateSelectionState {
|
||||
isPriceDetailsModalOpen: boolean
|
||||
isSummaryOpen: boolean
|
||||
guestsInRooms: { adults: number; children?: Child[] }[]
|
||||
modifyRateIndex: number | null
|
||||
modifyRate: (index: number) => void
|
||||
closeModifyRate: () => void
|
||||
selectRate: (index: number, rate: RateCode | undefined) => void
|
||||
initializeRates: (count: number) => void
|
||||
calculateRateSummary: ({
|
||||
@@ -46,18 +48,18 @@ export const useRateSelectionStore = create<RateSelectionState>((set, get) => ({
|
||||
isPriceDetailsModalOpen: false,
|
||||
isSummaryOpen: false,
|
||||
guestsInRooms: [{ adults: 1 }],
|
||||
modifyRate: (index) =>
|
||||
set((state) => {
|
||||
const newRates = [...state.selectedRates]
|
||||
newRates[index] = undefined
|
||||
return { selectedRates: newRates }
|
||||
}),
|
||||
selectRate: (index, rate) =>
|
||||
modifyRateIndex: null,
|
||||
modifyRate: (index) => set({ modifyRateIndex: index }),
|
||||
closeModifyRate: () => set({ modifyRateIndex: null }),
|
||||
selectRate: (index, rate) => {
|
||||
set((state) => {
|
||||
const newRates = [...state.selectedRates]
|
||||
newRates[index] = rate
|
||||
return { selectedRates: newRates }
|
||||
}),
|
||||
return {
|
||||
selectedRates: newRates,
|
||||
}
|
||||
})
|
||||
},
|
||||
initializeRates: (count) =>
|
||||
set({ selectedRates: new Array(count).fill(undefined) }),
|
||||
calculateRateSummary: (params) => {
|
||||
|
||||
Reference in New Issue
Block a user