Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photos):defer-mobile-people-drawer-until-consent

Aswin Asokf5a2f7807e57
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index 9338f6dcdb..8224327734 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -41,7 +41,7 @@ type PhotosNavigationShellProps = SearchBarProps & {
onUpload: () => void;
onHome: () => void;
mode: GalleryBarMode;
- onChangeMode: (mode: GalleryBarMode) => void;
+ onChangeMode: (mode: GalleryBarMode) => boolean;
};
export const PhotosNavigationShell: React.FC<
@@ -79,6 +79,9 @@ export const PhotosNavigationShell: React.FC<
useEffect(() => {
if (!mobile) closeMobileNavigation();
}, [mobile, closeMobileNavigation]);
+ useEffect(() => {
+ if (mobile && props.mode == "people") showMobileNavigation();
+ }, [mobile, props.mode, showMobileNavigation]);
const handleChangeMode = (mode: GalleryBarMode) => {
const reopeningSection =
mobile &&
@@ -99,8 +102,8 @@ export const PhotosNavigationShell: React.FC<
}
return;
}
+ if (!props.onChangeMode(mode)) return;
setNavigationCollapsed(false);
- props.onChangeMode(mode);
if (mobile) showMobileNavigation();
};
return (
@@ -293,7 +296,8 @@ const NormalHeaderContents: React.FC<
};
const NormalNavigationRail: React.FC<
- Omit<PhotosNavigationShellProps, "onUpload"> & {
+ Omit<PhotosNavigationShellProps, "onUpload" | "onChangeMode"> & {
+ onChangeMode: (mode: GalleryBarMode) => void;
isHome: boolean;
opensDialog: boolean;
navigationOpen: boolean;
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 25c1b3fbf5..68d89812a0 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1486,19 +1486,20 @@ const Page: React.FC = () => {
const handleShowPeople = () => {
if (!isMLEnabled()) {
showPeopleConsent();
- return;
+ return false;
}
setCleanupView(undefined);
dispatch({ type: "showPeople" });
+ return true;
};
const handleChangeBarMode = (mode: GalleryBarMode) => {
if (mode == "people") {
- handleShowPeople();
- return;
+ return handleShowPeople();
}
setCleanupView(undefined);
dispatch({ type: "showAlbums" });
+ return true;
};
const handleFileViewerToggleFavorite = useCallback(