Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prune

Manav Rathi63c1e630350c
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index 705677778c..1ca3140377 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -123,6 +123,10 @@ export interface FileListProps {
*/
modePlus?: GalleryBarMode | "search";
showAppDownloadBanner?: boolean;
+ /**
+ * If `true`, then the current listing is showing magic search results.
+ */
+ isMagicSearchResult?: boolean;
selectable?: boolean;
setSelected: (
selected: SelectedState | ((selected: SelectedState) => SelectedState),
@@ -167,6 +171,7 @@ export const FileList: React.FC<FileListProps> = ({
modePlus,
annotatedFiles,
showAppDownloadBanner,
+ isMagicSearchResult,
selectable,
selected,
setSelected,
@@ -235,7 +240,7 @@ export const FileList: React.FC<FileListProps> = ({
),
);
}
- if (galleryContext.isClipSearchResult) {
+ if (isMagicSearchResult) {
noGrouping(timeStampList);
} else {
groupByTime(timeStampList);
@@ -277,7 +282,7 @@ export const FileList: React.FC<FileListProps> = ({
annotatedFiles,
galleryContext.photoListHeader,
publicCollectionGalleryContext.photoListHeader,
- galleryContext.isClipSearchResult,
+ isMagicSearchResult,
]);
useEffect(() => {
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index 6c512e75f2..d2c22ae352 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -53,6 +53,7 @@ export type FileListWithViewerProps = {
| "mode"
| "modePlus"
| "showAppDownloadBanner"
+ | "isMagicSearchResult"
| "selectable"
| "selected"
| "setSelected"
@@ -89,6 +90,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
files,
enableDownload,
showAppDownloadBanner,
+ isMagicSearchResult,
selectable,
selected,
setSelected,
@@ -175,6 +177,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
mode,
modePlus,
showAppDownloadBanner,
+ isMagicSearchResult,
selectable,
selected,
setSelected,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 77174822c9..8420be8e92 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -137,7 +137,6 @@ const defaultGalleryContext: GalleryContextType = {
userIDToEmailMap: null,
emailList: null,
openHiddenSection: () => null,
- isClipSearchResult: null,
selectedFile: null,
setSelectedFiles: () => null,
};
@@ -202,9 +201,6 @@ const Page: React.FC = () => {
const peopleState = usePeopleStateSnapshot();
- const [isClipSearchResult, setIsClipSearchResult] =
- useState<boolean>(false);
-
// The (non-sticky) header shown at the top of the gallery items.
const [photoListHeader, setPhotoListHeader] =
useState<TimeStampListItem>(null);
@@ -758,7 +754,6 @@ const Page: React.FC = () => {
} else {
dispatch({ type: "exitSearch" });
}
- setIsClipSearchResult(type == "clip");
};
const openUploader = (intent?: UploadTypeSelectorIntent) => {
@@ -895,7 +890,6 @@ const Page: React.FC = () => {
userIDToEmailMap: state.emailByUserID,
emailList: state.shareSuggestionEmails,
openHiddenSection,
- isClipSearchResult,
selectedFile: selected,
setSelectedFiles: setSelected,
}}
@@ -1094,6 +1088,9 @@ const Page: React.FC = () => {
showAppDownloadBanner={
state.collectionFiles.length < 30 && !isInSearchMode
}
+ isMagicSearchResult={
+ state.searchSuggestion?.type == "clip"
+ }
selectable={true}
selected={selected}
setSelected={setSelected}
diff --git a/web/apps/photos/src/types/gallery/index.ts b/web/apps/photos/src/types/gallery/index.ts
index a717d31295..012df9a13c 100644
--- a/web/apps/photos/src/types/gallery/index.ts
+++ b/web/apps/photos/src/types/gallery/index.ts
@@ -46,7 +46,6 @@ export interface GalleryContextType {
userIDToEmailMap: Map<number, string>;
emailList: string[];
openHiddenSection: (callback?: () => void) => void;
- isClipSearchResult: boolean;
setSelectedFiles: (value) => void;
selectedFile: SelectedState;
}