From ca1f84c827f630da3d7e86b31aad2ccc15231d4e Mon Sep 17 00:00:00 2001 From: Somay Chauhan Date: Wed, 26 Feb 2025 11:15:55 +0530 Subject: [PATCH] fix: disable skip confirm for booker_layout=WEEK_VIEW (#19524) * fix: disable skip confirm for booker_layout=WEEK_VIEW * Make code clearer --------- Co-authored-by: Hariom Balhara --- packages/features/bookings/Booker/Booker.tsx | 7 +++++-- .../Booker/components/hooks/useSkipConfirmStep.ts | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/features/bookings/Booker/Booker.tsx b/packages/features/bookings/Booker/Booker.tsx index d86f9c5583..66383fa85c 100644 --- a/packages/features/bookings/Booker/Booker.tsx +++ b/packages/features/bookings/Booker/Booker.tsx @@ -165,6 +165,7 @@ const BookerComponent = ({ bookingForm, bookerState, isInstantMeeting, + layout == BookerLayouts.WEEK_VIEW, event?.data?.bookingFields ); @@ -181,9 +182,11 @@ const BookerComponent = ({ if (event.isPending) return setBookerState("loading"); if (!selectedDate) return setBookerState("selecting_date"); if (!selectedTimeslot) return setBookerState("selecting_time"); - if (selectedTimeslot && skipConfirmStep && !isInstantMeeting) return setBookerState("selecting_time"); + const isSkipConfirmStepSupported = !isInstantMeeting && layout !== BookerLayouts.WEEK_VIEW; + if (selectedTimeslot && skipConfirmStep && isSkipConfirmStepSupported) + return setBookerState("selecting_time"); return setBookerState("booking"); - }, [event, selectedDate, selectedTimeslot, setBookerState, skipConfirmStep]); + }, [event, selectedDate, selectedTimeslot, setBookerState, skipConfirmStep, layout, isInstantMeeting]); const slot = getQueryParam("slot"); diff --git a/packages/features/bookings/Booker/components/hooks/useSkipConfirmStep.ts b/packages/features/bookings/Booker/components/hooks/useSkipConfirmStep.ts index 7e081ff9a4..d5aae56577 100644 --- a/packages/features/bookings/Booker/components/hooks/useSkipConfirmStep.ts +++ b/packages/features/bookings/Booker/components/hooks/useSkipConfirmStep.ts @@ -11,6 +11,7 @@ const useSkipConfirmStep = ( bookingForm: UseBookingFormReturnType["bookingForm"], bookerState: BookerState, isInstantMeeting: boolean, + isWeekView: boolean, bookingFields?: BookerEvent["bookingFields"] ) => { const bookingFormValues = bookingForm.getValues(); @@ -37,9 +38,11 @@ const useSkipConfirmStep = ( setCanSkip(false); } }; - - bookerState === "selecting_time" && !isInstantMeeting && checkSkipStep(); - }, [bookingFormValues, bookingFields, rescheduleUid, bookerState]); + const isSkipConfirmStepSupported = !isInstantMeeting && !isWeekView; + if (bookerState === "selecting_time" && isSkipConfirmStepSupported) { + checkSkipStep(); + } + }, [bookingFormValues, bookingFields, rescheduleUid, bookerState, isWeekView, isInstantMeeting]); return canSkip; };