π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Select person
Manav Rathi57d245d9e043
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsxindex 59bb80b954..ccf0908a2b 100644--- a/web/apps/photos/src/components/PhotoFrame.tsx+++ b/web/apps/photos/src/components/PhotoFrame.tsx@@ -8,7 +8,7 @@ import { PHOTOS_PAGES } from "@ente/shared/constants/pages";import { CustomError } from "@ente/shared/error";import useMemoSingleThreaded from "@ente/shared/hooks/useMemoSingleThreaded";import { styled } from "@mui/material";-import PhotoViewer from "components/PhotoViewer";+import PhotoViewer, { type PhotoViewerProps } from "components/PhotoViewer";import { useRouter } from "next/router";import { GalleryContext } from "pages/gallery";import PhotoSwipe from "photoswipe";@@ -72,6 +72,7 @@ interface Props {isInHiddenSection?: boolean;setFilesDownloadProgressAttributesCreator?: SetFilesDownloadProgressAttributesCreator;selectable?: boolean;+ onSelectPerson?: PhotoViewerProps["onSelectPerson"];}const PhotoFrame = ({@@ -95,6 +96,7 @@ const PhotoFrame = ({isInHiddenSection,setFilesDownloadProgressAttributesCreator,selectable,+ onSelectPerson,}: Props) => {const [open, setOpen] = useState(false);const [currentIndex, setCurrentIndex] = useState<number>(0);@@ -580,6 +582,7 @@ const PhotoFrame = ({setFilesDownloadProgressAttributesCreator={setFilesDownloadProgressAttributesCreator}+ onSelectPerson={onSelectPerson}/></Container>);diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsxindex ead1211fdc..a528aa1c2e 100644--- a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx+++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx@@ -69,7 +69,7 @@ export interface FileInfoExif {parsed: ParsedMetadata | undefined;}-interface FileInfoProps {+export interface FileInfoProps {showInfo: boolean;handleCloseInfo: () => void;closePhotoViewer: () => void;@@ -81,6 +81,10 @@ interface FileInfoProps {fileToCollectionsMap?: Map<number, number[]>;collectionNameMap?: Map<number, string>;showCollectionChips: boolean;+ /**+ * Called when the user selects a person in the file info panel.+ */+ onSelectPerson?: ((personID: string) => void) | undefined;}export const FileInfo: React.FC<FileInfoProps> = ({@@ -95,6 +99,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({collectionNameMap,showCollectionChips,closePhotoViewer,+ onSelectPerson,}) => {const { mapEnabled, updateMapEnabled, setDialogBoxAttributesV2 } =useContext(AppContext);@@ -156,7 +161,10 @@ export const FileInfo: React.FC<FileInfoProps> = ({);const handleSelectFace = (annotatedFaceID: AnnotatedFaceID) => {- console.log(annotatedFaceID);+ if (onSelectPerson) {+ onSelectPerson(annotatedFaceID.personID);+ closePhotoViewer();+ }};return (diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsxindex 10d2f310e2..b15f1e3f44 100644--- a/web/apps/photos/src/components/PhotoViewer/index.tsx+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx@@ -48,7 +48,7 @@ import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";import { pauseVideo, playVideo } from "utils/photoFrame";import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";import { getTrashFileMessage } from "utils/ui";-import { FileInfo, type FileInfoExif } from "./FileInfo";+import { FileInfo, type FileInfoExif, type FileInfoProps } from "./FileInfo";import ImageEditorOverlay from "./ImageEditorOverlay";import CircularProgressWithLabel from "./styledComponents/CircularProgressWithLabel";import { ConversionFailedNotification } from "./styledComponents/ConversionFailedNotification";@@ -98,7 +98,8 @@ const CaptionContainer = styled("div")(({ theme }) => ({backgroundColor: theme.colors.backdrop.faint,backdropFilter: `blur(${theme.colors.blur.base})`,}));-interface Iprops {++export interface PhotoViewerProps {isOpen: boolean;items: any[];currentIndex?: number;@@ -115,9 +116,10 @@ interface Iprops {fileToCollectionsMap: Map<number, number[]>;collectionNameMap: Map<number, string>;setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator;+ onSelectPerson?: FileInfoProps["onSelectPerson"];}-function PhotoViewer(props: Iprops) {+function PhotoViewer(props: PhotoViewerProps) {const galleryContext = useContext(GalleryContext);const appContext = useContext(AppContext);const publicCollectionGalleryContext = useContext(@@ -969,6 +971,7 @@ function PhotoViewer(props: Iprops) {refreshPhotoswipe={refreshPhotoswipe}fileToCollectionsMap={props.fileToCollectionsMap}collectionNameMap={props.collectionNameMap}+ onSelectPerson={props.onSelectPerson}/><ImageEditorOverlayshow={showImageEditorOverlay}diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex a3c3a78937..86a3b88e02 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -1123,6 +1123,11 @@ export default function Gallery() {setBarMode("people");};+ const handleSelectFileInfoPerson = (personID: string) => {+ setActivePersonID(personID);+ setBarMode("people");+ };+if (!collectionSummaries || !filteredData) {return <div></div>;}@@ -1321,6 +1326,7 @@ export default function Gallery() {setFilesDownloadProgressAttributesCreator}selectable={true}+ onSelectPerson={handleSelectFileInfoPerson}/>)}{selected.count > 0 &&