From 71eb30bd895fed0ce6fd83cbb8ad376ad8ae0a80 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 4 Jan 2026 10:17:15 +0100 Subject: [PATCH] feat: remove Try Again button - allow immediate retries like Chess.com When a user makes an incorrect move, they can now immediately try again without clicking Try Again. The wrong move is undone, error sound plays, and the user can make another attempt right away. Changes: - Remove setFeedback(incorrect) on wrong moves - Remove handleTryAgain function (no longer needed) - Simplify button logic: Show Next when correct, Skip otherwise - Skip button now always visible during puzzle solving This matches Chess.com UX where incorrect moves just play a sound and let you retry instantly. --- src/app/learning/tactics/[pattern]/page.tsx | 42 +++------------------ 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/src/app/learning/tactics/[pattern]/page.tsx b/src/app/learning/tactics/[pattern]/page.tsx index 0ce650f..ed5a5a0 100644 --- a/src/app/learning/tactics/[pattern]/page.tsx +++ b/src/app/learning/tactics/[pattern]/page.tsx @@ -275,9 +275,8 @@ export default function TacticalPracticePage() { })); } else { errorSound.current?.play().catch(e => console.error("Audio play failed", e)); - setFeedback('incorrect'); - // Undo the wrong move instead of resetting to start position - // This allows the user to try again from the same position (like chess.com) + // Don't set feedback to 'incorrect' - just play error sound and undo + // This allows the user to immediately try again without clicking "Try Again" gameRef.current.undo(); setFen(gameRef.current.fen()); @@ -315,9 +314,8 @@ export default function TacticalPracticePage() { if (!isCorrect) { errorSound.current?.play().catch(e => console.error("Audio play failed", e)); - setFeedback('incorrect'); - // Undo the wrong move instead of resetting to start position - // This allows the user to try again from the same position (like chess.com) + // Don't set feedback to 'incorrect' - just play error sound and undo + // This allows the user to immediately try again without clicking "Try Again" // The currentMoveIndex stays the same since we're still waiting for the same move gameRef.current.undo(); setFen(gameRef.current.fen()); @@ -385,15 +383,6 @@ export default function TacticalPracticePage() { } }; - const handleTryAgain = () => { - // Since we now undo the wrong move immediately when it's made, - // the board is already in the correct position (before the error). - // We just need to reset the feedback state to allow the user to try again. - setFeedback('none'); - // Don't reset userMove - keep the chat context - // The Tutor will know the user tried again because feedback changed to 'none' - }; - const handleSkipPuzzle = () => { // Skip counts as incorrect for stats setStats(prev => ({ @@ -637,7 +626,7 @@ export default function TacticalPracticePage() { {/* Action Buttons */}
- {feedback === 'correct' && ( + {feedback === 'correct' ? ( - )} - {feedback === 'incorrect' && ( - <> - - - - )} - {feedback === 'none' && ( + ) : (