Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use

Manav Rathid8e7415c36fd
diff --git a/web/apps/photos/src/components/Upload/Uploader.tsx b/web/apps/photos/src/components/Upload/Uploader.tsx
index fa3711fe07..9104efd718 100644
--- a/web/apps/photos/src/components/Upload/Uploader.tsx
+++ b/web/apps/photos/src/components/Upload/Uploader.tsx
@@ -18,7 +18,6 @@ import type {
} from "@/new/photos/services/upload/types";
import { redirectToCustomerPortal } from "@/new/photos/services/user-details";
import { useAppContext } from "@/new/photos/types/context";
-import { NotificationAttributes } from "@/new/photos/types/notification";
import { firstNonEmpty } from "@/utils/array";
import { CustomError } from "@ente/shared/error";
import DiscFullIcon from "@mui/icons-material/DiscFull";
@@ -106,13 +105,14 @@ export default function Uploader({
openZipFileSelector,
fileSelectorZipFiles,
onUploadFile,
+ showSessionExpiredMessage,
...props
}: Props) {
const {
showMiniDialog,
+ showNotification,
onGenericError,
watchFolderView,
- setNotificationAttributes,
} = useAppContext();
const galleryContext = useContext(GalleryContext);
const publicCollectionGalleryContext = useContext(
@@ -647,36 +647,34 @@ export default function Uploader({
};
function showUserFacingError(err: string) {
- let notification: NotificationAttributes;
switch (err) {
case CustomError.SESSION_EXPIRED:
- props.showSessionExpiredMessage();
- return;
+ showSessionExpiredMessage();
+ break;
case CustomError.SUBSCRIPTION_EXPIRED:
- notification = {
+ showNotification({
variant: "critical",
subtext: t("subscription_expired"),
message: t("renew_now"),
onClick: redirectToCustomerPortal,
- };
+ });
break;
case CustomError.STORAGE_QUOTA_EXCEEDED:
- notification = {
+ showNotification({
variant: "critical",
subtext: t("storage_quota_exceeded"),
message: t("upgrade_now"),
onClick: () => galleryContext.showPlanSelectorModal(),
startIcon: <DiscFullIcon />,
- };
+ });
break;
default:
- notification = {
+ showNotification({
variant: "critical",
message: t("generic_error_retry"),
onClick: () => null,
- };
+ });
}
- setNotificationAttributes(notification);
}
const uploadToSingleNewCollection = (collectionName: string) => {
diff --git a/web/packages/new/photos/components/Notification.tsx b/web/packages/new/photos/components/Notification.tsx
index 01b889f6a0..870bbaf37b 100644
--- a/web/packages/new/photos/components/Notification.tsx
+++ b/web/packages/new/photos/components/Notification.tsx
@@ -96,6 +96,8 @@ export const Notification: React.FC<NotificationProps> = ({
attributes,
keepOpenOnClick,
}) => {
+ if (!attributes) return <></>;
+
const handleClose: ButtonProps["onClick"] = (event) => {
onClose();
event.stopPropagation();