import { profileLinks } from '@/components/profile-navigation'; import type { ProfileAccess } from '@/types/profile-access'; import { Link, usePage } from '@inertiajs/react'; import { LayoutGrid } from 'lucide-react'; import { portalNavigation } from '@/lib/portal-navigation'; import AppLogo from '@/components/app-logo'; import { NavMain } from '@/components/nav-main'; import { NavUser } from '@/components/nav-user'; import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, } from '@/components/ui/sidebar'; import { dashboard } from '@/routes'; import type { Auth } from '@/types'; import type { OpportunityManagementAccess } from '@/types/opportunity-management'; export function AppSidebar() { const { auth, existingBusinessEnabled, educationEnabled, aiEnabled, opportunityManagement, contentManagementHref, profileAccess, } = usePage<{ auth: Auth; existingBusinessEnabled?: boolean; educationEnabled?: boolean; aiEnabled?: boolean; profileAccess?: ProfileAccess | null; opportunityManagement?: OpportunityManagementAccess | null; contentManagementHref?: string | null; }>().props; const groups = portalNavigation({ authenticated: !!auth.user, manager: auth.canManagePortal, businesses: existingBusinessEnabled, education: educationEnabled, ai: aiEnabled, opportunityManagement, }); const items = groups.map((group) => ({ title: group.label, href: group.children?.find((item) => item.href)?.href ?? '/', icon: LayoutGrid, })); if (contentManagementHref) { items.unshift({ title: 'Gestão de conteúdos e oportunidades', href: contentManagementHref, icon: LayoutGrid }); } if (auth.canManagePortal && opportunityManagement) { items.push({ title: opportunityManagement.manage.label, href: opportunityManagement.manage.href, icon: LayoutGrid, }); if (opportunityManagement.installed) { items.push({ title: opportunityManagement.create.label, href: opportunityManagement.create.href, icon: LayoutGrid, }); } } items.push( ...profileLinks(profileAccess).map((link) => ({ ...link, icon: LayoutGrid, })), ); return ( ); }