From e84b5cf674fcb4f6137d876edbc28b547c0302f9 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Mon, 2 Mar 2026 09:42:05 +0100 Subject: [PATCH] feat(ui) : display role badge in profile dropdown Co-Authored-By: Claude Opus 4.6 --- app/components/layout/AppNavbar.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/components/layout/AppNavbar.vue b/app/components/layout/AppNavbar.vue index 8fb0ed8..78e1624 100644 --- a/app/components/layout/AppNavbar.vue +++ b/app/components/layout/AppNavbar.vue @@ -185,6 +185,7 @@
  • Connecté en tant que
    {{ activeProfileLabel }} + {{ roleLabel }}
  • @@ -289,7 +290,7 @@ const navGroups: NavGroup[] = [ const route = useRoute() const { openDropdown, setDropdown, scheduleDropdownClose, toggleDropdown } = useNavDropdown() const { activeProfile } = useProfileSession() -const { isAdmin } = usePermissions() +const { isAdmin, canEdit } = usePermissions() const isActive = (path: string) => { if (path === '/') { @@ -320,6 +321,18 @@ const childLinkClass = (child: NavLink) => { : 'text-base-content hover:bg-primary/10 hover:text-primary' } +const roleLabel = computed(() => { + if (isAdmin.value) return 'Admin' + if (canEdit.value) return 'Gestionnaire' + return 'Lecteur' +}) + +const roleBadgeClass = computed(() => { + if (isAdmin.value) return 'badge-error' + if (canEdit.value) return 'badge-warning' + return 'badge-info' +}) + const activeProfileLabel = computed(() => { if (!activeProfile.value) { return 'Profil inconnu'