Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move closer to source

Manav Rathi11413ee77b00
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 2e8e227192..cc3435c8ba 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -56,11 +56,65 @@ import {
moreButtonID,
moreMenuID,
resetMoreMenuButtonOnMenuClose,
- type FileViewerAnnotatedFile,
- type FileViewerFileAnnotation,
type FileViewerPhotoSwipeDelegate,
} from "./photoswipe";
+/**
+ * Derived data for a file that is needed to display the file viewer controls
+ * etc associated with the file.
+ *
+ * This is recomputed on-demand each time the slide changes.
+ */
+export interface FileViewerFileAnnotation {
+ /**
+ * The id of the file whose annotation this is.
+ */
+ fileID: number;
+ /**
+ * `true` if this file is owned by the logged in user (if any).
+ */
+ isOwnFile: boolean;
+ /**
+ * `true` if the toggle favorite action should be shown for this file.
+ */
+ showFavorite: boolean;
+ /**
+ * Set if the download action should be shown for this file.
+ *
+ * - When "bar", the action button is shown among the bar icons.
+ *
+ * - When "menu", the action is shown as a more menu entry.
+ *
+ * Note: "bar" should only be set if {@link haveUser} is also true.
+ */
+ showDownload: "bar" | "menu" | undefined;
+ /**
+ * `true` if the more menu action should be shown for this file.
+ */
+ showMore: boolean;
+ /**
+ * `true` if the delete action should be shown for this file.
+ */
+ showDelete: boolean;
+ /**
+ * `true` if the copy image action should be shown for this file.
+ */
+ showCopyImage: boolean;
+ /**
+ * `true` if this is an image which can be edited, _and_ editing is
+ * possible, and the edit action should therefore be shown for this file.
+ */
+ showEditImage: boolean;
+}
+
+/**
+ * A file and its annotation, in a nice cosy box.
+ */
+export interface FileViewerAnnotatedFile {
+ file: EnteFile;
+ annotation: FileViewerFileAnnotation;
+}
+
export type FileViewerProps = ModalVisibilityProps & {
/**
* The currently logged in user, if any.
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index c8d170bfe3..082ac919d5 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -14,6 +14,10 @@ import {
itemDataForFile,
updateFileInfoExifIfNeeded,
} from "./data-source";
+import {
+ type FileViewerAnnotatedFile,
+ type FileViewerFileAnnotation,
+} from "./FileViewer";
import { createPSRegisterElementIconHTML } from "./icons";
// TODO(PS): WIP gallery using upstream photoswipe
@@ -34,54 +38,6 @@ if (process.env.NEXT_PUBLIC_ENTE_WIP_PS5) {
PhotoSwipe = require("./ps5/dist/photoswipe.esm.js").default;
}
-/**
- * Derived data for a file that is needed to display the file viewer controls
- * etc associated with the file.
- *
- * This is recomputed on-demand each time the slide changes.
- */
-export interface FileViewerFileAnnotation {
- /**
- * The id of the file whose annotation this is.
- */
- fileID: number;
- /**
- * `true` if this file is owned by the logged in user (if any).
- */
- isOwnFile: boolean;
- /**
- * `true` if the toggle favorite action should be shown for this file.
- */
- showFavorite: boolean;
- /**
- * Set if the download action should be shown for this file.
- *
- * - When "bar", the action button is shown among the bar icons.
- *
- * - When "menu", the action is shown as a more menu entry.
- *
- * Note: "bar" should only be set if {@link haveUser} is also true.
- */
- showDownload: "bar" | "menu" | undefined;
- /**
- * `true` if the more menu action should be shown for this file.
- */
- showMore: boolean;
- /**
- * `true` if the delete action should be shown for this file.
- */
- showDelete: boolean;
- /**
- * `true` if the copy image action should be shown for this file.
- */
- showCopyImage: boolean;
- /**
- * `true` if this is an image which can be edited, _and_ editing is
- * possible, and the edit action should therefore be shown for this file.
- */
- showEditImage: boolean;
-}
-
export interface FileViewerPhotoSwipeDelegate {
/**
* Called to obtain the latest list of files.
@@ -172,14 +128,6 @@ type FileViewerPhotoSwipeOptions = Pick<
) => void;
};
-/**
- * A file and its annotation, in a nice cosy box.
- */
-export interface FileViewerAnnotatedFile {
- file: EnteFile;
- annotation: FileViewerFileAnnotation;
-}
-
/**
* The ID that is used by the "more" action button (if one is being displayed).
*