π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Selection reset will automatically happen on deleting
Manav Rathi531d4ede4059
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 9aba0993ec..cf4e171e98 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -854,11 +854,6 @@ export default function Gallery() {});};- const handleSelectPerson = (personID: string | undefined) =>- personID- ? dispatch({ type: "showPerson", personID })- : dispatch({ type: "showPeople" });-const handleOpenCollectionSelector = useCallback((attributes: CollectionSelectorAttributes) => {setCollectionSelectorAttributes(attributes);@@ -980,7 +975,10 @@ export default function Gallery() {onShowSearchInput: () =>dispatch({ type: "enterSearchMode" }),onSelectSearchOption: handleSelectSearchOption,- onSelectPerson: handleSelectPerson,+ onSelectPeople: () =>+ dispatch({ type: "showPeople" }),+ onSelectPerson: (personID) =>+ dispatch({ type: "showPerson", personID }),}}/>)}@@ -1003,7 +1001,8 @@ export default function Gallery() {? state.view.visiblePeople: undefined) ?? [],activePerson,- onSelectPerson: handleSelectPerson,+ onSelectPerson: (personID) =>+ dispatch({ type: "showPerson", personID }),setCollectionNamerAttributes,setPhotoListHeader,setFilesDownloadProgressAttributesCreator,diff --git a/web/packages/new/photos/components/SearchBar.tsx b/web/packages/new/photos/components/SearchBar.tsxindex f776d137c3..d2eeb78cc6 100644--- a/web/packages/new/photos/components/SearchBar.tsx+++ b/web/packages/new/photos/components/SearchBar.tsx@@ -68,11 +68,12 @@ export interface SearchBarProps {*/onSelectSearchOption: (o: SearchOption | undefined) => void;/**- * Called when the user selects a person shown in the empty state view, or- * clicks the people list header itself.- *- * @param personID The person ID of the selected person, or `undefined` if- * the user clicked the generic "People" header.+ * Called when the user selects the generic "People" header in the empty+ * state view.+ */+ onSelectPeople: () => void;+ /**+ * Called when the user selects a person shown in the empty state view.*/onSelectPerson: (personID: string | undefined) => void;}@@ -126,6 +127,7 @@ const MobileSearchArea: React.FC<MobileSearchAreaProps> = ({ onSearch }) => (const SearchInput: React.FC<Omit<SearchBarProps, "onShowSearchInput">> = ({isInSearchMode,onSelectSearchOption,+ onSelectPeople,onSelectPerson,}) => {// A ref to the top level Select.@@ -184,6 +186,11 @@ const SearchInput: React.FC<Omit<SearchBarProps, "onShowSearchInput">> = ({onSelectSearchOption(undefined);};+ const handleSelectPeople = () => {+ resetSearch();+ onSelectPeople();+ };+const handleSelectPerson = (personID: string | undefined) => {resetSearch();onSelectPerson(personID);@@ -218,7 +225,10 @@ const SearchInput: React.FC<Omit<SearchBarProps, "onShowSearchInput">> = ({placeholder={t("search_hint")}noOptionsMessage={({ inputValue }) =>shouldShowEmptyState(inputValue) ? (- <EmptyState onSelectPerson={handleSelectPerson} />+ <EmptyState+ onSelectPeople={handleSelectPeople}+ onSelectPerson={handleSelectPerson}+ />) : null}/>@@ -372,9 +382,9 @@ const shouldShowEmptyState = (inputValue: string) => {* The view shown in the menu area when the user has not typed anything in the* search box.*/-const EmptyState: React.FC<Pick<SearchBarProps, "onSelectPerson">> = ({- onSelectPerson,-}) => {+const EmptyState: React.FC<+ Pick<SearchBarProps, "onSelectPeople" | "onSelectPerson">+> = ({ onSelectPeople, onSelectPerson }) => {const mlStatus = useMLStatusSnapshot();const people = usePeopleStateSnapshot()?.visiblePeople;@@ -408,9 +418,7 @@ const EmptyState: React.FC<Pick<SearchBarProps, "onSelectPerson">> = ({<Box sx={{ textAlign: "left" }}>{people && people.length > 0 && (<>- <SearchPeopleHeader- onClick={() => onSelectPerson(undefined)}- />+ <SearchPeopleHeader onClick={onSelectPeople} /><SearchPeopleList {...{ people, onSelectPerson }} /></>)}diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/packages/new/photos/components/gallery/BarImpl.tsxindex 58542e40dc..6821b622b0 100644--- a/web/packages/new/photos/components/gallery/BarImpl.tsx+++ b/web/packages/new/photos/components/gallery/BarImpl.tsx@@ -94,11 +94,6 @@ export interface GalleryBarImplProps {* The currently selected person, if any.*/activePerson: Person | undefined;- /**- * Called when the selection should be moved to first person in the bar (if- * any).- */- onResetPersonSelection: () => void;/*** Called when the selection should be moved to a new person in the bar.*/diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsxindex 6ba276b2bd..059e1fad23 100644--- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx+++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx@@ -76,7 +76,7 @@ import { GalleryItemsHeaderAdapter, GalleryItemsSummary } from "./ListHeader";type PeopleHeaderProps = Pick<GalleryBarImplProps,- "people" | "onSelectPerson" | "onResetPersonSelection"+ "people" | "onSelectPerson"> & {person: Person;};@@ -84,17 +84,13 @@ type PeopleHeaderProps = Pick<export const PeopleHeader: React.FC<PeopleHeaderProps> = ({people,onSelectPerson,- onResetPersonSelection,person,}) => {return (<GalleryItemsHeaderAdapter><SpaceBetweenFlex>{person.type == "cgroup" ? (- <CGroupPersonHeader- person={person}- {...{ onResetPersonSelection }}- />+ <CGroupPersonHeader person={person} />) : (<ClusterPersonHeaderperson={person}@@ -106,17 +102,11 @@ export const PeopleHeader: React.FC<PeopleHeaderProps> = ({);};-type CGroupPersonHeaderProps = Pick<- PeopleHeaderProps,- "onResetPersonSelection"-> & {+interface CGroupPersonHeaderProps {person: CGroupPerson;-};+}-const CGroupPersonHeader: React.FC<CGroupPersonHeaderProps> = ({- person,- onResetPersonSelection,-}) => {+const CGroupPersonHeader: React.FC<CGroupPersonHeaderProps> = ({ person }) => {const cgroup = person.cgroup;const { showMiniDialog } = useAppContext();@@ -137,10 +127,7 @@ const CGroupPersonHeader: React.FC<CGroupPersonHeaderProps> = ({continue: {text: t("reset"),color: "primary",- action: async () => {- await deleteCGroup(cgroup);- onResetPersonSelection();- },+ action: () => deleteCGroup(cgroup),},});