Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

chore(settings):merge-upstream-main

Aswin Asok14d278768851
diff --cc web/apps/photos/src/components/sidebar/Sidebar.tsx
index 0e0b2b5caa,5f1b694d66..f5218d1136
--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx
+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx
@@@ -89,9 -89,7 +90,9 @@@ type SidebarProps = ModalVisibilityProp
collectionSummaryID: number,
isHiddenCollectionSummary?: boolean,
) => Promise<void>;
- onShowExport: () => void;
+ collectionNameByID: Map<number, string>;
+ onCloseOverlays: () => void;
+ children?: React.ReactNode;
onAuthenticateUser: () => Promise<boolean>;
};
@@@ -129,39 -133,6 +138,41 @@@ export const Sidebar: React.FC<SidebarP
const [pendingFreeUpSpaceAction, setPendingFreeUpSpaceAction] =
useState<FreeUpSpaceAction>();
+ const closeAccount = accountVisibilityProps.onClose;
+ const closeReferrals = referralsVisibilityProps.onClose;
+ const closePreferences = preferencesVisibilityProps.onClose;
+ const closeHelp = helpVisibilityProps.onClose;
+ const closeFreeUpSpace = freeUpSpaceVisibilityProps.onClose;
+ const closeSections = useCallback(() => {
+ closeAccount();
+ closeReferrals();
+ closePreferences();
+ closeHelp();
+ closeFreeUpSpace();
++ closeExport();
+ setWatchFolderView(false);
+ onCloseOverlays();
+ }, [
+ closeAccount,
+ closeReferrals,
+ closePreferences,
+ closeHelp,
+ closeFreeUpSpace,
++ closeExport,
+ setWatchFolderView,
+ onCloseOverlays,
+ ]);
+
+ const onClose = useCallback(() => {
+ closeSections();
+ closeRoot();
+ }, [closeSections, closeRoot]);
+
+ const selectSection = (show: () => void) => () => {
+ closeSections();
+ show();
+ };
+
const handleLogout = useCallback(
() =>
showMiniDialog({
@@@ -200,12 -171,11 +211,12 @@@
log.error("Failed to authenticate before export", error);
}
})();
- }, [onAuthenticateUser, onShowExport, showMiniDialog]);
+ }, [onAuthenticateUser, showExport, showMiniDialog]);
const performSidebarAction = useCallback(
- async (actionID: SidebarActionID) =>
- performSidebarRegistryAction(actionID, {
+ async (actionID: SidebarActionID) => {
+ closeSections();
+ return performSidebarRegistryAction(actionID, {
onClose,
onShowCollectionSummary,
onShowPlanSelector,
@@@ -295,23 -258,21 +306,23 @@@
<UtilitySection
onCloseSidebar={onClose}
{...{
- onShowExport: selectSection(handleShowExport),
- showExport: handleShowExport,
++ showExport: selectSection(handleShowExport),
onAuthenticateUser,
onShowPlanSelector,
- showAccount,
+ showAccount: selectSection(showAccount),
accountVisibilityProps,
- showReferrals,
+ showReferrals: selectSection(showReferrals),
referralsVisibilityProps,
- showPreferences,
+ showPreferences: selectSection(showPreferences),
preferencesVisibilityProps,
- showHelp,
+ showHelp: selectSection(showHelp),
helpVisibilityProps,
- showFreeUpSpace,
+ showFreeUpSpace: selectSection(showFreeUpSpace),
freeUpSpaceVisibilityProps,
watchFolderView,
- onShowWatchFolder: handleOpenWatchFolder,
+ onShowWatchFolder: selectSection(
+ handleOpenWatchFolder,
+ ),
onCloseWatchFolder: handleCloseWatchFolder,
pendingAccountAction,
onAccountActionHandled: setPendingAccountAction,
@@@ -330,8 -291,13 +341,15 @@@
<InfoSection />
</Stack>
</RootSidebarDrawer>
- <Export
- {...exportVisibilityProps}
- open={open && exportVisibilityProps.open}
- collectionNameByID={collectionNameByID}
- onRootClose={onClose}
- />
- </>
++ {open && exportVisibilityProps.open && (
++ <Export
++ {...exportVisibilityProps}
++ collectionNameByID={collectionNameByID}
++ onRootClose={onClose}
++ />
++ )}
+ {children}
+ </SidebarDrawerShell>
);
};
@@@ -711,17 -675,15 +727,17 @@@ const UtilitySection: React.FC<UtilityS
<RowButtonEndActivityIndicator />
)
}
- onClick={onShowExport}
+ onClick={showExport}
/>
- <Help
- {...helpVisibilityProps}
- onRootClose={onCloseSidebar}
- pendingAction={pendingHelpAction}
- onActionHandled={onHelpActionHandled}
- />
- {isDesktop && (
+ {helpVisibilityProps.open && (
+ <Help
+ {...helpVisibilityProps}
+ onRootClose={onCloseSidebar}
+ pendingAction={pendingHelpAction}
+ onActionHandled={onHelpActionHandled}
+ />
+ )}
+ {isDesktop && watchFolderView && (
<WatchFolder
open={watchFolderView}
onClose={onCloseWatchFolder}
diff --cc web/apps/photos/src/pages/gallery.tsx
index ef97db15a7,8713d69434..61ecf20760
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@@ -368,20 -365,9 +365,18 @@@ const Page: React.FC = () =>
}
}, []);
+ const closeSidebarOverlays = useCallback(() => {
- exportVisibilityProps.onClose();
+ planSelectorVisibilityProps.onClose();
+ familyManagementVisibilityProps.onClose();
+ }, [
- exportVisibilityProps.onClose,
+ planSelectorVisibilityProps.onClose,
+ familyManagementVisibilityProps.onClose,
+ ]);
+
const handleSidebarClose = useCallback(() => {
+ closeSidebarOverlays();
sidebarVisibilityProps.onClose();
- }, [sidebarVisibilityProps.onClose]);
+ }, [closeSidebarOverlays, sidebarVisibilityProps.onClose]);
const handleSidebarActionHandled = useCallback(
() => setPendingSidebarAction(undefined),
@@@ -2053,19 -2030,9 +2047,12 @@@
onActionHandled={handleSidebarActionHandled}
onShowPlanSelector={showPlanSelector}
onShowCollectionSummary={handleSidebarShowCollectionSummary}
- onShowExport={showExport}
+ collectionNameByID={collectionNameByID}
+ onCloseOverlays={closeSidebarOverlays}
onAuthenticateUser={authenticateUser}
- />
+ >
+ {sidebarVisibilityProps.open && subscriptionDialogs}
- {exportVisibilityProps.open && (
- <Export
- {...exportVisibilityProps}
- {...{ collectionNameByID }}
- onRootClose={handleSidebarClose}
- />
- )}
+ </Sidebar>
<WhatsNew {...whatsNewVisibilityProps} />
<AssignPersonDialog
{...contextMenuAssignPersonProps}