82 lines
3.0 KiB
TypeScript
82 lines
3.0 KiB
TypeScript
import {
|
|
incidentOperationLabel,
|
|
incidentErrorLabel,
|
|
} from '@/lib/technical-incident-labels';
|
|
|
|
export type OpportunityTechnicalIncident = {
|
|
reference: string;
|
|
operation: string;
|
|
version: number;
|
|
occurred_at: string;
|
|
error_code: string;
|
|
handling?: {
|
|
version: number;
|
|
status: string;
|
|
updated_at: string | null;
|
|
} | null;
|
|
};
|
|
|
|
export default function OpportunityTechnicalIncidents({
|
|
incidents,
|
|
}: {
|
|
incidents: OpportunityTechnicalIncident[];
|
|
}) {
|
|
if (!incidents.length) return null;
|
|
return (
|
|
<section
|
|
className="space-y-3 rounded border p-4"
|
|
aria-label="As minhas tentativas com falha técnica"
|
|
>
|
|
<h2 className="text-lg font-semibold">
|
|
As minhas tentativas com falha técnica
|
|
</h2>
|
|
<p>
|
|
Últimos dez registos desta conta. Consulte o estado actual antes
|
|
de repetir uma operação. Um incidente não confirma nem desfaz
|
|
uma gravação, submissão ou publicação.
|
|
</p>
|
|
<p>
|
|
Guarde a referência para acompanhamento. O Suporte técnico
|
|
consulta os incidentes no âmbito da sua atribuição e não altera
|
|
a decisão de investimento.
|
|
</p>
|
|
{incidents.map((incident) => (
|
|
<article
|
|
key={incident.reference}
|
|
className="space-y-1 border-t pt-2"
|
|
>
|
|
<h3 className="font-semibold">
|
|
{incidentOperationLabel(incident.operation)} · versão
|
|
observada {incident.version}
|
|
</h3>
|
|
<p>{incident.occurred_at}</p>
|
|
{incident.handling ? (
|
|
<p>
|
|
Estado técnico:{' '}
|
|
{(
|
|
{
|
|
open: 'Na fila',
|
|
in_progress: 'Em tratamento',
|
|
resolved: 'Resolvido',
|
|
} as Record<string, string>
|
|
)[incident.handling.status] || 'Não identificado'}
|
|
</p>
|
|
) : (
|
|
<p>Estado técnico indisponível para consulta.</p>
|
|
)}
|
|
<p>{incidentErrorLabel(incident.error_code)}</p>
|
|
{incident.operation === 'scan_document' && (
|
|
<p>
|
|
O recurso já foi registado. Acompanhe o estado da
|
|
análise de segurança antes de pedir nova análise.
|
|
</p>
|
|
)}
|
|
<p className="break-all">
|
|
Referência para acompanhamento: {incident.reference}
|
|
</p>
|
|
</article>
|
|
))}
|
|
</section>
|
|
);
|
|
}
|