Skip to content

Commit

Permalink
remove language filter from search drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Hussein committed Jul 3, 2024
1 parent 6079d12 commit 4059d34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/components/Navbar/SearchDrawer/SearchDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import React, { RefObject, useEffect, useState } from 'react';

import dynamic from 'next/dynamic';
import useTranslation from 'next-translate/useTranslation';
import { shallowEqual, useDispatch, useSelector } from 'react-redux';

import SearchDrawerHeader from './Header';
Expand Down Expand Up @@ -39,7 +38,6 @@ const PAGE_SIZE = 10;
const DEBOUNCING_PERIOD_MS = 1000;

const SearchDrawer: React.FC = () => {
const { lang } = useTranslation();
const selectedTranslations = useSelector(selectSelectedTranslations, areArraysEqual);
const [focusInput, searchInputRef]: [() => void, RefObject<HTMLInputElement>] = useFocus();
const [searchQuery, setSearchQuery] = useState<string>('');
Expand Down Expand Up @@ -70,11 +68,11 @@ const SearchDrawer: React.FC = () => {
setIsSearching,
setHasError,
setSearchResult,
lang,
null,
selectedTranslations?.length && selectedTranslations.join(','),
);
}
}, [debouncedSearchQuery, selectedTranslations, dispatch, lang]);
}, [debouncedSearchQuery, selectedTranslations, dispatch]);

const resetQueryAndResults = () => {
logButtonClick('search_drawer_clear_input');
Expand Down
4 changes: 2 additions & 2 deletions src/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ export const searchGetResults = (
setIsSearching: (arg: boolean) => void,
setHasError: (arg: boolean) => void,
setSearchResult: (data: SearchResponse) => void,
languages: string,
languages?: string,
translations?: string,
) => {
setIsSearching(true);
logTextSearchQuery(query, source);
getSearchResults({
query,
filterLanguages: languages,
...(languages && { filterLanguages: languages }), // languages will be included only when there is a selected language
size: pageSize,
page,
...(translations && { filterTranslations: translations }), // translations will be included only when there is a selected translation
Expand Down

0 comments on commit 4059d34

Please sign in to comment.