import type { Metadata } from 'next'; import Link from 'next/link'; import { PageHeader } from '@/components/ui/section'; import { EmptyState } from '@/components/ui/empty-state'; import { Badge } from '@/components/ui/badge'; import { Pagination } from '@/components/ui/pagination'; import { listDrugs } from '@/lib/queries/drugs'; import { fmtInt, humanize } from '@/lib/format'; import { str, int, withParams, type SP } from '@/lib/search-params'; export const metadata: Metadata = { title: 'Drugs', description: 'Oncology drugs with jurisdiction-aware approvals, curated evidence and trials.' }; // Filtered list: rendered per request (searchParams); 600 s is the CDN/ISR hint shared by all list pages. export const revalidate = 600; const PAGE_SIZE = 50; export default async function DrugsPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const q = str(sp, 'q'); const kind = str(sp, 'kind'); const page = int(sp, 'page', 1, 1, 100_000); const { rows, total, kinds } = await listDrugs({ q, kind, page, pageSize: PAGE_SIZE }); const href = (o: Record) => `/drugs${withParams({ q, kind }, o)}`; return (

{fmtInt(total)} drugs

{rows.length === 0 ? (
{total === 0 && !q && !kind ? 'Drug entities are created by the CIViC therapy, NCIt and regulatory connectors; none has run on this environment yet.' : 'Try another name, brand or development code.'}
) : ( <>
{rows.map((d) => ( ))}
Drug Kind Mechanism Approvals Evidence items Trials Identifiers
{d.name} {d.kind ? {humanize(d.kind)} : 'โ€”'} {d.mechanism ?? 'โ€”'} {fmtInt(d.approval_count ?? 0)} {fmtInt(d.evidence_count ?? 0)} {fmtInt(d.trial_count ?? 0)} {[d.ncit_code, d.chembl_id, d.drugbank_id].filter(Boolean).join(' ยท ') || 'โ€”'}
href({ page: p === 1 ? '' : p })} /> )}
); }