'use client' import Link from 'next/link' interface Props { incidentId: string referenceNo: string | null status: string backHref: string canTriage?: boolean canInvestigate?: boolean canAddCapa?: boolean } const STATUS_COLORS: Record = { reported: 'bg-yellow-100 text-yellow-800', triaged: 'bg-blue-100 text-blue-800', investigating: 'bg-purple-100 text-purple-800', capa_pending: 'bg-orange-100 text-orange-800', verification: 'bg-indigo-100 text-indigo-800', closed: 'bg-green-100 text-green-800', } const STATUS_LABELS: Record = { reported: 'Reported', triaged: 'Triaged', investigating: 'Investigating', capa_pending: 'CAPA Pending', verification: 'Verification', closed: 'Closed', } export function IncidentHeader({ incidentId, referenceNo, status, backHref, canTriage, canInvestigate, canAddCapa, }: Props) { return (
← Incidents | {referenceNo ?? 'Pending'} {STATUS_LABELS[status] ?? status.replace(/_/g, ' ')}
{canTriage && ( Triage )} {canInvestigate && ( Investigate )} {canAddCapa && ( Add CAPA )}
) }