Files
ai-taxonomy-literature-anal…/lib/content-cards.ts
T
claude-bot 5e3441d76a
Deploy / deploy (push) Successful in 7m27s
Contents: waterfall layout of analysis pages; add Lean theorem-proving page
- /contents: masonry cards, one per analysis page, with stats and a glimpse of what is inside
- new node lean-theorem-proving (kind "papers"): papers matched by text, their analysis articles,
  benchmarks used, full paper list; node kinds: tools | papers
- tools table rows get anchors

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
2026-10-23 21:18:29 +08:00

35 lines
1.6 KiB
TypeScript

import { CONTENT_TREE, ContentNode } from './content-tree';
import { getPaperList } from './content-papers';
import { getToolTable } from './tool-taxonomy';
export interface Card {
id: string; title: string; blurb: string; kind: ContentNode['kind'];
stats: { n: number; label: string }[];
items: { title: string; href: string; note?: string }[]; // what is inside: categories, analysed papers, ...
more?: string;
}
/** One card per analysis page on /contents, with a glimpse of what is inside. */
export async function getCards(): Promise<Card[]> {
return Promise.all(CONTENT_TREE.children.map(async (n): Promise<Card> => {
const base = { id: n.id, title: n.title, blurb: n.blurb, kind: n.kind };
if (n.kind === 'tools') {
const t = await getToolTable();
const top = t.rows.filter((r) => r.depth === 0);
return {
...base,
stats: [{ n: t.tools, label: 'tools' }, { n: t.papers, label: 'papers' }, { n: t.rows.length, label: 'categories' }],
items: top.map((r) => ({ title: r.title, href: `/contents/${n.id}#${r.slug}`, note: `${r.entries.length}` })),
};
}
const l = await getPaperList(n);
const shown = l.analysed.slice(0, 6);
return {
...base,
stats: [{ n: l.total, label: 'papers' }, { n: l.analysed.length, label: 'analysed in depth' }, { n: l.byVenue.length, label: 'venues' }],
items: shown.map((a) => ({ title: a.paperTitle.split(':')[0], href: `/papers/${a.paperId}`, note: a.updatedAt })),
more: l.analysed.length > shown.length ? `+${l.analysed.length - shown.length} more` : undefined,
};
}));
}