import { usePage, Link } from '@inertiajs/react'; import { PageProps } from '@/types'; export function Sidebar({ theme: _theme }: { theme: string }) { const props = usePage().props as any; const { auth } = props; const { user, permissions } = auth; const path = window.location.pathname; const canAccess = (ability: string | null) => { if (!ability) return true; return permissions.includes(ability); }; const initials = `${user.first_name?.charAt(0) || ''}${user.last_name?.charAt(0) || ''}`.toUpperCase(); const allGroups = [ { label: 'Governance', items: [ { href: '/dashboard', label: 'Dashboard', ability: null, icon: }, { href: '/notifications', label: 'Notifications', ability: 'notifications.view', icon: }, ] }, { label: 'Management', items: [ { href: '/users', label: 'Users', ability: 'user.view', icon: }, { href: '/roles', label: 'Roles', ability: 'role.view', icon: }, { href: '/activity-logs', label: 'Activity Logs', ability: 'activity-logs.view', icon: }, ] }, { label: 'Account', items: [ { href: '/settings', label: 'Settings', ability: null, icon: }, ] }, { label: 'Systems', adminOnly: true, items: [ { href: '/system-settings', label: 'System Settings', ability: 'settings.view', icon: }, { href: '/documentation', label: 'Dokumentasi', ability: 'documentation.view', icon: }, ] }, ]; const canManageSettings = permissions.includes('settings.view'); return ( ); }