Skip to content

armgit / ente

Public Imported from GitHub
0

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

Up

Manav Rathi0aeb9f0c829b
diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx
index b934e68f23..e740effc31 100644
--- a/web/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx
@@ -722,6 +722,18 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
}
};
+ const handleSelectCollection = (collectionID: number) => {
+ galleryContext.onShowCollection(collectionID);
+ handleClose();
+ };
+
+ const handleSelectPerson = onSelectPerson
+ ? (personID: string) => {
+ onSelectPerson(personID);
+ handleClose();
+ }
+ : undefined;
+
const handleForceConvert = () =>
forceConvertItem(
photoSwipe,
@@ -969,7 +981,6 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
<FileInfo
showInfo={showInfo}
handleCloseInfo={handleCloseInfo}
- closePhotoViewer={handleClose}
file={photoSwipe?.currItem as EnteFile}
exif={exif?.value}
showMiniDialog={showMiniDialog}
@@ -982,8 +993,8 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
refreshPhotoswipe={refreshPhotoswipe}
fileToCollectionsMap={fileToCollectionsMap}
collectionNameMap={collectionNameMap}
- onSelectCollection={galleryContext.onShowCollection}
- onSelectPerson={onSelectPerson}
+ onSelectCollection={handleSelectCollection}
+ onSelectPerson={handleSelectPerson}
/>
<ImageEditorOverlay
show={showImageEditorOverlay}
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index 07988fe954..7bc39b364c 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -108,7 +108,6 @@ export interface FileInfoProps {
file: EnteFile | undefined;
showInfo: boolean;
handleCloseInfo: () => void;
- closePhotoViewer: () => void;
exif: FileInfoExif | undefined;
/**
* This is the same as the {@link showMiniDialog} prop in the top level
@@ -153,7 +152,6 @@ export const FileInfo: React.FC<FileInfoProps> = ({
fileToCollectionsMap,
collectionNameMap,
showCollectionChips,
- closePhotoViewer,
onSelectCollection,
onSelectPerson,
}) => {
@@ -195,11 +193,6 @@ export const FileInfo: React.FC<FileInfoProps> = ({
return <></>;
}
- const onCollectionChipClick = (collectionID: number) => {
- onSelectCollection(collectionID);
- closePhotoViewer();
- };
-
const openEnableMapConfirmationDialog = () =>
showMiniDialog(
confirmEnableMapsDialogAttributes(() => updateMapEnabled(true)),
@@ -210,12 +203,8 @@ export const FileInfo: React.FC<FileInfoProps> = ({
confirmDisableMapsDialogAttributes(() => updateMapEnabled(false)),
);
- const handleSelectFace = (annotatedFaceID: AnnotatedFaceID) => {
- if (onSelectPerson) {
- onSelectPerson(annotatedFaceID.personID);
- closePhotoViewer();
- }
- };
+ const handleSelectFace = ({ personID }: AnnotatedFaceID) =>
+ onSelectPerson?.(personID);
return (
<FileInfoSidebar open={showInfo} onClose={handleCloseInfo}>
@@ -340,7 +329,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
<ChipButton
key={collectionID}
onClick={() =>
- onCollectionChipClick(collectionID)
+ onSelectCollection(collectionID)
}
>
{collectionNameMap.get(collectionID)}