feat(ui) : display role badge in profile dropdown
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,7 @@
|
|||||||
<li class="px-2 py-1 text-sm text-base-content/70">
|
<li class="px-2 py-1 text-sm text-base-content/70">
|
||||||
Connecté en tant que<br />
|
Connecté en tant que<br />
|
||||||
<span class="font-semibold text-base-content">{{ activeProfileLabel }}</span>
|
<span class="font-semibold text-base-content">{{ activeProfileLabel }}</span>
|
||||||
|
<span class="badge badge-sm" :class="roleBadgeClass">{{ roleLabel }}</span>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="isAdmin">
|
<li v-if="isAdmin">
|
||||||
<NuxtLink to="/admin" class="justify-between">
|
<NuxtLink to="/admin" class="justify-between">
|
||||||
@@ -289,7 +290,7 @@ const navGroups: NavGroup[] = [
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { openDropdown, setDropdown, scheduleDropdownClose, toggleDropdown } = useNavDropdown()
|
const { openDropdown, setDropdown, scheduleDropdownClose, toggleDropdown } = useNavDropdown()
|
||||||
const { activeProfile } = useProfileSession()
|
const { activeProfile } = useProfileSession()
|
||||||
const { isAdmin } = usePermissions()
|
const { isAdmin, canEdit } = usePermissions()
|
||||||
|
|
||||||
const isActive = (path: string) => {
|
const isActive = (path: string) => {
|
||||||
if (path === '/') {
|
if (path === '/') {
|
||||||
@@ -320,6 +321,18 @@ const childLinkClass = (child: NavLink) => {
|
|||||||
: 'text-base-content hover:bg-primary/10 hover:text-primary'
|
: '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(() => {
|
const activeProfileLabel = computed(() => {
|
||||||
if (!activeProfile.value) {
|
if (!activeProfile.value) {
|
||||||
return 'Profil inconnu'
|
return 'Profil inconnu'
|
||||||
|
|||||||
Reference in New Issue
Block a user