Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web] Use short notification titles and caption tooltips

AswinAsok1e7f7675c76a
diff --git a/web/apps/albums/src/public-album/upload/components/Upload.tsx b/web/apps/albums/src/public-album/upload/components/Upload.tsx
index a017aeee5f..85d4db4c8a 100644
--- a/web/apps/albums/src/public-album/upload/components/Upload.tsx
+++ b/web/apps/albums/src/public-album/upload/components/Upload.tsx
@@ -371,21 +371,22 @@ export const Upload: React.FC<UploadProps> = ({
case subscriptionExpiredErrorMessage:
showNotification({
color: "critical",
- title: t("generic_error_retry"),
+ title: t("upload_reason_failed"),
caption: t("subscription_expired"),
});
break;
case storageLimitExceededErrorMessage:
showNotification({
color: "critical",
- title: t("generic_error_retry"),
+ title: t("upload_reason_failed"),
caption: t("storage_quota_exceeded"),
});
break;
default:
showNotification({
color: "critical",
- title: t("generic_error_retry"),
+ title: t("upload_reason_failed"),
+ caption: t("generic_error_retry"),
});
}
};
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index c35da63038..dd7885e7da 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -237,7 +237,8 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
if (uploadManager.isUploadInProgress()) {
showNotification({
color: "critical",
- title: t("wait_for_active_upload_to_finish"),
+ title: t("uploads_in_progress"),
+ caption: t("wait_for_active_upload_to_finish"),
});
return false;
}
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index f9b5887949..924687fc72 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -1133,7 +1133,8 @@ export const Upload: React.FC<UploadProps> = ({
default:
showNotification({
color: "critical",
- title: t("generic_error_retry"),
+ title: t("upload_reason_failed"),
+ caption: t("generic_error_retry"),
});
}
};
diff --git a/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx b/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx
index 0cdaeff5e2..00c9aedb1b 100644
--- a/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx
+++ b/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx
@@ -58,7 +58,8 @@ export const CreateAlbumDialog: React.FC<CreateAlbumDialogProps> = ({
} catch {
showNotification({
color: "critical",
- title: t("generic_error_retry"),
+ title: t("error"),
+ caption: t("generic_error_retry"),
});
}
})();
diff --git a/web/apps/photos/src/components/collections/useDeleteEmptyAlbums.ts b/web/apps/photos/src/components/collections/useDeleteEmptyAlbums.ts
index 1422bdfd28..5aa4736a18 100644
--- a/web/apps/photos/src/components/collections/useDeleteEmptyAlbums.ts
+++ b/web/apps/photos/src/components/collections/useDeleteEmptyAlbums.ts
@@ -93,7 +93,8 @@ export const useDeleteEmptyAlbums = (
} else if (refreshFailed) {
showNotification({
color: "critical",
- title: t("delete_empty_albums_refresh_failed"),
+ title: t("error"),
+ caption: t("delete_empty_albums_refresh_failed"),
});
}
};
diff --git a/web/apps/photos/tests/delete-empty-albums.test.ts b/web/apps/photos/tests/delete-empty-albums.test.ts
index 62100657e2..e0f0b13a49 100644
--- a/web/apps/photos/tests/delete-empty-albums.test.ts
+++ b/web/apps/photos/tests/delete-empty-albums.test.ts
@@ -6,7 +6,10 @@ import { useDeleteEmptyAlbums } from "../src/components/collections/useDeleteEmp
const mocks = vi.hoisted(() => ({
showMiniDialog: vi.fn<(attributes: MiniDialogAttributes) => void>(),
notify: vi.fn<
- (notification: { title: { key: string; opts?: unknown } }) => void
+ (notification: {
+ title: { key: string; opts?: unknown };
+ caption?: { key: string; opts?: unknown };
+ }) => void
>(),
pull: vi.fn(),
collections: vi.fn(),
@@ -131,7 +134,8 @@ describe("shared empty album deletion", () => {
.mockResolvedValueOnce(undefined)
.mockRejectedValueOnce(new Error("refresh"));
await start().continue?.action?.();
- expect(mocks.notify.mock.calls[0]![0].title.key).toBe(
+ expect(mocks.notify.mock.calls[0]![0].title.key).toBe("error");
+ expect(mocks.notify.mock.calls[0]![0].caption?.key).toBe(
"delete_empty_albums_refresh_failed",
);
});
diff --git a/web/apps/share/src/hooks/use-collection-share.ts b/web/apps/share/src/hooks/use-collection-share.ts
index 8ca3ebf01c..9658a593e0 100644
--- a/web/apps/share/src/hooks/use-collection-share.ts
+++ b/web/apps/share/src/hooks/use-collection-share.ts
@@ -9,6 +9,7 @@ import {
import { apiOrigin } from "ente-base/origins";
import { extractCollectionKeyFromShareURL } from "ente-gallery/services/share";
import type { PublicURL } from "ente-media/collection";
+import { t } from "i18next";
import { useRouter } from "next/router";
import { useCallback, useEffect, useRef, useState } from "react";
import {
@@ -497,7 +498,8 @@ export const useCollectionShare = (): UseCollectionShareResult => {
}
showNotification({
color: "critical",
- title:
+ title: t("download_failed"),
+ caption:
err instanceof Error
? err.message
: "Failed to download file",
diff --git a/web/packages/base/components/Notification.tsx b/web/packages/base/components/Notification.tsx
index 31e8ee3b3f..ff7023821e 100644
--- a/web/packages/base/components/Notification.tsx
+++ b/web/packages/base/components/Notification.tsx
@@ -10,12 +10,12 @@ import {
Paper,
Snackbar,
Stack,
+ Tooltip,
Typography,
type ButtonProps,
type SxProps,
type Theme,
} from "@mui/material";
-import { EllipsizedTypography } from "ente-base/components/Typography";
import { RippleDisabledButton } from "ente-base/components/mui/FocusVisibleButton";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import type {} from "ente-base/components/utils/mui-theme";
@@ -105,18 +105,20 @@ export const Notification: React.FC<NotificationProps> = ({
};
const captionElement = caption && (
- <EllipsizedTypography
- variant="small"
- title={typeof caption === "string" ? caption : undefined}
- sx={{
- fontFamily: "inherit",
- fontSize: 14,
- lineHeight: "20px",
- color: neutral ? "text.muted" : "inherit",
- }}
- >
- {caption}
- </EllipsizedTypography>
+ <Tooltip title={caption} describeChild>
+ <Typography
+ variant="small"
+ noWrap
+ sx={{
+ fontFamily: "inherit",
+ fontSize: 14,
+ lineHeight: "20px",
+ color: neutral ? "text.muted" : "inherit",
+ }}
+ >
+ {caption}
+ </Typography>
+ </Tooltip>
);
const content = (