From 7244349fe7d4d727773d2e276335d8dc0b45c285 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 11 Jul 2025 16:44:29 -0400 Subject: [PATCH] fix: Resolve 500 error in unified sidebar by using simpler implementation - Replace problematic UDashboardSidebar components with custom implementation - Use standard HTML/CSS for sidebar instead of Nuxt UI dashboard components - Fix 'Cannot destructure property collapsed of undefined' error - Maintain all features: responsive, role-based nav, clean design - Ensure compatibility with existing Vuetify components --- layouts/dashboard-unified.vue | 278 +++++++++++++++------------------- 1 file changed, 124 insertions(+), 154 deletions(-) diff --git a/layouts/dashboard-unified.vue b/layouts/dashboard-unified.vue index 40f7f6a..9278cb9 100644 --- a/layouts/dashboard-unified.vue +++ b/layouts/dashboard-unified.vue @@ -1,141 +1,127 @@ @@ -145,21 +131,16 @@ import { ref, computed } from 'vue'; // Define NavigationMenuItem type locally interface NavigationMenuItem { label: string; - icon?: string; - to?: string; - badge?: string | number; - click?: () => void; - defaultOpen?: boolean; - children?: NavigationMenuItem[]; + icon: string; + to: string; } const route = useRoute(); const router = useRouter(); const nuxtApp = useNuxtApp(); -const { mdAndDown } = useDisplay(); // Sidebar state -const sidebarOpen = ref(true); +const sidebarOpen = ref(false); // Get auth state - with fallback to prevent errors const authState = computed(() => { @@ -197,7 +178,7 @@ const pageTitle = computed(() => { }); // Navigation items based on user role -const navigationItems = computed((): NavigationMenuItem[][] => { +const navigationItems = computed((): NavigationMenuItem[] => { const items: NavigationMenuItem[] = [ { label: 'Dashboard', @@ -261,8 +242,7 @@ const navigationItems = computed((): NavigationMenuItem[][] => { }); } - // Return as nested array for proper spacing - return [items]; + return items; }); // Logout handler @@ -276,23 +256,13 @@ const handleLogout = async () => { await router.push('/login'); } }; - -// Initialize sidebar state based on screen size -onMounted(() => { - if (mdAndDown.value) { - sidebarOpen.value = false; - } -});