Group dashboard activities under primary administration and tidy editorial overview
tests / ci (push) Waiting to run
tests / ci (push) Waiting to run
This commit is contained in:
@@ -13,6 +13,7 @@ export type PortalNavAccess = {
|
||||
opportunities?: { index: string; create?: string | null };
|
||||
};
|
||||
scopedAdministration?: { label: string; href: string }[];
|
||||
dashboardNavigation?: { label: string; href: string }[];
|
||||
procurement?: boolean;
|
||||
funding?: boolean;
|
||||
authenticated: boolean;
|
||||
@@ -477,6 +478,44 @@ export function portalNavigation(access: PortalNavAccess): PortalNavItem[] {
|
||||
? access.opportunityManagement.create.href
|
||||
: null)
|
||||
: null;
|
||||
const dashboardActivities = access.authenticated
|
||||
? [
|
||||
...(access.dashboardNavigation ?? []),
|
||||
...previous
|
||||
.filter((group) => group.id === 'account')
|
||||
.flatMap((group) => group.children ?? [])
|
||||
.filter((item) => item.href === '/dashboard')
|
||||
.map((item) => ({
|
||||
label: 'Painel operacional',
|
||||
href: item.href!,
|
||||
})),
|
||||
]
|
||||
: [];
|
||||
const administration = access.authenticated
|
||||
? [
|
||||
...(dashboardActivities.length
|
||||
? [
|
||||
{
|
||||
id: 'collaborative-dashboard',
|
||||
label: 'Dashboard',
|
||||
children: dashboardActivities.map((item, index) =>
|
||||
link(
|
||||
'dashboard-activity-' + index,
|
||||
item.label,
|
||||
item.href,
|
||||
),
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...previous
|
||||
.filter((group) => group.id === 'management')
|
||||
.flatMap((group) => group.children ?? []),
|
||||
...(access.scopedAdministration ?? []).map((item, index) =>
|
||||
link('scoped-' + index, item.label, item.href),
|
||||
),
|
||||
]
|
||||
: [];
|
||||
return uniqueNavigationDestinations([
|
||||
{
|
||||
id: 'discovery',
|
||||
@@ -603,6 +642,15 @@ export function portalNavigation(access: PortalNavAccess): PortalNavItem[] {
|
||||
],
|
||||
},
|
||||
|
||||
...(administration.length
|
||||
? [
|
||||
{
|
||||
id: 'administration',
|
||||
label: 'Administração',
|
||||
children: administration,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
id: 'work',
|
||||
label: 'Área de trabalho',
|
||||
@@ -633,28 +681,8 @@ export function portalNavigation(access: PortalNavAccess): PortalNavItem[] {
|
||||
]
|
||||
: []),
|
||||
...previous
|
||||
.filter((group) =>
|
||||
['management', 'profile-opportunities'].includes(
|
||||
group.id,
|
||||
),
|
||||
)
|
||||
.filter((group) => group.id === 'profile-opportunities')
|
||||
.flatMap((group) => group.children ?? []),
|
||||
...(access.authenticated && access.scopedAdministration?.length
|
||||
? [
|
||||
{
|
||||
id: 'work-administration',
|
||||
label: 'Administração',
|
||||
children: access.scopedAdministration.map(
|
||||
(item, index) =>
|
||||
link(
|
||||
'scoped-' + index,
|
||||
item.label,
|
||||
item.href,
|
||||
),
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
},
|
||||
...previous.filter((group) => group.id === 'account'),
|
||||
|
||||
Reference in New Issue
Block a user