import { useNavigate } from 'react-router-dom'; import type { SequenceSummary } from '../lib/api'; import { cleanFunction, fmtInt, methodShort, sequencePath, year } from '../lib/format'; import { MiniSplit } from './charts'; export type SortKey = 'sequence' | 'length' | 'observations' | 'states' | 'entries' | 'released'; function Th({ k, label, sort, order, onSort, num, }: { k: SortKey; label: string; sort?: SortKey; order?: 'asc' | 'desc'; onSort?: (k: SortKey) => void; num?: boolean; }) { const active = sort === k; if (!onSort) return {label}; return ( ); } export function SequenceTable({ items, sort, order, onSort, }: { items: SequenceSummary[]; sort?: SortKey; order?: 'asc' | 'desc'; onSort?: (k: SortKey) => void; }) { const navigate = useNavigate(); const p = { sort, order, onSort }; return (
{items.map((s) => ( { if ((e.target as HTMLElement).closest('a')) return; navigate(sequencePath(s.sequence_id)); }} > ))}
Function Apo / holo Methods
{ e.preventDefault(); navigate(sequencePath(s.sequence_id)); }} > {s.sequence_id}
{s.uniprot_id ?? 'no UniProt'}
{s.top_function ? cleanFunction(s.top_function) : '—'} {fmtInt(s.length)} {fmtInt(s.n_obs)} {fmtInt(s.n_states)} {fmtInt(s.n_entries)} {s.methods.slice(0, 2).map(methodShort).join(', ')} {year(s.last_release)}
); }