diff --git a/src/components/ChessGame.tsx b/src/components/ChessGame.tsx index 7ba115c..80c7b60 100644 --- a/src/components/ChessGame.tsx +++ b/src/components/ChessGame.tsx @@ -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(); diff --git a/src/lib/i18n/translations.ts b/src/lib/i18n/translations.ts index 483490c..0477a01 100644 --- a/src/lib/i18n/translations.ts +++ b/src/lib/i18n/translations.ts @@ -63,6 +63,7 @@ export interface Translations { depth: string; undoMove: string; resign: string; + resignConfirm: string; resignation: string; gameHistory: string; analyze: string; @@ -238,6 +239,7 @@ const en: Translations = { depth: 'Depth', undoMove: 'Undo Last Move', resign: 'Resign', + resignConfirm: 'Are you sure you want to resign? This action cannot be undone.', resignation: 'You resigned.', gameHistory: 'Game History', analyze: 'Analyze', @@ -408,6 +410,7 @@ const de: Translations = { depth: 'Tiefe', undoMove: 'Letzten Zug rückgängig', resign: 'Aufgeben', + resignConfirm: 'Möchtest du wirklich aufgeben? Diese Aktion kann nicht rückgängig gemacht werden.', resignation: 'Du hast aufgegeben.', gameHistory: 'Spielverlauf', analyze: 'Analysieren', @@ -578,6 +581,7 @@ const fr: Translations = { depth: 'Profondeur', undoMove: 'Annuler le dernier coup', resign: 'Abandonner', + resignConfirm: 'Êtes-vous sûr de vouloir abandonner ? Cette action est irréversible.', resignation: 'Vous avez abandonné.', gameHistory: 'Historique de la partie', analyze: 'Analyser', @@ -748,6 +752,7 @@ const it: Translations = { depth: 'Profondità', undoMove: 'Annulla ultima mossa', resign: 'Abbandona', + resignConfirm: 'Sei sicuro di voler abbandonare? Questa azione non può essere annullata.', resignation: 'Hai abbandonato.', gameHistory: 'Cronologia partita', analyze: 'Analizza', @@ -918,6 +923,7 @@ const pl: Translations = { depth: 'Głębokość', undoMove: 'Cofnij ruch', resign: 'Poddaj partię', + resignConfirm: 'Czy na pewno chcesz się poddać? Tej akcji nie można cofnąć.', resignation: 'Poddano partię.', gameHistory: 'Historia partii', analyze: 'Analizuj',