From eb19edfa8f4c5ac01df597bee6df1fc7a82ca97b Mon Sep 17 00:00:00 2001
From: Tushar Bhatt <95581504+TusharBhatt1@users.noreply.github.com>
Date: Thu, 10 Apr 2025 17:23:02 +0530
Subject: [PATCH] feat:overlay-calendar (#20610)
---
.../components/OverlayCalendar/OverlayCalendar.tsx | 13 +++++++++++--
packages/platform/atoms/booker/BookerWebWrapper.tsx | 4 ++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/packages/features/bookings/Booker/components/OverlayCalendar/OverlayCalendar.tsx b/packages/features/bookings/Booker/components/OverlayCalendar/OverlayCalendar.tsx
index 93354721db..0236732e0d 100644
--- a/packages/features/bookings/Booker/components/OverlayCalendar/OverlayCalendar.tsx
+++ b/packages/features/bookings/Booker/components/OverlayCalendar/OverlayCalendar.tsx
@@ -1,3 +1,5 @@
+import { useEffect } from "react";
+
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
import type { UseCalendarsReturnType } from "../hooks/useCalendars";
@@ -41,9 +43,16 @@ export const OverlayCalendar = ({
checkIsCalendarToggled,
} = useOverlayCalendar({ connectedCalendars, overlayBusyDates, onToggleCalendar });
+ // Adding to avoid flickering of continue modal due to stale state
+ useEffect(() => {
+ if (isOverlayCalendarEnabled) {
+ handleCloseContinueModal(false);
+ }
+ }, [isOverlayCalendarEnabled, handleCloseContinueModal]);
+
// on platform we don't handle connecting to third party calendar via booker yet
if (isPlatform && connectedCalendars?.length === 0) {
- return <>>;
+ return null;
}
return (
@@ -55,7 +64,7 @@ export const OverlayCalendar = ({
/>
{!isPlatform && (
diff --git a/packages/platform/atoms/booker/BookerWebWrapper.tsx b/packages/platform/atoms/booker/BookerWebWrapper.tsx
index db1304331c..49c8fc7041 100644
--- a/packages/platform/atoms/booker/BookerWebWrapper.tsx
+++ b/packages/platform/atoms/booker/BookerWebWrapper.tsx
@@ -209,6 +209,10 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
)
);
+ useEffect(() => {
+ if (hasSession) onOverlaySwitchStateChange(true);
+ }, [hasSession]);
+
return (