From 82a5eb2e4bf74f42a183a15f1129e5ec84cc5231 Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Wed, 29 Oct 2025 14:17:22 -0500 Subject: [PATCH] refactor(rithmomachia): simplify capture error dialog to one-liner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace verbose error dialog with patronizing list of all failed relations with a simple, concise message: "No valid mathematical relation" + Close button. Changes: - Remove moverPiece and targetPiece props from CaptureErrorDialog - Remove all explanation generation logic - Reduce dialog size from 5x4 cells to 3x1.6 cells - Show single line of text instead of bulleted list - Keep red styling and smooth animation Result: Clean, non-patronizing feedback that simply states the fact. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/RithmomachiaGame.tsx | 82 ++++--------------- 1 file changed, 14 insertions(+), 68 deletions(-) diff --git a/apps/web/src/arcade-games/rithmomachia/components/RithmomachiaGame.tsx b/apps/web/src/arcade-games/rithmomachia/components/RithmomachiaGame.tsx index 56914e76..537eabf7 100644 --- a/apps/web/src/arcade-games/rithmomachia/components/RithmomachiaGame.tsx +++ b/apps/web/src/arcade-games/rithmomachia/components/RithmomachiaGame.tsx @@ -25,43 +25,19 @@ import { import { PieceRenderer } from './PieceRenderer' /** - * Error dialog when no capture is possible + * Error dialog when no capture is possible - simple one-liner */ function CaptureErrorDialog({ targetPos, cellSize, - moverPiece, - targetPiece, onClose, closing, }: { targetPos: { x: number; y: number } cellSize: number - moverPiece: Piece - targetPiece: Piece onClose: () => void closing: boolean }) { - const moverValue = getEffectiveValue(moverPiece) - const targetValue = getEffectiveValue(targetPiece) - - // Get explanations for why each relation failed - const explanations: string[] = [] - if ( - moverValue !== undefined && - moverValue !== null && - targetValue !== undefined && - targetValue !== null - ) { - explanations.push(checkEqual(moverValue, targetValue).explanation || '') - explanations.push(checkMultiple(moverValue, targetValue).explanation || '') - explanations.push(checkDivisor(moverValue, targetValue).explanation || '') - explanations.push('SUM: No friendly piece can serve as helper') - explanations.push('DIFF: No friendly piece can serve as helper') - explanations.push('PRODUCT: No friendly piece can serve as helper') - explanations.push('RATIO: No friendly piece can serve as helper') - } - const entranceSpring = useSpring({ from: { scale: 0, opacity: 0 }, scale: closing ? 0 : 1, @@ -80,66 +56,38 @@ function CaptureErrorDialog({ )} >
e.stopPropagation()} > -
- ❌ Capture Not Possible -
-
- No mathematical relation works: -
-
- {explanations.filter(Boolean).map((exp, i) => ( -
- • {exp} -
- ))} -
+
No valid mathematical relation