Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

person sugg

Manav Rathic595c88e8270
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index b2aa2d571d..96913963d4 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -962,15 +962,22 @@ export default function Gallery() {
const handleSelectSearchOption = (
searchOption: SearchOption | undefined,
) => {
- if (searchOption?.suggestion.type == "collection") {
+ const type = searchOption?.suggestion.type;
+ if (type == "collection" || type == "person") {
setIsInSearchMode(false);
setSelectedSearchOption(undefined);
- setActiveCollectionID(searchOption.suggestion.collectionID);
+ if (type == "collection") {
+ setBarMode("albums");
+ setActiveCollectionID(searchOption.suggestion.collectionID);
+ } else {
+ setBarMode("people");
+ setActivePerson(searchOption.suggestion.person);
+ }
} else {
setIsInSearchMode(!!searchOption);
setSelectedSearchOption(searchOption);
}
- setIsClipSearchResult(searchOption?.suggestion.type == "clip");
+ setIsClipSearchResult(type == "clip");
};
const openUploader = (intent?: UploadTypeSelectorIntent) => {
diff --git a/web/packages/new/photos/components/SearchBar.tsx b/web/packages/new/photos/components/SearchBar.tsx
index 752b8aeec7..aacf829ca5 100644
--- a/web/packages/new/photos/components/SearchBar.tsx
+++ b/web/packages/new/photos/components/SearchBar.tsx
@@ -151,9 +151,10 @@ const SearchInput: React.FC<Omit<SearchBarProps, "onShowSearchInput">> = ({
const components = useMemo(() => ({ Control, Input, Option }), []);
const handleChange = (value: SearchOption | null) => {
- // Collection suggestions are handled differently - our caller will
- // switch to the collection view, dismissing search.
- if (value?.suggestion.type == "collection") {
+ const type = value?.suggestion.type;
+ // Collection and people suggestions are handled differently - our
+ // caller will switch to the corresponding view, dismissing search.
+ if (type == "collection" || type == "person") {
setValue(null);
setInputValue("");
} else {