From 1506d98b42e1ace7bf2a561ac05810d1dcb6cdcd Mon Sep 17 00:00:00 2001 From: djg Date: Wed, 23 Sep 2026 02:01:57 +0000 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20Sprint=201=20=E2=80=94=20Make=20It?= =?UTF-8?q?=20Real?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Track 1 — Fix the foundation (P0): - Fix dopamine reroll bug (track selected time bucket properly) - Add 404 page with gentle copy - Persist timer state across page refresh (localStorage) - Add ARIA labels, roles, keyboard nav across all tools - Shame-free microcopy throughout Track 2 — Connect the flow (P0): - Break down → 'Start this step' sets One Thing - One Thing shows step progress (step N of M) - 'Start timer' from One Thing pre-links context - Timer completion → 'Mark step done?' prompt - Done → auto-surface next step with transition - Full flow: task → break down → focus → complete → next Track 3 — Sensory rewards (P1): - Canvas confetti on step/task completion - Celebration moment when all steps done - Session counter with warm encouragement - Streak tracking for dopamine menu Track 4 — Quality of life (P1-P2): - PWA: manifest.json, service worker, installable + offline - Welcome state for first-time visitors - Keyboard shortcuts (1-4 for tools) - Pick For Me button on task breaker - OG image for social sharing - Proper meta tags for SEO --- nginx.conf | 7 +- site/404.html | 35 +++ site/index.html | 115 +++++++-- site/manifest.json | 13 + site/static/app.js | 529 +++++++++++++++++++++++++++++++++++---- site/static/icon-192.png | Bin 0 -> 1029 bytes site/static/icon-512.png | Bin 0 -> 5256 bytes site/static/og.png | Bin 0 -> 17453 bytes site/static/style.css | 140 +++++++++++ site/sw.js | 30 +++ 10 files changed, 792 insertions(+), 77 deletions(-) create mode 100644 site/404.html create mode 100644 site/manifest.json create mode 100644 site/static/icon-192.png create mode 100644 site/static/icon-512.png create mode 100644 site/static/og.png create mode 100644 site/sw.js diff --git a/nginx.conf b/nginx.conf index 22f3212..58248d1 100644 --- a/nginx.conf +++ b/nginx.conf @@ -17,7 +17,12 @@ http { error_page 404 /404.html; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy strict-origin-when-cross-origin always; - location ~* \.(css|js|svg|png|jpg|ico|woff2?)$ { + # Service worker must not be cached aggressively + location = /sw.js { + add_header Cache-Control "no-cache"; + add_header X-Content-Type-Options nosniff always; + } + location ~* \.(css|js|svg|png|jpg|ico|woff2?|json)$ { expires 7d; add_header Cache-Control "public"; } diff --git a/site/404.html b/site/404.html new file mode 100644 index 0000000..e5fb779 --- /dev/null +++ b/site/404.html @@ -0,0 +1,35 @@ + + + + + +Lost? — myadhd.dev + + + + + +
+ +
+
+
+
+

That page wandered off.

+

The ADHD brain found something shiny and forgot to put this page here. Totally fair.

+
+
+

🧠💨

+

This page doesn't exist — but you do, and that's more important.

+ +
+
+
+ + + diff --git a/site/index.html b/site/index.html index 0aa30c7..244d56a 100644 --- a/site/index.html +++ b/site/index.html @@ -8,40 +8,69 @@ + + +
+ + + -
+ + + diff --git a/site/manifest.json b/site/manifest.json new file mode 100644 index 0000000..782e690 --- /dev/null +++ b/site/manifest.json @@ -0,0 +1,13 @@ +{ + "name": "myadhd.dev", + "short_name": "myadhd", + "description": "ADHD-friendly tools for focus, tasks and momentum", + "start_url": "/", + "display": "standalone", + "background_color": "#14141c", + "theme_color": "#14141c", + "icons": [ + { "src": "/static/icon-192.png", "sizes": "192x192", "type": "image/png" }, + { "src": "/static/icon-512.png", "sizes": "512x512", "type": "image/png" } + ] +} diff --git a/site/static/app.js b/site/static/app.js index 375c243..d6763e2 100644 --- a/site/static/app.js +++ b/site/static/app.js @@ -9,59 +9,256 @@ } function today() { return new Date().toISOString().slice(0, 10); } + /* ---------- register service worker ---------- */ + if ('serviceWorker' in navigator) { + navigator.serviceWorker.register('/sw.js').catch(function () {}); + } + + /* ---------- audio helpers ---------- */ + var audioCtx = null; + function getAudio() { + if (!audioCtx) { + try { audioCtx = new (window.AudioContext || window.webkitAudioContext)(); } catch (e) {} + } + return audioCtx; + } + + function beep() { + var ctx = getAudio(); if (!ctx) return; + [[660, 0], [880, 0.18]].forEach(function (n) { + var o = ctx.createOscillator(), g = ctx.createGain(); + o.frequency.value = n[0]; o.type = 'sine'; + g.gain.setValueAtTime(0.001, ctx.currentTime + n[1]); + g.gain.exponentialRampToValueAtTime(0.12, ctx.currentTime + n[1] + 0.02); + g.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + n[1] + 0.4); + o.connect(g); g.connect(ctx.destination); + o.start(ctx.currentTime + n[1]); o.stop(ctx.currentTime + n[1] + 0.45); + }); + } + + function tickSound() { + var ctx = getAudio(); if (!ctx) return; + var o = ctx.createOscillator(), g = ctx.createGain(); + o.frequency.value = 520; o.type = 'sine'; + g.gain.setValueAtTime(0.001, ctx.currentTime); + g.gain.exponentialRampToValueAtTime(0.08, ctx.currentTime + 0.01); + g.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + 0.15); + o.connect(g); g.connect(ctx.destination); + o.start(ctx.currentTime); o.stop(ctx.currentTime + 0.2); + } + + function celebrateSound() { + var ctx = getAudio(); if (!ctx) return; + var notes = [523, 659, 784, 1047]; + notes.forEach(function (freq, i) { + var o = ctx.createOscillator(), g = ctx.createGain(); + o.frequency.value = freq; o.type = 'sine'; + g.gain.setValueAtTime(0.001, ctx.currentTime + i * 0.12); + g.gain.exponentialRampToValueAtTime(0.1, ctx.currentTime + i * 0.12 + 0.02); + g.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + i * 0.12 + 0.35); + o.connect(g); g.connect(ctx.destination); + o.start(ctx.currentTime + i * 0.12); o.stop(ctx.currentTime + i * 0.12 + 0.4); + }); + } + + /* ---------- confetti ---------- */ + function confetti() { + var canvas = $('#confetti'); + if (!canvas) return; + var ctx2d = canvas.getContext('2d'); + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + var colors = ['#a78bfa', '#7dd3a0', '#f9c846', '#f472b6', '#60a5fa', '#e6e6f0']; + var pieces = []; + for (var i = 0; i < 80; i++) { + pieces.push({ + x: Math.random() * canvas.width, + y: Math.random() * canvas.height - canvas.height, + w: Math.random() * 8 + 4, + h: Math.random() * 6 + 3, + r: Math.random() * 6.28, + dx: (Math.random() - 0.5) * 4, + dy: Math.random() * 3 + 2, + dr: (Math.random() - 0.5) * 0.2, + color: colors[Math.floor(Math.random() * colors.length)], + life: 1 + }); + } + var frame; + function draw() { + ctx2d.clearRect(0, 0, canvas.width, canvas.height); + var alive = 0; + pieces.forEach(function (p) { + if (p.life <= 0) return; + alive++; + p.x += p.dx; + p.y += p.dy; + p.r += p.dr; + p.dy += 0.08; + p.life -= 0.008; + ctx2d.save(); + ctx2d.translate(p.x, p.y); + ctx2d.rotate(p.r); + ctx2d.globalAlpha = Math.max(0, p.life); + ctx2d.fillStyle = p.color; + ctx2d.fillRect(-p.w / 2, -p.h / 2, p.w, p.h); + ctx2d.restore(); + }); + if (alive > 0) { frame = requestAnimationFrame(draw); } + else { ctx2d.clearRect(0, 0, canvas.width, canvas.height); } + } + if (frame) cancelAnimationFrame(frame); + draw(); + } + /* ---------- tabs ---------- */ function showTab(name) { $$('.tool').forEach(function (t) { t.hidden = (t.id !== name); }); - $$('.tab').forEach(function (t) { t.classList.toggle('on', t.dataset.tab === name); }); - if (!location.hash.slice(1)) {} // keep url in sync without loops + $$('.tab').forEach(function (t) { + var isOn = t.dataset.tab === name; + t.classList.toggle('on', isOn); + t.setAttribute('aria-selected', isOn ? 'true' : 'false'); + }); try { history.replaceState(null, '', '#' + name); } catch (e) {} } $$('.tab').forEach(function (t) { t.addEventListener('click', function (e) { e.preventDefault(); showTab(t.dataset.tab); }); }); + + /* ---------- welcome / first visit ---------- */ + var visited = store('visited'); var initial = location.hash.slice(1); - showTab(['breaker', 'timer', 'dopamine', 'now'].indexOf(initial) !== -1 ? initial : 'breaker'); + if (!visited && !initial) { + showTab('welcome'); + store('visited', true); + } else { + showTab(['breaker', 'timer', 'dopamine', 'now'].indexOf(initial) !== -1 ? initial : 'breaker'); + } + + $$('.welcome-btn').forEach(function (b) { + b.addEventListener('click', function () { + var target = b.dataset.goto; + if (target === 'pick') { + var tabs = ['breaker', 'timer', 'dopamine', 'now']; + target = tabs[Math.floor(Math.random() * tabs.length)]; + } + showTab(target); + }); + }); + + /* ---------- session stats ---------- */ + function paintStats() { + var sessions = store('sessions') || 0; + var el = $('#session-stats'); + var text = $('#stats-text'); + if (sessions > 0 && el && text) { + el.hidden = false; + text.textContent = sessions + ' focus round' + (sessions !== 1 ? 's' : '') + ' completed — nice work.'; + } + } + paintStats(); /* ---------- task breaker ---------- */ var breakerKey = 'breaker'; function breakerTemplates(task) { return [ - { t: 'Write down what “done” looks like for: ' + task + '.', mins: 2, done: false }, - { t: 'Gather everything you need for “' + task + '” in one spot.', mins: 5, done: false }, - { t: 'Do the ugliest possible first version of “' + task + '”. No polish allowed.', mins: 5, done: false }, - { t: 'Set a 10-minute timer and start “' + task + '”. Starting is the whole job.', mins: 10, done: false }, + { t: 'Write down what "done" looks like for: ' + task + '.', mins: 2, done: false }, + { t: 'Gather everything you need for "' + task + '" in one spot.', mins: 5, done: false }, + { t: 'Do the ugliest possible first version of "' + task + '". No polish allowed.', mins: 5, done: false }, + { t: 'Set a 10-minute timer and start "' + task + '". Starting is the whole job.', mins: 10, done: false }, { t: 'Momentum check: keep going, or park it with a note for next time.', mins: 2, done: false }, { t: 'Close the loop: tidy up and write down the very next step.', mins: 2, done: false } ]; } + + function breakerFindNextStep(b) { + if (!b || !b.steps) return -1; + for (var i = 0; i < b.steps.length; i++) { + if (!b.steps[i].done) return i; + } + return -1; + } + function breakerRender() { var b = store(breakerKey); $('#breaker-out').hidden = !b; if (!b) return; var ul = $('#breaker-steps'); ul.innerHTML = ''; + var done = 0; + var allDone = true; b.steps.forEach(function (s, i) { + if (s.done) done++; + else allDone = false; var li = document.createElement('li'); li.className = s.done ? 'done' : ''; var tick = document.createElement('button'); tick.className = 'tick'; tick.type = 'button'; - tick.setAttribute('aria-label', 'toggle done'); + tick.setAttribute('aria-label', s.done ? 'Mark undone' : 'Mark done'); tick.addEventListener('click', function () { - s.done = !s.done; store(breakerKey, b); breakerRender(); + var wasDone = s.done; + s.done = !s.done; + store(breakerKey, b); + if (!wasDone) { + tickSound(); + li.classList.add('step-just-done'); + setTimeout(function () { li.classList.remove('step-just-done'); }, 300); + } + breakerRender(); + // If all done, celebrate! + if (!wasDone) { + var allNow = b.steps.every(function (st) { return st.done; }); + if (allNow) { + celebrateSound(); + confetti(); + } + } }); var txt = document.createElement('span'); txt.className = 'txt'; txt.contentEditable = 'true'; txt.textContent = s.t; + txt.setAttribute('role', 'textbox'); + txt.setAttribute('aria-label', 'Step ' + (i + 1) + ' text'); txt.addEventListener('blur', function () { s.t = txt.textContent.trim(); store(breakerKey, b); }); var mins = document.createElement('span'); mins.className = 'mins'; mins.textContent = s.mins ? s.mins + ' min' : ''; - li.appendChild(tick); li.appendChild(txt); li.appendChild(mins); + + // "start this step" button for undone steps + var actions = document.createElement('span'); + actions.className = 'step-actions'; + if (!s.done) { + var goBtn = document.createElement('button'); + goBtn.className = 'step-go'; + goBtn.textContent = 'start →'; + goBtn.type = 'button'; + goBtn.setAttribute('aria-label', 'Start working on this step'); + goBtn.addEventListener('click', function () { + // Set this step as the One Thing + store('now', { text: s.t, fromBreaker: true, stepIndex: i }); + showTab('now'); + nowRender(); + }); + actions.appendChild(goBtn); + } + + li.appendChild(tick); li.appendChild(txt); li.appendChild(mins); li.appendChild(actions); ul.appendChild(li); }); - var done = b.steps.filter(function (s) { return s.done; }).length; + $('#breaker-progress').style.width = b.steps.length ? (100 * done / b.steps.length) + '%' : '0'; - $('#breaker-count').textContent = done + ' of ' + b.steps.length + ' steps done' + - (done === b.steps.length && b.steps.length ? ' — look at you. 🎉' : ''); + $('#breaker-count').textContent = done + ' of ' + b.steps.length + ' steps done'; + + // Show/hide done message + var doneMsg = $('#breaker-done-msg'); + var actionsRow = $('#breaker-actions'); + if (allDone && b.steps.length) { + doneMsg.hidden = false; + actionsRow.hidden = true; + } else { + doneMsg.hidden = true; + actionsRow.hidden = false; + } } + $('#breaker-form').addEventListener('submit', function (e) { e.preventDefault(); var task = $('#breaker-input').value.trim(); @@ -79,70 +276,144 @@ $('#breaker-input').value = ''; breakerRender(); }); + $('#breaker-new').addEventListener('click', function () { + localStorage.removeItem('myadhd.' + breakerKey); + $('#breaker-input').value = ''; + breakerRender(); + $('#breaker-input').focus(); + }); breakerRender(); /* ---------- focus timer ---------- */ var CIRC = 628.3; - var timer = { total: 25 * 60, left: 25 * 60, running: false, phase: 'focus', iv: null }; + // Restore persisted timer state or default + var timerState = store('timer_state'); + var timer; + if (timerState && timerState.left > 0) { + timer = { total: timerState.total, left: timerState.left, running: false, phase: timerState.phase || 'focus', iv: null }; + } else { + timer = { total: 25 * 60, left: 25 * 60, running: false, phase: 'focus', iv: null }; + } + + function timerPersist() { + store('timer_state', { total: timer.total, left: timer.left, phase: timer.phase }); + } + function timerPaint() { var m = Math.floor(timer.left / 60), s = timer.left % 60; $('#timer-time').textContent = (m < 10 ? '0' : '') + m + ':' + (s < 10 ? '0' : '') + s; $('#ring-fg').style.strokeDashoffset = CIRC * (1 - timer.left / timer.total); + // Ring color matches phase + var ringFg = $('#ring-fg'); + if (timer.phase === 'break') { ringFg.classList.add('break-ring'); } + else { ringFg.classList.remove('break-ring'); } var ph = $('#timer-phase'); ph.textContent = timer.running ? (timer.phase === 'focus' ? 'focus — you got this' : 'break — actually rest') : ph.textContent; ph.className = 'timer-phase' + (timer.phase === 'break' ? ' break' : ''); + // Update context bar + var nowData = store('now'); + var ctxBar = $('#timer-context-bar'); + var ctxText = $('#timer-context-text'); + if (nowData && nowData.text && ctxBar && ctxText) { + ctxBar.hidden = false; + ctxText.textContent = nowData.text; + } else if (ctxBar) { + ctxBar.hidden = true; + } } - function beep() { - try { - var ctx = new (window.AudioContext || window.webkitAudioContext)(); - [[660, 0], [880, 0.18]].forEach(function (n) { - var o = ctx.createOscillator(), g = ctx.createGain(); - o.frequency.value = n[0]; o.type = 'sine'; - g.gain.setValueAtTime(0.001, ctx.currentTime + n[1]); - g.gain.exponentialRampToValueAtTime(0.12, ctx.currentTime + n[1] + 0.02); - g.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + n[1] + 0.4); - o.connect(g); g.connect(ctx.destination); - o.start(ctx.currentTime + n[1]); o.stop(ctx.currentTime + n[1] + 0.45); - }); - } catch (e) {} + + function timerStop() { clearInterval(timer.iv); timer.iv = null; timer.running = false; timerPersist(); } + + function timerComplete() { + timerStop(); beep(); + if (timer.phase === 'focus') { + var sessions = (store('sessions') || 0) + 1; + store('sessions', sessions); + paintStats(); + // Show completion overlay + var overlay = $('#timer-complete'); + if (overlay) { + overlay.hidden = false; + $('#timer-complete-sessions').textContent = sessions + ' focus round' + (sessions !== 1 ? 's' : '') + ' completed.'; + // Show "mark step done" only if there's a linked one-thing from breaker + var nowData = store('now'); + var markBtn = $('#timer-mark-done'); + if (markBtn) { + markBtn.hidden = !(nowData && nowData.fromBreaker); + } + } + celebrateSound(); + confetti(); + } else { + // Break is over + timer.phase = 'focus'; + timer.total = timer.left = 25 * 60; + $('#timer-start').textContent = 'start'; + $('#timer-note').textContent = 'Break over. Pick a length and go again — or stop here, that is allowed too.'; + } + timerPersist(); + timerPaint(); } - function timerStop() { clearInterval(timer.iv); timer.iv = null; timer.running = false; } + $('#timer-start').addEventListener('click', function () { if (timer.running) { timerStop(); $('#timer-start').textContent = 'resume'; timerPaint(); return; } timer.running = true; $('#timer-start').textContent = 'pause'; timer.iv = setInterval(function () { timer.left--; + timerPersist(); if (timer.left <= 0) { - timerStop(); beep(); - if (timer.phase === 'focus') { - store('sessions', (store('sessions') || 0) + 1); - timer.phase = 'break'; - $('#timer-note').textContent = 'Focus round done (' + store('sessions') + ' total). Stand up. Drink water. Actually take the break.'; - } else { - timer.phase = 'focus'; - $('#timer-note').textContent = 'Break over. Pick a length and go again — or stop here, that is allowed too.'; - } - timer.total = timer.left = (timer.phase === 'break' ? 5 : 25) * 60; - $('#timer-start').textContent = 'start'; + timerComplete(); + return; } timerPaint(); }, 1000); timerPaint(); }); + $('#timer-reset').addEventListener('click', function () { timerStop(); timer.left = timer.total; $('#timer-start').textContent = 'start'; - timerPaint(); + timerPersist(); timerPaint(); }); + $$('.preset').forEach(function (p) { p.addEventListener('click', function () { timerStop(); timer.total = timer.left = (+p.dataset.min) * 60; timer.phase = p.classList.contains('break') ? 'break' : 'focus'; $('#timer-start').textContent = 'start'; - timerPaint(); + timerPersist(); timerPaint(); }); }); + + // Timer completion overlay actions + $('#timer-take-break').addEventListener('click', function () { + $('#timer-complete').hidden = true; + timer.phase = 'break'; + timer.total = timer.left = 5 * 60; + $('#timer-start').textContent = 'start'; + $('#timer-note').textContent = 'Focus round done. Stand up. Drink water. Actually take the break.'; + timerPersist(); timerPaint(); + }); + + $('#timer-mark-done').addEventListener('click', function () { + $('#timer-complete').hidden = true; + // Mark the current one-thing step as done in the breaker + var nowData = store('now'); + if (nowData && nowData.fromBreaker && typeof nowData.stepIndex === 'number') { + var b = store(breakerKey); + if (b && b.steps[nowData.stepIndex]) { + b.steps[nowData.stepIndex].done = true; + store(breakerKey, b); + breakerRender(); + } + } + // Clear one-thing and show next step prompt + localStorage.removeItem('myadhd.now'); + showTab('now'); + nowShowNext(); + }); + timerPaint(); /* ---------- dopamine menu ---------- */ @@ -197,7 +468,14 @@ ] }; var lastPick = null; + var currentMenuMins = null; + function menuPick(mins) { + currentMenuMins = mins; + // Highlight the selected time button + $$('.menu-pick').forEach(function (b) { + b.classList.toggle('on', +b.dataset.min === mins); + }); var pool = MENU[mins].filter(function (x) { return x !== lastPick; }); var item = pool[Math.floor(Math.random() * pool.length)]; lastPick = item; @@ -205,13 +483,16 @@ $('#menu-item').hidden = false; $('#menu-actions').hidden = false; } + $$('.menu-pick').forEach(function (b) { b.addEventListener('click', function () { menuPick(+b.dataset.min); }); }); + $('#menu-reroll').addEventListener('click', function () { - var mins = $$('.menu-pick').filter(function (b) { return b.classList.contains('on'); })[0]; - menuPick(mins ? +mins.dataset.min : 5); + // Use tracked mins instead of .on class + menuPick(currentMenuMins || 5); }); + function paintStreak() { var s = store('streak'); $('#menu-streak').innerHTML = s && s.streak ? @@ -226,6 +507,7 @@ s.last = today(); store('streak', s); } + tickSound(); $('#menu-item').hidden = true; $('#menu-actions').hidden = true; paintStreak(); @@ -233,32 +515,169 @@ paintStreak(); /* ---------- one thing ---------- */ - var nowSaved = store('now'); - if (nowSaved && nowSaved.text) { - $('#now-text').textContent = nowSaved.text; - $('#now-form').hidden = true; - $('#now-view').hidden = false; + function nowRender() { + var nowSaved = store('now'); + var nextPrompt = $('#now-next'); + if (nextPrompt) nextPrompt.hidden = true; + + if (nowSaved && nowSaved.text) { + $('#now-text').textContent = nowSaved.text; + $('#now-form').hidden = true; + $('#now-view').hidden = false; + // Show source info if from breaker + var sourceEl = $('#now-source'); + if (sourceEl && nowSaved.fromBreaker) { + sourceEl.hidden = false; + var b = store(breakerKey); + if (b && typeof nowSaved.stepIndex === 'number') { + $('#now-step-num').textContent = nowSaved.stepIndex + 1; + $('#now-step-total').textContent = b.steps.length; + } + } else if (sourceEl) { + sourceEl.hidden = true; + } + } else { + $('#now-form').hidden = false; + $('#now-view').hidden = true; + } } + + function nowShowNext() { + var nextPrompt = $('#now-next'); + if (!nextPrompt) return; + var b = store(breakerKey); + if (!b) { + // No breaker data, just show "done" and reset form + nowRender(); + return; + } + var nextIdx = breakerFindNextStep(b); + nextPrompt.hidden = false; + $('#now-form').hidden = true; + $('#now-view').hidden = true; + + if (nextIdx >= 0) { + $('#now-next-step').hidden = false; + $('#now-all-done').hidden = true; + $('#now-next-text').textContent = b.steps[nextIdx].t; + // Wire up "Let's do it" + $('#now-next-go').onclick = function () { + store('now', { text: b.steps[nextIdx].t, fromBreaker: true, stepIndex: nextIdx }); + nowRender(); + }; + $('#now-next-skip').onclick = function () { + nextPrompt.hidden = true; + $('#now-form').hidden = false; + $('#now-view').hidden = true; + $('#now-input').value = ''; + $('#now-input').focus(); + }; + } else { + // All steps done + $('#now-next-step').hidden = true; + $('#now-all-done').hidden = false; + celebrateSound(); + confetti(); + } + } + + nowRender(); + $('#now-form').addEventListener('submit', function (e) { e.preventDefault(); var t = $('#now-input').value.trim(); if (!t) return; store('now', { text: t }); - $('#now-text').textContent = t; - $('#now-form').hidden = true; - $('#now-view').hidden = false; + nowRender(); }); + $('#now-edit').addEventListener('click', function () { $('#now-view').hidden = true; $('#now-form').hidden = false; $('#now-input').value = ''; $('#now-input').focus(); }); + $('#now-done').addEventListener('click', function () { + var nowData = store('now'); + tickSound(); + // If from breaker, mark that step done + if (nowData && nowData.fromBreaker && typeof nowData.stepIndex === 'number') { + var b = store(breakerKey); + if (b && b.steps[nowData.stepIndex]) { + b.steps[nowData.stepIndex].done = true; + store(breakerKey, b); + breakerRender(); + } + } localStorage.removeItem('myadhd.now'); - $('#now-view').hidden = true; - $('#now-form').hidden = false; - $('#now-input').value = ''; - $('#now-input').focus(); + // Check if there's a next step from breaker + var b2 = store(breakerKey); + if (nowData && nowData.fromBreaker && b2) { + var allDone = b2.steps.every(function (s) { return s.done; }); + if (allDone) { + celebrateSound(); + confetti(); + } + nowShowNext(); + } else { + nowRender(); + $('#now-input').focus(); + } }); + + // "Start timer" button on One Thing + $('#now-timer').addEventListener('click', function () { + showTab('timer'); + // If timer isn't already running, pre-set 25 min + if (!timer.running) { + timer.total = timer.left = 25 * 60; + timer.phase = 'focus'; + $('#timer-start').textContent = 'start'; + timerPersist(); + timerPaint(); + } + }); + + // "Start something new" after all breaker steps done in now view + var nowFresh = $('#now-fresh'); + if (nowFresh) { + nowFresh.addEventListener('click', function () { + localStorage.removeItem('myadhd.now'); + $('#now-next').hidden = true; + showTab('breaker'); + localStorage.removeItem('myadhd.' + breakerKey); + $('#breaker-input').value = ''; + breakerRender(); + $('#breaker-input').focus(); + }); + } + + /* ---------- keyboard shortcuts ---------- */ + document.addEventListener('keydown', function (e) { + // Don't trigger shortcuts when typing in an input or contenteditable + var tag = e.target.tagName; + if (tag === 'INPUT' || tag === 'TEXTAREA' || e.target.contentEditable === 'true') return; + + // Number keys 1-4 switch tabs + if (e.key === '1') { showTab('breaker'); e.preventDefault(); } + if (e.key === '2') { showTab('timer'); e.preventDefault(); } + if (e.key === '3') { showTab('dopamine'); e.preventDefault(); } + if (e.key === '4') { showTab('now'); e.preventDefault(); } + + // Space to start/pause timer when on timer tab + if (e.key === ' ' && !$('#timer').hidden) { + e.preventDefault(); + $('#timer-start').click(); + } + + // Escape to close completion overlay + if (e.key === 'Escape') { + var overlay = $('#timer-complete'); + if (overlay && !overlay.hidden) { + overlay.hidden = true; + } + } + }); + })(); diff --git a/site/static/icon-192.png b/site/static/icon-192.png new file mode 100644 index 0000000000000000000000000000000000000000..23a784beb1756b2cd33d0599ebda67d5cf81081e GIT binary patch literal 1029 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvE4M+yv$zf+;U_RsN;uumf=k4W_y(;b^EEffn z`mW4q3UH6}D3Ryj+5U3rDqW+$k_q3>$miYP#|YGi3R?brd;PxtL-v~cRr9JCM2=1m zwl_FBA;4a(6-dZ|2r&@B*E%84p2HPLu((bLke~lNBLCy*mHg*EuQC6bdZqo@&TF@8 ztiCo@?)&OC->o(x?s(N|{^fQW>(lq%Y!8&5bbaf+cg`#NPrQ!G|9<%j`;)J0&Hp66 zI{eY@T6CTH*Mk-IuYLD-|BBc%|Ld~*KD8S6u2-?!iU@jpnu z9Yog$$+uZwi~b+}YH`8ws@MM)*l~PcWB#A{tKp9Hy+7qw^dGc+efGa=Eyug4{Qpyb zaopK@@1OQp!5!Iq|AxO(F1TLxd;Jyn2kX9m>z%)o>A{vkjy^Ni{Qq})xy?iAb-(U@ zz0Lh#g1blq1B(I!BZmV6lK_xeFqgsZ_k^QA{C~dt^_I2ZfHRi^!*u=!i~A${{V>_V3f~*W1MpOlGhA_2M*8MGS+u?DN<)KpJcy(Cm(c zl0PsuhXYIVV{x#Zf@}KX!D?JKSk*xsaPZX+Rj$S=4nc`} zuUa0(H#{I|xqlNG_XNnN*tYyqyZpF*q1~w@p0E44ALL(YUupX5;m7>}^3Pp*|8Be{ z{a^EIV@3Sy-2I)uJoc>rx(%GL&R1Q2zsOGPefr*)<-zhj-#6a-)V`Ac`0MEWAE0zu zx_0|-fmh0(c3rz&EAdsa5}1_i=KNZ)r|)YRC|S?T-+OU+u>6eYQTd-wui!rmO8rl- zus^rF7VWdL-~aIWmGVu;<_Ftz^#12~b$sDNdB?vICV!My$oIF^vwTgy^r3%YU4qo# l!Yj-Xo9ePrGa>_n#B=`zibwR7>-)VxQl74UF6*2UngCq1<@Nvo literal 0 HcmV?d00001 diff --git a/site/static/icon-512.png b/site/static/icon-512.png new file mode 100644 index 0000000000000000000000000000000000000000..aae681c4cf433a6317da630b4d74cb2ea3d24948 GIT binary patch literal 5256 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 U=F#t|2_p#jNaSC;CVJoB03Iy29RL6T literal 0 HcmV?d00001 diff --git a/site/static/og.png b/site/static/og.png new file mode 100644 index 0000000000000000000000000000000000000000..4f3b79bb90755087d6f6b6fb1270031981c353e8 GIT binary patch literal 17453 zcmeAS@N?(olHy`uVBq!ia0y~yVA;UHz*NS;1{CpksE%P^aQ@=y;uuoF`1aO9-op+e zE(f&_8OZJy_%88C!*`9GguuV8vnG_=o&Q_=H|GEYGmilp5nx)ds(t6_`E87B5(y2c z#Djc?1D{xD>3_hGX=vQS$jE)cBw%T5W;&X#21Z8j140{c>zNvxilL{mIClQ^^K2N- z1G+YpnQ2;sdV&#}!-3pPW+t%(nG3Fddabu!2wm$N9*zj0#-o^iUc$=}(Xgy>)y>_r za3^K^15px}OaWINWMzV9k(PF>CMYo7=XTqB_UnDgkX7TmS4j zy_yA87X!03C&1$ojS}?e?u}XwCsg96oKM5r>G^(TGEY1&jsFsG~U! zDMOCtIJ8oR#{gQwjuw?jAv0RXq1Vu`s&TZALkgME#tF_g&1mBURt=A~D)ICpMjI!i zjT0V&(SF=$2OLt9jP~OY)dq|;+KdI z+NvB~b27SE2wW$OcEFLE%FsGuv;z(+AQ6@3Xa{_>0}f9Wqw6Y1*HuEY!)Q?n&lK?T zVYH}(2L-JD80~;R(QKDq~d lbn`wWHH;ROR4gj(Kg8GGy_s3f0z3wU!PC{xWt~$(69D|dPqhF5 literal 0 HcmV?d00001 diff --git a/site/static/style.css b/site/static/style.css index bdc255f..b521099 100644 --- a/site/static/style.css +++ b/site/static/style.css @@ -10,6 +10,7 @@ --accent: #a78bfa; --accent-dim: #6d5aa8; --good: #7dd3a0; + --warm: #f9c846; --radius: 18px; } body { @@ -19,6 +20,21 @@ body { } main { max-width: 760px; margin: 0 auto; padding: 0 20px 60px; } +/* sr-only for accessibility */ +.sr-only { + position: absolute; width: 1px; height: 1px; padding: 0; + margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); + white-space: nowrap; border: 0; +} + +/* skip link */ +.skip-link { + position: absolute; top: -100%; left: 16px; z-index: 1000; + background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 8px; + text-decoration: none; font-weight: 700; +} +.skip-link:focus { top: 8px; } + /* header */ .top { max-width: 760px; margin: 0 auto; padding: 22px 20px 6px; @@ -30,8 +46,10 @@ main { max-width: 760px; margin: 0 auto; padding: 0 20px 60px; } .tab { color: var(--dim); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg2); + transition: all 0.15s ease; } .tab:hover { color: var(--text); } +.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .tab.on { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; } /* tools */ @@ -51,14 +69,19 @@ input[type="text"] { flex: 1 1 240px; font: inherit; color: var(--text); background: var(--bg2); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 16px; outline: none; + transition: border-color 0.15s ease; } input[type="text"]:focus { border-color: var(--accent-dim); } +input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; } .btn { font: inherit; font-weight: 700; cursor: pointer; color: #fff; background: var(--accent-dim); border: none; border-radius: 12px; padding: 12px 22px; + transition: filter 0.15s ease, transform 0.1s ease; } .btn:hover { filter: brightness(1.15); } +.btn:active { transform: scale(0.97); } +.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--dim); } .btn.ghost:hover { color: var(--text); border-color: var(--accent-dim); } @@ -66,12 +89,34 @@ input[type="text"]:focus { border-color: var(--accent-dim); } font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; color: var(--dim); background: var(--bg2); border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 15px; + transition: all 0.15s ease; } .chip:hover, .chip.on { color: var(--text); border-color: var(--accent-dim); } +.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 22px; } .tiny { color: var(--dim); font-size: .85rem; margin-top: 14px; } +/* welcome */ +.welcome-q { + font-size: 1.2rem; font-weight: 600; margin-bottom: 20px; +} +.welcome-picks { + display: flex; flex-direction: column; gap: 10px; + max-width: 360px; margin: 0 auto; +} +.welcome-btn { + font-size: 1rem; text-align: left; padding: 14px 20px; +} + +/* context bar (shows when timer is linked to a task step) */ +.context-bar { + background: var(--bg2); border: 1.5px solid var(--accent-dim); + border-radius: 12px; padding: 10px 16px; margin-bottom: 12px; + font-size: .9rem; color: var(--dim); text-align: center; +} +.context-bar strong { color: var(--text); margin-left: 6px; } + /* breaker */ .progress-wrap { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 18px 0 6px; } .progress { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s ease; } @@ -79,16 +124,38 @@ input[type="text"]:focus { border-color: var(--accent-dim); } .steps li { display: flex; align-items: flex-start; gap: 12px; background: var(--bg2); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; + transition: opacity 0.2s ease, border-color 0.2s ease; } +.steps li.active-step { border-color: var(--accent-dim); background: #22223a; } .steps li .tick { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px; cursor: pointer; border: 2px solid var(--accent-dim); border-radius: 7px; background: transparent; + transition: all 0.15s ease; } +.steps li .tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .steps li.done .tick { background: var(--good); border-color: var(--good); } .steps li.done .txt { color: var(--dim); text-decoration: line-through; } .steps li .txt { flex: 1; outline: none; } .steps li .txt:focus { background: var(--bg); border-radius: 6px; } .steps li .mins { flex: 0 0 auto; color: var(--accent); font-weight: 700; font-size: .85rem; margin-top: 3px; } +.steps li .step-actions { + flex: 0 0 auto; display: flex; gap: 4px; margin-top: 1px; +} +.step-go { + font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer; + color: var(--accent); background: transparent; border: 1.5px solid var(--accent-dim); + border-radius: 8px; padding: 3px 10px; white-space: nowrap; + transition: all 0.15s ease; +} +.step-go:hover { background: var(--accent-dim); color: #fff; } +.step-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } +.steps li.done .step-go { display: none; } + +/* done message */ +.done-msg { + text-align: center; padding: 24px 0; +} +.done-text { font-size: 1.15rem; font-weight: 600; margin-bottom: 14px; } /* timer */ .timer-wrap { position: relative; width: 240px; margin: 10px auto; } @@ -97,7 +164,9 @@ input[type="text"]:focus { border-color: var(--accent-dim); } .ring-fg { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 628.3; stroke-dashoffset: 0; + transition: stroke 0.3s ease; } +.ring-fg.break-ring { stroke: var(--good); } .timer-readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; @@ -106,6 +175,33 @@ input[type="text"]:focus { border-color: var(--accent-dim); } .timer-phase { color: var(--dim); font-size: .9rem; font-weight: 600; } .timer-phase.break { color: var(--good); } +/* completion overlay */ +.completion-overlay { + position: fixed; inset: 0; z-index: 100; + background: rgba(20, 20, 28, 0.92); + display: flex; align-items: center; justify-content: center; + animation: fadeIn 0.3s ease; +} +.completion-card { + background: var(--card); border: 1.5px solid var(--accent-dim); + border-radius: var(--radius); padding: 40px 32px; + max-width: 400px; text-align: center; + animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); +} +.completion-emoji { font-size: 3rem; margin-bottom: 12px; } +.completion-title { font-size: 1.4rem; margin-bottom: 8px; } +.completion-stat { color: var(--dim); margin-bottom: 18px; } + +/* next step prompt */ +.next-step-prompt { + text-align: center; padding: 24px 0; + animation: fadeIn 0.3s ease; +} +.next-step-text { + font-size: 1.15rem; font-weight: 600; margin: 8px 0 4px; + color: var(--accent); +} + /* dopamine menu */ .menu-item { background: var(--bg2); border: 1.5px dashed var(--accent-dim); border-radius: 14px; @@ -118,6 +214,16 @@ input[type="text"]:focus { border-color: var(--accent-dim); } /* one thing */ .now-label { color: var(--dim); text-transform: uppercase; letter-spacing: 2px; font-size: .8rem; margin-top: 8px; } .now-text { font-size: 1.5rem; font-weight: 700; margin: 12px 0 20px; } +.now-source { margin-bottom: 16px; } + +/* confetti canvas */ +.confetti-canvas { + position: fixed; inset: 0; width: 100%; height: 100%; + pointer-events: none; z-index: 200; +} + +/* session stats */ +.session-stats { margin-top: 12px; } /* footer */ .foot { @@ -126,7 +232,41 @@ input[type="text"]:focus { border-color: var(--accent-dim); } } .foot .tiny { margin-top: 6px; } +/* keyboard shortcut hints */ +.kbd-hint { + font-size: .7rem; color: var(--dim); opacity: 0.6; + margin-left: 6px; +} + +/* animations */ +@keyframes fadeIn { + from { opacity: 0; } + to { opacity: 1; } +} +@keyframes scaleIn { + from { opacity: 0; transform: scale(0.85); } + to { opacity: 1; transform: scale(1); } +} +@keyframes stepComplete { + 0% { transform: scale(1); } + 50% { transform: scale(1.03); } + 100% { transform: scale(1); } +} +.step-just-done { + animation: stepComplete 0.3s ease; +} + +/* Reduced motion: disable all animations and transitions */ +@media (prefers-reduced-motion: reduce) { + *, *::before, *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} + @media (max-width: 560px) { h1 { font-size: 1.55rem; } .timer-wrap, .ring { width: 200px; height: 200px; } + .welcome-btn { font-size: .9rem; padding: 12px 16px; } } diff --git a/site/sw.js b/site/sw.js new file mode 100644 index 0000000..89fa384 --- /dev/null +++ b/site/sw.js @@ -0,0 +1,30 @@ +/* myadhd.dev — service worker for offline PWA */ +var CACHE = 'myadhd-v1'; +var ASSETS = [ + '/', + '/index.html', + '/static/style.css', + '/static/app.js', + '/static/favicon.svg', + '/manifest.json' +]; + +self.addEventListener('install', function (e) { + e.waitUntil(caches.open(CACHE).then(function (c) { return c.addAll(ASSETS); })); + self.skipWaiting(); +}); + +self.addEventListener('activate', function (e) { + e.waitUntil( + caches.keys().then(function (names) { + return Promise.all(names.filter(function (n) { return n !== CACHE; }).map(function (n) { return caches.delete(n); })); + }) + ); + self.clients.claim(); +}); + +self.addEventListener('fetch', function (e) { + e.respondWith( + caches.match(e.request).then(function (r) { return r || fetch(e.request); }) + ); +}); From 79d8a5d62354cf541cedf56954e4b7f89d9be0b0 Mon Sep 17 00:00:00 2001 From: djg Date: Wed, 23 Sep 2026 02:11:22 +0000 Subject: [PATCH 2/6] fix: remove duplicate celebrate on all done in now view --- site/static/app.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/site/static/app.js b/site/static/app.js index d6763e2..6d74bd5 100644 --- a/site/static/app.js +++ b/site/static/app.js @@ -614,11 +614,6 @@ // Check if there's a next step from breaker var b2 = store(breakerKey); if (nowData && nowData.fromBreaker && b2) { - var allDone = b2.steps.every(function (s) { return s.done; }); - if (allDone) { - celebrateSound(); - confetti(); - } nowShowNext(); } else { nowRender(); From 80a4618d95dd717f4c1915e5a3451d4b6e0573de Mon Sep 17 00:00:00 2001 From: djg Date: Wed, 23 Sep 2026 02:13:39 +0000 Subject: [PATCH 3/6] 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(); + } } } From 453ae9c8a0f8c3f7427d541421b28294b07a8398 Mon Sep 17 00:00:00 2001 From: djg Date: Wed, 23 Sep 2026 02:25:59 +0000 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20address=20remaining=20QA=20bugs=20?= =?UTF-8?q?=E2=80=94=20timer=20reset,=20ARIA,=20SW=20cache,=20og:url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG 2 — Timer not reset after mark-done: extract timerReset() and call it after marking a step done so the timer is ready for the next step BUG 4 — ARIA tabpanel linking: add id/aria-controls on tabs, aria-labelledby on panels BUG 6 — SW missing icons: add icon-192.png and icon-512.png to cache list, bump cache version to v2 BUG 7 — og:url: add missing meta tag --- site/index.html | 17 +++++++++-------- site/static/app.js | 8 ++++++-- site/sw.js | 4 +++- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/site/index.html b/site/index.html index 244d56a..af2fa1c 100644 --- a/site/index.html +++ b/site/index.html @@ -15,15 +15,16 @@ +
@@ -49,7 +50,7 @@ -