Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix

Manav Rathi719f548185ee
diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx
index 766b2cd600..67498b49d1 100644
--- a/web/apps/photos/src/components/Upload/Uploader.tsx
+++ b/web/apps/photos/src/components/Upload/Uploader.tsx
@@ -653,8 +653,8 @@ export default function Uploader({
break;
case CustomError.SUBSCRIPTION_EXPIRED:
showNotification({
- textOrder: "captionTitle",
color: "critical",
+ captionFirst: true,
caption: t("subscription_expired"),
title: t("renew_now"),
onClick: redirectToCustomerPortal,
@@ -662,8 +662,8 @@ export default function Uploader({
break;
case CustomError.STORAGE_QUOTA_EXCEEDED:
showNotification({
- textOrder: "captionTitle",
color: "critical",
+ captionFirst: true,
caption: t("storage_quota_exceeded"),
title: t("upgrade_now"),
onClick: galleryContext.showPlanSelectorModal,
@@ -672,7 +672,6 @@ export default function Uploader({
break;
default:
showNotification({
- textOrder: "captionTitle",
color: "critical",
title: t("generic_error_retry"),
});
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index d87c2a09a2..97471a2b9b 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -89,9 +89,9 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
showMiniDialog(updateReadyToInstallDialogAttributes(update));
} else {
showNotification({
+ color: "secondary",
+ title: t("update_available"),
endIcon: <ArrowForwardIcon />,
- variant: "secondary",
- message: t("update_available"),
onClick: () =>
showMiniDialog(
updateAvailableForDownloadDialogAttributes(update),
diff --git a/web/packages/new/photos/components/Notification.tsx b/web/packages/new/photos/components/Notification.tsx
index acf7910475..79625bd8ca 100644
--- a/web/packages/new/photos/components/Notification.tsx
+++ b/web/packages/new/photos/components/Notification.tsx
@@ -21,10 +21,11 @@ import React from "react";
*/
export interface NotificationAttributes {
/**
- * Set the order in which the title and caption components of the
- * notification should be shown.
+ * If set, then the caption is shown first, then the title.
+ *
+ * Default is to show the title first, then the caption.
*/
- textOrder: "titleCaption" | "captionTitle";
+ captionFirst?: boolean;
/**
* The color of the notification.
*/
@@ -121,7 +122,7 @@ export const Notification: React.FC<NotificationProps> = ({
if (!attributes) return <></>;
console.log(attributes);
- const { textOrder, color, startIcon, title, caption, endIcon, onClick } =
+ const { captionFirst, color, startIcon, title, caption, endIcon, onClick } =
attributes;
const handleClose: React.MouseEventHandler = (event) => {
@@ -142,7 +143,14 @@ export const Notification: React.FC<NotificationProps> = ({
vertical: vertical ?? "bottom",
}}
sx={[
- { width: "min(320px, 100vw)", bgcolor: "background.base" },
+ {
+ width: "min(320px, 100vw)",
+ // If the `color` of the button is a translucent one, e.g.
+ // "secondary", then the notification becomes opaque, which
+ // is not what we want. So give the entire snackbar a solid
+ // background color.
+ backgroundColor: "#000",
+ },
...(sx ? (isSxArray(sx) ? sx : [sx]) : []),
]}
>
@@ -151,7 +159,7 @@ export const Notification: React.FC<NotificationProps> = ({
onClick={handleClick}
sx={{
flex: "1",
- padding: "12px 8px 12px 12px",
+ padding: "12px 8px 12px 14px",
borderRadius: "8px",
}}
>
@@ -179,27 +187,27 @@ export const Notification: React.FC<NotificationProps> = ({
overflow: "hidden",
}}
>
- {textOrder == "titleCaption" ? (
+ {captionFirst ? (
<>
- <Typography sx={{ fontWeight: "medium" }}>
- {title}
- </Typography>
{caption && (
<EllipsizedTypography variant="small">
{caption}
</EllipsizedTypography>
)}
+ <Typography sx={{ fontWeight: "medium" }}>
+ {title}
+ </Typography>
</>
) : (
<>
+ <Typography sx={{ fontWeight: "medium" }}>
+ {title}
+ </Typography>
{caption && (
<EllipsizedTypography variant="small">
{caption}
</EllipsizedTypography>
)}
- <Typography sx={{ fontWeight: "medium" }}>
- {title}
- </Typography>
</>
)}
</Stack>