mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-28 07:32:52 +00:00
What the site's header and root mount on every page carried three things no page draws until the reader acts: - The header's Solutions and Hanzo OS rows imported lib/data/solutions.ts and lib/layers.ts whole, every solution's page copy and every layer's operations, to draw a column of links that is not open. The rows are now derived at prebuild (scripts/sync-menu.mjs → lib/data/menu.json: names and addresses), so a solution or a layer is still added in its list and nowhere else; e2e/unit/menu.spec holds the file to the lists. - The ⌘K palette and the toast viewport load once React owns the page (components/shell/later.tsx): the palette listens for its own chord, and a toast is always something the reader did after the page was theirs. components/shell/lazy.ts names one export of each package, so the import takes them and not the barrels. An empty page's first load is 354 KB (was 367), the landing's 430 KB gzip against weight.spec's 445 (was 457), and the pages over perf.budget.json go from 124 to 64. Claude-Session: https://claude.ai/code/session_01BLLMyBFSvAfCt7ZGqYuiEz
33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
/**
|
|
* The header's rows for Solutions and Hanzo OS, as names and addresses.
|
|
*
|
|
* The header draws on every page, and the lists these rows come from are not
|
|
* small: lib/data/solutions.ts carries every solution's page copy and
|
|
* lib/layers.ts every layer's operations. Imported by the nav tree, all of it
|
|
* shipped in the first load of every page to draw a column of links that is
|
|
* not even open (about 11 KB after brotli). So the rows are DERIVED from those
|
|
* two lists here, at prebuild, and the nav tree reads this file: a solution or
|
|
* a layer is still added in its list and nowhere else.
|
|
*
|
|
* It imports the TypeScript sources directly, which Node strips types from on
|
|
* its own from 22.18 (scripts/sync-pages.mjs makes the same call).
|
|
*/
|
|
import { writeFileSync } from 'node:fs'
|
|
import { join } from 'node:path'
|
|
import { INDEX, KINDS, href as solution, ofKind } from '../lib/data/solutions.ts'
|
|
import { LAYERS, href as layer } from '../lib/layers.ts'
|
|
|
|
const OUT = join(import.meta.dirname, '..', 'lib', 'data', 'menu.json')
|
|
|
|
/** The rows, in the lists' own order. */
|
|
export const menu = () => ({
|
|
index: INDEX,
|
|
solutions: KINDS.map((k) => ({ id: k.id, title: k.label, links: ofKind(k.id).map((s) => ({ label: s.name, href: solution(s) })) })),
|
|
layers: LAYERS.map((l) => ({ label: l.name, href: layer(l) })),
|
|
})
|
|
|
|
if (import.meta.main) {
|
|
writeFileSync(OUT, JSON.stringify(menu(), null, 2) + '\n')
|
|
console.log(`[menu] ${OUT}`)
|
|
}
|