fix(navigation): expose work area and preserve authorised menu destinations in QA
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-28 20:08:54 +02:00
parent 77d133ef0e
commit 6e8de43ae7
13 changed files with 1416 additions and 66 deletions
+17 -35
View File
@@ -1,10 +1,8 @@
import { profileLinks } from '@/components/profile-navigation';
import {PortalSidebarNavigation} from '@/components/portal-sidebar-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 { portalNavigation,canShowLegacyManagement } from '@/lib/portal-navigation';
import AppLogo from '@/components/app-logo';
import { NavMain } from '@/components/nav-main';
import { NavUser } from '@/components/nav-user';
import {
Sidebar,
@@ -20,6 +18,7 @@ import type { Auth } from '@/types';
import type { OpportunityManagementAccess } from '@/types/opportunity-management';
export function AppSidebar() {
const currentPage=usePage();
const {
auth,
existingBusinessEnabled,
@@ -27,7 +26,9 @@ export function AppSidebar() {
aiEnabled,
opportunityManagement,
contentManagementHref,
contentManagementAccess,
profileAccess,
scopedAdministration,
} = usePage<{
auth: Auth;
existingBusinessEnabled?: boolean;
@@ -36,45 +37,26 @@ export function AppSidebar() {
profileAccess?: ProfileAccess | null;
opportunityManagement?: OpportunityManagementAccess | null;
contentManagementHref?: string | null;
scopedAdministration?: {label:string;href:string}[];
contentManagementAccess?: {opportunities?:{index:string;create?:string|null}};
}>().props;
const groups = portalNavigation({
authenticated: !!auth.user,
manager: auth.canManagePortal,
manager: canShowLegacyManagement(auth),
businesses: existingBusinessEnabled,
education: educationEnabled,
ai: aiEnabled,
opportunityManagement,
profileAccess,
contentManagementHref,
contentManagementAccess,
scopedAdministration,
legacyContent: currentPage.props.legacyContentEnabled as boolean|undefined,
procurement: currentPage.props.procurementEnabled as boolean|undefined,
businessReviewUrl: currentPage.props.businessReviewUrl as string|null|undefined,
});
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 (
<Sidebar collapsible="icon" variant="inset">
<Sidebar collapsible="offcanvas" variant="inset">
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
@@ -88,7 +70,7 @@ export function AppSidebar() {
</SidebarHeader>
<SidebarContent>
<NavMain items={items} />
<PortalSidebarNavigation groups={groups} url={currentPage.url}/>
</SidebarContent>
<SidebarFooter>