Added Function to config Profil
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user