'use client'; import { useTranslations } from 'next-intl'; import { formatCaseSentLines } from '@/components/treatment/caseSendLabel'; import type { LabCaseSendInfo, LinkedOrganizationOption } from '@/types/treatment'; interface CaseSentLabelProps { treatmentCase: { sends?: LabCaseSendInfo[]; sendToOrganizationIds?: string[]; destinationOrganizationId?: string | null; sentAt?: string | null; }; orgs?: LinkedOrganizationOption[]; className?: string; } export function CaseSentLabel({ treatmentCase, orgs, className = 'text-xs text-text-muted' }: CaseSentLabelProps) { const t = useTranslations('treatment'); const organizationIds = treatmentCase.sendToOrganizationIds ?? (treatmentCase.destinationOrganizationId ? [treatmentCase.destinationOrganizationId] : []); const lines = formatCaseSentLines(treatmentCase.sends, { organizationIds, sentAt: treatmentCase.sentAt ?? null, orgs, }, t); if (lines.length === 0) return null; return (
{lines.map((line, i) => ( {line} ))}
); }