feat(ui) : display role badge in profile dropdown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-02 09:42:05 +01:00
parent cc70fe2b29
commit e84b5cf674

View File

@@ -185,6 +185,7 @@
<li class="px-2 py-1 text-sm text-base-content/70">
Connecté en tant que<br />
<span class="font-semibold text-base-content">{{ activeProfileLabel }}</span>
<span class="badge badge-sm" :class="roleBadgeClass">{{ roleLabel }}</span>
</li>
<li v-if="isAdmin">
<NuxtLink to="/admin" class="justify-between">
@@ -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'