From 37a1d234a7230b7c3a75b44568e86cc098fd3c39 Mon Sep 17 00:00:00 2001 From: Bastian Masanek Date: Mon, 3 Nov 2025 18:28:27 +0100 Subject: [PATCH] Refactor UserMenu and navigation components for improved user experience - Enhanced UserMenu.vue by implementing an extended user type for better user data handling and updated user initials logic. - Adjusted AppHeader.vue and AreaTabs.vue for improved layout and spacing, ensuring a more cohesive design. - Updated CartButton.vue and Tabs components for consistent styling and better responsiveness. These changes aim to enhance the overall usability and visual appeal of the application, providing a smoother user experience. --- app/components/UserMenu.vue | 34 ++++++++++++++---------- app/components/navigation/AppHeader.vue | 9 +++---- app/components/navigation/AreaTabs.vue | 30 ++++++++++++++------- app/components/navigation/CartButton.vue | 8 +++--- app/components/ui/tabs/TabsList.vue | 2 +- app/components/ui/tabs/TabsTrigger.vue | 2 +- 6 files changed, 51 insertions(+), 34 deletions(-) diff --git a/app/components/UserMenu.vue b/app/components/UserMenu.vue index a602726..4c48989 100644 --- a/app/components/UserMenu.vue +++ b/app/components/UserMenu.vue @@ -16,17 +16,27 @@ import { const { user, loggedIn, logout } = useAuth() +// Extended user type with all profile fields +type ExtendedUser = typeof user.value & { + id?: string + firstName?: string + lastName?: string + email?: string +} + +const extendedUser = computed(() => user.value as ExtendedUser) + /** * Get user initials for Avatar fallback * Example: "Bastian Masanek" → "BM" */ const userInitials = computed(() => { - if (!user.value) return '?' + if (!extendedUser.value) return '?' - const first = user.value.firstName?.charAt(0)?.toUpperCase() || '' - const last = user.value.lastName?.charAt(0)?.toUpperCase() || '' + const first = extendedUser.value.firstName?.charAt(0)?.toUpperCase() || '' + const last = extendedUser.value.lastName?.charAt(0)?.toUpperCase() || '' - return first + last || user.value.email?.charAt(0)?.toUpperCase() || '?' + return first + last || extendedUser.value.email?.charAt(0)?.toUpperCase() || '?' }) /** @@ -44,13 +54,9 @@ async function handleLogout() {