π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Move download status check into gallery page
AswinAsok6eff52d79773
diff --git a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsxindex 7bf69b2e70..3351d9380f 100644--- a/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx+++ b/web/apps/photos/src/components/collections/GalleryBarAndListHeader.tsx@@ -11,11 +11,6 @@ import {} from "@/components/gallery/BarImpl";import { PeopleHeader } from "@/components/gallery/PeopleHeader";import { useModalVisibility } from "ente-base/components/utils/modal";-import {- isSaveCancelled,- isSaveComplete,- type SaveGroup,-} from "ente-gallery/components/utils/save-groups";import type { Collection } from "ente-media/collection";import {GalleryItemsHeaderAdapter,@@ -41,9 +36,9 @@ export type GalleryBarAndListHeaderProps = GalleryBarImplProps & {onSelectPersonInHeader: GalleryBarImplProps["onSelectPerson"];setFileListHeader: (header: FileListHeaderOrFooter) => void;hasActiveFileSelection: boolean;- saveGroups: SaveGroup[];} & Pick<CollectionHeaderProps,+ | "isActiveCollectionDownloadInProgress"| "onRemotePull"| "onAddSaveGroup"| "onEditAlbumDetails"@@ -87,7 +82,7 @@ export const GalleryBarAndListHeader: React.FC<onCreateAlbum,onSelectPerson,onSelectPersonInHeader,- saveGroups,+ isActiveCollectionDownloadInProgress,hasActiveFileSelection,activePerson,emailByUserID,@@ -123,13 +118,6 @@ export const GalleryBarAndListHeader: React.FC<collectionShareVisibilityProps.onClose();}, [collectionShareVisibilityProps]);- const isActiveCollectionDownloadInProgress = useCallback(() => {- const group = saveGroups.find(- (g) => g.collectionSummaryID === activeCollectionID,- );- return !!group && !isSaveComplete(group) && !isSaveCancelled(group);- }, [saveGroups, activeCollectionID]);-const albumDescription =activeCollection?.pubMagicMetadata?.data.caption?.trim();const [descriptionHeight, setDescriptionHeight] = useState(0);diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 5a2464831d..c2fb3560d0 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -101,7 +101,11 @@ import { initContacts, pullContacts } from "ente-contacts";import { DownloadStatusNotifications } from "ente-gallery/components/DownloadStatusNotifications";import { FullScreenDropZone } from "ente-gallery/components/FullScreenDropZone";import type { UploadTypeSelectorIntent } from "ente-gallery/components/Upload";-import { useSaveGroups } from "ente-gallery/components/utils/save-groups";+import {+ isSaveCancelled,+ isSaveComplete,+ useSaveGroups,+} from "ente-gallery/components/utils/save-groups";import type { FileViewerInitialSidebar } from "ente-gallery/components/viewer/FileViewer";import type { Collection } from "ente-media/collection";import type { EnteFile } from "ente-media/file";@@ -455,6 +459,14 @@ const Page: React.FC = () => {: state.view?.activeCollectionSummary;const selectedLinkID =state.view?.type == "links" ? state.view.selectedLinkID : undefined;+ const galleryBarActiveCollectionID =+ barMode == "links" ? selectedLinkID : activeCollectionID;+ const isActiveCollectionDownloadInProgress = useCallback(() => {+ const group = saveGroups.find(+ (g) => g.collectionSummaryID === galleryBarActiveCollectionID,+ );+ return !!group && !isSaveComplete(group) && !isSaveCancelled(group);+ }, [saveGroups, galleryBarActiveCollectionID]);const quickLinks = useMemo(() =>visibleQuickLinks(@@ -2176,9 +2188,7 @@ const Page: React.FC = () => {// TODO: These are incorrect assertions, the types of the// component need to be updated.activeCollection: activeCollection!,- activeCollectionID: (barMode == "links"- ? selectedLinkID- : activeCollectionID)!,+ activeCollectionID: galleryBarActiveCollectionID!,activePerson,albumFilter,albumSearchQuery,@@ -2192,7 +2202,7 @@ const Page: React.FC = () => {peopleSortBy,onChangePeopleSortBy: setPeopleSortBy,setFileListHeader,- saveGroups,+ isActiveCollectionDownloadInProgress,onAddSaveGroup,onEditAlbumDetails: showEditAlbumDetails,onShowMap: handleShowCollectionMap,diff --git a/web/apps/photos/tests/sidebar-quick-links.test.tsx b/web/apps/photos/tests/sidebar-quick-links.test.tsxindex 0cfc29b64c..86de1995a0 100644--- a/web/apps/photos/tests/sidebar-quick-links.test.tsx+++ b/web/apps/photos/tests/sidebar-quick-links.test.tsx@@ -67,7 +67,7 @@ const renderSidebar = (people: [],sortedPeople: [],peopleSortBy: "name-asc",- saveGroups: [],+ isActiveCollectionDownloadInProgress: vi.fn(() => false),setActiveCollectionID: vi.fn(),onSelectCollectionID: vi.fn(),onSelectPerson: vi.fn(),