Skip to content

armgit / ente

Public Imported from GitHub
0

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

menu

Manav Rathi76efe1290cc6
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 9de2c15a45..1e4f1c02df 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -39,6 +39,7 @@ import {
} from "@/new/photos/components/ImageEditorOverlay";
import DeleteIcon from "@mui/icons-material/Delete";
import EditIcon from "@mui/icons-material/Edit";
+import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import { Button, Menu, MenuItem, styled, Typography } from "@mui/material";
import { t } from "i18next";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -283,6 +284,14 @@ const FileViewer: React.FC<FileViewerProps> = ({
const handleFileInfoClose = useCallback(() => setOpenFileInfo(false), []);
+ const handleDownload = useCallback(
+ (annotatedFile: FileViewerAnnotatedFile) => {
+ setActiveAnnotatedFile(annotatedFile);
+ console.log("TODO download", annotatedFile);
+ },
+ [],
+ );
+
const handleMore = useCallback(
(
annotatedFile: FileViewerAnnotatedFile,
@@ -497,6 +506,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
onClose: handleClose,
onAnnotate: handleAnnotate,
onViewInfo: handleViewInfo,
+ onDownload: handleDownload,
onMore: handleMore,
});
@@ -518,6 +528,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
handleClose,
handleAnnotate,
handleViewInfo,
+ handleDownload,
handleMore,
]);
@@ -570,6 +581,14 @@ const FileViewer: React.FC<FileViewerProps> = ({
<EditIcon />
</MoreMenuItem>
)}
+ {activeAnnotatedFile?.annotation.showDownload == "menu" && (
+ <MoreMenuItem onClick={handleDownload}>
+ <Typography sx={{ fontWeight: "medium" }}>
+ {/*TODO */ t("download")}
+ </Typography>
+ <FileDownloadOutlinedIcon />
+ </MoreMenuItem>
+ )}
</MoreMenu>
{/* TODO(PS): Fix imports */}
<ConfirmDeleteFileDialog
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 5424c6c3ab..890d6fc164 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -150,6 +150,10 @@ type FileViewerPhotoSwipeOptions = Pick<
* Called when the user activates the info action on a file.
*/
onViewInfo: (annotatedFile: FileViewerAnnotatedFile) => void;
+ /**
+ * Called when the user activates the download action on a file.
+ */
+ onDownload: (annotatedFile: FileViewerAnnotatedFile) => void;
/**
* Called when the user activates the more action on a file.
*