From 012a79689408f3ec66bc42727e26db95b4ace316 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 11 Sep 2024 17:05:28 +0530 Subject: [PATCH] New type --- web/apps/photos/src/services/searchService.ts | 4 ++-- web/packages/new/photos/services/search/types.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/web/apps/photos/src/services/searchService.ts b/web/apps/photos/src/services/searchService.ts index 47b6b27a2a..f10f9e95a3 100644 --- a/web/apps/photos/src/services/searchService.ts +++ b/web/apps/photos/src/services/searchService.ts @@ -14,8 +14,8 @@ import { SuggestionType, } from "@/new/photos/services/search/types"; import type { LocationTag } from "@/new/photos/services/user-entity"; -import { EnteFile } from "@/new/photos/types/file"; -import { Collection } from "types/collection"; +import { type EnteFile } from "@/new/photos/types/file"; +import { type Collection } from "types/collection"; import { getUniqueFiles } from "utils/file"; // Suggestions shown in the search dropdown when the user has typed something. diff --git a/web/packages/new/photos/services/search/types.ts b/web/packages/new/photos/services/search/types.ts index baddbfbb28..b375c05aeb 100644 --- a/web/packages/new/photos/services/search/types.ts +++ b/web/packages/new/photos/services/search/types.ts @@ -140,6 +140,17 @@ export interface SearchResultSummary { fileCount: number; } +export type SearchSuggestion = { label: string } & ( + | { type: "collection"; collectionID: number } + | { type: "files"; fileIDs: number[] } + | { type: "fileType"; fileType: FileType } + | { type: "date"; dateComponents: SearchDateComponents } + | { type: "location"; locationTag: LocationTag } + | { type: "city"; city: City } + | { type: "clip"; clipScoreForFileID: Map } + | { type: "cgroup"; cgroup: SearchPerson } +); + /** * An option shown in the the search bar's select dropdown. *