mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: création d'une tooltip pour les informations supplémentaires de
l'enseignant
This commit is contained in:
@ -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
|
||||
</span>
|
||||
)
|
||||
},
|
||||
{ name: 'Utilisateur', transform: (row) => row.associated_person?.guardian_name },
|
||||
{ name: 'Utilisateur', transform: (row) => (
|
||||
<div className="flex flex-col justify-center space-y-2">
|
||||
{row.associated_person?.guardian_name}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{ name: 'Elève(s) associé(s)', transform: (row) => (
|
||||
<div className="flex flex-col justify-center space-y-2">
|
||||
{row.associated_person?.students?.map(student => (
|
||||
@ -133,22 +139,35 @@ const ProfileDirectory = ({ profileRoles, handleActivateProfile, handleDeletePro
|
||||
</span>
|
||||
)
|
||||
},
|
||||
{ name: 'Utilisateur', transform: (row) => row.associated_person?.teacher_name },
|
||||
{ name: 'Classe(s) associée(s)', transform: (row) => (
|
||||
<div className="flex flex-wrap justify-center space-x-2">
|
||||
{row.associated_person?.classes?.map(classe => (
|
||||
<span key={classe.id} className="px-2 py-1 rounded-full bg-gray-200 text-gray-800">
|
||||
{classe.name}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{ name: 'Spécialités', transform: (row) => (
|
||||
<div className="flex flex-wrap justify-center space-x-2">
|
||||
{row.associated_person?.specialities?.map(speciality => (
|
||||
<SpecialityItem speciality={speciality} isDraggable={false}/>
|
||||
))}
|
||||
{ name: 'Utilisateur', transform: (row) => (
|
||||
<div className="flex items-center justify-center space-x-2">
|
||||
<span>{row.associated_person?.teacher_name}</span>
|
||||
<Tooltip content={
|
||||
<div>
|
||||
<div className="mb-2">
|
||||
<strong>Classes associées:</strong>
|
||||
<div className="flex flex-wrap justify-center space-x-2">
|
||||
{row.associated_person?.classes?.map(classe => (
|
||||
<span key={classe.id} className="px-2 py-1 rounded-full bg-gray-200 text-gray-800">
|
||||
{classe.name}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<strong>Spécialités:</strong>
|
||||
<div className="flex flex-wrap justify-center space-x-2">
|
||||
{row.associated_person?.specialities?.map(speciality => (
|
||||
<SpecialityItem key={speciality.name} speciality={speciality} isDraggable={false} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}>
|
||||
<button className="text-blue-500 hover:text-blue-700">
|
||||
<Info className="w-5 h-5" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
@ -176,7 +195,7 @@ const ProfileDirectory = ({ profileRoles, handleActivateProfile, handleDeletePro
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-lg shadow-lg w-full p-6">
|
||||
<div className="bg-white rounded-lg shadow-lg w-3/5 p-6">
|
||||
<div className="space-y-8">
|
||||
<div className="max-h-128 overflow-y-auto border rounded p-4">
|
||||
{parentProfiles.length === 0 ? (
|
||||
|
||||
30
Front-End/src/components/Tooltip.js
Normal file
30
Front-End/src/components/Tooltip.js
Normal file
@ -0,0 +1,30 @@
|
||||
import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Tooltip = ({ content, children }) => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="relative inline-block">
|
||||
<div
|
||||
onMouseEnter={() => setVisible(true)}
|
||||
onMouseLeave={() => setVisible(false)}
|
||||
className="cursor-pointer"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
{visible && (
|
||||
<div className="absolute z-10 w-64 p-2 bg-white border border-gray-200 rounded shadow-lg">
|
||||
{content}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Tooltip.propTypes = {
|
||||
content: PropTypes.node.isRequired,
|
||||
children: PropTypes.node.isRequired,
|
||||
};
|
||||
|
||||
export default Tooltip;
|
||||
Reference in New Issue
Block a user