From 80a4618d95dd717f4c1915e5a3451d4b6e0573de Mon Sep 17 00:00:00 2001 From: djg Date: Wed, 23 Sep 2026 02:13:39 +0000 Subject: [PATCH] fix: persist dopamine menu time selection, prevent double confetti on last step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Store currentMenuMins in localStorage so reroll works after page reload - Restore selected time button highlight on page load - Add skipCelebration param to nowShowNext() — timer-mark-done already fires celebrateSound()+confetti(), so suppress duplicate when it discovers all steps are done --- site/static/app.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/site/static/app.js b/site/static/app.js index 6d74bd5..763db75 100644 --- a/site/static/app.js +++ b/site/static/app.js @@ -411,7 +411,7 @@ // Clear one-thing and show next step prompt localStorage.removeItem('myadhd.now'); showTab('now'); - nowShowNext(); + nowShowNext(true); }); timerPaint(); @@ -468,10 +468,11 @@ ] }; var lastPick = null; - var currentMenuMins = null; + var currentMenuMins = store('menu_mins') || null; function menuPick(mins) { currentMenuMins = mins; + store('menu_mins', mins); // Highlight the selected time button $$('.menu-pick').forEach(function (b) { b.classList.toggle('on', +b.dataset.min === mins); @@ -514,6 +515,13 @@ }); paintStreak(); + // Restore menu time selection highlight on page load + if (currentMenuMins) { + $$('.menu-pick').forEach(function (b) { + b.classList.toggle('on', +b.dataset.min === currentMenuMins); + }); + } + /* ---------- one thing ---------- */ function nowRender() { var nowSaved = store('now'); @@ -542,7 +550,7 @@ } } - function nowShowNext() { + function nowShowNext(skipCelebration) { var nextPrompt = $('#now-next'); if (!nextPrompt) return; var b = store(breakerKey); @@ -576,8 +584,10 @@ // All steps done $('#now-next-step').hidden = true; $('#now-all-done').hidden = false; - celebrateSound(); - confetti(); + if (!skipCelebration) { + celebrateSound(); + confetti(); + } } }