Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(DownloadNotification):add-close-button

Aswin Asok5f142d233026
diff --git a/web/packages/base/components/Notification.tsx b/web/packages/base/components/Notification.tsx
index 5ab250d61d..addf0d96a2 100644
--- a/web/packages/base/components/Notification.tsx
+++ b/web/packages/base/components/Notification.tsx
@@ -66,6 +66,10 @@ export interface NotificationAttributes {
* button in this position).
*/
endIcon?: React.ReactNode;
+ /**
+ * If true, show the default close button after the custom {@link endIcon}.
+ */
+ showCloseButtonWithEndIcon?: boolean;
/**
* Optional handler when {@link endIcon} is clicked.
*
@@ -140,6 +144,7 @@ export const Notification: React.FC<NotificationProps> = ({
title,
caption,
endIcon,
+ showCloseButtonWithEndIcon,
onClick,
onEndIconClick,
} = attributes;
@@ -244,7 +249,7 @@ export const Notification: React.FC<NotificationProps> = ({
)}
</Stack>
- {endIcon ? (
+ {endIcon && (
<IconButton
component="div"
onClick={handleEndIconClick}
@@ -252,7 +257,8 @@ export const Notification: React.FC<NotificationProps> = ({
>
{endIcon}
</IconButton>
- ) : (
+ )}
+ {(!endIcon || showCloseButtonWithEndIcon) && (
<IconButton
// Buttons cannot be nested in buttons, so we use a div
// here instead.
diff --git a/web/packages/gallery/components/DownloadStatusNotifications.tsx b/web/packages/gallery/components/DownloadStatusNotifications.tsx
index e45c1d87e7..e4328fc3f1 100644
--- a/web/packages/gallery/components/DownloadStatusNotifications.tsx
+++ b/web/packages/gallery/components/DownloadStatusNotifications.tsx
@@ -312,6 +312,7 @@ export const DownloadStatusNotifications: React.FC<
onEndIconClick: canRetry
? () => group.retry?.()
: undefined,
+ showCloseButtonWithEndIcon: canRetry,
}}
/>
);