Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(DownloadStatusNotification):fixed-file(s)

Aswin Asok0db845872c58
diff --git a/web/apps/photos/src/components/DownloadStatusNotifications.tsx b/web/apps/photos/src/components/DownloadStatusNotifications.tsx
index abac34ab23..64d8dd6cd3 100644
--- a/web/apps/photos/src/components/DownloadStatusNotifications.tsx
+++ b/web/apps/photos/src/components/DownloadStatusNotifications.tsx
@@ -66,6 +66,7 @@ export const DownloadStatusNotifications: React.FC<
DownloadStatusNotificationsProps
> = ({ saveGroups, onRemoveSaveGroup, onShowCollectionSummary }) => {
const { showMiniDialog } = useBaseContext();
+ const fileLabel = t("file").toLowerCase();
const confirmCancelDownload = (group: SaveGroup) =>
showMiniDialog({
@@ -149,10 +150,17 @@ export const DownloadStatusNotifications: React.FC<
}
// Build caption: "Status β€’ X / Y files"
- const progress = t("download_progress", {
- count: group.success + group.failed,
- total: group.total,
- });
+ const completedCount = group.success + group.failed;
+ const progress =
+ group.total === 1
+ ? `${t("processed_counts", {
+ count: completedCount,
+ total: group.total,
+ })} ${fileLabel}`
+ : t("download_progress", {
+ count: completedCount,
+ total: group.total,
+ });
const caption = (
<Typography
variant="small"
@@ -189,7 +197,12 @@ export const DownloadStatusNotifications: React.FC<
}
// Title is always the album name (truncated)
- const truncatedName = truncateAlbumName(group.title);
+ const filesCountTitle = t("files_count", { count: group.total });
+ const title =
+ group.total === 1 && group.title === filesCountTitle
+ ? `${group.total} ${fileLabel}`
+ : group.title;
+ const truncatedName = truncateAlbumName(title);
return (
<Notification
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 525ea76663..a9707b9831 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -478,11 +478,7 @@ export default function PublicCollectionGallery() {
singleFile?.metadata.fileType === FileType.livePhoto
? fileFileName(singleFile)
: t("files_count", { count: selectedFiles.length });
- await downloadAndSaveFiles(
- selectedFiles,
- title,
- onAddSaveGroup,
- );
+ await downloadAndSaveFiles(selectedFiles, title, onAddSaveGroup);
clearSelection();
} catch (e) {
log.error("failed to download selected files", e);
diff --git a/web/apps/photos/src/utils/file/index.ts b/web/apps/photos/src/utils/file/index.ts
index 98bf361e56..b1821fd676 100644
--- a/web/apps/photos/src/utils/file/index.ts
+++ b/web/apps/photos/src/utils/file/index.ts
@@ -62,11 +62,7 @@ export const performFileOp = async (
singleFile?.metadata.fileType === FileType.livePhoto
? fileFileName(singleFile)
: t("files_count", { count: files.length });
- await downloadAndSaveFiles(
- files,
- title,
- onAddSaveGroup,
- );
+ await downloadAndSaveFiles(files, title, onAddSaveGroup);
break;
}
case "fixTime":