import type { FieldChange, ProtocolAmendment } from "../types"; import { ALL_SOURCES } from "../types"; import "./review-fixes.css"; const FIELD_LABELS: Record = { title: "Title", population: "Population", intervention: "Intervention / Exposure", comparator: "Comparator", outcome: "Outcome", intervention_terms: "Exposure search terms", outcome_terms: "Outcome search terms", inclusion_criteria: "Inclusion criteria", exclusion_criteria: "Exclusion criteria", sources: "Sources", reviewers_required: "Reviewers per record", rob_key_questions_observational: "Risk-of-bias key questions (observational)", rob_key_questions_experimental: "Risk-of-bias key questions (animal & trials)", rob_criteria: "Risk-of-bias criteria", }; function formatValue(field: string, value: unknown): string { if (value === null || value === undefined || value === "") return "โ€”"; if (field === "reviewers_required") return value === 2 ? "2 independent reviewers" : "1 reviewer"; if (field.startsWith("rob_key_questions") && Array.isArray(value)) return value.map((q) => `Q${q}`).join(", "); if (Array.isArray(value)) { if (value.length === 0) return "โ€”"; const items = field === "sources" ? value.map((v) => ALL_SOURCES.find((s) => s.value === v)?.label ?? String(v)) : value.map(String); return items.join("; "); } return String(value); } function ChangeLine({ change }: { change: FieldChange }) { return (
  • {FIELD_LABELS[change.field] ?? change.field}:{" "} {formatValue(change.field, change.before)} โ†’{" "} {formatValue(change.field, change.after)}
  • ); } /** Amendments to a locked protocol (PRISMA 2020 item 24c), newest first. */ export function AmendmentHistory({ amendments }: { amendments: ProtocolAmendment[] }) { if (amendments.length === 0) return null; return (

    Protocol amendments

    ); }