mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 10:42:12 +00:00
feat: implement search history
This commit is contained in:
parent
e823664aaf
commit
fcc3317dc8
4 changed files with 18 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ const { useTranslation } = require('react-i18next');
|
|||
const { default: Icon } = require('@stremio/stremio-icons/react');
|
||||
const { Image, MainNavBars, MetaRow, MetaItem, withCoreSuspender, getVisibleChildrenRange } = require('stremio/common');
|
||||
const useSearch = require('./useSearch');
|
||||
const useSearchHistory = require('./useSearchHistory');
|
||||
const styles = require('./styles');
|
||||
|
||||
const THRESHOLD = 100;
|
||||
|
|
@ -15,6 +16,8 @@ const THRESHOLD = 100;
|
|||
const Search = ({ queryParams }) => {
|
||||
const { t } = useTranslation();
|
||||
const [search, loadSearchRows] = useSearch(queryParams);
|
||||
const searchHistory = useSearchHistory();
|
||||
console.log(searchHistory);
|
||||
const query = React.useMemo(() => {
|
||||
return search.selected !== null ?
|
||||
search.selected.extra.reduceRight((query, [name, value]) => {
|
||||
|
|
|
|||
2
src/routes/Search/useSearchHistory.d.ts
vendored
Normal file
2
src/routes/Search/useSearchHistory.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
declare const useSearchHistory: () => SearchHistory;
|
||||
export = useSearchHistory;
|
||||
10
src/routes/Search/useSearchHistory.js
Normal file
10
src/routes/Search/useSearchHistory.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright (C) 2017-2023 Smart code 203358507
|
||||
|
||||
const useModelState = require('stremio/common/useModelState');
|
||||
|
||||
const useSearchHistory = () => {
|
||||
const { searchHistory } = useModelState({ model: 'ctx' });
|
||||
return searchHistory;
|
||||
};
|
||||
|
||||
module.exports = useSearchHistory;
|
||||
3
src/types/models/Ctx.d.ts
vendored
3
src/types/models/Ctx.d.ts
vendored
|
|
@ -56,7 +56,10 @@ type NotificationItem = {
|
|||
videoReleased: string,
|
||||
}
|
||||
|
||||
type SearchHistory = string[];
|
||||
|
||||
type Ctx = {
|
||||
profile: Profile,
|
||||
notifications: Notifications,
|
||||
searchHistory: SearchHistory,
|
||||
};
|
||||
Loading…
Reference in a new issue