Group dashboard activities under primary administration and tidy editorial overview
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-14 11:43:56 +02:00
parent ce8b744d1f
commit 73e1d7b964
12 changed files with 314 additions and 102 deletions
@@ -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}