import Link from 'next/link'; import type { ReactNode } from 'react'; import { Badge, ClaimBadge, StatusBadge } from '@/components/ui/badge'; import { SourceBadge, TableProvenance, type ProvenanceInfo } from '@/components/ui/source-badge'; import type { TrialListRow } from '@/lib/queries/trials'; import { fmtDate, fmtInt, phaseLabel } from '@/lib/format'; const CT: ProvenanceInfo = { sourceSlug: 'clinicaltrials', sourceName: 'ClinicalTrials.gov', dataset: 'ClinicalTrials.gov API v2 studies', layer: 'normalized' }; /** * Dense trial table. All rows come from one registry, so the provenance popover is rendered once in * the caption (with the latest retrieval date of the page) and each row carries a compact badge. */ export function TrialTable({ rows, summary }: { rows: TrialListRow[]; summary?: ReactNode }) { const latest = rows.reduce((m, t) => (m == null || String(t.updated_at) > String(m) ? t.updated_at : m), null); return (
}> {summary ?? `${fmtInt(rows.length)} stud${rows.length === 1 ? 'y' : 'ies'}`} ยท status and phase as posted by the registrant; each row links to the study record.
{rows.map((t) => ( ))}
NCT Title Status Phase Enrollment (n) Sponsor Countries Last update Source
{t.nct_id} {t.brief_title} {t.acronym ? ({t.acronym}) : null} {t.phases.length ? t.phases.map(phaseLabel).join(' / ') : โ€”} {t.enrollment_count == null ? 'โ€”' : fmtInt(t.enrollment_count)} {t.lead_sponsor ?? 'โ€”'} {t.lead_sponsor_class ? ( {t.lead_sponsor_class} ) : null} {t.countries.length} {fmtDate(t.last_update_posted_date)}
); }