feature: treatment frontend wired with the newly implemented backend. no mocked data no more.

This commit is contained in:
2026-05-19 23:43:43 +03:30
parent f743046b38
commit 633c939560
13 changed files with 1199 additions and 528 deletions

View 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>
);
}