From 5652811918d50f463f4e3c6265b8022c0dd1c2eb Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 3 Jun 2022 14:18:03 +0530 Subject: [PATCH] change collectionSummary to searchResultSummary --- src/components/Search/index.tsx | 4 ++-- src/components/Search/input.tsx | 8 +++----- src/pages/gallery/index.tsx | 6 +++--- src/types/gallery/index.ts | 8 ++++---- src/types/search/index.ts | 5 +++++ 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index e5dcba9c0..c3a154821 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -7,14 +7,14 @@ import { EnteFile } from 'types/file'; import { SearchBarWrapper, SearchButtonWrapper } from './styledComponents'; import SearchInput from './input'; import { Search } from 'types/search'; -import { SetSearchResultInfo } from 'types/gallery'; +import { SetSearchResultSummary } from 'types/gallery'; interface Props { isOpen: boolean; isFirstFetch: boolean; setOpen: (value: boolean) => void; setSearch: (search: Search) => void; - setSearchResultInfo: SetSearchResultInfo; + setSearchResultInfo: SetSearchResultSummary; collections: Collection[]; setActiveCollection: (id: number) => void; files: EnteFile[]; diff --git a/src/components/Search/input.tsx b/src/components/Search/input.tsx index 4416b9765..201632799 100644 --- a/src/components/Search/input.tsx +++ b/src/components/Search/input.tsx @@ -10,11 +10,10 @@ import { SearchInputWrapper } from './styledComponents'; import { SelectStyles } from './styles'; import AsyncSelect from 'react-select/async'; import CloseIcon from '@mui/icons-material/Close'; -import { SetSearch, SetSearchResultInfo } from 'types/gallery'; +import { SetSearch, SetSearchResultSummary } from 'types/gallery'; import { EnteFile } from 'types/file'; import { Collection } from 'types/collection'; import { OptionWithInfo } from './optionWithInfo'; -import { CollectionType } from 'constants/collection'; interface Iprops { isOpen: boolean; @@ -23,7 +22,7 @@ interface Iprops { files: EnteFile[]; collections: Collection[]; setActiveCollection: (id: number) => void; - setSearchResultInfo: SetSearchResultInfo; + setSearchResultInfo: SetSearchResultSummary; } export default function SearchInput(props: Iprops) { @@ -80,9 +79,8 @@ export default function SearchInput(props: Iprops) { break; } props.setSearchResultInfo({ - name: selectedOption.label, + optionName: selectedOption.label, fileCount: selectedOption.fileCount, - type: CollectionType.system, }); }; diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 4391c178b..8f0b7cd2d 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -179,7 +179,7 @@ export default function Gallery() { }); const [isInSearchMode, setIsInSearchMode] = useState(false); - const [searchResultInfo, setSearchResultInfo] = + const [searchResultSummary, setSetSearchResultSummary] = useState(null); const syncInProgress = useRef(true); const resync = useRef(false); @@ -630,7 +630,7 @@ export default function Gallery() { files={getNonTrashedUniqueUserFiles(files)} setActiveCollection={setActiveCollection} updateSearch={updateSearch} - setSearchResultInfo={setSearchResultInfo} + setSearchResultInfo={setSetSearchResultSummary} /> {isInSearchMode && ( - + )} >; export type SetCollections = React.Dispatch>; export type SetLoading = React.Dispatch>; -export type SetSearchResultInfo = React.Dispatch< - React.SetStateAction +export type SetSearchResultSummary = React.Dispatch< + React.SetStateAction >; export type SetSearch = React.Dispatch>; diff --git a/src/types/search/index.ts b/src/types/search/index.ts index 14d473522..7d415c591 100644 --- a/src/types/search/index.ts +++ b/src/types/search/index.ts @@ -34,6 +34,11 @@ export type Search = { file?: number; }; +export type SearchResultSummary = { + optionName: string; + fileCount: number; +}; + export interface SearchOption extends Suggestion { fileCount: number; previewFiles: EnteFile[];