13924f8985
- Next.js/React/TypeScript app: overview, paper explorer with FTS5 search, paper detail, global taxonomy tree with per-conference tag breakdown - Python ingestion (ICLR/ICML 2026 via paperlists, ACL Anthology 2026) into data/papers.db, plus keyword-scored taxonomy (scripts/taxonomy.py) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bhs9LU8eMixk6g1kb1d3j7
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
import Link from 'next/link';
|
|
import { TaxNode } from '../lib/types';
|
|
|
|
interface Props {
|
|
nodes: TaxNode[];
|
|
selected?: string;
|
|
/** build the href for a node */
|
|
href: (id: string) => string;
|
|
openAll?: boolean;
|
|
/** node id -> conference slug -> count; renders conference tag chips */
|
|
breakdown?: Record<string, Record<string, number>>;
|
|
chipHref?: (nodeId: string, conf: string) => string;
|
|
confLabel?: Record<string, string>;
|
|
}
|
|
|
|
function Chips({ id, p }: { id: string; p: Props }) {
|
|
const b = p.breakdown?.[id];
|
|
if (!b || !p.chipHref) return null;
|
|
return (
|
|
<span style={{ marginLeft: 8 }}>
|
|
{Object.entries(b).sort((x, y) => y[1] - x[1]).map(([conf, n]) => (
|
|
<Link key={conf} href={p.chipHref!(id, conf)} className="badge">{p.confLabel?.[conf] ?? conf} {n}</Link>
|
|
))}
|
|
</span>
|
|
);
|
|
}
|
|
|
|
export default function TaxonomyTree(props: Props) {
|
|
const { nodes, selected = '', href, openAll = false } = props;
|
|
return (
|
|
<ul className="tree">
|
|
{nodes.map((n) => {
|
|
const link = (
|
|
<Link href={href(n.id)} className={n.id === selected ? 'sel' : ''}>
|
|
{n.label}
|
|
</Link>
|
|
);
|
|
if (!n.children.length) {
|
|
return (
|
|
<li key={n.id}>
|
|
{link}
|
|
<span className="n">{n.count.toLocaleString()}</span>
|
|
<Chips id={n.id} p={props} />
|
|
</li>
|
|
);
|
|
}
|
|
const open = openAll || selected === n.id || selected.startsWith(n.id + '/');
|
|
return (
|
|
<li key={n.id}>
|
|
<details open={open}>
|
|
<summary>
|
|
{link}
|
|
<span className="n">{n.count.toLocaleString()}</span>
|
|
<Chips id={n.id} p={props} />
|
|
</summary>
|
|
<TaxonomyTree {...props} nodes={n.children} />
|
|
</details>
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
);
|
|
}
|