76 lines
2.7 KiB
TypeScript
76 lines
2.7 KiB
TypeScript
import { Link } from '@inertiajs/react';
|
|
import { Management } from './shared';
|
|
import { states } from '@/lib/editorial-states';
|
|
|
|
const titles: Record<string, string> = {
|
|
projects: 'Projectos',
|
|
clusters: 'Clusters',
|
|
corridors: 'Corredores',
|
|
'cluster-project': 'Projectos associados ao cluster',
|
|
'corridor-project': 'Projectos associados ao corredor',
|
|
'corridor-cluster': 'Clusters associados ao corredor',
|
|
'value-chains': 'Etapas da cadeia de valor',
|
|
'value-chain-links': 'Ligações da cadeia de valor',
|
|
'investment-gaps': 'Lacunas de investimento',
|
|
'zone-relations': 'Relações territoriais',
|
|
};
|
|
type Item = {
|
|
id: string;
|
|
subject_kind: string;
|
|
subject_key: string;
|
|
revision_no: number;
|
|
state: string;
|
|
title: string;
|
|
};
|
|
export default function Subjects({
|
|
items,
|
|
}: {
|
|
items: {
|
|
data: Item[];
|
|
prev_page_url: string | null;
|
|
next_page_url: string | null;
|
|
};
|
|
}) {
|
|
return (
|
|
<Management title="Revisão de estruturas e relações">
|
|
<Link className="underline" href="/management/editorial">
|
|
Circuito editorial
|
|
</Link>
|
|
<p>
|
|
Prepare no formulário existente. Reveja e publique a edição
|
|
aprovada, conservando o registo anterior durante a preparação.
|
|
</p>
|
|
{!items.data.length && <p>Não existem propostas neste percurso.</p>}
|
|
<ul className="space-y-4">
|
|
{items.data.map((item) => (
|
|
<li key={item.id} className="rounded border p-4">
|
|
<p className="text-sm">
|
|
{titles[item.subject_kind] ?? item.subject_kind} ·{' '}
|
|
{states[item.state] ?? item.state} · edição{' '}
|
|
{item.revision_no}
|
|
</p>
|
|
<Link
|
|
className="font-semibold underline"
|
|
href={`/management/editorial/subjects/${item.subject_kind}/${item.subject_key}`}
|
|
>
|
|
{item.title}
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
<nav aria-label="Páginas de propostas" className="flex gap-4">
|
|
{items.prev_page_url && (
|
|
<Link className="underline" href={items.prev_page_url}>
|
|
Anterior
|
|
</Link>
|
|
)}
|
|
{items.next_page_url && (
|
|
<Link className="underline" href={items.next_page_url}>
|
|
Seguinte
|
|
</Link>
|
|
)}
|
|
</nav>
|
|
</Management>
|
|
);
|
|
}
|