Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web] Simplify shared notification defaults

AswinAsokd747c45753e2
diff --git a/web/apps/photos/src/components/QuickLinkCreatedNotification.tsx b/web/apps/photos/src/components/QuickLinkCreatedNotification.tsx
index 8babfceb50..51d1228f0a 100644
--- a/web/apps/photos/src/components/QuickLinkCreatedNotification.tsx
+++ b/web/apps/photos/src/components/QuickLinkCreatedNotification.tsx
@@ -61,7 +61,6 @@ export const QuickLinkCreatedNotification: React.FC<
endIcon: copied ? Tick02Icon : Copy01Icon,
endIconLabel: t("copy_link"),
onEndIconClick: handleCopy,
- showCloseButtonWithEndIcon: true,
}}
/>
);
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index e41d9258ac..f9b5887949 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -1115,7 +1115,6 @@ export const Upload: React.FC<UploadProps> = ({
case subscriptionExpiredErrorMessage:
showNotification({
color: "critical",
- captionFirst: true,
caption: t("subscription_expired"),
title: t("renew_now"),
onClick: () =>
@@ -1125,7 +1124,6 @@ export const Upload: React.FC<UploadProps> = ({
case storageLimitExceededErrorMessage:
showNotification({
color: "critical",
- captionFirst: true,
caption: t("storage_quota_exceeded"),
title: t("upgrade_now"),
onClick: onShowPlanSelector,
diff --git a/web/apps/photos/tests/notification-icons.test.tsx b/web/apps/photos/tests/notification-icons.test.tsx
index 92d5fc599e..7b9b555031 100644
--- a/web/apps/photos/tests/notification-icons.test.tsx
+++ b/web/apps/photos/tests/notification-icons.test.tsx
@@ -30,7 +30,6 @@ describe("notification icons", () => {
startIcon: Tick02Icon,
endIcon: ReloadIcon,
endIconLabel: "Retry",
- showCloseButtonWithEndIcon: true,
});
const icons = markup.match(/<svg\b[^>]*>/g) ?? [];
expect(icons).toHaveLength(3);
@@ -47,7 +46,6 @@ describe("notification icons", () => {
color: "inherit",
startIcon: null,
endIcon,
- showCloseButtonWithEndIcon: true,
});
const icons = markup.match(/<svg\b[^>]*>/g) ?? [];
expect(icons).toHaveLength(2);
@@ -73,7 +71,7 @@ describe("notification icons", () => {
});
expect(markup).toContain('data-testid="custom-copy"');
const icons = markup.match(/<svg\b[^>]*>/g) ?? [];
- expect(icons).toHaveLength(1);
+ expect(icons).toHaveLength(2);
expect(icons[0]).toContain('width="18"');
expect(icons[0]).toContain('stroke-width="2"');
});
diff --git a/web/packages/base/components/Notification.tsx b/web/packages/base/components/Notification.tsx
index ef10dfb5b0..7ff934e58b 100644
--- a/web/packages/base/components/Notification.tsx
+++ b/web/packages/base/components/Notification.tsx
@@ -26,7 +26,6 @@ import React from "react";
type NotificationIcon = IconSvgElement | React.ReactElement | null;
export interface NotificationAttributes {
- captionFirst?: boolean;
color: ButtonProps["color"];
// Set to null to omit the leading icon.
startIcon?: NotificationIcon;
@@ -35,7 +34,6 @@ export interface NotificationAttributes {
onClick?: () => void;
endIcon?: NotificationIcon;
endIconLabel?: string;
- showCloseButtonWithEndIcon?: boolean;
onEndIconClick?: () => void;
}
@@ -84,14 +82,12 @@ export const Notification: React.FC<NotificationProps> = ({
if (!attributes) return <></>;
const {
- captionFirst,
color,
startIcon,
title,
caption,
endIcon,
endIconLabel,
- showCloseButtonWithEndIcon,
onClick,
onEndIconClick,
} = attributes;
@@ -149,8 +145,8 @@ export const Notification: React.FC<NotificationProps> = ({
overflow: "hidden",
}}
>
- {captionFirst && captionElement}
<Typography
+ noWrap
sx={{
fontFamily: "inherit",
fontSize: 18,
@@ -160,7 +156,7 @@ export const Notification: React.FC<NotificationProps> = ({
>
{title}
</Typography>
- {!captionFirst && captionElement}
+ {captionElement}
</Stack>
</Stack>
);
@@ -257,18 +253,16 @@ export const Notification: React.FC<NotificationProps> = ({
{renderIcon(endIcon, 22)}
</IconButton>
)}
- {(!endIcon || showCloseButtonWithEndIcon) && (
- <IconButton
- aria-label={t("close")}
- onClick={(event) => {
- event.stopPropagation();
- onClose();
- }}
- sx={buttonSx}
- >
- {renderIcon(Cancel01Icon, 22)}
- </IconButton>
- )}
+ <IconButton
+ aria-label={t("close")}
+ onClick={(event) => {
+ event.stopPropagation();
+ onClose();
+ }}
+ sx={buttonSx}
+ >
+ {renderIcon(Cancel01Icon, 22)}
+ </IconButton>
</Stack>
</Paper>
</Snackbar>
diff --git a/web/packages/gallery/components/DownloadStatusNotifications.tsx b/web/packages/gallery/components/DownloadStatusNotifications.tsx
index 63bcb252e7..ce6bed3862 100644
--- a/web/packages/gallery/components/DownloadStatusNotifications.tsx
+++ b/web/packages/gallery/components/DownloadStatusNotifications.tsx
@@ -249,7 +249,6 @@ export const DownloadStatusNotifications: React.FC<
? () => group.retry?.()
: undefined,
endIconLabel: t("retry"),
- showCloseButtonWithEndIcon: canRetry,
}}
/>
);