Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Pass selected collection summary to gallery header

AswinAsok196da19ffde1
diff --git a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx
index 78d24700e3..b4fa6e8fbf 100644
--- a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx
@@ -15,7 +15,7 @@ import {
} from "ente-new/photos/components/gallery/ListHeader";
import {
PseudoCollectionID,
- type CollectionSummaries,
+ type CollectionSummary,
} from "ente-new/photos/services/collection-summary";
import type { Person } from "ente-new/photos/services/ml/people";
import React, { useCallback, useEffect, useState } from "react";
@@ -28,9 +28,8 @@ import {
type GalleryBarAndListHeaderProps = {
mode: GalleryBarMode;
shouldHide: boolean;
- barCollectionSummaries: CollectionSummaries;
+ collectionSummary: CollectionSummary | undefined;
activeCollection: Collection | undefined;
- activeCollectionID: number | undefined;
activePerson: Person | undefined;
people: Person[];
setActiveCollectionID: (collectionID: number) => void;
@@ -57,9 +56,8 @@ export const GalleryBarAndListHeader: React.FC<
shouldHide,
mode,
user,
- barCollectionSummaries: toShowCollectionSummaries,
+ collectionSummary,
activeCollection,
- activeCollectionID,
setActiveCollectionID,
setBlockingLoad,
people,
@@ -105,9 +103,6 @@ export const GalleryBarAndListHeader: React.FC<
useEffect(() => {
if (shouldHide || mode == "links") return;
- const collectionSummary = toShowCollectionSummaries.get(
- activeCollectionID!,
- );
// Pseudo-collections need header actions despite having no Collection.
const shouldRenderCollectionHeader =
mode != "people" &&
@@ -157,9 +152,8 @@ export const GalleryBarAndListHeader: React.FC<
}, [
shouldHide,
mode,
- toShowCollectionSummaries,
+ collectionSummary,
activeCollection,
- activeCollectionID,
isActiveCollectionDownloadInProgress,
activePerson,
showCollectionShare,
@@ -190,9 +184,7 @@ export const GalleryBarAndListHeader: React.FC<
<CollectionShare
{...collectionShareVisibilityProps}
onClose={closeCollectionShare}
- collectionSummary={toShowCollectionSummaries.get(
- activeCollectionID!,
- )!}
+ collectionSummary={collectionSummary!}
collection={activeCollection}
intent={collectionShareIntent}
{...{
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 30e86f0ff2..19935f9dfd 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -631,6 +631,10 @@ const Page: React.FC = () => {
? state.archivedCollectionSummaries
: state.normalCollectionSummaries;
+ const collectionSummary = barCollectionSummaries.get(
+ galleryBarActiveCollectionID!,
+ );
+
const {
sidebarCollectionSummaries,
overviewAlbums,
@@ -2258,7 +2262,7 @@ const Page: React.FC = () => {
user,
activeCollection,
activePerson,
- barCollectionSummaries,
+ collectionSummary,
people,
setBlockingLoad,
setFileListHeader,
@@ -2268,7 +2272,6 @@ const Page: React.FC = () => {
}}
mode={barMode}
shouldHide={isInSearchMode}
- activeCollectionID={galleryBarActiveCollectionID}
setActiveCollectionID={selectGalleryCollection}
onSelectPerson={handleSelectPerson}
onEditAlbumDetails={showEditAlbumDetails}