Added Function to config Profil

This commit is contained in:
2026-02-08 14:21:07 +01:00
parent ff6201a42c
commit f1e9e3f8d4
11 changed files with 557 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ interface User {
id: string;
email: string;
name: string | null;
photoUrl?: string | null;
roleId?: string | null;
}
@@ -71,7 +72,14 @@ export default function DashboardLayout({ user, children }: DashboardLayoutProps
fetcher
);
// Récupérer le profil complet de l'utilisateur pour la photo
const { data: userProfile } = useSWR<{ photoUrl?: string | null }>(
'/api/user/profile',
fetcher
);
const accessiblePages = userPagesData?.pages || [];
const userPhotoUrl = userProfile?.photoUrl;
// Calculer le nombre total de messages non lus
const totalUnreadCount = Array.isArray(conversations)
@@ -377,9 +385,17 @@ export default function DashboardLayout({ user, children }: DashboardLayoutProps
onClick={() => setShowProfileMenu(!showProfileMenu)}
className="flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-50 border border-gray-200 transition-all duration-200 hover:shadow-sm group"
>
<div className="w-9 h-9 rounded-lg bg-gradient-to-br from-lblue to-dblue flex items-center justify-center shadow-sm">
<span className="text-white text-sm font-semibold">{getUserInitials()}</span>
</div>
{userPhotoUrl ? (
<img
src={userPhotoUrl}
alt={user.name || 'Utilisateur'}
className="w-9 h-9 rounded-lg object-cover shadow-sm border border-gray-200"
/>
) : (
<div className="w-9 h-9 rounded-lg bg-gradient-to-br from-lblue to-dblue flex items-center justify-center shadow-sm">
<span className="text-white text-sm font-semibold">{getUserInitials()}</span>
</div>
)}
<div className="hidden md:block text-left">
<div className="text-sm font-medium text-gray-900">{user.name || 'Utilisateur'}</div>
<div className="text-xs text-gray-500">{user.email}</div>