import { Link } from '@inertiajs/react'; import { publicationHistoryActions, type PublicationHistorySummary, } from '@/lib/partnership-history'; import { labels } from '@/pages/partnerships/shared'; const status = (value: string | null) => value === null ? 'Estado não registado ou reservado' : (labels[value] ?? 'Estado não identificado no registo'); export default function PublicationSummary({ value, }: { value: PublicationHistorySummary; }) { return (

Histórico e decisões

Até {value.limit}{' '} {value.limit === 1 ? 'alteração mais recente' : 'alterações mais recentes'} . Os nomes são os disponíveis no cadastro actual; as decisões e motivos são os que ficaram guardados.

{!value.entries.length ? (

Ainda não existem alterações guardadas para apresentar.

) : (
    {value.entries.map((entry, index) => (
  1. Versão {entry.version ?? 'não registada'} ·{' '} {entry.restricted ? 'Conteúdo reservado' : (publicationHistoryActions[ entry.action ?? '' ] ?? 'Alteração registada')}

    {entry.restricted ? (

    Os dados desta alteração não estão disponíveis para esta conta. Consulte o histórico para conhecer os limites do registo.

    ) : ( <>

    {entry.actor_name ?? 'Autor não registado'}{' '} ·{' '} {entry.occurred_at ?? 'Data não registada'}

    {status(entry.status_before)} →{' '} {status(entry.status_after)}

    {entry.reason !== null && (

    Motivo:{' '} {entry.reason || 'Não indicado'}

    )} )}
  2. ))}
)} {value.has_more && (

Existem alterações anteriores no histórico completo.

)} Consultar versões e decisões da publicação
); }