Skip to content

armgit / ente

Public Imported from GitHub
0

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

Swap

Manav Rathieeb68588a081
diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx
index a057677e35..bb956a7dd1 100644
--- a/web/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx
@@ -124,7 +124,7 @@ export interface PhotoViewerProps {
function PhotoViewer(props: PhotoViewerProps) {
const galleryContext = useContext(GalleryContext);
- const { showLoadingBar, hideLoadingBar, setDialogMessage, showMiniDialog } =
+ const { showLoadingBar, hideLoadingBar, showMiniDialog } =
useContext(AppContext);
const publicCollectionGalleryContext = useContext(
PublicCollectionGalleryContext,
diff --git a/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx
index 2b2600648e..603bc184de 100644
--- a/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx
@@ -7,7 +7,6 @@ import DeleteIcon from "@mui/icons-material/Delete";
import { Box, IconButton, Tooltip } from "@mui/material";
import { t } from "i18next";
import { useContext } from "react";
-import { getTrashFilesMessage } from "utils/ui";
interface IProps {
deleteFileHelper: () => void;
@@ -22,10 +21,18 @@ export default function DeduplicateOptions({
count,
clearSelection,
}: IProps) {
- const { setDialogMessage } = useContext(AppContext);
+ const { showMiniDialog } = useContext(AppContext);
const trashHandler = () =>
- setDialogMessage(getTrashFilesMessage(deleteFileHelper));
+ showMiniDialog({
+ title: t("TRASH_FILES_TITLE"),
+ message: t("TRASH_FILES_MESSAGE"),
+ continue: {
+ text: t("MOVE_TO_TRASH"),
+ color: "critical",
+ action: deleteFileHelper,
+ },
+ });
return (
<SelectionBar>
diff --git a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
index b09338aff0..881c8e0ae9 100644
--- a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
+++ b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx
@@ -27,7 +27,6 @@ import { t } from "i18next";
import { useContext } from "react";
import { COLLECTION_OPS_TYPE } from "utils/collection";
import { FILE_OPS_TYPE } from "utils/file";
-import { getTrashFilesMessage } from "utils/ui";
interface Props {
handleCollectionOps: (
@@ -74,7 +73,7 @@ const SelectedFileOptions = ({
isInSearchMode,
isInHiddenSection,
}: Props) => {
- const { setDialogMessage } = useContext(AppContext);
+ const { setDialogMessage, showMiniDialog } = useContext(AppContext);
const peopleMode = barMode == "people";
@@ -90,9 +89,15 @@ const SelectedFileOptions = ({
});
const trashHandler = () =>
- setDialogMessage(
- getTrashFilesMessage(handleFileOps(FILE_OPS_TYPE.TRASH)),
- );
+ showMiniDialog({
+ title: t("TRASH_FILES_TITLE"),
+ message: t("TRASH_FILES_MESSAGE"),
+ continue: {
+ text: t("MOVE_TO_TRASH"),
+ color: "critical",
+ action: handleFileOps(FILE_OPS_TYPE.TRASH),
+ },
+ });
const permanentlyDeleteHandler = () =>
setDialogMessage({
diff --git a/web/apps/photos/src/utils/ui/index.tsx b/web/apps/photos/src/utils/ui/index.tsx
deleted file mode 100644
index 7732cafcd5..0000000000
--- a/web/apps/photos/src/utils/ui/index.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { DialogBoxAttributes } from "@ente/shared/components/DialogBox/types";
-import { t } from "i18next";
-
-export const getTrashFilesMessage = (
- deleteFileHelper,
-): DialogBoxAttributes => ({
- title: t("TRASH_FILES_TITLE"),
- content: t("TRASH_FILES_MESSAGE"),
- proceed: {
- action: deleteFileHelper,
- text: t("MOVE_TO_TRASH"),
- variant: "critical",
- },
- close: { text: t("cancel") },
-});
-