Skip to content

Nouveau filtres fiche action #3805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

dimitrivalax
Copy link
Contributor

@dimitrivalax dimitrivalax commented Jun 19, 2025

Nouveau filtres de toutes les fiches actions :

  • actions mutualisées dans plusieurs plans
  • Date de fin prévisionnelle
  • Indicateur(s) associé(s)
  • option “sans priorité” au dropdown du filtre “Niveau de priorité”
  • Ajouter “Sans tags” en haut de la liste déroulante des valeurs, pour le dropdown “Tags personnalisés”
  • Notes de suivi
  • Années des notes de suivi
  • Lien sur graphiques du TBD:
    • graphe année note de suivi + clic
    • Rendre cliquable le “Sans indicateur associé”
    • rendre cliquable répartition par date de fin prévisonnelle”

notion :https://www.notion.so/accelerateur-transition-ecologique-ademe/Am-liorations-filtres-de-la-page-Toutes-les-FA-1746523d57d78056b00bf5be1762949c?source=copy_link

Comment on lines +183 to +185
<SelectWithTrueFalseUndefinedValueDropdown
values={filters.hasIndicateurLies}
onChange={(value) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je pense que ce composant SelectWithTrueFalseUndefinedValueDropdown peut être remplacé par un simple select qui prend des options

[{id: 1, label: "..."}, {id:2, label: "..."}, ...]

et c'est dans le onChange que le mapping est fait pour savoir si l'on parle d'une valeur true, false ou autre

@@ -59,374 +47,457 @@ const MenuFiltresToutesLesFichesAction = ({

const debutPeriodeRef = useRef<HTMLInputElement>(null);
const finPeriodeRef = useRef<HTMLInputElement>(null);
const { register, watch } = useForm({ defaultValues: filters });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tous les dropdowns ne sont pas branchés sur react-hook-form donc on est dans un entre-deux pas idéal je pense. Faudrait soit l'un soit l'autre.

Par ailleurs, avec react-hook-form, tu peux trigger le submit de ton formulaire sur des onChange event donc tu te retrouvais à faire setFilters uniquement dans le onSubmit.

Sinon, chaque dropdown et input manipuleraient uniquement les onChangefournit par react-hook-form.

Comment on lines +77 to +86
<PlansActionDropdown
values={filters.planActionIds}
onChange={({ plans }) => {
const { planActionIds, ...rest } = filters;
setFilters({
...rest,
...(plans ? { planActionIds: plans } : {}),
});
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avec react-hook-form only, on aurait ceci:

Suggested change
<PlansActionDropdown
values={filters.planActionIds}
onChange={({ plans }) => {
const { planActionIds, ...rest } = filters;
setFilters({
...rest,
...(plans ? { planActionIds: plans } : {}),
});
}}
/>
import { Controller } from 'react-hook-form';
<Controller
name="planActionIds"
control={control}
render={({ field }) => (
<PlansActionDropdown
values={field.value}
onChange={({ plans }) => {
field.onChange(plans || null);
}}
/>
)}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants