π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Better handling of empty albums
Manav Rathi148a3c13dbb0
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsxindex 800df6edc2..91790a6a97 100644--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx@@ -139,7 +139,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({const { show: showAlbumNameInput, props: albumNameInputVisibilityProps } =useModalVisibility();- const { type: collectionSummaryType } = collectionSummary;+ const { type: collectionSummaryType, fileCount } = collectionSummary;/*** Return a new function by wrapping an async function in an error handler,@@ -334,13 +334,17 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({case "userFavorites":menuOptions = [- <DownloadOption- key="download"- isDownloadInProgress={isActiveCollectionDownloadInProgress}- onClick={downloadCollection}- >- {t("download_favorites")}- </DownloadOption>,+ fileCount && (+ <DownloadOption+ key="download"+ isDownloadInProgress={+ isActiveCollectionDownloadInProgress+ }+ onClick={downloadCollection}+ >+ {t("download_favorites")}+ </DownloadOption>+ ),<OverflowMenuOptionkey="share"onClick={onCollectionShare}@@ -360,20 +364,24 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({case "uncategorized":menuOptions = [- <DownloadOption key="download" onClick={downloadCollection}>- {t("download_uncategorized")}- </DownloadOption>,+ fileCount && (+ <DownloadOption key="download" onClick={downloadCollection}>+ {t("download_uncategorized")}+ </DownloadOption>+ ),];break;case "hiddenItems":menuOptions = [- <DownloadOption- key="download-hidden"- onClick={downloadCollection}- >- {t("download_hidden_items")}- </DownloadOption>,+ fileCount && (+ <DownloadOption+ key="download-hidden"+ onClick={downloadCollection}+ >+ {t("download_hidden_items")}+ </DownloadOption>+ ),];break;@@ -509,6 +517,8 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({break;}+ const validMenuOptions = menuOptions.filter((o) => !!o);+return (<Box sx={{ display: "inline-flex", gap: "16px" }}><QuickOptions@@ -518,13 +528,16 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({onDownloadClick={downloadCollection}onShareClick={onCollectionShare}/>-- <OverflowMenu- ariaID="collection-options"- triggerButtonIcon={<MoreHorizIcon ref={overflowMenuIconRef} />}- >- {...menuOptions}- </OverflowMenu>+ {validMenuOptions.length > 0 && (+ <OverflowMenu+ ariaID="collection-options"+ triggerButtonIcon={+ <MoreHorizIcon ref={overflowMenuIconRef} />+ }+ >+ {validMenuOptions}+ </OverflowMenu>+ )}<CollectionSortOrderMenu{...sortOrderMenuVisibilityProps}overflowMenuIconRef={overflowMenuIconRef}@@ -569,6 +582,7 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({<EmptyTrashQuickOption onClick={onEmptyTrashClick} />)}{showDownloadQuickOption(collectionSummary) &&+ collectionSummary.fileCount > 0 &&(isDownloadInProgress() ? (<ActivityIndicator size="20px" sx={{ m: "12px" }} />) : (diff --git a/web/apps/photos/src/components/DownloadStatusNotifications.tsx b/web/apps/photos/src/components/DownloadStatusNotifications.tsxindex 27a246f120..cc69d2027e 100644--- a/web/apps/photos/src/components/DownloadStatusNotifications.tsx+++ b/web/apps/photos/src/components/DownloadStatusNotifications.tsx@@ -2,7 +2,6 @@ import { useBaseContext } from "ente-base/context";import {isSaveComplete,isSaveCompleteWithErrors,- isSaveStarted,type SaveGroup,} from "ente-gallery/components/utils/save-groups";import { Notification } from "ente-new/photos/components/Notification";@@ -91,42 +90,31 @@ export const DownloadStatusNotifications: React.FC<return <></>;}- const notifications: React.ReactNode[] = [];-- let visibleIndex = 0;- for (const group of saveGroups) {- // Skip attempted downloads of empty albums, which had no effect.- if (!isSaveStarted(group)) continue;-- const index = visibleIndex++;- notifications.push(- <Notification- key={group.id}- horizontal="left"- sx={{ "&&": { bottom: `${index * 80 + 20}px` } }}- open={isSaveStarted(group)}- onClose={createOnClose(group)}- keepOpenOnClick- attributes={{- color: isSaveCompleteWithErrors(group)- ? "critical"- : "secondary",- title: isSaveCompleteWithErrors(group)- ? t("download_failed")- : isSaveComplete(group)- ? t("download_complete")- : t("downloading_album", { name: group.title }),- caption: isSaveComplete(group)- ? group.title- : t("download_progress", {- count: group.success + group.failed,- total: group.total,- }),- onClick: createOnClick(group),- }}- />,- );- }-- return notifications;+ return saveGroups.map((group, index) => (+ <Notification+ key={group.id}+ horizontal="left"+ sx={{ "&&": { bottom: `${index * 80 + 20}px` } }}+ open={true}+ onClose={createOnClose(group)}+ keepOpenOnClick+ attributes={{+ color: isSaveCompleteWithErrors(group)+ ? "critical"+ : "secondary",+ title: isSaveCompleteWithErrors(group)+ ? t("download_failed")+ : isSaveComplete(group)+ ? t("download_complete")+ : t("downloading_album", { name: group.title }),+ caption: isSaveComplete(group)+ ? group.title+ : t("download_progress", {+ count: group.success + group.failed,+ total: group.total,+ }),+ onClick: createOnClick(group),+ }}+ />+ ));};diff --git a/web/packages/gallery/services/save.ts b/web/packages/gallery/services/save.tsindex 73faa7e3d2..72cf8cd021 100644--- a/web/packages/gallery/services/save.ts+++ b/web/packages/gallery/services/save.ts@@ -1,3 +1,4 @@+import { assertionFailed } from "ente-base/assert";import { joinPath } from "ente-base/file-name";import log from "ente-base/log";import { type Electron } from "ente-base/types/ipc";@@ -86,6 +87,13 @@ const downloadAndSave = async () => {const electron = globalThis.electron;+ const total = files.length;+ if (!files.length) {+ // Nothing to download.+ assertionFailed();+ return;+ }+let downloadDirPath: string | undefined;if (electron) {downloadDirPath = await electron.selectDirectory();@@ -103,7 +111,6 @@ const downloadAndSave = async (}const canceller = new AbortController();- const total = files.length;const updateSaveGroup = onAddSaveGroup({title,