diff --git a/src/components/Modals.js b/src/components/Modals.js index 93346f5..b2ab302 100644 --- a/src/components/Modals.js +++ b/src/components/Modals.js @@ -1,7 +1,7 @@ import { CURATED_PUZZLES } from '../data/puzzles.js'; import { sound } from '../engine/audio.js'; -export function createModals({ onSelectPuzzle, onCustomPuzzleCreated, onResetPuzzle }) { +export function createModals({ onSelectPuzzle, onCustomPuzzleCreated, onResetPuzzle, onRevealAll }) { const container = document.createElement('div'); container.id = 'app-modals-container'; @@ -270,7 +270,10 @@ export function createModals({ onSelectPuzzle, onCustomPuzzleCreated, onResetPuz -
+
+ @@ -363,6 +366,14 @@ export function createModals({ onSelectPuzzle, onCustomPuzzleCreated, onResetPuz render(state); }); + const revealBtn = container.querySelector('#setting-reveal-all'); + if (revealBtn) { + revealBtn.addEventListener('click', () => { + close(); + onRevealAll?.(); + }); + } + const resetBtn = container.querySelector('#setting-reset-puzzle'); if (resetBtn) { let isConfirming = false; diff --git a/src/main.js b/src/main.js index c71cd8f..55d9354 100644 --- a/src/main.js +++ b/src/main.js @@ -68,6 +68,11 @@ async function initApp() { gameState.loadPuzzle(gameState.currentPuzzle); gameState.notifyToast('Progress reset', 'info'); } + }, + onRevealAll: () => { + gameState.revealAllWords(); + gameState.notifyToast('All words revealed!', 'info'); + wordsDrawer.open(); } }); document.body.appendChild(modals.element);