import { archiveSummary } from '../../utils/archivedResource'; /** * Says a record is archived, why and when, wherever one is shown, so an archived record never reads as one in * current use. Its recorded details below are left as they were: archiving is not a change of clinical status. * Renders nothing for a record that is not archived. */ export const ArchivedNotice = ({ resource }: { resource?: Record | null }) => { const summary = archiveSummary(resource); if (!summary) return null; const when = summary.at ? ` on ${new Date(summary.at).toLocaleString()}` : ''; return ( // Stacked: .ak-notice is a flex row, which set each sentence in its own narrow column.

Archived{when}: {summary.reasonLabel}.

It is no longer in current use. What was recorded is kept as it was.

{summary.note &&

{summary.note}

}
); }; /** The short form for a list row. */ export const ArchivedBadge = ({ resource }: { resource?: Record | null }) => { const summary = archiveSummary(resource); if (!summary) return null; return ( Archived ยท {summary.reasonLabel} ); }; export default ArchivedNotice;