This commit is contained in:
Manav Rathi
2025-02-14 11:37:41 +05:30
parent b931dac18b
commit 87ff5c5c0b
2 changed files with 8 additions and 3 deletions

View File

@@ -76,7 +76,6 @@ import {
} from "@mui/material";
import { Formik } from "formik";
import { t } from "i18next";
import { GalleryContext } from "pages/gallery";
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";
import * as Yup from "yup";
@@ -108,6 +107,11 @@ export interface FileInfoProps {
fileToCollectionsMap?: Map<number, number[]>;
collectionNameMap?: Map<number, string>;
showCollectionChips: boolean;
/**
* Called when the user selects a collection from among the collections that
* the file belongs to.
*/
onSelectCollection: (collectionID: number) => void;
/**
* Called when the user selects a person in the file info panel.
*/
@@ -126,12 +130,12 @@ export const FileInfo: React.FC<FileInfoProps> = ({
collectionNameMap,
showCollectionChips,
closePhotoViewer,
onSelectCollection,
onSelectPerson,
}) => {
const { mapEnabled } = useSettingsSnapshot();
const { showMiniDialog } = useContext(AppContext);
const galleryContext = useContext(GalleryContext);
const publicCollectionGalleryContext = useContext(
PublicCollectionGalleryContext,
);
@@ -173,7 +177,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
}
const onCollectionChipClick = (collectionID) => {
galleryContext.onShowCollection(collectionID);
onSelectCollection(collectionID);
closePhotoViewer();
};

View File

@@ -975,6 +975,7 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
refreshPhotoswipe={refreshPhotoswipe}
fileToCollectionsMap={fileToCollectionsMap}
collectionNameMap={collectionNameMap}
onSelectCollection={galleryContext.onShowCollection}
onSelectPerson={onSelectPerson}
/>
<ImageEditorOverlay