Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photos):preserve-archive-album-dialog-list

Aswin Asokf3e2e1d4dc16
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx
index a3bb28a117..bfa4968619 100644
--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx
+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx
@@ -92,6 +92,7 @@ interface AllAlbums {
collectionsSortBy: CollectionsSortBy;
onChangeCollectionsSortBy: (by: CollectionsSortBy) => void;
isInHiddenSection: boolean;
+ isInArchiveSection: boolean;
canCreateAlbum: boolean;
onRemotePull: (opts?: RemotePullOpts) => Promise<void>;
}
@@ -104,12 +105,14 @@ export const AllAlbums: React.FC<AllAlbums> = ({
collectionsSortBy,
onChangeCollectionsSortBy,
isInHiddenSection,
+ isInArchiveSection,
canCreateAlbum,
onRemotePull,
}) => {
const fullScreen = useMediaQuery(collectionDialogFullScreenQuery);
const [searchTerm, setSearchTerm] = useState("");
const [albumFilter, setAlbumFilter] = useState<AlbumFilter>("ente");
+ const showAlbumFilters = !isInHiddenSection && !isInArchiveSection;
const { showMiniDialog } = useBaseContext();
const { showNotification } = usePhotosAppContext();
const { show: showAlbumNameInput, props: albumNameInputVisibilityProps } =
@@ -161,7 +164,7 @@ export const AllAlbums: React.FC<AllAlbums> = ({
const hasEnoughEmptyAlbums = emptyAlbumCandidates.length >= 3;
const showDeleteEmptyAlbums =
- !isInHiddenSection &&
+ showAlbumFilters &&
hasEnoughEmptyAlbums &&
albumFilter == "empty-albums" &&
!searchTerm.trim();
@@ -268,7 +271,7 @@ export const AllAlbums: React.FC<AllAlbums> = ({
};
const filteredCollectionSummaries = useMemo(() => {
- const albumFilteredCollectionSummaries = isInHiddenSection
+ const albumFilteredCollectionSummaries = !showAlbumFilters
? collectionSummaries
: collectionSummaries.filter((cs) =>
matchesAlbumFilter(cs, albumFilter),
@@ -281,18 +284,18 @@ export const AllAlbums: React.FC<AllAlbums> = ({
return albumFilteredCollectionSummaries.filter((cs) =>
cs.name.toLowerCase().includes(searchLower),
);
- }, [albumFilter, collectionSummaries, isInHiddenSection, searchTerm]);
+ }, [albumFilter, collectionSummaries, showAlbumFilters, searchTerm]);
const showCreateButton = useMemo(() => {
if (!canCreateAlbum) return false;
- if (!isInHiddenSection && albumFilter != "ente") return false;
+ if (showAlbumFilters && albumFilter != "ente") return false;
if (!searchTerm.trim()) {
return true;
}
const searchLower = searchTerm.toLowerCase();
const createText = t("new_album").toLowerCase();
return createText.includes(searchLower);
- }, [albumFilter, canCreateAlbum, isInHiddenSection, searchTerm]);
+ }, [albumFilter, canCreateAlbum, showAlbumFilters, searchTerm]);
return (
<>
@@ -313,7 +316,9 @@ export const AllAlbums: React.FC<AllAlbums> = ({
<Typography sx={titleSx}>
{isInHiddenSection
? t("all_hidden_albums")
- : activeFilterTitle}
+ : isInArchiveSection
+ ? t("section_archive")
+ : activeFilterTitle}
</Typography>
<Typography sx={bodyMutedSx}>
{t("albums_count", {
@@ -337,7 +342,7 @@ export const AllAlbums: React.FC<AllAlbums> = ({
</IconButton>
</Stack>
</Stack>
- {!isInHiddenSection && visibleAlbumFilters.length > 1 && (
+ {showAlbumFilters && visibleAlbumFilters.length > 1 && (
<ToggleButtonGroup
exclusive
value={albumFilter}
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index 7f1a0afb1c..850adc8a0f 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -300,6 +300,7 @@ export const GalleryBarAndListHeader: React.FC<
onChangeCollectionsSortBy={setCollectionsSortBy}
collectionsSortBy={collectionsSortBy}
isInHiddenSection={mode == "hidden-albums"}
+ isInArchiveSection={mode == "archive-albums"}
canCreateAlbum={canCreateAlbum}
onRemotePull={onRemotePull}
/>