From 332d4219acd50f40c48ff7fcc12f018e00df4a82 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 1 Jul 2025 07:38:03 +0530 Subject: [PATCH] Reusable --- web/apps/photos/src/components/Sidebar.tsx | 2 +- web/apps/photos/src/pages/gallery.tsx | 10 ++---- web/packages/gallery/components/FileInfo.tsx | 2 +- .../new/photos/components/utils/dialog.tsx | 33 ------------------- 4 files changed, 4 insertions(+), 43 deletions(-) delete mode 100644 web/packages/new/photos/components/utils/dialog.tsx diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx index f28525f9da..13899ebabf 100644 --- a/web/apps/photos/src/components/Sidebar.tsx +++ b/web/apps/photos/src/components/Sidebar.tsx @@ -71,7 +71,7 @@ import { TwoFactorSettings } from "ente-new/photos/components/sidebar/TwoFactorS import { confirmDisableMapsDialogAttributes, confirmEnableMapsDialogAttributes, -} from "ente-new/photos/components/utils/dialog"; +} from "ente-new/photos/components/utils/dialog-attributes"; import { downloadAppDialogAttributes } from "ente-new/photos/components/utils/download"; import { useHLSGenerationStatusSnapshot, diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx index e9c1d8be93..1e81c09df4 100644 --- a/web/apps/photos/src/pages/gallery.tsx +++ b/web/apps/photos/src/pages/gallery.tsx @@ -1,6 +1,5 @@ import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import FileUploadOutlinedIcon from "@mui/icons-material/FileUploadOutlined"; -import InfoIcon from "@mui/icons-material/Info"; import MenuIcon from "@mui/icons-material/Menu"; import { IconButton, Stack, Typography } from "@mui/material"; import { AuthenticateUser } from "components/AuthenticateUser"; @@ -28,7 +27,6 @@ import { errorDialogAttributes } from "ente-base/components/utils/dialog"; import { useIsSmallWidth } from "ente-base/components/utils/hooks"; import { useModalVisibility } from "ente-base/components/utils/modal"; import { useBaseContext } from "ente-base/context"; -import { pt } from "ente-base/i18n"; import log from "ente-base/log"; import { clearSessionStorage, @@ -71,6 +69,7 @@ import { useGalleryReducer, type GalleryBarMode, } from "ente-new/photos/components/gallery/reducer"; +import { notifyOthersFilesDialogAttributes } from "ente-new/photos/components/utils/dialog-attributes"; import { useIsOffline } from "ente-new/photos/components/utils/use-is-offline"; import { usePeopleStateSnapshot } from "ente-new/photos/components/utils/use-snapshot"; import { shouldShowWhatsNew } from "ente-new/photos/services/changelog"; @@ -666,12 +665,7 @@ const Page: React.FC = () => { } if (notifyOtherFiles) { - showMiniDialog({ - title: pt("Note"), - icon: , - message: pt("Files added by other users were not removed"), - cancel: t("ok"), - }); + showMiniDialog(notifyOthersFilesDialogAttributes()); } })(); }; diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx index 5d272738bb..80a9014e01 100644 --- a/web/packages/gallery/components/FileInfo.tsx +++ b/web/packages/gallery/components/FileInfo.tsx @@ -70,7 +70,7 @@ import { FilePeopleList } from "ente-new/photos/components/PeopleList"; import { confirmDisableMapsDialogAttributes, confirmEnableMapsDialogAttributes, -} from "ente-new/photos/components/utils/dialog"; +} from "ente-new/photos/components/utils/dialog-attributes"; import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot"; import { updateFileCaption, diff --git a/web/packages/new/photos/components/utils/dialog.tsx b/web/packages/new/photos/components/utils/dialog.tsx deleted file mode 100644 index a3a14d8a7e..0000000000 --- a/web/packages/new/photos/components/utils/dialog.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Link } from "@mui/material"; -import type { MiniDialogAttributes } from "ente-base/components/MiniDialog"; -import { t } from "i18next"; -import { Trans } from "react-i18next"; - -export const confirmEnableMapsDialogAttributes = ( - onConfirm: () => void, -): MiniDialogAttributes => ({ - title: t("enable_maps_confirm"), - message: ( - - ), - }} - /> - ), - continue: { text: t("enable"), action: onConfirm }, -}); - -export const confirmDisableMapsDialogAttributes = ( - onConfirm: () => void, -): MiniDialogAttributes => ({ - title: t("disable_maps_confirm"), - message: , - continue: { text: t("disable"), color: "critical", action: onConfirm }, -});