1 import { useActiveBreakpoint } from '@proton/components/index';
2 import { getPersonalCalendars } from '@proton/shared/lib/calendar/calendar';
3 import type { VIEWS } from '@proton/shared/lib/calendar/constants';
4 import type { VisualCalendar } from '@proton/shared/lib/interfaces/calendar';
6 import DummyCalendarContainerView from '../calendar/DummyCalendarContainerView';
7 import UnlockCalendarsModal from './UnlockCalendarsModal';
10 calendars: VisualCalendar[];
11 calendarsToUnlock: VisualCalendar[];
14 hasReactivatedCalendarsRef: React.MutableRefObject<boolean>;
16 const UnlockCalendarsContainer = ({
21 hasReactivatedCalendarsRef,
23 const { viewportWidth } = useActiveBreakpoint();
24 // Don't take into account subscribed calendars to decide whether to show a partial list of the calendars that need reset.
25 // Although we do need to reset the calendar keys for those, they will be immediately re-synced so the users should not see them "locked"
26 const numberOfPersonalCalendars = getPersonalCalendars(calendars).length;
27 const numberOfPersonalCalendarsToUnlock = getPersonalCalendars(calendarsToUnlock).length;
28 const hasOnlySubscribedCalendarsToUnlock = numberOfPersonalCalendarsToUnlock === 0;
30 hasOnlySubscribedCalendarsToUnlock || numberOfPersonalCalendars === numberOfPersonalCalendarsToUnlock;
35 calendars={calendarsToUnlock}
37 hasReactivatedCalendarsRef={hasReactivatedCalendarsRef}
40 <DummyCalendarContainerView drawerView={drawerView} isSmallViewport={viewportWidth['<=small']} />
45 export default UnlockCalendarsContainer;