diff --git a/apps/portal/src/components/questions/QuestionSearchBar.tsx b/apps/portal/src/components/questions/QuestionSearchBar.tsx index 1ccec162..bfd378ad 100644 --- a/apps/portal/src/components/questions/QuestionSearchBar.tsx +++ b/apps/portal/src/components/questions/QuestionSearchBar.tsx @@ -11,6 +11,7 @@ import type { SortOptionsSelectProps } from './SortOptionsSelect'; import { SortOrder, SortType } from '~/types/questions.d'; export type QuestionSearchBarProps = SortOptionsSelectProps & { + activeFilterCount: number; onFilterOptionsToggle: () => void; onQueryChange: (query: string) => void; query: string; @@ -33,6 +34,7 @@ function getSortOrderLabel(sortOrder: SortOrder, sortType: SortType): string { } export default function QuestionSearchBar({ + activeFilterCount, onFilterOptionsToggle, onQueryChange, query, @@ -55,22 +57,16 @@ export default function QuestionSearchBar({ }} /> -
+
-
-
diff --git a/apps/portal/src/pages/questions/browse.tsx b/apps/portal/src/pages/questions/browse.tsx index 6943fbdb..9cf9f6ab 100644 --- a/apps/portal/src/pages/questions/browse.tsx +++ b/apps/portal/src/pages/questions/browse.tsx @@ -149,13 +149,15 @@ export default function QuestionsBrowsePage() { }, }); - const hasFilters = useMemo( + const activeFilterCount = useMemo( () => - selectedCompanySlugs.length > 0 || - selectedQuestionTypes.length > 0 || - selectedQuestionAge !== 'all' || - selectedRoles.length > 0 || - selectedLocations.length > 0, + [ + ...selectedCompanySlugs, + ...selectedQuestionTypes, + ...(selectedQuestionAge !== 'all' ? [selectedQuestionAge] : []), + ...selectedRoles, + ...selectedLocations, + ].length, [ selectedCompanySlugs, selectedQuestionTypes, @@ -165,6 +167,8 @@ export default function QuestionsBrowsePage() { ], ); + const hasFilters = activeFilterCount > 0; + const today = useMemo(() => new Date(), []); const startDate = useMemo(() => { return selectedQuestionAge === 'last-year' @@ -522,6 +526,7 @@ export default function QuestionsBrowsePage() {