From dff4ea9eaba5c6880583336bb24fff32c3f1f6a2 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 27 Apr 2026 20:51:37 +0700 Subject: [PATCH] fix: address review-pass findings - GameView: ignore game keys (Esc/R/U/Z) while the donate modal is open so its own Escape no longer doubles as a navigate-to-levels. - GameView: tag the win dialog with role/aria-modal/aria-labelledby so screen readers announce it correctly. - LevelSelectView: read the progress snapshot once per page render instead of two localStorage parses per visible tile (40 reads -> 1). - progress-store: add snapshot() method for batch reads. - vite-plugin-pwa: include jpg in the workbox precache glob so the donation QR keeps working offline. --- src/lib/core/progress-store.js | 8 ++++++++ src/views/GameView.svelte | 7 +++++-- src/views/LevelSelectView.svelte | 6 ++++-- vite/config.prod.mjs | 3 ++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/lib/core/progress-store.js b/src/lib/core/progress-store.js index 372f60c..dbd7e17 100644 --- a/src/lib/core/progress-store.js +++ b/src/lib/core/progress-store.js @@ -46,6 +46,14 @@ export const progressStore = { return Object.keys(readRaw().completed).length; }, + /** + * Returns the full progress snapshot. Lets callers read many levels + * without paying for one parse + one localStorage read per query. + */ + snapshot() { + return readRaw(); + }, + reset() { writeRaw({ completed: {}, bestMoves: {} }); } diff --git a/src/views/GameView.svelte b/src/views/GameView.svelte index a548fdf..c655d2f 100644 --- a/src/views/GameView.svelte +++ b/src/views/GameView.svelte @@ -97,6 +97,9 @@ let lastKeyAt = 0; function onKey(e) { + // Don't route gameplay keys while the donate modal is open — its own + // Escape handler should be the only consumer. + if (donateOpen) return; if (e.key === 'Escape') { onLevels(); return; } if (e.key === 'r' || e.key === 'R') { restart(); return; } if (e.key === 'u' || e.key === 'U' || e.key === 'z' || e.key === 'Z') { undo(); return; } @@ -181,8 +184,8 @@ {#if won}
-
-

LEVEL COMPLETE!

+