feat(editorial): stage portfolio base data and territory for atomic publication

This commit is contained in:
2026-11-13 23:47:04 +02:00
parent d2c72f5e13
commit 2459d0ca37
11 changed files with 491 additions and 11 deletions
@@ -18,6 +18,10 @@ type Edition = {
editorial_content?: string | null;
source?: string;
content?: Record<string, string | null>;
_structure?: {
fields: Record<string, string | number | null>;
territory_context?: { id: string; name: string }[];
};
};
files: {
id: string;
@@ -181,6 +185,68 @@ export default function EditorialEdition({
</dl>
</>
)}
{subject === 'portfolio' &&
edition.payload.resource._structure && (
<section className="rounded border p-3">
<h3 className="font-semibold">
Alterações propostas nos dados-base
</h3>
<dl>
{Object.entries(
edition.payload.resource._structure
.fields,
)
.filter(
([key]) =>
![
'primary_territory_id',
'territory_version',
].includes(key),
)
.map(([key, value]) => (
<div key={key}>
<dt className="font-semibold">
{(
{
name: 'Designação',
code: 'Código',
status: 'Estado operacional',
sector: 'Sector',
description:
'Descrição',
budget_amount:
'Orçamento',
budget_currency:
'Moeda',
start_date:
'Data inicial',
end_date:
'Data final',
} as Record<
string,
string
>
)[key] ?? key}
</dt>
<dd>
{value ?? 'Por indicar'}
</dd>
</div>
))}
</dl>
{'primary_territory_id' in
edition.payload.resource._structure
.fields && (
<p>
Localização proposta:{' '}
{edition.payload.resource._structure.territory_context
?.map((node) => node.name)
.join(' / ') ||
'Sem localização associada'}
</p>
)}
</section>
)}
{subject === 'portfolio' &&
edition.payload.links?.map((link) => (
<p key={link.target_key}>