diff --git a/frontend/src/layouts/DashboardLayout.vue b/frontend/src/layouts/DashboardLayout.vue index 6e1464b..c4addfe 100644 --- a/frontend/src/layouts/DashboardLayout.vue +++ b/frontend/src/layouts/DashboardLayout.vue @@ -26,6 +26,16 @@ const nav = computed(() => [ const contextLabel = computed(() => auth.user?.company?.name ?? auth.user?.reseller?.name ?? 'Plattform', ) +const userName = computed(() => auth.user?.name || auth.user?.email || '') +const initials = computed(() => + userName.value.split(/[\s@.]+/).filter(Boolean).slice(0, 2).map((s) => s[0]).join('').toUpperCase() || 'U', +) +const roleLabel = computed(() => { + if (auth.isPlatformAdmin) return 'Plattform-Admin' + if (auth.isResellerAdmin) return 'Reseller-Admin' + if (auth.isCompanyAdmin) return 'Firmen-Admin' + return 'Mitarbeiter' +}) function logout() { auth.logout() @@ -42,14 +52,18 @@ async function stopImpersonation() {
@@ -65,7 +79,13 @@ async function stopImpersonation() { {{ contextLabel }}
- {{ auth.user?.email }} +
+
{{ initials }}
+
+ {{ userName }} + {{ roleLabel }} +
+
@@ -77,30 +97,46 @@ async function stopImpersonation() { diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.ts index 55d52f3..6cfd0f2 100644 --- a/frontend/src/stores/auth.ts +++ b/frontend/src/stores/auth.ts @@ -10,6 +10,7 @@ export interface TenantRef { export interface CurrentUser { id: string email: string + name?: string roles: string[] reseller: TenantRef | null company: TenantRef | null