π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
feat(DownloadStatusNotification):styles-updated
Aswin Asok463dee320493
diff --git a/web/apps/photos/package.json b/web/apps/photos/package.jsonindex 4f34314758..ba799e138a 100644--- a/web/apps/photos/package.json+++ b/web/apps/photos/package.json@@ -3,6 +3,8 @@"version": "0.0.0","private": true,"dependencies": {+ "@hugeicons/core-free-icons": "^1.1.0",+ "@hugeicons/react": "^1.1.4","chrono-node": "^2.9.0","debounce": "^2.2.0","ente-accounts": "*",diff --git a/web/apps/photos/src/components/DownloadStatusNotifications.tsx b/web/apps/photos/src/components/DownloadStatusNotifications.tsxindex 41fe9e67c6..5e3f9d335f 100644--- a/web/apps/photos/src/components/DownloadStatusNotifications.tsx+++ b/web/apps/photos/src/components/DownloadStatusNotifications.tsx@@ -1,3 +1,10 @@+import {+ Download01Icon,+ Loading03Icon,+ Tick02Icon,+} from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";+import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";import ReplayIcon from "@mui/icons-material/Replay";import { keyframes, styled, Typography } from "@mui/material";import { useBaseContext } from "ente-base/context";@@ -10,7 +17,7 @@ import { Notification } from "ente-new/photos/components/Notification";import { t } from "i18next";/** Maximum characters for album name before truncation */-const MAX_ALBUM_NAME_LENGTH = 20;+const MAX_ALBUM_NAME_LENGTH = 30;/** Truncate album name with ellipsis if it exceeds max length */const truncateAlbumName = (name: string): string => {@@ -18,21 +25,25 @@ const truncateAlbumName = (name: string): string => {return name.slice(0, MAX_ALBUM_NAME_LENGTH) + "...";};-/** CSS keyframes for animating ellipsis dots */-const ellipsisAnimation = keyframes`- 0% { content: " ."; }- 33% { content: " .."; }- 66% { content: " ..."; }+/** CSS keyframes for spinning animation */+const spinAnimation = keyframes`+ from { transform: rotate(0deg); }+ to { transform: rotate(360deg); }`;-/** Animated ellipsis using pure CSS - no React re-renders */-const AnimatedEllipsis = styled("span")`- &::after {- content: " .";- animation: ${ellipsisAnimation} 1.5s steps(1) infinite;- }+/** Spinning loading icon wrapper */+const SpinningIconWrapper = styled("span")`+ display: inline-flex;+ animation: ${spinAnimation} 2s linear infinite;`;+/** Spinning loading icon */+const SpinningIcon: React.FC = () => (+ <SpinningIconWrapper>+ <HugeiconsIcon icon={Loading03Icon} size={28} />+ </SpinningIconWrapper>+);+interface DownloadStatusNotificationsProps {/*** A list of user-initiated downloads for which a status should be shown.@@ -114,77 +125,105 @@ export const DownloadStatusNotifications: React.FC<return saveGroups.map((group, index) => {const hasErrors = isSaveCompleteWithErrors(group);+ const isComplete = isSaveComplete(group);const canRetry = hasErrors && !!group.retry;- // Show specific error message based on failure reason- let failedTitle: string;- if (group.failureReason === "network_offline") {- failedTitle = `${t("download_failed_network_offline")} (${group.failed}/${group.total})`;- } else if (group.failureReason === "file_error") {- failedTitle = `${t("download_failed_file_error")} (${group.failed}/${group.total})`;- } else {- failedTitle = `${t("download_failed")} (${group.failed}/${group.total})`;- }-// Determine if this is a ZIP download (web with multiple files or live photo)const isZipDownload = !group.downloadDirPath && group.total > 1;const isDesktopOrSingleFile =!!group.downloadDirPath || group.total === 1;- // Build the title based on download type- let progressTitle: React.ReactNode;- if (isZipDownload) {+ // Build the status text for the caption+ let statusText: React.ReactNode;+ if (hasErrors) {+ // Show specific error message based on failure reason+ if (group.failureReason === "network_offline") {+ statusText = t("download_failed_network_offline");+ } else if (group.failureReason === "file_error") {+ statusText = t("download_failed_file_error");+ } else {+ statusText = t("download_failed");+ }+ } else if (isComplete) {+ statusText = t("download_complete");+ } else if (isZipDownload) {const part = group.currentPart ?? 1;- progressTitle = (- <>- {group.isDownloadingZip- ? t("downloading_part", { part })- : t("preparing_part", { part })}- <AnimatedEllipsis />- </>- );+ statusText = group.isDownloadingZip+ ? t("downloading_part", { part })+ : t("preparing_part", { part });} else if (isDesktopOrSingleFile) {- progressTitle =+ statusText =group.total === 1? t("downloading_file"): t("downloading_files");} else {- progressTitle = t("downloading");+ statusText = t("downloading");}- // Build caption: "X / Y files - Album Name"- const truncatedName = truncateAlbumName(group.title);+ // Build caption: "Status β’ X / Y files"const progress = t("download_progress", {count: group.success + group.failed,total: group.total,});- const progressCaption = (- <Typography variant="small" sx={{ color: "text.muted" }}>- {progress} - {truncatedName}+ const caption = (+ <Typography+ variant="small"+ sx={{ color: hasErrors ? "white" : "text.muted" }}+ >+ {statusText}+ {!isComplete && <> • {progress}</>}</Typography>);+ // Determine the start icon based on state+ let startIcon: React.ReactNode;+ if (hasErrors) {+ startIcon = <ErrorOutlineIcon />;+ } else if (isComplete) {+ startIcon = <HugeiconsIcon icon={Tick02Icon} size={28} />;+ } else if (isZipDownload && !group.isDownloadingZip) {+ // Preparing state - use loading icon+ startIcon = <SpinningIcon />;+ } else {+ // Downloading state+ startIcon = <HugeiconsIcon icon={Download01Icon} size={28} />;+ }++ // Title is always the album name (truncated)+ const truncatedName = truncateAlbumName(group.title);+return (<Notificationkey={group.id}horizontal="left"- sx={{ "&&": { bottom: `${index * 80 + 20}px` } }}+ sx={{+ "&&": { bottom: `${index * 80 + 20}px` },+ width: "min(400px, 100vw)",+ borderRadius: "20px",+ "& .MuiButton-root": {+ borderRadius: "20px",+ padding: "16px 16px 16px 20px",+ },+ "& .MuiIconButton-root": {+ width: "40px",+ height: "40px",+ "& svg": { fontSize: "22px" },+ },+ }}open={true}onClose={createOnClose(group)}keepOpenOnClickattributes={{color: hasErrors ? "critical" : "secondary",- title: hasErrors- ? failedTitle- : isSaveComplete(group)- ? t("download_complete")- : progressTitle,- caption: isSaveComplete(group)- ? group.title- : progressCaption,+ startIcon,+ title: truncatedName,+ caption,onClick: createOnClick(group),endIcon: canRetry ? (- <ReplayIcon titleAccess={t("retry")} />+ <ReplayIcon+ titleAccess={t("retry")}+ sx={{ color: "white" }}+ />) : undefined,onEndIconClick: canRetry? () => group.retry?.()diff --git a/web/yarn.lock b/web/yarn.lockindex 40ab80e667..3c6b475fc3 100644--- a/web/yarn.lock+++ b/web/yarn.lock@@ -645,6 +645,16 @@resolved "https://registry.yarnpkg.com/@fontsource-variable/inter/-/inter-5.2.8.tgz#29b11476f5149f6a443b4df6516e26002d87941a"integrity sha512-kOfP2D+ykbcX/P3IFnokOhVRNoTozo5/JxhAIVYLpea/UBmCQ/YWPBfWIDuBImXX/15KH+eKh4xpEUyS2sQQGQ==+"@hugeicons/core-free-icons@^1.1.0":+ version "1.2.1"+ resolved "https://registry.yarnpkg.com/@hugeicons/core-free-icons/-/core-free-icons-1.2.1.tgz#c741eaa8bbf1453e9282a64c19a8bbcc8cef5f19"+ integrity sha512-ho0QdGMkgL+kt+QsZocCsKvJou1rfyVQWARrxIhNLi+9tCKayUUtD9jlHgioaRphmskSl84TxrDm9Ae0G4Uu1g==++"@hugeicons/react@^1.1.4":+ version "1.1.4"+ resolved "https://registry.yarnpkg.com/@hugeicons/react/-/react-1.1.4.tgz#1662f11ebb42c7e16fa7e16e04615db666813a06"+ integrity sha512-gsc3eZyd2fGqRUThW9+lfjxxsOkz6KNVmRXRgJjP32GL0OnnLJnl3hytKt47CBbiQj2xE2kCw+rnP3UQCThcKw==+"@humanfs/core@^0.19.1":version "0.19.1"resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.1.tgz#17c55ca7d426733fe3c561906b8173c336b40a77"