diff --git a/apps/web/.claude/CLAUDE.md b/apps/web/.claude/CLAUDE.md index 25384a9a..ac7ddc1d 100644 --- a/apps/web/.claude/CLAUDE.md +++ b/apps/web/.claude/CLAUDE.md @@ -138,12 +138,43 @@ See `.claude/GAME_THEMES.md` for standardized color theme usage in arcade games. - ✅ Use `useAbacusConfig` for abacus configuration - ✅ Use `useAbacusDisplay` for reading abacus state +**MANDATORY: Read the Docs Before Customizing** + +**ALWAYS read the full README documentation before customizing or styling AbacusReact:** +- Location: `packages/abacus-react/README.md` +- Check homepage implementation: `src/app/page.tsx` (MiniAbacus component) +- Check storybook examples: `src/stories/AbacusReact.*.stories.tsx` + +**Key Documentation Points:** +1. **Custom Styles**: Use `fill` (not just `stroke`) for columnPosts and reckoningBar +2. **Props**: Use direct props like `value`, `columns`, `scaleFactor` (not config objects) +3. **Example from Homepage:** + ```typescript + const darkStyles = { + columnPosts: { + fill: 'rgba(255, 255, 255, 0.3)', + stroke: 'rgba(255, 255, 255, 0.2)', + strokeWidth: 2, + }, + reckoningBar: { + fill: 'rgba(255, 255, 255, 0.4)', + stroke: 'rgba(255, 255, 255, 0.25)', + strokeWidth: 3, + }, + } + + + ``` + **Example Usage:** ```typescript -import { AbacusReact, useAbacusConfig } from '@soroban/abacus-react' +import { AbacusReact } from '@soroban/abacus-react' -const config = useAbacusConfig({ columns: 5 }) - + ``` ## Known Issues diff --git a/apps/web/src/app/levels/page.tsx b/apps/web/src/app/levels/page.tsx index 28387577..f30ab1cc 100644 --- a/apps/web/src/app/levels/page.tsx +++ b/apps/web/src/app/levels/page.tsx @@ -127,6 +127,29 @@ export default function LevelsPage() { // Smaller scale for more columns (Dan levels with 30 columns) const scaleFactor = Math.min(2.5, 20 / currentLevel.digits) + // Generate an interesting non-zero number to display on the abacus + // Create a value that uses all available columns (e.g., 2 columns = 12, 3 columns = 123) + // For larger numbers, create a pattern like 123456789012... up to the column count + const digitPattern = '123456789' + const displayValue = Number.parseInt( + digitPattern.repeat(Math.ceil(currentLevel.digits / digitPattern.length)).slice(0, currentLevel.digits), + 10, + ) + + // Dark theme styles matching the homepage + const darkStyles = { + columnPosts: { + fill: 'rgba(255, 255, 255, 0.3)', + stroke: 'rgba(255, 255, 255, 0.2)', + strokeWidth: 2, + }, + reckoningBar: { + fill: 'rgba(255, 255, 255, 0.4)', + stroke: 'rgba(255, 255, 255, 0.25)', + strokeWidth: 3, + }, + } + return ( @@ -251,17 +274,11 @@ export default function LevelsPage() { })} >