Prune
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { assertionFailed } from "@/base/assert";
|
||||
import { useIsMobileWidth } from "@/base/hooks";
|
||||
import type { Collection } from "@/media/collection";
|
||||
import { FileType } from "@/media/file-type";
|
||||
import {
|
||||
isMLSupported,
|
||||
@@ -22,7 +21,6 @@ import {
|
||||
} from "@/new/photos/services/search/types";
|
||||
import { labelForSuggestionType } from "@/new/photos/services/search/ui";
|
||||
import type { LocationTag } from "@/new/photos/services/user-entity";
|
||||
import { EnteFile } from "@/new/photos/types/file";
|
||||
import {
|
||||
FreeFlowText,
|
||||
SpaceBetweenFlex,
|
||||
@@ -76,8 +74,6 @@ interface SearchBarProps {
|
||||
/** Enter or exit search mode. */
|
||||
setIsInSearchMode: (v: boolean) => void;
|
||||
updateSearch: UpdateSearch;
|
||||
collections: Collection[];
|
||||
files: EnteFile[];
|
||||
}
|
||||
|
||||
export type UpdateSearch = (
|
||||
@@ -140,16 +136,12 @@ interface SearchInputProps {
|
||||
isOpen: boolean;
|
||||
setIsOpen: (value: boolean) => void;
|
||||
updateSearch: UpdateSearch;
|
||||
files: EnteFile[];
|
||||
collections: Collection[];
|
||||
}
|
||||
|
||||
const SearchInput: React.FC<SearchInputProps> = ({
|
||||
isOpen,
|
||||
setIsOpen,
|
||||
updateSearch,
|
||||
files,
|
||||
collections,
|
||||
}) => {
|
||||
const appContext = useContext(AppContext);
|
||||
|
||||
@@ -199,8 +191,8 @@ const SearchInput: React.FC<SearchInputProps> = ({
|
||||
};
|
||||
|
||||
const getOptions = useCallback(
|
||||
pDebounce(getAutoCompleteSuggestions(files, collections), 250),
|
||||
[files, collections],
|
||||
pDebounce(getAutoCompleteSuggestions(), 250),
|
||||
[],
|
||||
);
|
||||
|
||||
const search = (selectedOption: SearchOption) => {
|
||||
|
||||
@@ -1099,8 +1099,6 @@ export default function Gallery() {
|
||||
isInSearchMode={isInSearchMode}
|
||||
setIsInSearchMode={setIsInSearchMode}
|
||||
updateSearch={updateSearch}
|
||||
collections={collections}
|
||||
files={files}
|
||||
/>
|
||||
)}
|
||||
</NavbarBase>
|
||||
@@ -1279,8 +1277,6 @@ interface NormalNavbarContentsProps {
|
||||
isInSearchMode: boolean;
|
||||
setIsInSearchMode: (v: boolean) => void;
|
||||
updateSearch: UpdateSearch;
|
||||
collections: Collection[];
|
||||
files: EnteFile[];
|
||||
}
|
||||
|
||||
const NormalNavbarContents: React.FC<NormalNavbarContentsProps> = ({
|
||||
@@ -1289,8 +1285,6 @@ const NormalNavbarContents: React.FC<NormalNavbarContentsProps> = ({
|
||||
isInSearchMode,
|
||||
setIsInSearchMode,
|
||||
updateSearch,
|
||||
collections,
|
||||
files,
|
||||
}) => (
|
||||
<>
|
||||
{!isInSearchMode && <SidebarButton onClick={openSidebar} />}
|
||||
@@ -1298,8 +1292,6 @@ const NormalNavbarContents: React.FC<NormalNavbarContentsProps> = ({
|
||||
isInSearchMode={isInSearchMode}
|
||||
setIsInSearchMode={setIsInSearchMode}
|
||||
updateSearch={updateSearch}
|
||||
collections={collections}
|
||||
files={files}
|
||||
/>
|
||||
{!isInSearchMode && <UploadButton onClick={openUploader} />}
|
||||
</>
|
||||
|
||||
@@ -2,11 +2,9 @@ import { isDesktop } from "@/base/app";
|
||||
import log from "@/base/log";
|
||||
import { masterKeyFromSession } from "@/base/session-store";
|
||||
import { ComlinkWorker } from "@/base/worker/comlink-worker";
|
||||
import type { Collection } from "@/media/collection";
|
||||
import { FileType } from "@/media/file-type";
|
||||
import type { LocationTag } from "@/new/photos/services/user-entity";
|
||||
import i18n, { t } from "i18next";
|
||||
import type { EnteFile } from "../../types/file";
|
||||
import { clipMatches, isMLEnabled } from "../ml";
|
||||
import type {
|
||||
City,
|
||||
@@ -166,12 +164,9 @@ const labelledFileTypes = (): LabelledFileType[] => [
|
||||
|
||||
// Suggestions shown in the search dropdown when the user has typed something.
|
||||
export const getAutoCompleteSuggestions =
|
||||
(files: EnteFile[], collections: Collection[]) =>
|
||||
() =>
|
||||
async (searchPhrase: string): Promise<SearchOption[]> => {
|
||||
log.debug(() => [
|
||||
"getAutoCompleteSuggestions",
|
||||
{ searchPhrase, files, collections },
|
||||
]);
|
||||
log.debug(() => ["getAutoCompleteSuggestions"]);
|
||||
try {
|
||||
const suggestions: Suggestion[] =
|
||||
await suggestionsForString(searchPhrase);
|
||||
|
||||
Reference in New Issue
Block a user