Add reviews view, work-type UI updates, and permanent deploy workflow (ces-control)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
This commit is contained in:
2026-10-22 14:50:03 +00:00
parent 0a8c7fd4de
commit f5d014a022
10 changed files with 535 additions and 108 deletions
+116
View File
@@ -0,0 +1,116 @@
import Link from 'next/link';
import Layout from './Layout';
import { ScoreBars, ScoreScatter, TimelineBars } from './SvgCharts';
import { typeSlug } from '../lib/slug';
import type { getWorkType } from '../lib/worktypes';
type Data = NonNullable<ReturnType<typeof getWorkType>>;
const sc = (d: string) => (d.length > 140 ? d.slice(0, 138) + '…' : d);
export default function LegacyTypeView({ data, page, llm, slug }: { data: Data; page: number; llm: boolean; slug: string }) {
const { type, area, role, members, timeline, benchmarks, results, siblings, sameRole, note, workflows, total, pageSize } = data;
const pages = Math.max(1, Math.ceil(total / pageSize));
const href = (p: number, src = llm) => `/work-types/${slug}?${[src ? 'src=llm' : '', p > 1 ? `page=${p}` : ''].filter(Boolean).join('&')}`;
const withScores = results.length > 0;
return (
<Layout title={`${area.label} · ${role.label}`}>
<p><Link href="/work-types">← All types of work</Link></p>
<h1>{role.label}</h1>
<p className="sub">in <b>{area.label}</b> · {type.n_papers.toLocaleString()} papers ({type.n_llm_labeled} labelled in detail)</p>
<h2>1. Time order</h2>
<div className="card">
<TimelineBars items={timeline} />
<p className="sub" style={{ margin: '6px 0 0' }}>Papers placed by venue date; the table below lists them in the same order. Exact submission dates need arXiv access.</p>
</div>
<h2>2. How it is classified, and why different papers are the same type</h2>
<div className="card">
<p><b>Definition.</b> {role.descr}</p>
<p><b>Holds fixed:</b> {role.fixes || '—'} &nbsp; <b>Varies:</b> {role.varies || '—'}</p>
{note?.why_same && <p><b>What these papers share:</b> {note.why_same}</p>}
{note?.narrative && <p>{note.narrative}</p>}
<p><b>How this type differs from neighbours in the same area</b></p>
<table>
<thead><tr><th>Role (same area)</th><th>Fixes</th><th>Varies</th><th>Papers</th></tr></thead>
<tbody>
{siblings.map((s) => (
<tr key={s.id} style={s.id === type.id ? { fontWeight: 700 } : undefined}>
<td>{s.id === type.id ? s.label : <Link href={`/work-types/${typeSlug(s.id)}`}>{s.label}</Link>}</td><td>{s.fixes || '—'}</td><td>{s.varies || '—'}</td><td>{s.n_papers}</td>
</tr>
))}
</tbody>
</table>
{sameRole.length > 0 && (
<p style={{ marginTop: 10 }}><b>Same role in other areas:</b>{' '}
{sameRole.map((s) => <Link key={s.id} className="badge" href={`/work-types/${typeSlug(s.id)}`}>{s.label.slice(0, 40)} {s.n_papers}</Link>)}
</p>
)}
</div>
<h2>3. Benchmarks usually used, and what they are used to show</h2>
{benchmarks.length ? (
<table>
<thead><tr><th>Benchmark</th><th>Papers</th><th>Introduced here</th><th>Used to show</th></tr></thead>
<tbody>
{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><td>{b.purposes ?? '—'}</td></tr>
))}
</tbody>
</table>
) : <p className="sub">No benchmark named in these papers’ abstracts yet.</p>}
{note?.bench_summary && <p>{note.bench_summary}</p>}
<h2>4. Workflow</h2>
<div className="card">
{note && note.workflow.length > 0 && (
<ol style={{ margin: '0 0 10px', paddingLeft: 20 }}>{note.workflow.map((s, i) => <li key={i}>{s}</li>)}</ol>
)}
{workflows.length > 0 ? workflows.map((w) => (
<p key={w.id} style={{ margin: '6px 0', fontSize: 14 }}>
<Link href={`/papers/${w.id}`}>{w.title.slice(0, 60)}</Link>: {w.steps.join(' → ')}
</p>
)) : <span className="sub">Workflows are extracted for papers that were read in detail.</span>}
</div>
<h2>5. Scores</h2>
<div className="card">
{withScores ? (
<>
<ScoreScatter points={results.map((r) => ({ date: r.date, score: r.score, series: r.setting ?? 'reported', label: `${r.system ?? '?'} on ${r.bench}`, unit: r.unit }))} />
<h3 style={{ fontSize: 14 }}>Best reported score per system</h3>
<ScoreBars rows={results.map((r) => ({ label: `${r.system ?? '?'} · ${r.bench}`, score: r.score, series: r.setting ?? 'reported' }))} />
</>
) : (
<p className="sub" style={{ margin: 0 }}>
No numeric scores are stated in the abstracts of this type’s papers. Scores sit in result tables, which need the full text (arXiv / OpenReview / ACL Anthology). The chart renders automatically once results are loaded.
</p>
)}
</div>
<h2>Papers in time order</h2>
<div className="filters">
<Link className={`btn ${llm ? 'ghost' : ''}`} href={href(1, false)}>All labels</Link>
<Link className={`btn ${llm ? '' : 'ghost'}`} href={href(1, true)}>Detailed (LLM-read) only</Link>
</div>
<table>
<thead><tr><th>Date</th><th>Paper</th><th>What it varies / holds fixed</th><th>Why this type</th></tr></thead>
<tbody>
{members.map((m) => (
<tr key={m.id}>
<td style={{ whiteSpace: 'nowrap' }}>{m.date.slice(0, 7)}<div className="sub" style={{ margin: 0, fontSize: 12 }}>{m.conf_short}{m.track ? ` · ${m.track}` : ''}</div></td>
<td><Link href={`/papers/${m.id}`}>{m.title}</Link>{m.source === 'rule' && <span className="badge" title="rule-based label">rule</span>}{m.summary && <div className="sub" style={{ margin: 0, fontSize: 13 }}>{sc(m.summary)}</div>}</td>
<td style={{ fontSize: 13 }}>{m.varies.length ? <>varies: {m.varies.join('; ')}</> : '—'}{m.fixes.length ? <><br />fixes: {m.fixes.join('; ')}</> : null}</td>
<td style={{ fontSize: 13 }}>{m.why || '—'}</td>
</tr>
))}
</tbody>
</table>
<div className="pager">
<Link className={`btn ghost ${page <= 1 ? 'dis' : ''}`} href={href(page - 1)}>← Prev</Link>
<span>Page {page} / {pages}</span>
<Link className={`btn ghost ${page >= pages ? 'dis' : ''}`} href={href(page + 1)}>Next →</Link>
</div>
</Layout>
);
}
+48
View File
@@ -0,0 +1,48 @@
import Link from 'next/link';
import { Fragment, ReactNode } from 'react';
/** Minimal, safe markdown: paragraphs, ###/#### headings, -/1. lists, **bold**, *italic*, `code`, citations [#id] / [#a, #b]. */
export default function Markdown({ text, cite }: { text: string; cite: Record<number, number> }) {
const blocks = (text ?? '').replace(/\r/g, '').split(/\n{2,}/);
return <>{blocks.map((b, i) => <Block key={i} src={b.trim()} cite={cite} />)}</>;
}
function Block({ src, cite }: { src: string; cite: Record<number, number> }) {
if (!src) return null;
const h = src.match(/^(#{2,4})\s+(.*)$/);
if (h && !src.includes('\n')) {
const lvl = h[1].length;
return lvl <= 3 ? <h3 className="md-h">{inline(h[2], cite)}</h3> : <h4 className="md-h">{inline(h[2], cite)}</h4>;
}
const lines = src.split('\n');
if (lines.every((l) => /^\s*[-*]\s+/.test(l))) return <ul>{lines.map((l, i) => <li key={i}>{inline(l.replace(/^\s*[-*]\s+/, ''), cite)}</li>)}</ul>;
if (lines.every((l) => /^\s*\d+[.)]\s+/.test(l))) return <ol>{lines.map((l, i) => <li key={i}>{inline(l.replace(/^\s*\d+[.)]\s+/, ''), cite)}</li>)}</ol>;
return <p>{inline(lines.join(' '), cite)}</p>;
}
export function inline(s: string, cite: Record<number, number>): ReactNode[] {
const out: ReactNode[] = [];
const re = /(\[#\d+(?:\s*[,;]\s*#?\d+)*\])|(\*\*[^*]+\*\*)|(\*[^*\s][^*]*\*)|(`[^`]+`)/g;
let last = 0; let m: RegExpExecArray | null; let k = 0;
while ((m = re.exec(s))) {
if (m.index > last) out.push(s.slice(last, m.index));
const t = m[0];
if (m[1]) {
const ids = [...t.matchAll(/(\d+)/g)].map((x) => Number(x[1]));
out.push(<sup key={k++} className="cite">[{ids.map((id, j) => (
<Fragment key={id}>{j > 0 && ','}<a href={`#ref-${id}`} title={`paper ${id}`}>{cite[id] ?? '?'}</a></Fragment>
))}]</sup>);
} else if (m[2]) out.push(<strong key={k++}>{t.slice(2, -2)}</strong>);
else if (m[3]) out.push(<em key={k++}>{t.slice(1, -1)}</em>);
else out.push(<code key={k++}>{t.slice(1, -1)}</code>);
last = m.index + t.length;
}
if (last < s.length) out.push(s.slice(last));
return out;
}
/** Inline list of citation chips for id arrays (tables). */
export function Cites({ ids, cite }: { ids: number[]; cite: Record<number, number> }) {
return <>{ids.map((id) => <a key={id} className="cite-chip" href={`#ref-${id}`}>[{cite[id] ?? '?'}]</a>)}</>;
}
export { Link };
+49
View File
@@ -0,0 +1,49 @@
const PALETTE = ['#2f5bea', '#e0702b', '#1b9e77', '#a14b9c', '#c9a227', '#d6336c', '#37a0d6', '#6b8e23'];
/** Swimlane: one lane per subfield, papers as dots on a venue-date axis. */
export function SubfieldTimeline({ lanes, cite }: { lanes: { name: string; papers: { id: number; date: string; title: string }[] }[]; cite: Record<number, number> }) {
const all = lanes.flatMap((l) => l.papers);
if (!all.length) return null;
const ts = (d: string) => new Date(d + (d.length === 7 ? '-15' : '') + 'T00:00:00Z').getTime();
const lo = Math.min(...all.map((p) => ts(p.date))) - 25 * 864e5, hi = Math.max(...all.map((p) => ts(p.date))) + 25 * 864e5;
const W = 760, L = 210, R = 16, laneH = 34, top = 8, H = top + lanes.length * laneH + 30;
const X = (t: number) => L + ((t - lo) / (hi - lo || 1)) * (W - L - R);
const months: number[] = [];
for (let d = new Date(lo); d.getTime() <= hi; d.setUTCMonth(d.getUTCMonth() + 1)) months.push(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1));
return (
<svg viewBox={`0 0 ${W} ${H}`} width="100%" role="img" aria-label="papers per subfield over time">
{months.map((m) => (<g key={m}><line x1={X(m)} x2={X(m)} y1={top} y2={H - 26} stroke="currentColor" opacity=".08" /><text x={X(m)} y={H - 10} fontSize="10" textAnchor="middle" fill="currentColor" opacity=".6">{new Date(m).toISOString().slice(0, 7)}</text></g>))}
{lanes.map((l, i) => {
const y = top + i * laneH + laneH / 2;
const byDate: Record<string, number> = {};
return (
<g key={l.name}>
<text x={L - 8} y={y + 4} fontSize="11" textAnchor="end" fill="currentColor">{l.name.length > 32 ? l.name.slice(0, 31) + '…' : l.name}</text>
<line x1={L} x2={W - R} y1={y} y2={y} stroke="currentColor" opacity=".15" />
{l.papers.map((p) => {
const k = (byDate[p.date] = (byDate[p.date] ?? 0) + 1);
const dx = ((k - 1) % 6) * 7 - 17, dy = Math.floor((k - 1) / 6) * 7 - 5;
return (
<a key={p.id} href={`#ref-${p.id}`}>
<circle cx={X(ts(p.date)) + dx} cy={y + dy} r="4.5" fill={PALETTE[i % PALETTE.length]} opacity=".85"><title>{`[${cite[p.id]}] ${p.title} (${p.date})`}</title></circle>
</a>
);
})}
</g>
);
})}
</svg>
);
}
/** Horizontal workflow: boxes with arrows, wrapping. */
export function WorkflowFlow({ steps }: { steps: string[] }) {
if (!steps.length) return null;
return (
<div className="flow">
{steps.map((s, i) => (
<div key={i} className="flow-step"><span className="flow-n">{i + 1}</span>{s}{i < steps.length - 1 && <span className="flow-arrow">→</span>}</div>
))}
</div>
);
}