diff --git a/packages/features/bookings/Booker/Booker.tsx b/packages/features/bookings/Booker/Booker.tsx index abde6880ab..c64792097c 100644 --- a/packages/features/bookings/Booker/Booker.tsx +++ b/packages/features/bookings/Booker/Booker.tsx @@ -1,6 +1,6 @@ import type { MotionStyle } from "framer-motion"; import { LazyMotion, domAnimation, m, AnimatePresence } from "framer-motion"; -import { Fragment, useEffect, useRef } from "react"; +import { useCallback, useEffect, useRef } from "react"; import StickyBox from "react-sticky-box"; import { shallow } from "zustand/shallow"; @@ -55,6 +55,7 @@ const BookerComponent = ({ username, eventSlug, month, rescheduleBooking }: Book shallow ); const extraDays = layout === "large_timeslots" ? (isTablet ? 2 : 4) : 0; + const onLayoutToggle = useCallback((newLayout: BookerLayout) => setLayout(newLayout), [setLayout]); useBrandColors({ brandColor: event.data?.profile.brandColor, @@ -71,10 +72,12 @@ const BookerComponent = ({ username, eventSlug, month, rescheduleBooking }: Book }); useEffect(() => { - if (isMobile) { + if (isMobile && layout !== "mobile") { setLayout("mobile"); + } else if (!isMobile && layout === "mobile") { + setLayout("small_calendar"); } - }, [isMobile, setLayout]); + }, [isMobile, setLayout, layout]); useEffect(() => { if (event.isLoading) return setBookerState("loading"); @@ -98,7 +101,7 @@ const BookerComponent = ({ username, eventSlug, month, rescheduleBooking }: Book {!isMobile && (