import { RankedCandidate } from "../api"; import { useEffect, useMemo, useState } from "react"; export function CandidateTable({ candidates }: { candidates: RankedCandidate[] }) { const pageSize = 10; const [page, setPage] = useState(1); const [preview, setPreview] = useState(null); const pageCount = Math.max(1, Math.ceil(candidates.length / pageSize)); const visibleCandidates = useMemo( () => candidates.slice((page - 1) * pageSize, page * pageSize), [candidates, page], ); useEffect(() => { setPage(1); }, [candidates]); return (
Candidate intelligence

Ranked Candidates

{candidates.length} structures
{candidates.length === 0 ? ( ) : ( visibleCandidates.map((item) => ( )) )}
Rank Structure SMILES Score Similarity Reason Warnings
No ranked candidates yet.
{item.rank} {item.canonical_smiles} {item.score} {item.similarity} {item.recommendation} {item.warnings.join("; ")}
{candidates.length > 0 && ( )} {preview && (
setPreview(null)}>
event.stopPropagation()} >
Structure preview

Candidate {preview.rank}

Original structure

Modified candidate

Changed atoms are highlighted in orange on the modified candidate. {preview.change_summary}

{preview.canonical_smiles}

)}
); }