Skip to content

armgit / ente

Public Imported from GitHub
0

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

Modal

Manav Rathi1c322a9c62e5
diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx
index 48b484bb7e..a9fe6a4d8c 100644
--- a/web/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx
@@ -992,8 +992,8 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
onConfirm={handleDeleteFile}
/>
<FileInfo
- showInfo={showInfo}
- handleCloseInfo={handleCloseInfo}
+ open={showInfo}
+ onClose={handleCloseInfo}
file={photoSwipe?.currItem as EnteFile}
exif={exif?.value}
shouldDisableEdits={!isOwnFile}
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index 120f81517d..b22fb97a99 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -18,7 +18,7 @@ import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { SidebarDrawer } from "@/base/components/mui/SidebarDrawer";
import { Titlebar } from "@/base/components/Titlebar";
import { EllipsizedTypography } from "@/base/components/Typography";
-import { useModalVisibility } from "@/base/components/utils/modal";
+import { useModalVisibility, type ModalVisibilityProps } from "@/base/components/utils/modal";
import { useBaseContext } from "@/base/context";
import { haveWindow } from "@/base/env";
import { nameAndExtension } from "@/base/file-name";
@@ -107,13 +107,11 @@ export interface FileInfoExif {
parsed: ParsedMetadata | undefined;
}
-export interface FileInfoProps {
+export type FileInfoProps = ModalVisibilityProps & {
/**
* The file whose information we are showing.
*/
file: EnteFile | undefined;
- showInfo: boolean;
- handleCloseInfo: () => void;
exif: FileInfoExif | undefined;
/**
* TODO: Rename and flip to allowEdits.
@@ -141,11 +139,11 @@ export interface FileInfoProps {
}
export const FileInfo: React.FC<FileInfoProps> = ({
+ open,
+ onClose,
file,
shouldDisableEdits,
allowMap,
- showInfo,
- handleCloseInfo,
exif,
scheduleUpdate,
refreshPhotoswipe,
@@ -209,8 +207,8 @@ export const FileInfo: React.FC<FileInfoProps> = ({
onSelectPerson?.(personID);
return (
- <FileInfoSidebar open={showInfo} onClose={handleCloseInfo}>
- <Titlebar onClose={handleCloseInfo} title={t("info")} backIsClose />
+ <FileInfoSidebar open={open} onClose={onClose}>
+ <Titlebar onClose={onClose} title={t("info")} backIsClose />
<Stack sx={{ pt: 1, pb: 3, gap: "20px" }}>
<RenderCaption
{...{
@@ -343,7 +341,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
</Stack>
<RawExif
{...rawExifVisibilityProps}
- onInfoClose={handleCloseInfo}
+ onInfoClose={onClose}
tags={exif?.tags}
fileName={file.metadata.title}
/>
diff --git a/web/packages/new/photos/components/FileViewer5.tsx b/web/packages/new/photos/components/FileViewer5.tsx
index a4d6e3677c..2e019202c5 100644
--- a/web/packages/new/photos/components/FileViewer5.tsx
+++ b/web/packages/new/photos/components/FileViewer5.tsx
@@ -14,9 +14,10 @@ if (process.env.NEXT_PUBLIC_ENTE_WIP_PS5) {
}
import { useModalVisibility } from "@/base/components/utils/modal";
+import { FileInfo } from "@/gallery/components/FileInfo";
import type { EnteFile } from "@/media/file.js";
import { Button, styled } from "@mui/material";
-import { useCallback, useEffect, useRef } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import { FileViewerPhotoSwipe } from "./FileViewerPhotoSwipe";
export interface FileViewerProps {
@@ -65,7 +66,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
// This is not guaranteed, or even intended, to be in sync with the active
// file shown within the file viewer. All that this guarantees is this will
// refer to the file on which the last user initiated action was performed.
- const [activeFile, setActiveFile] = setState<EnteFile | undefined>(
+ const [activeFile, setActiveFile] = useState<EnteFile | undefined>(
undefined,
);
@@ -101,6 +102,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
return (
<Container>
<Button>Test</Button>
+ <FileInfo {...fileInfoVisibilityProps} file={activeFile} />
</Container>
);
};