feature: treatment frontend wired with the newly implemented backend. no mocked data no more.
This commit is contained in:
31
frontend/src/components/ui/treatment/CaseSentLabel.tsx
Normal file
31
frontend/src/components/ui/treatment/CaseSentLabel.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { formatCaseSentLines } from '@/components/treatment/caseSendLabel';
|
||||
import type { LinkedOrganizationOption, PastTreatmentCase, TreatmentCaseDraft } from '@/types/treatment';
|
||||
|
||||
interface CaseSentLabelProps {
|
||||
treatmentCase: Pick<
|
||||
PastTreatmentCase | TreatmentCaseDraft,
|
||||
'sends' | 'sendToOrganizationIds' | 'sentAt'
|
||||
>;
|
||||
orgs?: LinkedOrganizationOption[];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function CaseSentLabel({ treatmentCase, orgs, className = 'text-xs text-text-muted' }: CaseSentLabelProps) {
|
||||
const lines = formatCaseSentLines(treatmentCase.sends, {
|
||||
organizationIds: treatmentCase.sendToOrganizationIds ?? [],
|
||||
sentAt: treatmentCase.sentAt ?? null,
|
||||
orgs,
|
||||
});
|
||||
|
||||
if (lines.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{lines.map((line, i) => (
|
||||
<span key={`${line}-${i}`} className="block">
|
||||
{line}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user