From 91976157e44e319b23fd35fa89859164bab71202 Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Fri, 14 Mar 2025 21:21:12 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20cr=C3=A9ation=20d'une=20tooltip=20pour?= =?UTF-8?q?=20les=20informations=20suppl=C3=A9mentaires=20de=20l'enseignan?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Front-End/src/components/ProfileDirectory.js | 57 +++++++++++++------- Front-End/src/components/Tooltip.js | 30 +++++++++++ 2 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 Front-End/src/components/Tooltip.js diff --git a/Front-End/src/components/ProfileDirectory.js b/Front-End/src/components/ProfileDirectory.js index 41226b3..0809644 100644 --- a/Front-End/src/components/ProfileDirectory.js +++ b/Front-End/src/components/ProfileDirectory.js @@ -1,9 +1,10 @@ import React, { useState } from 'react'; -import { Trash2, Eye, EyeOff, ToggleLeft, ToggleRight } from 'lucide-react'; +import { Trash2, Eye, EyeOff, ToggleLeft, ToggleRight, Info } from 'lucide-react'; import Table from '@/components/Table'; import Popup from '@/components/Popup'; import StatusLabel from '@/components/StatusLabel'; import SpecialityItem from '@/components/Structure/Configuration/SpecialityItem'; +import Tooltip from '@/components/Tooltip'; const roleTypeToLabel = (roleType) => { switch (roleType) { @@ -83,7 +84,12 @@ const ProfileDirectory = ({ profileRoles, handleActivateProfile, handleDeletePro ) }, - { name: 'Utilisateur', transform: (row) => row.associated_person?.guardian_name }, + { name: 'Utilisateur', transform: (row) => ( +
+ {row.associated_person?.guardian_name} +
+ ) + }, { name: 'Elève(s) associé(s)', transform: (row) => (
{row.associated_person?.students?.map(student => ( @@ -133,22 +139,35 @@ const ProfileDirectory = ({ profileRoles, handleActivateProfile, handleDeletePro ) }, - { name: 'Utilisateur', transform: (row) => row.associated_person?.teacher_name }, - { name: 'Classe(s) associée(s)', transform: (row) => ( -
- {row.associated_person?.classes?.map(classe => ( - - {classe.name} - - ))} -
- ) - }, - { name: 'Spécialités', transform: (row) => ( -
- {row.associated_person?.specialities?.map(speciality => ( - - ))} + { name: 'Utilisateur', transform: (row) => ( +
+ {row.associated_person?.teacher_name} + +
+ Classes associées: +
+ {row.associated_person?.classes?.map(classe => ( + + {classe.name} + + ))} +
+
+
+ Spécialités: +
+ {row.associated_person?.specialities?.map(speciality => ( + + ))} +
+
+
+ }> + +
) }, @@ -176,7 +195,7 @@ const ProfileDirectory = ({ profileRoles, handleActivateProfile, handleDeletePro ]; return ( -
+
{parentProfiles.length === 0 ? ( diff --git a/Front-End/src/components/Tooltip.js b/Front-End/src/components/Tooltip.js new file mode 100644 index 0000000..335c588 --- /dev/null +++ b/Front-End/src/components/Tooltip.js @@ -0,0 +1,30 @@ +import React, { useState } from 'react'; +import PropTypes from 'prop-types'; + +const Tooltip = ({ content, children }) => { + const [visible, setVisible] = useState(false); + + return ( +
+
setVisible(true)} + onMouseLeave={() => setVisible(false)} + className="cursor-pointer" + > + {children} +
+ {visible && ( +
+ {content} +
+ )} +
+ ); +}; + +Tooltip.propTypes = { + content: PropTypes.node.isRequired, + children: PropTypes.node.isRequired, +}; + +export default Tooltip; \ No newline at end of file