This commit is contained in:
Manav Rathi
2025-02-25 16:55:37 +05:30
parent 7545047647
commit 82082e2cbf
4 changed files with 21 additions and 22 deletions

View File

@@ -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";

View File

@@ -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.

View File

@@ -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,

View File

@@ -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.