Feature/search bar improvements (#455)
* Require search to be committed with enter * Extract back navigation logic into hook * Navigate to previous page when canceling search This makes the search the next page in the history stack instead of making it the previous one * Close and open search depending on the location and available query * Navigate to previous page in case new query is empty
This commit is contained in:
@@ -20,7 +20,7 @@ import { AppbarSearch } from '@/components/util/AppbarSearch';
|
||||
import { LangSelect } from '@/components/navbar/action/LangSelect';
|
||||
import { MangaGrid } from '@/components/MangaGrid';
|
||||
import { useDebounce } from '@/components/manga/hooks';
|
||||
import { NavBarContext } from '@/components/context/NavbarContext.tsx';
|
||||
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx';
|
||||
|
||||
type SourceLoadingState = { isLoading: boolean; hasResults: boolean; emptySearch: boolean };
|
||||
type SourceToLoadingStateMap = Map<string, SourceLoadingState>;
|
||||
@@ -161,6 +161,8 @@ export const SearchAll: React.FC = () => {
|
||||
|
||||
const { setTitle, setAction } = useContext(NavBarContext);
|
||||
|
||||
useSetDefaultBackTo('sources/all/search');
|
||||
|
||||
const [query] = useQueryParam('query', StringParam);
|
||||
const searchString = useDebounce(query, TRIGGER_SEARCH_THRESHOLD);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user