Layout and Navigation System Documentation
Overview
The application uses a hierarchical layout system with multiple navigation components working together to provide a consistent user experience across all pages.Architecture
Component Hierarchy
Navigation Components
1. AppSidebar (Left Navigation)
Location:resources/js/components/AppSidebar.vue
Purpose: Primary navigation menu showing all main sections and sub-sections.
Features:
- Collapsible/expandable
- Multi-level menu support
- Active state highlighting
- Icon support
- Authorization-based visibility
- Main: YAML files defined in
config/core/app.php - Default:
resources/views/partials/app/dms/navnext.yml - Additional: Directory, Core, Parameter menus
2. TopBar (Top Navigation)
Location:resources/js/components/TopBar.vue
Purpose: Contextual navigation and utility controls.
Components:
- Sidebar Toggle: Collapse/expand left sidebar
- NavTopMenubar: Context-aware menu items
- Language Switcher: Multi-language support
- Theme Toggle: Light/dark mode switching
3. NavTopMenubar (Contextual Menu)
Location:resources/js/components/NavTopMenubar.vue
Purpose: Shows menu items relevant to the current active section.
Logic:
- Displays children of the currently active main menu group
- Falls back to main menu if no top_menu is provided
- Supports dropdown menus for items with children
Menu Data Flow
1. Backend Processing (AdminController)
2. Frontend Prop Passing
3. Component Usage
Menu Configuration
YAML Menu Structure
Menu Properties
- title: Display name (translatable)
- auth: Permission requirement
- icon: Lucide icon name
- url: Navigation path
- children: Sub-menu items
- isActive: Set automatically based on current URL
Active State Detection
How It Works
- Current Path Extraction: Gets current request path
- URL Normalization: Ensures consistent path format
- Path Matching: Compares menu item URLs with current path
- Hierarchy Marking: Marks parents as active if children are active
Implementation
Customization Options
1. Sidebar Configuration
Rail Mode: Collapsed sidebar showing only icons2. Top Navigation Toggle
Enable/disable top navigation contextual menu:3. Menu Sources
Configure which YAML files to load:Responsive Behavior
Mobile/Tablet
- Sidebar becomes overlay instead of persistent
- Top navigation adapts to smaller screens
- Menu items may stack or become dropdowns
Desktop
- Sidebar can be toggled between rail and full modes
- Full top navigation with all contextual items visible
- Hover states and smooth transitions
Troubleshooting
Common Issues
1. Top menu shows wrong items- Check if page component passes
top_menuprop to AppLayout - Verify
generateTopMenu()is called in controller - Ensure menu active states are correctly set
- Check URL normalization in MenuUtil
- Verify path matching logic
- Ensure menu URLs are consistent format
- Verify icon names match Lucide Vue Next components
- Check icon registry in NavTopMenubar component
- Ensure icons are properly loaded in MenuUtil::getIcons()
- Check AuthUtil::checkItem() implementation
- Verify user permissions
- Ensure ‘auth’ property is correctly set in YAML
Debug Steps
- Check browser console for errors
- Verify menu data structure in Vue DevTools
- Test URL normalization with debug logging
- Validate YAML syntax and structure
- Check controller menu processing flow
