This commit is contained in:
@@ -145,6 +145,7 @@ const EventsCalendar = () => {
|
|||||||
const [loadingProgress, setLoadingProgress] = useState(12);
|
const [loadingProgress, setLoadingProgress] = useState(12);
|
||||||
const [initialLookupsLoaded, setInitialLookupsLoaded] = useState(false);
|
const [initialLookupsLoaded, setInitialLookupsLoaded] = useState(false);
|
||||||
const [initialEventsLoaded, setInitialEventsLoaded] = useState(false);
|
const [initialEventsLoaded, setInitialEventsLoaded] = useState(false);
|
||||||
|
const [isTabTransitionLoading, setIsTabTransitionLoading] = useState(false);
|
||||||
const hasMarkedInitialEventsLoadedRef = useRef(false);
|
const hasMarkedInitialEventsLoadedRef = useRef(false);
|
||||||
const visibleCalendarTabs = calendarTabOrder.filter((tabKey) => AuthService.canViewCalendarTab(tabKey) || AuthService.canEditCalendarTab(tabKey));
|
const visibleCalendarTabs = calendarTabOrder.filter((tabKey) => AuthService.canViewCalendarTab(tabKey) || AuthService.canEditCalendarTab(tabKey));
|
||||||
const canEditCurrentTab = () => AuthService.canEditCalendarTab(currentTab);
|
const canEditCurrentTab = () => AuthService.canEditCalendarTab(currentTab);
|
||||||
@@ -461,6 +462,16 @@ const EventsCalendar = () => {
|
|||||||
return () => clearTimeout(closeTimer);
|
return () => clearTimeout(closeTimer);
|
||||||
}, [initialLookupsLoaded, initialEventsLoaded]);
|
}, [initialLookupsLoaded, initialEventsLoaded]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isTabTransitionLoading) return;
|
||||||
|
setLoadingProgress(100);
|
||||||
|
const closeTimer = setTimeout(() => {
|
||||||
|
setShowSpinner(false);
|
||||||
|
setIsTabTransitionLoading(false);
|
||||||
|
}, 220);
|
||||||
|
return () => clearTimeout(closeTimer);
|
||||||
|
}, [events, isTabTransitionLoading]);
|
||||||
|
|
||||||
// Auto-fill repeat start date from event date when repeat option is selected (new modal)
|
// Auto-fill repeat start date from event date when repeat option is selected (new modal)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (newEventRecurring && newEventStartDateTime) {
|
if (newEventRecurring && newEventStartDateTime) {
|
||||||
@@ -984,6 +995,11 @@ const EventsCalendar = () => {
|
|||||||
|
|
||||||
const goToTab = (value) => {
|
const goToTab = (value) => {
|
||||||
if (!value || !visibleCalendarTabs.includes(value)) return;
|
if (!value || !visibleCalendarTabs.includes(value)) return;
|
||||||
|
if (value !== currentTab) {
|
||||||
|
setIsTabTransitionLoading(true);
|
||||||
|
setShowSpinner(true);
|
||||||
|
setLoadingProgress(65);
|
||||||
|
}
|
||||||
setTargetedEventType(eventTypeMap[value]);
|
setTargetedEventType(eventTypeMap[value]);
|
||||||
setCurrentTab(value);
|
setCurrentTab(value);
|
||||||
currentTabRef.current = value;
|
currentTabRef.current = value;
|
||||||
@@ -1010,8 +1026,14 @@ const EventsCalendar = () => {
|
|||||||
calendar?.config?.plugins?.eventModal?.close();
|
calendar?.config?.plugins?.eventModal?.close();
|
||||||
} catch (_e) {}
|
} catch (_e) {}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.querySelectorAll('[class*="sx__event-modal"]').forEach(el => el.remove());
|
document.querySelectorAll('.sx__event-modal').forEach((el) => {
|
||||||
document.querySelectorAll('[class*="event-modal"]').forEach(el => el.remove());
|
const dialogContainer = el.closest('[role="dialog"]');
|
||||||
|
if (dialogContainer) {
|
||||||
|
dialogContainer.remove();
|
||||||
|
} else {
|
||||||
|
el.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1024,7 +1046,6 @@ const EventsCalendar = () => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={dismissEventModal}
|
onClick={dismissEventModal}
|
||||||
onMouseDown={dismissEventModal}
|
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
title="Close"
|
title="Close"
|
||||||
data-custom-close="true"
|
data-custom-close="true"
|
||||||
|
|||||||
@@ -412,8 +412,14 @@ const EventsCalendar = () => {
|
|||||||
calendar?.config?.plugins?.eventModal?.close();
|
calendar?.config?.plugins?.eventModal?.close();
|
||||||
} catch (_e) {}
|
} catch (_e) {}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.querySelectorAll('[class*="sx__event-modal"]').forEach(el => el.remove());
|
document.querySelectorAll('.sx__event-modal').forEach((el) => {
|
||||||
document.querySelectorAll('[class*="event-modal"]').forEach(el => el.remove());
|
const dialogContainer = el.closest('[role="dialog"]');
|
||||||
|
if (dialogContainer) {
|
||||||
|
dialogContainer.remove();
|
||||||
|
} else {
|
||||||
|
el.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -425,7 +431,6 @@ const EventsCalendar = () => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={dismissEventModal}
|
onClick={dismissEventModal}
|
||||||
onMouseDown={dismissEventModal}
|
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
title="Close"
|
title="Close"
|
||||||
data-custom-close="true"
|
data-custom-close="true"
|
||||||
|
|||||||
Reference in New Issue
Block a user