π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
wip: checkpoint
Manav Rathi6a24528ed022
diff --git a/web/apps/photos/src/components/Collections/CollectionListBar.tsx b/web/apps/photos/src/components/Collections/CollectionListBar.tsxindex 90b997987b..2d3f28cf56 100644--- a/web/apps/photos/src/components/Collections/CollectionListBar.tsx+++ b/web/apps/photos/src/components/Collections/CollectionListBar.tsx@@ -1,4 +1,5 @@import { useIsMobileWidth } from "@/base/hooks";+import type { Person } from "@/new/photos/services/ml/cgroups";import {IconButtonWithBG,Overlay,@@ -29,11 +30,15 @@ import { ALL_SECTION, COLLECTION_LIST_SORT_BY } from "utils/collection";import CollectionCard from "./CollectionCard";import CollectionListSortBy from "./CollectionListSortBy";-interface CollectionListBarProps {+export interface CollectionListBarProps {/**- * `true` if we're currently in the hidden section.+ * What are we displaying currently.*/- isInHiddenSection: boolean;+ mode: "albums" | "hidden-albums" | "people";+ /**+ * Massaged data about the collections that should be shown in the bar.+ */+ collectionSummaries: CollectionSummary[];/*** The ID of the currently active collection (if any)*/@@ -42,14 +47,6 @@ interface CollectionListBarProps {* Called when the user changes the active collection.*/setActiveCollectionID: (id?: number) => void;- /**- * The ID of the currently selected person (if any).- */- activePersonID: string | undefined;- /**- * Called when the user changes the active person.- */- setActivePersonID: (id: string | undefined) => void;/*** Called when the user selects the option to show a modal with all the* collections.@@ -65,21 +62,30 @@ interface CollectionListBarProps {*/setCollectionListSortBy: (v: COLLECTION_LIST_SORT_BY) => void;/**- * Massaged data about the collections that should be shown in the bar.+ * The list of people that should be shown in the bar.*/- collectionSummaries: CollectionSummary[];+ people: Person[];+ /**+ * The ID of the currently selected person (if any).+ */+ activePersonID: string | undefined;+ /**+ * Called when the user changes the active person.+ */+ setActivePersonID: (id: string | undefined) => void;}export const CollectionListBar: React.FC<CollectionListBarProps> = ({- isInHiddenSection,+ mode,+ collectionSummaries,activeCollectionID,setActiveCollectionID,- activePersonID,- // setActivePersonIDonShowAllCollections,collectionListSortBy,setCollectionListSortBy,- collectionSummaries,+ // people,+ // activePersonID,+ // setActivePersonID}) => {const windowSize = useWindowSize();const isMobile = useIsMobileWidth();@@ -155,16 +161,26 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({onCollectionClick,);- const mode = activePersonID ? "people" : "albums";-return (<CollectionListBarWrapper><SpaceBetweenFlex mb={1}><Stack direction="row" gap={1}>- <Typography color={mode == "people" ? "text.muted" : "text.base"}>- {isInHiddenSection ? t("HIDDEN_ALBUMS") : t("ALBUMS")}+ <Typography+ color={mode == "people" ? "text.muted" : "text.base"}+ >+ {mode == "hidden-albums"+ ? t("HIDDEN_ALBUMS")+ : t("ALBUMS")}</Typography>- {mode == "people" && <Typography>{t("people")}</Typography>}+ {process.env.NEXT_PUBLIC_ENTE_WIP_CL && (+ <Typography+ color={+ mode == "people" ? "text.base" : "text.muted"+ }+ >+ {t("people")}+ </Typography>+ )}</Stack>{isMobile && (<Box display="flex" alignItems={"center"} gap={1}>diff --git a/web/apps/photos/src/components/Collections/index.tsx b/web/apps/photos/src/components/Collections/index.tsxindex 3927cf70c4..6b16533699 100644--- a/web/apps/photos/src/components/Collections/index.tsx+++ b/web/apps/photos/src/components/Collections/index.tsx@@ -1,9 +1,13 @@import type { Collection } from "@/media/collection";+import type { Person } from "@/new/photos/services/ml/cgroups";import { useLocalState } from "@ente/shared/hooks/useLocalState";import { LS_KEYS } from "@ente/shared/storage/localStorage";import AllCollections from "components/Collections/AllCollections";import CollectionInfoWithOptions from "components/Collections/CollectionInfoWithOptions";-import { CollectionListBar } from "components/Collections/CollectionListBar";+import {+ CollectionListBar,+ type CollectionListBarProps,+} from "components/Collections/CollectionListBar";import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer";import CollectionShare from "components/Collections/CollectionShare";import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";@@ -25,29 +29,33 @@ import {} from "../FilesDownloadProgress";import AlbumCastDialog from "./CollectionOptions/AlbumCastDialog";-interface Iprops {+interface CollectionsProps {+ mode: CollectionListBarProps["mode"] | "search";+ collectionSummaries: CollectionSummaries;activeCollection: Collection;activeCollectionID?: number;setActiveCollectionID: (id?: number) => void;- isInSearchMode: boolean;- isInHiddenSection: boolean;- collectionSummaries: CollectionSummaries;hiddenCollectionSummaries: CollectionSummaries;+ people: Person[];+ activePersonID: string | undefined;+ setActivePersonID: (id: string | undefined) => void;setCollectionNamerAttributes: SetCollectionNamerAttributes;setPhotoListHeader: (value: TimeStampListItem) => void;filesDownloadProgressAttributesList: FilesDownloadProgressAttributes[];setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator;}-export default function Collections(props: Iprops) {+export default function Collections(props: CollectionsProps) {const {+ mode,+ collectionSummaries,activeCollection,- isInSearchMode,- isInHiddenSection,activeCollectionID,setActiveCollectionID,- collectionSummaries,hiddenCollectionSummaries,+ people,+ activePersonID,+ setActivePersonID,setCollectionNamerAttributes,setPhotoListHeader,filesDownloadProgressAttributesList,@@ -68,16 +76,18 @@ export default function Collections(props: Iprops) {const toShowCollectionSummaries = useMemo(() =>- isInHiddenSection ? hiddenCollectionSummaries : collectionSummaries,- [isInHiddenSection, hiddenCollectionSummaries, collectionSummaries],+ mode == "hidden-albums"+ ? hiddenCollectionSummaries+ : collectionSummaries,+ [mode, hiddenCollectionSummaries, collectionSummaries],);const shouldBeHidden = useMemo(() =>- isInSearchMode ||+ mode == "search" ||(!hasNonSystemCollections(toShowCollectionSummaries) &&activeCollectionID === ALL_SECTION),- [isInSearchMode, toShowCollectionSummaries, activeCollectionID],+ [mode, toShowCollectionSummaries, activeCollectionID],);const sortedCollectionSummaries = useMemo(@@ -101,9 +111,8 @@ export default function Collections(props: Iprops) {}, [activeCollectionID, filesDownloadProgressAttributesList]);useEffect(() => {- if (isInSearchMode) {- return;- }+ if (mode == "search") return;+setPhotoListHeader({item: (<CollectionInfoWithOptions@@ -129,12 +138,13 @@ export default function Collections(props: Iprops) {height: 68,});}, [+ mode,toShowCollectionSummaries,activeCollectionID,- isInSearchMode,isActiveCollectionDownloadInProgress,]);+ if (mode == "search") return <></>;if (shouldBeHidden) {return <></>;}@@ -147,16 +157,17 @@ export default function Collections(props: Iprops) {return (<><CollectionListBar- isInHiddenSection={isInHiddenSection}- activeCollectionID={activeCollectionID}- setActiveCollectionID={setActiveCollectionID}- activePersonID={- process.env.NEXT_PUBLIC_ENTE_WIP_CL ? "test" : undefined- }- setActivePersonID={(id) => console.log(id)}+ {...{+ mode,+ activeCollectionID,+ setActiveCollectionID,+ people,+ activePersonID,+ setActivePersonID,+ collectionListSortBy,+ setCollectionListSortBy,+ }}onShowAllCollections={openAllCollections}- collectionListSortBy={collectionListSortBy}- setCollectionListSortBy={setCollectionListSortBy}collectionSummaries={sortedCollectionSummaries.filter((x) =>shouldBeShownOnCollectionBar(x.type),)}@@ -171,7 +182,7 @@ export default function Collections(props: Iprops) {setActiveCollectionID={setActiveCollectionID}setCollectionListSortBy={setCollectionListSortBy}collectionListSortBy={collectionListSortBy}- isInHiddenSection={isInHiddenSection}+ isInHiddenSection={mode == "hidden-albums"}/><CollectionShare