Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add back navigation to Hidden and Archive headers

AswinAsokef34e1fa713e
diff --git a/web/apps/photos/src/components/collections/CollectionHeader.tsx b/web/apps/photos/src/components/collections/CollectionHeader.tsx
index 77524dbce1..d742019449 100644
--- a/web/apps/photos/src/components/collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/collections/CollectionHeader.tsx
@@ -22,6 +22,7 @@ import {
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import ArchiveOutlinedIcon from "@mui/icons-material/ArchiveOutlined";
+import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import CheckIcon from "@mui/icons-material/Check";
import LinkIcon from "@mui/icons-material/Link";
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
@@ -86,6 +87,7 @@ export interface CollectionHeaderProps {
hasActiveFileSelection: boolean;
onAddSaveGroup: AddSaveGroup;
onShowMap: () => void;
+ onBackToAlbums: () => void;
onDescriptionHeightChange?: (height: number) => void;
}
@@ -121,14 +123,30 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {
return (
<GalleryItemsHeaderAdapter>
<SpacedRow>
- <GalleryItemsSummary
- name={name}
- description={description}
- descriptionMaxWidth={480}
- fileCount={fileCount}
- endIcon={<EndIcon />}
- onDescriptionHeightChange={onDescriptionHeightChange}
- />
+ <Stack
+ direction="row"
+ sx={{ gap: 1, alignItems: "center", minWidth: 0 }}
+ >
+ {(type == "hiddenItems" || type == "archiveItems") && (
+ <Tooltip title={t("go_back")}>
+ <IconButton
+ aria-label={t("go_back")}
+ onClick={props.onBackToAlbums}
+ sx={{ width: 32, height: 32 }}
+ >
+ <ArrowBackIcon sx={{ fontSize: 20 }} />
+ </IconButton>
+ </Tooltip>
+ )}
+ <GalleryItemsSummary
+ name={name}
+ description={description}
+ descriptionMaxWidth={480}
+ fileCount={fileCount}
+ endIcon={<EndIcon />}
+ onDescriptionHeightChange={onDescriptionHeightChange}
+ />
+ </Stack>
{shouldShowOptions(type) && (
<CollectionHeaderOptions {...props} />
)}
diff --git a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx
index b4fa6e8fbf..bc0ede89f6 100644
--- a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx
@@ -44,6 +44,7 @@ type GalleryBarAndListHeaderProps = {
| "onEditAlbumDetails"
| "onShowMap"
| "onCollectionSlideshow"
+ | "onBackToAlbums"
> &
Pick<
CollectionShareProps,
@@ -73,6 +74,7 @@ export const GalleryBarAndListHeader: React.FC<
onShowMap,
onCollectionSlideshow,
setFileListHeader,
+ onBackToAlbums,
}) => {
const { show: showCollectionShare, props: collectionShareVisibilityProps } =
useModalVisibility();
@@ -121,6 +123,7 @@ export const GalleryBarAndListHeader: React.FC<
onAddSaveGroup,
onShowMap,
onCollectionSlideshow,
+ onBackToAlbums,
}}
collectionSummary={collectionSummary}
onCollectionShare={openCollectionShare}
@@ -165,6 +168,7 @@ export const GalleryBarAndListHeader: React.FC<
onAddSaveGroup,
onShowMap,
onCollectionSlideshow,
+ onBackToAlbums,
onEditAlbumDetails,
albumDescription,
descriptionHeight,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index ac195bf9ee..b55cfc48da 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1654,6 +1654,19 @@ const Page: React.FC = () => {
dispatch({ type: "showAlbumOverview", albumFilter: filter });
};
+ const handleBackToAlbums = useCallback(() => {
+ setCleanupView(undefined);
+ setAlbumSearchQuery("");
+ setSelected({
+ ownCount: 0,
+ count: 0,
+ collectionID: 0,
+ context: undefined,
+ });
+ setAlbumFilter("ente");
+ dispatch({ type: "showAlbumOverview", albumFilter: "ente" });
+ }, []);
+
const handleChangeBarMode = (mode: GalleryBarMode) => {
if (mode == "links") {
setCleanupView(undefined);
@@ -2267,6 +2280,7 @@ const Page: React.FC = () => {
isActiveCollectionDownloadInProgress,
onAddSaveGroup,
}}
+ onBackToAlbums={handleBackToAlbums}
mode={barMode}
shouldHide={isInSearchMode}
setActiveCollectionID={selectGalleryCollection}