Skip to content

armgit / ente

Public Imported from GitHub
0

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

ann

Manav Rathi5e4707b69561
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index 469ef5521f..390746968a 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -533,6 +533,7 @@ const PhotoFrame = ({
/* @ts-ignore TODO(PS): test */
open={open5}
onClose={handleClose}
+ user={galleryContext.user ?? undefined}
files={files}
initialIndex={currentIndex}
{...{
diff --git a/web/packages/gallery/components/viewer/data-source.ts b/web/packages/gallery/components/viewer/data-source.ts
index 50f234d8ea..2d215deca3 100644
--- a/web/packages/gallery/components/viewer/data-source.ts
+++ b/web/packages/gallery/components/viewer/data-source.ts
@@ -3,16 +3,15 @@ import {
downloadManager,
type LivePhotoSourceURL,
} from "@/gallery/services/download";
-import type { EnteFile } from "@/media/file";
-import type { ParsedMetadata } from "@/media/file-metadata";
-import { FileType } from "@/media/file-type";
-import { ensureString } from "@/utils/ensure";
-// TODO(PS):
import {
extractRawExif,
parseExif,
type RawExifTags,
} from "@/gallery/services/exif";
+import type { EnteFile } from "@/media/file";
+import type { ParsedMetadata } from "@/media/file-metadata";
+import { FileType } from "@/media/file-type";
+import { ensureString } from "@/utils/ensure";
/**
* This is a subset of the fields expected by PhotoSwipe itself (see the
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 85d9b21fdc..e991e9cedf 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -34,16 +34,34 @@ if (process.env.NEXT_PUBLIC_ENTE_WIP_PS5) {
// PhotoSwipe = require("./ps5/dist/photoswipe.esm.js").default;
}
-type FileViewerPhotoSwipeOptions = FileViewerProps & {
+type FileViewerPhotoSwipeOptions = {
/**
* Called when the file viewer is closed.
*/
onClose: () => void;
+ /**
+ * Called whenever the slide changes to obtain the derived data for the file
+ * that is about to be displayed.
+ */
+ onAnnotate: (file: EnteFile) => FileViewerFileAnnotation;
/**
* Called when the user activates the info action on a file.
*/
onViewInfo: (file: EnteFile) => void;
-};
+} & Pick<FileViewerProps, "files" | "initialIndex" | "disableDownload">;
+
+/**
+ * Derived data for a file that is needed to display the file viewer controls
+ * etc associated with the file.
+ *
+ * This is recomputed each time the slide changes.
+ */
+interface FileViewerFileAnnotation {
+ /**
+ * `true` if this file is owned by the logged in user (if any).
+ */
+ isOwnFile: boolean;
+}
/**
* A wrapper over {@link PhotoSwipe} to tailor its interface for use by our file
@@ -94,12 +112,19 @@ export class FileViewerPhotoSwipe {
* - "auto-hidden" if controls were hidden by us because of inactivity.
*/
private lastActivityDate: Date | "auto-hidden" | "already-hidden";
+ /**
+ * Derived data about the currently displayed file.
+ *
+ * This is recomputed each time the slide changes.
+ */
+ // private activeFileAnnotation;
constructor({
files,
initialIndex,
disableDownload,
onClose,
+ onAnnotate,
onViewInfo,
}: FileViewerPhotoSwipeOptions) {
this.files = files;