Sadum1's picture
Update frontend/src/components/ExtractionList.tsx
587d29d verified
Raw History Blame Contribute Delete
1.4 kB
import type { ReactNode } from "react";
import type { ExtractionRecordEntry } from "../types";
import { latestExtractionsByOutcome } from "../utils/confidence";
const KLIMISCH_LABELS: Record<number, string> = {
1: "1 – reliable without restriction",
2: "2 – reliable with restrictions",
3: "3 – not reliable",
4: "4 – not assignable",
};
export function ExtractionList({ records, onAddAnother, extra }: {
records: ExtractionRecordEntry[];
onAddAnother: () => void;
extra?: ReactNode;
}) {
return (
<div className="extraction-summary">
{latestExtractionsByOutcome(records).map((r) => (
<div key={r.id}>
<strong>Extracted</strong> by {r.extracted_by}
{r.outcome ? ` β€” ${r.outcome}` : ""}
{r.evidence_stream ? ` (${r.evidence_stream.replace("_", " ")})` : ""}:{" "}
{[r.species, r.route, r.duration, r.effect_finding].filter(Boolean).join(" Β· ")}
{r.klimisch_score != null && (
<div className="klimisch-line">
<strong>Klimisch:</strong> {KLIMISCH_LABELS[r.klimisch_score] ?? r.klimisch_score}
{r.klimisch_justification ? ` β€” ${r.klimisch_justification}` : ""}
</div>
)}
</div>
))}
<button className="change-btn" onClick={onAddAnother}>
Add data for another outcome
</button>{" "}
{extra}
</div>
);
}