From 82082e2cbfaf2010d55fe98cd24c68f45965a521 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 25 Feb 2025 16:55:37 +0530 Subject: [PATCH] Move --- .../src/components/PhotoViewer/index.tsx | 3 +-- web/packages/gallery/components/FileInfo.tsx | 13 ++++++++++++- .../gallery/components/viewer/FileViewer.tsx | 8 ++++++-- .../gallery/components/viewer/data-source.ts | 19 ++----------------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx index ef6b0ed8a1..3454d11ae7 100644 --- a/web/apps/photos/src/components/PhotoViewer/index.tsx +++ b/web/apps/photos/src/components/PhotoViewer/index.tsx @@ -9,8 +9,7 @@ import { } from "@/base/components/utils/modal"; import { lowercaseExtension } from "@/base/file-name"; import log from "@/base/log"; -import { FileInfo } from "@/gallery/components/FileInfo"; -import { type FileInfoExif } from "@/gallery/components/viewer/data-source"; +import { FileInfo, type FileInfoExif } from "@/gallery/components/FileInfo"; import { downloadManager } from "@/gallery/services/download"; import { extractRawExif, parseExif } from "@/gallery/services/exif"; import type { Collection } from "@/media/collection"; diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx index 7963e26608..629f47375f 100644 --- a/web/packages/gallery/components/FileInfo.tsx +++ b/web/packages/gallery/components/FileInfo.tsx @@ -37,6 +37,7 @@ import { fileLocation, filePublicMagicMetadata, updateRemotePublicMagicMetadata, + type ParsedMetadata, type ParsedMetadataDate, } from "@/media/file-metadata"; import { FileType } from "@/media/file-type"; @@ -89,7 +90,6 @@ import { Formik } from "formik"; import { t } from "i18next"; import React, { useEffect, useMemo, useRef, useState } from "react"; import * as Yup from "yup"; -import type { FileInfoExif } from "./viewer/data-source"; // Re-uses images from ~leaflet package. import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.webpack.css"; @@ -101,6 +101,17 @@ const leaflet = haveWindow() (require("leaflet") as typeof import("leaflet")) : null; +/** + * Exif data for a file, in a form suitable for use by {@link FileInfo}. + * + * TODO: Indicate missing exif (e.g. videos) better, both in the data type, and + * in the UI (e.g. by omitting the entire row). + */ +export interface FileInfoExif { + tags: RawExifTags | undefined; + parsed: ParsedMetadata | undefined; +} + export type FileInfoProps = ModalVisibilityProps & { /** * The file whose information we are showing. diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx index 07756ec357..4c21d1dab3 100644 --- a/web/packages/gallery/components/viewer/FileViewer.tsx +++ b/web/packages/gallery/components/viewer/FileViewer.tsx @@ -18,11 +18,15 @@ import { type ModalVisibilityProps, } from "@/base/components/utils/modal"; import type { LocalUser } from "@/base/local-user"; -import { FileInfo, type FileInfoProps } from "@/gallery/components/FileInfo"; +import { + FileInfo, + type FileInfoExif, + type FileInfoProps, +} from "@/gallery/components/FileInfo"; import type { EnteFile } from "@/media/file.js"; import { Button, styled } from "@mui/material"; import { useCallback, useEffect, useRef, useState } from "react"; -import { fileInfoExifForFile, type FileInfoExif } from "./data-source"; +import { fileInfoExifForFile } from "./data-source"; import { FileViewerPhotoSwipe, type FileViewerAnnotatedFile, diff --git a/web/packages/gallery/components/viewer/data-source.ts b/web/packages/gallery/components/viewer/data-source.ts index 2d215deca3..715d152805 100644 --- a/web/packages/gallery/components/viewer/data-source.ts +++ b/web/packages/gallery/components/viewer/data-source.ts @@ -1,15 +1,11 @@ import log from "@/base/log"; +import type { FileInfoExif } from "@/gallery/components/FileInfo"; import { downloadManager, type LivePhotoSourceURL, } from "@/gallery/services/download"; -import { - extractRawExif, - parseExif, - type RawExifTags, -} from "@/gallery/services/exif"; +import { extractRawExif, parseExif } 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"; @@ -103,17 +99,6 @@ export type ItemData = PhotoSwipeSlideData & { fetchFailed?: boolean; }; -/** - * Exif data for a file, in a form suitable for use by {@link FileInfo}. - * - * TODO(PS): Indicate missing exif (e.g. videos) better, both in the data type, - * and in the UI (e.g. by omitting the entire row). - */ -export interface FileInfoExif { - tags: RawExifTags | undefined; - parsed: ParsedMetadata | undefined; -} - /** * This module stores and serves data required by our custom PhotoSwipe * instance, effectively acting as an in-memory cache.