mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Ajout du logo de l'école
This commit is contained in:
@ -9,6 +9,9 @@ import { usePopup } from '@/context/PopupContext';
|
||||
import { getRightStr } from '@/utils/rights';
|
||||
import { ChevronDown } from 'lucide-react'; // Import de l'icône
|
||||
import Image from 'next/image'; // Import du composant Image
|
||||
import {
|
||||
BASE_URL,
|
||||
} from '@/utils/Url';
|
||||
|
||||
const ProfileSelector = ({ onRoleChange, className = '' }) => {
|
||||
const {
|
||||
@ -20,6 +23,8 @@ const ProfileSelector = ({ onRoleChange, className = '' }) => {
|
||||
user,
|
||||
setSelectedEstablishmentEvaluationFrequency,
|
||||
setSelectedEstablishmentTotalCapacity,
|
||||
selectedEstablishmentLogo,
|
||||
setSelectedEstablishmentLogo
|
||||
} = useEstablishment();
|
||||
const { isConnected, connectionStatus } = useChatConnection();
|
||||
const [dropdownOpen, setDropdownOpen] = useState(false);
|
||||
@ -33,12 +38,15 @@ const ProfileSelector = ({ onRoleChange, className = '' }) => {
|
||||
user.roles[roleId].establishment__evaluation_frequency;
|
||||
const establishmentTotalCapacity =
|
||||
user.roles[roleId].establishment__total_capacity;
|
||||
const establishmentLogo =
|
||||
user.roles[roleId].establishment__logo;
|
||||
setProfileRole(role);
|
||||
setSelectedEstablishmentId(establishmentId);
|
||||
setSelectedEstablishmentEvaluationFrequency(
|
||||
establishmentEvaluationFrequency
|
||||
);
|
||||
setSelectedEstablishmentTotalCapacity(establishmentTotalCapacity);
|
||||
setSelectedEstablishmentLogo(establishmentLogo);
|
||||
setSelectedRoleId(roleId);
|
||||
if (onRoleChange) {
|
||||
onRoleChange(roleId);
|
||||
@ -99,14 +107,14 @@ const ProfileSelector = ({ onRoleChange, className = '' }) => {
|
||||
<div className={`relative ${className}`}>
|
||||
<DropdownMenu
|
||||
buttonContent={
|
||||
<div className="h-16 flex items-center gap-2 cursor-pointer px-4 bg-white">
|
||||
<div className="h-16 flex items-center gap-2 cursor-pointer px-4 bg-white h-24">
|
||||
<div className="relative">
|
||||
<Image
|
||||
src={getGravatarUrl(user?.email)}
|
||||
src={selectedEstablishmentLogo ? `${BASE_URL}${selectedEstablishmentLogo}` : getGravatarUrl(user?.email)}
|
||||
alt="Profile"
|
||||
className="w-10 h-10 rounded-full object-cover shadow-md"
|
||||
width={32}
|
||||
height={32}
|
||||
className="w-16 h-16 rounded-full object-cover shadow-md"
|
||||
width={64}
|
||||
height={64}
|
||||
/>
|
||||
{/* Bulle de statut de connexion au chat */}
|
||||
<div
|
||||
@ -116,7 +124,7 @@ const ProfileSelector = ({ onRoleChange, className = '' }) => {
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div
|
||||
className="font-bold text-left truncate max-w-full"
|
||||
className="font-bold text-left truncate max-w-full text-sm"
|
||||
title={user?.email}
|
||||
>
|
||||
{user?.email}
|
||||
@ -125,11 +133,16 @@ const ProfileSelector = ({ onRoleChange, className = '' }) => {
|
||||
className="text-sm text-gray-500 text-left truncate max-w-full"
|
||||
title={`${getRightStr(selectedEstablishment?.role_type) || ''}${selectedEstablishment?.name ? ', ' + selectedEstablishment.name : ''}`}
|
||||
>
|
||||
{getRightStr(selectedEstablishment?.role_type) || ''}
|
||||
{selectedEstablishment?.name
|
||||
? `, ${selectedEstablishment.name}`
|
||||
? `${selectedEstablishment.name}`
|
||||
: ''}
|
||||
</div>
|
||||
<div
|
||||
className="italic text-sm text-gray-500 text-left truncate max-w-full"
|
||||
title={`${getRightStr(selectedEstablishment?.role_type) || ''}${selectedEstablishment?.name ? ', ' + selectedEstablishment.name : ''}`}
|
||||
>
|
||||
{getRightStr(selectedEstablishment?.role_type) || ''}
|
||||
</div>
|
||||
</div>
|
||||
<ChevronDown
|
||||
className={`w-5 h-5 transition-transform duration-200 ${dropdownOpen ? 'rotate-180' : 'rotate-0'}`}
|
||||
|
||||
Reference in New Issue
Block a user