Skip to content

Conversation

basseche
Copy link
Contributor

No description provided.

… equipment type and add new Fields for Aleas by filter

Signed-off-by: basseche <[email protected]>
@basseche basseche self-assigned this Aug 22, 2025
@basseche basseche changed the title Add color map to DirectoryItemInput so we can give different color by equipmentType and add Fields needed for contingency list by filter WIP : Add color map to DirectoryItemInput so we can give different color by equipmentType and add Fields needed for contingency list by filter Sep 2, 2025
@basseche basseche force-pushed the contingencyListByFilter branch 3 times, most recently from b0f47df to 5b94394 Compare September 4, 2025 07:58
Signed-off-by: basseche <[email protected]>
@basseche basseche force-pushed the contingencyListByFilter branch from 5b94394 to bf01977 Compare September 4, 2025 07:59
@basseche basseche changed the title WIP : Add color map to DirectoryItemInput so we can give different color by equipmentType and add Fields needed for contingency list by filter Add color map to DirectoryItemInput so we can give different color by equipmentType and add Fields needed for contingency list by filter Sep 11, 2025
Copy link

@flomillot flomillot self-requested a review September 17, 2025 15:18
fields: elements,
append,
remove,
} = useFieldArray({
Copy link
Contributor

Choose a reason for hiding this comment

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

À mon avis il n'y a plus besoin de renommer fields ici vu qu'il est déjà renommé en bas, autant garder le nom d'origine ici plutôt que de le changer 2 fois

{elementsWithMetaData.map((item, index) => (
<Box key={`Box${item.id}`} sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
<Chip
key={item.id}
Copy link
Contributor

Choose a reason for hiding this comment

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

Il y a toujours besoin de la prop key vu qu'il a été ajouté sur la box au-dessus ?

Comment on lines +198 to +201
item.specificMetadata?.equipmentType &&
equipmentColorsMap?.has(item.specificMetadata?.equipmentType)
? equipmentColorsMap.get(item.specificMetadata.equipmentType)
: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
item.specificMetadata?.equipmentType &&
equipmentColorsMap?.has(item.specificMetadata?.equipmentType)
? equipmentColorsMap.get(item.specificMetadata.equipmentType)
: undefined,
equipmentColorsMap?.get(item.specificMetadata?.equipmentType)

Corrigez moi si je me trompe mais je crois que du coup ça revient exactement a la même chose

}
/>
{elementsWithMetaData.map((item, index) => (
<Box key={`Box${item.id}`} sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

C'est pas quelque chose dont on risque d'avoir besoin ailleurs ? il faudrait peut-être sortir ce code et en faire un composant ?

<Chip
key={item.id}
size="small"
sx={{
Copy link
Contributor

Choose a reason for hiding this comment

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

Au lieu d'utiliser sx et la variable css backgroundcolor, pas possible d'utiliser tout simplement color de Chip ?
J'ai pas testé mais à mon avis ça doit être la même chose.
https://mui.com/material-ui/api/chip/#props

}
/>
{elementsWithMetaData.map((item, index) => (
<Box key={`Box${item.id}`} sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Petite question, pourquoi mettre box devant l'id ?
Je pense que c'est moins performant que de mettre directement l'id.

} = useFieldArray({
name,
});
const elementsWithMetaData: TreeViewFinderNodeProps[] = elements as unknown as TreeViewFinderNodeProps[];
Copy link
Contributor

Choose a reason for hiding this comment

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

On est sûr que les champs correspondent toujours à ce type TreeViewFinderNodeProps ?
J'ai essayé de remonter pour voir où se composant était utilisé et franchement j'ai toujours aucune idée d'à quoi ressemble ce formulaire.
En tout cas rien que le nom est bizarre, d'après le nom c'est censé être utilisé uniquement dans l'arbre mais je vois qu'il est un peu partout...

return '';
}
return equipmentType !== EquipmentType.HVDC_LINE
? (BASE_EQUIPMENTS[equipmentType as EquipmentType]?.label ?? '')
Copy link
Contributor

Choose a reason for hiding this comment

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

Pourquoi ne pas rajouter ce type d'équipement dans BASE_EQUIPMENTS ?

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