Skip to content
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

feat: add questioning page #95

Merged
merged 13 commits into from
Nov 27, 2024
Merged

feat: add questioning page #95

merged 13 commits into from
Nov 27, 2024

Conversation

RenauxLeaInsee
Copy link
Contributor

No description provided.

@RenauxLeaInsee RenauxLeaInsee self-assigned this Oct 30, 2024
@RenauxLeaInsee RenauxLeaInsee marked this pull request as ready for review November 8, 2024 13:53
Copy link
Collaborator

@Grafikart Grafikart left a comment

Choose a reason for hiding this comment

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

Un petit changement concernant l'utilisation de watch() sinon c'est bon.

error={errors.lastName?.message}
{...register("lastName")}
onResetField={() => onResetField("lastName")}
isEmpty={watch("lastName") === ""}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cette approche risque de créer beaucoup de rerender je pense que dans ce cas là tu devrais passer par des champs contrôler ou brancher la logique de détection du vide directement dans Field

Comment on lines 107 to 111
props.isEmpty === false ? (
<IconButton sx={{ mr: 2 }} size="small" onClick={props.onResetField}>
<CloseIcon />
</IconButton>
) : undefined
Copy link
Collaborator

Choose a reason for hiding this comment

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

Essayer la syntaxe suivante :

props.isEmpty && <IconButton sx={{ mr: 2 }} size="small" onClick={props.onResetField}>
                <CloseIcon />
              </IconButton>

const status = formData.get("status")?.toString();

if (!status) {
toggleDialog(undefined);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ce undefined me semble bizarre, il faudrait avoir un état "closed" plutôt histoire d'être cohérent

@@ -23,6 +32,7 @@ type Props = Pick<TextFieldProps, "onChange" | "onBlur" | "name" | "label" | "re
labelOutside?: boolean;
options?: { label: string; value: string }[];
selectoptions?: string[];
onResetField?: () => void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

"onReset" serait suffisant, je ne pense pas que "field" apporte de l'information ici

Copy link
Collaborator

Choose a reason for hiding this comment

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

Aussi, on pourrait se demander si il est pertinent d'exposer cette propriété. Le clique sur un "reset" devrait vider la valeur du champs (est donc plutôt déclencher un onChange à vide non ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bien vu, j'ai supprimé onResetField et j'utilise onChange à la place

Comment on lines 311 to 315
field.value !== "" && (
<IconButton sx={{ mr: 2 }} size="small" onClick={onResetField}>
<CloseIcon />
</IconButton>
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Conditionner l'affichage de ce endAdornment si onResetField est présent. Certains champs pourrait ne pas être reset

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Plus besoin si j'utilise onChange à la place (tous les fields ont une fonction onChange et d'après la maquette cette fonctionnalité doit toujours être présente lorsqu'il y a une valeur ) ^^

Comment on lines 278 to 283
endAdornment: field.value !== "" && (
<IconButton size="small" onClick={onResetField}>
<CloseIcon />
</IconButton>
),
}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Conditionner l'affichage de ce endAdornment si onResetField est présent. Certains champs pourrait ne pas être reset

Comment on lines 244 to 248
endAdornment: field.value !== "" && (
<IconButton size="small" onClick={onResetField}>
<CloseIcon />
</IconButton>
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Conditionner l'affichage de ce endAdornment si onResetField est présent. Certains champs pourrait ne pas être reset

</Row>
{questioning.dateLastEvent && (
<Typography variant="bodyMedium">
{new Date(Date.parse(questioning.dateLastEvent)).toLocaleDateString()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Créer un composant pour ça pour éviter la répétition

<FormattedDate date={questioning.dateLastEvent}/>

/>
{questioning.dateLastCommunication && (
<Typography variant="bodyMedium">
{new Date(Date.parse(questioning.dateLastCommunication)).toLocaleDateString()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Créer un composant pour ça pour éviter la répétition

<FormattedDate date={questioning.dateLastEvent}/>

@RenauxLeaInsee RenauxLeaInsee merged commit 65738c6 into develop Nov 27, 2024
5 checks passed
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