fix(web): use AbacusStatic for calendar SVG generation

- Switch from AbacusReact to AbacusStatic in generateCalendarAbacus.tsx
- Fixes "failed to parse SVG (missing root node)" Typst error
- AbacusReact can't be rendered server-side with renderToStaticMarkup
- AbacusStatic is designed for pure server-side rendering

Root cause: AbacusReact has "use client" directive and uses hooks,
which causes renderToStaticMarkup to generate invalid/empty SVG.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-11-03 19:24:57 -06:00
parent a9664bdcb4
commit 08c6a419e2

View File

@@ -5,12 +5,12 @@
* Usage: npx tsx scripts/generateCalendarAbacus.tsx <value> <columns>
* Example: npx tsx scripts/generateCalendarAbacus.tsx 15 2
*
* Pattern copied directly from working generateDayIcon.tsx
* Uses AbacusStatic for server-side rendering (no client hooks)
*/
import React from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { AbacusReact } from '@soroban/abacus-react'
import { AbacusStatic } from '@soroban/abacus-react/static'
const value = parseInt(process.argv[2], 10)
const columns = parseInt(process.argv[3], 10)
@@ -20,15 +20,14 @@ if (isNaN(value) || isNaN(columns)) {
process.exit(1)
}
// Use exact same pattern as generateDayIcon - inline customStyles
// Use AbacusStatic - pure server-side rendering, no client hooks
const abacusMarkup = renderToStaticMarkup(
<AbacusReact
<AbacusStatic
value={value}
columns={columns}
scaleFactor={1}
animated={false}
interactive={false}
showNumbers={false}
frameVisible={true}
/>
)