mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 09:26:17 -05:00
Modifying Dashboard search clear button to clear all search params.
This commit is contained in:
parent
bd8411bcd7
commit
dd13534a39
7 changed files with 43 additions and 11 deletions
|
|
@ -38,7 +38,7 @@ const SUGGESTED_APPS = [
|
|||
export const useSearch = (defaultLimit = 48, totalPages = 0, emptySearch = false, model) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const {dateRange, setDateRange, months, setDates} = useSearchDate();
|
||||
const {dateRange, setDateRange, months, setDates, isEmpty: datesIsEmpty} = useSearchDate();
|
||||
const {searchParams, updateQuery, getLocationStr} = React.useContext(QueryContext);
|
||||
// `searchStr` means actually fetch the files/zims.
|
||||
const searchStr = searchParams.get('q');
|
||||
|
|
@ -50,6 +50,9 @@ export const useSearch = (defaultLimit = 48, totalPages = 0, emptySearch = false
|
|||
// archive/video/ebook/etc.
|
||||
const model_ = searchParams.get('model') || model;
|
||||
|
||||
const anySearch = (!datesIsEmpty) || searchStr || (activeTags && activeTags.length > 0) || filter || model;
|
||||
const isEmpty = !anySearch;
|
||||
|
||||
const setSearchStr = (value) => {
|
||||
const searchQuery = {q: value, o: 0};
|
||||
if (filter) {
|
||||
|
|
@ -90,6 +93,7 @@ export const useSearch = (defaultLimit = 48, totalPages = 0, emptySearch = false
|
|||
clearSearch,
|
||||
setTags,
|
||||
months, dateRange, setDateRange, setDates,
|
||||
anySearch, isEmpty,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue