π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
checkpoint
Manav Rathi3c61b49548f5
diff --git a/web/apps/photos/src/components/Collections/CollectionListBar.tsx b/web/apps/photos/src/components/Collections/CollectionListBar.tsxindex 2d3f28cf56..85de3ec5e8 100644--- a/web/apps/photos/src/components/Collections/CollectionListBar.tsx+++ b/web/apps/photos/src/components/Collections/CollectionListBar.tsx@@ -66,13 +66,13 @@ export interface CollectionListBarProps {*/people: Person[];/**- * The ID of the currently selected person (if any).+ * The currently selected person (if any).*/- activePersonID: string | undefined;+ activePerson: Person | undefined;/*** Called when the user changes the active person.*/- setActivePersonID: (id: string | undefined) => void;+ setActivePerson: (id: Person | undefined) => void;}export const CollectionListBar: React.FC<CollectionListBarProps> = ({@@ -84,8 +84,8 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({collectionListSortBy,setCollectionListSortBy,// people,- // activePersonID,- // setActivePersonID+ // activePerson,+ // setActivePerson}) => {const windowSize = useWindowSize();const isMobile = useIsMobileWidth();diff --git a/web/apps/photos/src/components/Collections/index.tsx b/web/apps/photos/src/components/Collections/index.tsxindex 6b16533699..f050152335 100644--- a/web/apps/photos/src/components/Collections/index.tsx+++ b/web/apps/photos/src/components/Collections/index.tsx@@ -37,31 +37,29 @@ interface CollectionsProps {setActiveCollectionID: (id?: number) => void;hiddenCollectionSummaries: CollectionSummaries;people: Person[];- activePersonID: string | undefined;- setActivePersonID: (id: string | undefined) => void;+ activePerson: Person | undefined;+ setActivePerson: (id: Person | undefined) => void;setCollectionNamerAttributes: SetCollectionNamerAttributes;setPhotoListHeader: (value: TimeStampListItem) => void;filesDownloadProgressAttributesList: FilesDownloadProgressAttributes[];setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator;}-export default function Collections(props: CollectionsProps) {- const {- mode,- collectionSummaries,- activeCollection,- activeCollectionID,- setActiveCollectionID,- hiddenCollectionSummaries,- people,- activePersonID,- setActivePersonID,- setCollectionNamerAttributes,- setPhotoListHeader,- filesDownloadProgressAttributesList,- setFilesDownloadProgressAttributesCreator,- } = props;-+export const Collections: React.FC<CollectionsProps> = ({+ mode,+ collectionSummaries,+ activeCollection,+ activeCollectionID,+ setActiveCollectionID,+ hiddenCollectionSummaries,+ people,+ activePerson,+ setActivePerson,+ setCollectionNamerAttributes,+ setPhotoListHeader,+ filesDownloadProgressAttributesList,+ setFilesDownloadProgressAttributesCreator,+}) => {const [allCollectionView, setAllCollectionView] = useState(false);const [collectionShareModalView, setCollectionShareModalView] =useState(false);@@ -162,8 +160,8 @@ export default function Collections(props: CollectionsProps) {activeCollectionID,setActiveCollectionID,people,- activePersonID,- setActivePersonID,+ activePerson,+ setActivePerson,collectionListSortBy,setCollectionListSortBy,}}@@ -200,4 +198,4 @@ export default function Collections(props: CollectionsProps) {/></>);-}+};diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 9a16723da2..9ecab8363a 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -14,6 +14,7 @@ import {getLocalFiles,getLocalTrashedFiles,} from "@/new/photos/services/files";+import { peopleSnapshot, peopleSubscribe } from "@/new/photos/services/ml";import type { Person } from "@/new/photos/services/ml/cgroups";import {filterSearchableFiles,@@ -53,7 +54,7 @@ import MenuIcon from "@mui/icons-material/Menu";import type { ButtonProps, IconButtonProps } from "@mui/material";import { Box, Button, IconButton, Typography, styled } from "@mui/material";import AuthenticateUserModal from "components/AuthenticateUserModal";-import Collections from "components/Collections";+import { Collections } from "components/Collections";import { CollectionInfo } from "components/Collections/CollectionInfo";import CollectionNamer, {CollectionNamerAttributes,@@ -91,6 +92,7 @@ import {useMemo,useRef,useState,+ useSyncExternalStore,} from "react";import { useDropzone } from "react-dropzone";import {@@ -325,7 +327,9 @@ export default function Gallery() {//// - The collections bar is replaced with a people bar.// - The gallery itself shows files which contain this person.- const [person, setPerson] = useState<Person | undefined>();+ const [activePerson, setActivePerson] = useState<Person | undefined>();++ const people = useSyncExternalStore(peopleSubscribe, peopleSnapshot);const [filesDownloadProgressAttributesList,@@ -539,8 +543,8 @@ export default function Gallery() {filteredFiles = await filterSearchableFiles(selectedSearchOption.suggestion,);- } else if (person) {- const pfSet = new Set(person.fileIDs);+ } else if (activePerson) {+ const pfSet = new Set(activePerson.fileIDs);filteredFiles = files.filter((f) => pfSet.has(f.id));} else {filteredFiles = getUniqueFiles(@@ -617,7 +621,7 @@ export default function Gallery() {selectedSearchOption,activeCollectionID,archivedCollections,- person,+ activePerson,]);const selectAll = (e: KeyboardEvent) => {@@ -1024,10 +1028,18 @@ export default function Gallery() {console.log("onSelectPeople");};- if (person) {- log.debug(() => ["person", person]);+ if (activePerson) {+ log.debug(() => ["person", activePerson]);}+ const collectionBarMode = isInSearchMode+ ? "search"+ : isInHiddenSection+ ? "hidden-albums"+ : activePerson+ ? "people"+ : "albums";+return (<GalleryContext.Providervalue={{@@ -1111,27 +1123,27 @@ export default function Gallery() {setIsInSearchMode={setIsInSearchMode}onSelectSearchOption={handleSelectSearchOption}onSelectPeople={handleSelectPeople}- onSelectPerson={setPerson}+ onSelectPerson={setActivePerson}/>)}</NavbarBase><Collections- activeCollection={activeCollection}- isInSearchMode={isInSearchMode}- isInHiddenSection={isInHiddenSection}- activeCollectionID={activeCollectionID}- setActiveCollectionID={setActiveCollectionID}- collectionSummaries={collectionSummaries}- hiddenCollectionSummaries={hiddenCollectionSummaries}- setCollectionNamerAttributes={setCollectionNamerAttributes}- setPhotoListHeader={setPhotoListHeader}- setFilesDownloadProgressAttributesCreator={- setFilesDownloadProgressAttributesCreator- }- filesDownloadProgressAttributesList={- filesDownloadProgressAttributesList- }+ mode={collectionBarMode}+ {...{+ collectionSummaries,+ activeCollection,+ activeCollectionID,+ setActiveCollectionID,+ hiddenCollectionSummaries,+ people,+ activePerson,+ setActivePerson,+ setCollectionNamerAttributes,+ setPhotoListHeader,+ setFilesDownloadProgressAttributesCreator,+ filesDownloadProgressAttributesList,+ }}/><Uploader