diff --git a/back/app/services/export/xlsx/inputs_generator.rb b/back/app/services/export/xlsx/inputs_generator.rb index 76923930a34c..8cc8b4c5a62f 100644 --- a/back/app/services/export/xlsx/inputs_generator.rb +++ b/back/app/services/export/xlsx/inputs_generator.rb @@ -49,7 +49,7 @@ def generate_for_timeline_project(workbook, project) end def create_phase_sheet(workbook, phase) - inputs = eager_load_inputs(phase.ideas.published) + inputs = eager_load_inputs(phase.ideas.submitted_or_published) sheet_generator = InputSheetGenerator.new inputs, phase sheet_name = MultilocService.new.t phase.title_multiloc sheet_generator.generate_sheet(workbook, sheet_name) diff --git a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/BottomBar.tsx b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/BottomBar.tsx index 0906ba686634..75a00e97a50c 100644 --- a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/BottomBar.tsx +++ b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/BottomBar.tsx @@ -17,11 +17,10 @@ interface Props { onClick: (event: FormEvent) => void; ideaQueryParameters: InputFiltersProps['ideaQueryParameters']; filtersActive: boolean; - onReset: () => void; } const BottomBar = memo( - ({ onClick, ideaQueryParameters, onReset, filtersActive }) => { + ({ onClick, ideaQueryParameters, filtersActive }) => { const { data: ideasFilterCounts } = useIdeasFilterCounts(ideaQueryParameters); @@ -43,7 +42,7 @@ const BottomBar = memo( }} /> - + ); } diff --git a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/index.tsx b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/index.tsx index 26fcf4066baa..ceeeac0539d9 100644 --- a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/index.tsx +++ b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ButtonWithFiltersModal/FiltersModal/index.tsx @@ -19,7 +19,6 @@ interface Props extends InputFiltersProps { const FiltersModal = ({ opened, ideaQueryParameters, - onClearFilters, onClose, ...filtersProps }: Props) => { @@ -32,7 +31,6 @@ const FiltersModal = ({ } @@ -41,7 +39,6 @@ const FiltersModal = ({ import('./FiltersModal')); const ButtonWithFiltersModal = ({ ideaQueryParameters, - onClearFilters, ...filtersProps }: InputFiltersProps) => { const isSmallerThanTablet = useBreakpoint('tablet'); @@ -45,7 +44,6 @@ const ButtonWithFiltersModal = ({ diff --git a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/InputFilters.tsx b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/InputFilters.tsx index 1a2ef50f21ff..0e9e351051aa 100644 --- a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/InputFilters.tsx +++ b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/InputFilters.tsx @@ -26,7 +26,6 @@ export interface InputFiltersProps { ideasFilterCounts: IIdeasFilterCounts | NilOrError; numberOfSearchResults: number; ideaQueryParameters: Partial; - onClearFilters: () => void; onSearch: (searchTerm: string) => void; onChangeStatus: (ideaStatus: string | null) => void; onChangeTopics: (topics: string[] | null) => void; @@ -44,7 +43,6 @@ const InputFilters = ({ numberOfSearchResults, ideaQueryParameters, phaseId, - onClearFilters, showResetButton = true, showStatusFilter = true, showSearchField = true, @@ -101,10 +99,7 @@ const InputFilters = ({ )} {showResetButton && ( - + )} diff --git a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/MapView/FiltersMapView.tsx b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/MapView/FiltersMapView.tsx index 2d8b2418f980..2f1c60eb670c 100644 --- a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/MapView/FiltersMapView.tsx +++ b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/MapView/FiltersMapView.tsx @@ -14,7 +14,6 @@ interface Props extends InputFiltersProps { const FiltersMapView = ({ ideaQueryParameters, - onClearFilters, onClose, ...filtersProps }: Props) => { @@ -25,7 +24,6 @@ const FiltersMapView = ({ diff --git a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ResetFiltersButton.tsx b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ResetFiltersButton.tsx index 7f8a7a4c05d3..b0e75c9db2ae 100644 --- a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ResetFiltersButton.tsx +++ b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/ResetFiltersButton.tsx @@ -2,18 +2,34 @@ import React from 'react'; import { Button } from '@citizenlab/cl2-component-library'; +import tracks from 'components/IdeaCards/tracks'; + +import { trackEventByName } from 'utils/analytics'; import { FormattedMessage } from 'utils/cl-intl'; +import { updateSearchParams } from 'utils/cl-router/updateSearchParams'; import ideaCardsMessages from '../messages'; interface Props { - onClick: () => void; filtersActive: boolean; } -const ResetFiltersButton = ({ onClick, filtersActive }: Props) => { +const ResetFiltersButton = ({ filtersActive }: Props) => { + const handleOnClick = () => { + trackEventByName(tracks.clearFiltersClicked); + updateSearchParams({ + search: undefined, + idea_status: undefined, + topics: undefined, + }); + }; + return ( - ); diff --git a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/index.tsx b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/index.tsx index 6b21d0f836b4..f99d7924b6b6 100644 --- a/front/app/components/IdeaCards/IdeasWithFiltersSidebar/index.tsx +++ b/front/app/components/IdeaCards/IdeasWithFiltersSidebar/index.tsx @@ -190,15 +190,6 @@ const IdeasWithFiltersSidebar = ({ [onUpdateQuery] ); - const clearFilters = useCallback(() => { - trackEventByName(tracks.clearFiltersClicked); - onUpdateQuery({ - search: undefined, - idea_status: undefined, - topics: undefined, - }); - }, [onUpdateQuery]); - const filtersActive = !!( ideaQueryParameters.search || ideaQueryParameters.idea_status || @@ -213,7 +204,6 @@ const IdeasWithFiltersSidebar = ({ ideasFilterCounts, numberOfSearchResults: ideasCount, ideaQueryParameters, - onClearFilters: clearFilters, onSearch: handleSearchOnChange, onChangeStatus: handleStatusOnChange, onChangeTopics: handleTopicsOnChange, diff --git a/front/app/components/IdeasMap/desktop/MapIdeasList.tsx b/front/app/components/IdeasMap/desktop/MapIdeasList.tsx index c0be68e0d2c0..7171767403a0 100644 --- a/front/app/components/IdeasMap/desktop/MapIdeasList.tsx +++ b/front/app/components/IdeasMap/desktop/MapIdeasList.tsx @@ -59,14 +59,13 @@ const MapIdeasList = memo( onChangeStatus, onChangeTopics, handleSortOnChange, - onClearFilters, filtersActive, ideasFilterCounts, numberOfSearchResults, } = inputFiltersProps ?? {}; const hasInputFilterProps = - onChangeStatus && onChangeTopics && handleSortOnChange && onClearFilters; + onChangeStatus && onChangeTopics && handleSortOnChange; const { data: ideaCustomFieldsSchema } = useIdeaJsonFormSchema({ projectId, @@ -127,7 +126,6 @@ const MapIdeasList = memo( <>