Files
ai-taxonomy-literature-anal…/pages/contents/[node].tsx
T
2026-10-23 05:23:13 +00:00

90 lines
3.9 KiB
TypeScript

import type { GetServerSideProps } from 'next';
import Link from 'next/link';
import Layout from '../../components/Layout';
import { getContent } from '../../lib/content';
import { findNode } from '../../lib/content-tree';
import { typeSlug } from '../../lib/slug';
type Content = Awaited<ReturnType<typeof getContent>>;
interface Props { node: { id: string; title: string; blurb: string; areas: string[]; taxonomy: string[] }; content: Content }
export const getServerSideProps: GetServerSideProps<Props> = async ({ params }) => {
const node = findNode(String(params?.node));
if (!node || node.id === 'root') return { notFound: true };
const { children: _c, ...plain } = node;
return { props: { node: plain, content: await getContent(node) } };
};
export default function Contents({ node, content }: Props) {
const area = content.areas[0];
return (
<Layout title={node.title}>
<p><Link href="/contents">← Contents</Link></p>
<h1>{node.title}</h1>
<div>
<section>
<p className="sub">{node.blurb}</p>
<div className="cards">
<div className="card"><div className="stat">{content.total.toLocaleString()}</div>papers in this area{area ? ` (${area.label.split(',')[0]})` : ''}</div>
{content.taxonomy.map((t) => (
<Link key={t.id} href={`/papers?node=${t.id}`} className="card" style={{ color: 'inherit', textDecoration: 'none' }}>
<div className="stat">{t.n.toLocaleString()}</div>in taxonomy: <b style={{ color: 'var(--accent)' }}>{t.label}</b>
</Link>
))}
<div className="card"><div className="stat">{content.benchmarks.length}</div>benchmarks most used here</div>
</div>
{content.reviews.length > 0 && (
<>
<h2>Reviews</h2>
<div className="cards">
{content.reviews.map((r) => (
<Link key={r.type_id} href={`/work-types/${typeSlug(r.type_id)}`} className="card" style={{ color: 'inherit', textDecoration: 'none' }}>
<b style={{ color: 'var(--accent)' }}>{r.title}</b>
<div className="sub" style={{ margin: '4px 0 0', fontSize: 13 }}>{r.n} papers</div>
</Link>
))}
</div>
</>
)}
<h2>By kind of contribution</h2>
<table>
<thead><tr><th>Role</th><th>What it fixes → varies</th><th>Papers</th><th>Read in detail</th></tr></thead>
<tbody>
{content.roles.map((r) => (
<tr key={r.id}>
<td><b>{r.label}</b></td>
<td>{r.fixes || '—'} → {r.varies || '—'}</td>
<td>{r.cells.reduce((s, c) => s + c.n, 0)}</td>
<td>{r.cells.filter((c) => c.n > 0).map((c) => <Link key={c.id} href={`/work-types/${typeSlug(c.id)}`}>{c.n_llm > 0 ? `${c.n_llm} labelled` : 'rule-labelled'}</Link>)}</td>
</tr>
))}
</tbody>
</table>
<h2>Benchmarks used</h2>
<table>
<thead><tr><th>Benchmark</th><th>Papers</th><th>Introduced in 2026</th></tr></thead>
<tbody>
{content.benchmarks.map((b) => (
<tr key={b.id}><td><Link href={`/benchmarks/${b.id}`}>{b.name}</Link></td><td>{b.n}</td><td>{b.n_new || ''}</td></tr>
))}
</tbody>
</table>
<h2>Recent papers (read in detail)</h2>
{content.papers.map((p) => (
<div key={p.id} className="paper">
<h3><Link href={`/papers/${p.id}`}>{p.title}</Link></h3>
<div className="meta">{p.conf_short} · {p.date}</div>
{p.summary && <p>{p.summary}</p>}
</div>
))}
{content.taxonomy[0] && <p><Link href={`/papers?node=${content.taxonomy[0].id}`}>All papers in “{content.taxonomy[0].label}” →</Link></p>}
</section>
</div>
</Layout>
);
}