Add confirmation dialog for resign button

- Add window.confirm() before resigning to prevent accidental resignation
- Add 'resignConfirm' translation key in all 5 languages (EN, DE, FR, IT, PL)
- Messages are localized and warn that the action cannot be undone
This commit is contained in:
Stefan
2025-12-03 09:05:17 +01:00
parent 41ca7ae187
commit 6aa7d5bdd8
2 changed files with 12 additions and 1 deletions
+6 -1
View File
@@ -601,6 +601,11 @@ export default function ChessGame({ gameId, initialFen, initialPgn, initialPerso
const handleResign = useCallback(async () => {
if (gameOverState) return;
// Show confirmation dialog
const confirmed = window.confirm(t.game.resignConfirm);
if (!confirmed) return;
setIsAnalyzing(false);
const currentFen = gameRef.current.fen();
@@ -630,7 +635,7 @@ export default function ChessGame({ gameId, initialFen, initialPgn, initialPerso
result,
winner,
});
}, [gameOverState, moveHistory, playerColor, stockfish, stockfishDepth, t.game.resignation]);
}, [gameOverState, moveHistory, playerColor, stockfish, stockfishDepth, t.game.resignConfirm, t.game.resignation]);
const handleDownloadPGN = () => {
const pgn = gameRef.current.pgn();