5407bf4dff
Deploy / deploy (push) Successful in 8m0s
A page is now an ordered list of independent blocks (analysis.page_block), no sections and no headings; every block has an id shown on the page so it can be pointed at. Paper detail pages use page "paper/<conf>/<ext_id>", analysis pages on /contents use "content/<node id>". - /api/blocks (list, replace a page, add) and /api/blocks/:id (get, patch, move, delete) - dynamic block types (stats, tool-table, paper-table, benchmark-table) are filled from the database at render time; the two content pages are rendered from their blocks (seeded with defaults on first view) - one-time migration copies the legacy articles into blocks (section titles dropped, links become a links block); legacy tables are kept untouched - old /api/articles, ArticleView and PaperGroup removed Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
27 lines
1.6 KiB
TypeScript
27 lines
1.6 KiB
TypeScript
import type { ContentNode } from './content-tree';
|
|
|
|
/** The blocks a content page starts with (written to the database the first time the page is opened; edit them afterwards
|
|
* through /api/blocks, not here). */
|
|
export function defaultBlocks(n: ContentNode): { type: string; data: any }[] {
|
|
if (n.kind === 'tools') {
|
|
return [
|
|
{ type: 'stats', data: { node: n.id, items: [
|
|
{ metric: 'area-papers', label: 'papers in this area' },
|
|
...n.taxonomy.map((t) => ({ metric: 'taxonomy-papers', arg: t, label: 'in taxonomy: {name}' })),
|
|
{ metric: 'benchmark-count', label: 'benchmarks most used here' },
|
|
] } },
|
|
{ type: 'tool-table', data: { caption: 'Tools by category', note: '{tools} tools from {papers} papers. A tool can sit in several categories. A category lists every tool filed under it or under a category below it (marked “via …”); each tool links to the paper that designed it.' } },
|
|
{ type: 'benchmark-table', data: { node: n.id, scope: 'areas', caption: 'Benchmarks used' } },
|
|
];
|
|
}
|
|
return [
|
|
{ type: 'stats', data: { node: n.id, items: [
|
|
{ metric: 'group-papers', label: 'papers in this group' },
|
|
{ metric: 'group-analysed', label: 'analysed in depth' },
|
|
{ metric: 'group-venues', arg: 4, label: 'at {name}' },
|
|
] } },
|
|
{ type: 'benchmark-table', data: { node: n.id, scope: 'papers', caption: 'Benchmarks these papers use' } },
|
|
{ type: 'paper-table', data: { node: n.id, caption: 'All papers in the group', note: 'Matched by text (title, abstract, keywords); a paper may be a false match.' } },
|
|
];
|
|
}
|