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:
@@ -32,6 +32,7 @@ export function AppSidebar() {
|
||||
contentManagementAccess,
|
||||
profileAccess,
|
||||
scopedAdministration,
|
||||
dashboardNavigation,
|
||||
} = usePage<{
|
||||
auth: Auth;
|
||||
existingBusinessEnabled?: boolean;
|
||||
@@ -41,6 +42,7 @@ export function AppSidebar() {
|
||||
opportunityManagement?: OpportunityManagementAccess | null;
|
||||
contentManagementHref?: string | null;
|
||||
scopedAdministration?: { label: string; href: string }[];
|
||||
dashboardNavigation?: { label: string; href: string }[];
|
||||
contentManagementAccess?: {
|
||||
opportunities?: { index: string; create?: string | null };
|
||||
};
|
||||
@@ -56,6 +58,7 @@ export function AppSidebar() {
|
||||
contentManagementHref,
|
||||
contentManagementAccess,
|
||||
scopedAdministration,
|
||||
dashboardNavigation,
|
||||
legacyContent: currentPage.props.legacyContentEnabled as
|
||||
| boolean
|
||||
| undefined,
|
||||
|
||||
@@ -53,6 +53,7 @@ export function PortalGroupedMenu() {
|
||||
profileAccess?: ProfileAccess | null;
|
||||
opportunityManagement?: OpportunityManagementAccess | null;
|
||||
scopedAdministration?: { label: string; href: string }[];
|
||||
dashboardNavigation?: { label: string; href: string }[];
|
||||
contentManagementHref?: string | null;
|
||||
contentManagementAccess?: {
|
||||
opportunities?: { index: string; create?: string | null };
|
||||
@@ -79,6 +80,7 @@ export function PortalGroupedMenu() {
|
||||
contentManagementHref: props.contentManagementHref,
|
||||
contentManagementAccess: props.contentManagementAccess,
|
||||
scopedAdministration: props.scopedAdministration,
|
||||
dashboardNavigation: props.dashboardNavigation,
|
||||
});
|
||||
const current = currentNavigationGroup(groups, url);
|
||||
const currentItem = currentNavigationItem(groups, url);
|
||||
@@ -93,12 +95,17 @@ export function PortalGroupedMenu() {
|
||||
children.map((item) =>
|
||||
item.children ? (
|
||||
mobile ? (
|
||||
<Fragment key={item.id}>
|
||||
<DropdownMenuLabel className="mt-2 border-t px-3 pt-3 text-xs text-slate-500">
|
||||
<details
|
||||
key={item.id}
|
||||
className="rounded-lg border-b border-slate-100"
|
||||
>
|
||||
<summary className="cursor-pointer px-3 py-3 text-sm font-semibold text-slate-800">
|
||||
{t(item.label)}
|
||||
</DropdownMenuLabel>
|
||||
{items(item.children)}
|
||||
</Fragment>
|
||||
</summary>
|
||||
<div className="border-l border-slate-200 pl-2">
|
||||
{items(item.children)}
|
||||
</div>
|
||||
</details>
|
||||
) : (
|
||||
<DropdownMenuSub key={item.id}>
|
||||
<DropdownMenuSubTrigger className="tempo-menu-item font-semibold">
|
||||
@@ -138,6 +145,7 @@ export function PortalGroupedMenu() {
|
||||
'realization',
|
||||
'support',
|
||||
'work',
|
||||
'administration',
|
||||
].includes(group.id),
|
||||
);
|
||||
const institutionalCurrent = url.split('?')[0] === '/contacto';
|
||||
@@ -203,6 +211,7 @@ export function PortalGroupedMenu() {
|
||||
'discovery',
|
||||
'realization',
|
||||
'support',
|
||||
'administration',
|
||||
].includes(group.id),
|
||||
)
|
||||
.map((group) => (
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -85,81 +85,126 @@ export default function EditorialWorkflow({
|
||||
}) {
|
||||
const pageUrl = (page: number) =>
|
||||
`/management/editorial?${new URLSearchParams({ ...filters, page: String(page) })}`;
|
||||
const areas = [
|
||||
{
|
||||
title: 'Conteúdos e oportunidades',
|
||||
entries: [
|
||||
{
|
||||
label: 'Artigos',
|
||||
href: resourceAccess
|
||||
? '/management/editorial?kind=article'
|
||||
: null,
|
||||
},
|
||||
{
|
||||
label: 'Legislação',
|
||||
href: resourceAccess
|
||||
? '/management/editorial?kind=legislation'
|
||||
: null,
|
||||
},
|
||||
{
|
||||
label: 'Documentos',
|
||||
href: resourceAccess
|
||||
? '/management/editorial?kind=document'
|
||||
: null,
|
||||
},
|
||||
{
|
||||
label: 'Oportunidades',
|
||||
href: opportunitiesUrl,
|
||||
pending: opportunityPending,
|
||||
},
|
||||
{
|
||||
label: 'Biblioteca e editores',
|
||||
href: resourceAccess ? '/management/portal-services' : null,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Investimentos e competitividade',
|
||||
entries: [
|
||||
{
|
||||
label: 'Carteira',
|
||||
href: portfolioUrl,
|
||||
pending: portfolioPending,
|
||||
},
|
||||
{
|
||||
label: 'Competitividade dos clusters',
|
||||
href: clustersUrl,
|
||||
pending: nativePending.clusters,
|
||||
},
|
||||
{
|
||||
label: 'Estruturas e relações',
|
||||
href: subjectsUrl,
|
||||
pending: subjectsPending,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Território e dados',
|
||||
entries: [
|
||||
{
|
||||
label: 'Conteúdos territoriais',
|
||||
href: territorialUrl,
|
||||
pending: nativePending.territories,
|
||||
},
|
||||
{
|
||||
label: 'Zonas e indicadores',
|
||||
href: zonesUrl,
|
||||
pending: nativePending.zones ?? 0,
|
||||
},
|
||||
{
|
||||
label: 'Demografia',
|
||||
href: demographyUrl,
|
||||
pending: demographyPending,
|
||||
},
|
||||
],
|
||||
},
|
||||
].filter((area) => area.entries.some((item) => item.href));
|
||||
return (
|
||||
<Management title="Circuito editorial">
|
||||
<p>
|
||||
Artigos, legislação e documentos: edições privadas e versão
|
||||
pública separadas. As oportunidades mantêm o seu circuito
|
||||
próprio.
|
||||
<Management title="Dashboard">
|
||||
<p className="max-w-3xl text-sm text-slate-600">
|
||||
Acompanhe a preparação, revisão e publicação numa única área de
|
||||
trabalho. Seleccione uma actividade para continuar nas tarefas
|
||||
da sua equipa.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
{zonesUrl && (
|
||||
<Link className="underline" href={zonesUrl}>
|
||||
Zonas e indicadores: {nativePending.zones ?? 0}{' '}
|
||||
pendentes
|
||||
</Link>
|
||||
)}
|
||||
{subjectsUrl && (
|
||||
<Link className="underline" href={subjectsUrl}>
|
||||
Estruturas e relações: {subjectsPending} pendentes
|
||||
</Link>
|
||||
)}
|
||||
{demographyUrl && (
|
||||
<Link className="underline" href={demographyUrl}>
|
||||
Demografia: {demographyPending} lotes pendentes
|
||||
</Link>
|
||||
)}
|
||||
{territorialUrl && (
|
||||
<Link className="underline" href={territorialUrl}>
|
||||
Conteúdos territoriais: {nativePending.territories}{' '}
|
||||
pendentes
|
||||
</Link>
|
||||
)}
|
||||
{portfolioUrl && (
|
||||
<Link className="underline" href={portfolioUrl}>
|
||||
Carteira: {portfolioPending} fichas pendentes
|
||||
</Link>
|
||||
)}
|
||||
{clustersUrl && (
|
||||
<Link className="underline" href={clustersUrl}>
|
||||
Competitividade dos clusters: {nativePending.clusters}{' '}
|
||||
pendentes
|
||||
</Link>
|
||||
)}
|
||||
<Link className="underline" href="/dashboard">
|
||||
Painel geral
|
||||
</Link>
|
||||
{resourceAccess && (
|
||||
<Link
|
||||
className="underline"
|
||||
href="/management/portal-services"
|
||||
<section
|
||||
aria-label="Actividades do dashboard"
|
||||
className="grid gap-4 md:grid-cols-2 xl:grid-cols-3"
|
||||
>
|
||||
{areas.map((area) => (
|
||||
<section
|
||||
key={area.title}
|
||||
className="overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm"
|
||||
>
|
||||
Biblioteca e editores
|
||||
</Link>
|
||||
)}
|
||||
{opportunitiesUrl && (
|
||||
<Link className="underline" href={opportunitiesUrl}>
|
||||
Oportunidades
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
{opportunitiesUrl && (
|
||||
<section
|
||||
aria-label="Circuito de oportunidades"
|
||||
className="my-4 rounded border p-4"
|
||||
>
|
||||
<h2 className="font-semibold">Oportunidades</h2>
|
||||
<p>
|
||||
{opportunityPending} conteúdos pendentes no seu âmbito
|
||||
de acesso.
|
||||
</p>
|
||||
<Link className="underline" href={opportunitiesUrl}>
|
||||
Continuar na fila de oportunidades existente
|
||||
</Link>
|
||||
</section>
|
||||
)}
|
||||
<h2 className="border-b border-slate-100 bg-slate-50 px-5 py-4 text-sm font-semibold text-slate-900">
|
||||
{area.title}
|
||||
</h2>
|
||||
<ul className="divide-y divide-slate-100">
|
||||
{area.entries.map((item) =>
|
||||
item.href ? (
|
||||
<li key={item.label}>
|
||||
<Link
|
||||
href={item.href}
|
||||
className="flex min-h-14 items-center justify-between gap-3 px-5 py-3 text-sm font-medium text-slate-700 transition hover:bg-slate-50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-red-700"
|
||||
>
|
||||
<span>{item.label}</span>
|
||||
{'pending' in item && (
|
||||
<span className="shrink-0 rounded-full bg-slate-100 px-2.5 py-1 text-xs text-slate-600">
|
||||
{item.pending} pendentes
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
</li>
|
||||
) : null,
|
||||
)}
|
||||
</ul>
|
||||
</section>
|
||||
))}
|
||||
</section>
|
||||
{resourceAccess && (
|
||||
<>
|
||||
<h2 className="text-lg font-semibold text-slate-900">
|
||||
Fila de conteúdos
|
||||
</h2>
|
||||
<form
|
||||
action="/management/editorial"
|
||||
className="my-4 flex flex-wrap items-end gap-3"
|
||||
@@ -239,10 +284,22 @@ export default function EditorialWorkflow({
|
||||
</nav>
|
||||
</>
|
||||
)}
|
||||
<section aria-label="Notificações editoriais">
|
||||
<h2 className="font-semibold">Notificações</h2>
|
||||
<section
|
||||
id="notificacoes"
|
||||
aria-label="Notificações editoriais"
|
||||
className="rounded-xl border border-slate-200 bg-white p-5 shadow-sm"
|
||||
>
|
||||
<h2 className="mb-3 text-lg font-semibold">Notificações</h2>
|
||||
{notices.length === 0 && (
|
||||
<p className="text-sm text-slate-500">
|
||||
Não há notificações neste âmbito.
|
||||
</p>
|
||||
)}
|
||||
{notices.map((n) => (
|
||||
<p key={n.id}>
|
||||
<p
|
||||
key={n.id}
|
||||
className="flex flex-wrap items-center justify-between gap-3 border-t border-slate-100 py-3 text-sm"
|
||||
>
|
||||
<Link className="underline" href={n.href}>
|
||||
{eventTitles[n.action] ?? 'Alteração editorial'} ·{' '}
|
||||
{n.reference}
|
||||
|
||||
Reference in New Issue
Block a user