mirror of
http://nostr-git-proxy.forgejo.svc.cluster.local/git/45387ca441053e230b2126802005eb03767ab59d84555e8bac86b6e7def14e27/myadhd
synced 2026-09-23 20:23:10 +00:00
Merge pull request: Sprint 1 - Make it Real + Copy Pass
All checks were successful
Build and Deploy / deploy (push) Successful in 44s
All checks were successful
Build and Deploy / deploy (push) Successful in 44s
This commit is contained in:
commit
977f805abb
10 changed files with 809 additions and 82 deletions
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
35
site/404.html
Normal file
35
site/404.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Page not found — myadhd.dev</title>
|
||||
<meta name="theme-color" content="#14141c">
|
||||
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
<a class="logo" href="/">myadhd<span>.dev</span></a>
|
||||
</header>
|
||||
<main>
|
||||
<section class="tool">
|
||||
<div class="tool-head">
|
||||
<h1>That page wandered off.</h1>
|
||||
<p class="sub">We got distracted and didn't build this page. Totally fair.</p>
|
||||
</div>
|
||||
<div class="card center">
|
||||
<p style="font-size: 3rem; margin-bottom: 16px;">🧠💨</p>
|
||||
<p>This page doesn't exist — but you do, and that's more important.</p>
|
||||
<div class="row center gap" style="margin-top: 24px;">
|
||||
<a class="btn" href="/">Go home</a>
|
||||
<a class="btn ghost" href="/#breaker">Break down a task</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer class="foot">
|
||||
<p><strong>myadhd.dev</strong> — free tools, no signup, no tracking.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
120
site/index.html
120
site/index.html
|
|
@ -8,40 +8,70 @@
|
|||
<meta name="theme-color" content="#14141c">
|
||||
<link rel="canonical" href="https://myadhd.dev/">
|
||||
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<link rel="apple-touch-icon" href="/static/icon-192.png">
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<meta property="og:title" content="myadhd.dev — ADHD-friendly tools">
|
||||
<meta property="og:description" content="Break down scary tasks, tame time blindness, and build momentum. Free, no signup, data stays in your browser.">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:image" content="https://myadhd.dev/static/og.png">
|
||||
<meta property="og:url" content="https://myadhd.dev/">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
<a class="logo" href="/">myadhd<span>.dev</span></a>
|
||||
<nav class="tabs" role="tablist">
|
||||
<a href="#breaker" data-tab="breaker" class="tab">Break it down</a>
|
||||
<a href="#timer" data-tab="timer" class="tab">Focus timer</a>
|
||||
<a href="#dopamine" data-tab="dopamine" class="tab">Dopamine menu</a>
|
||||
<a href="#now" data-tab="now" class="tab">One thing</a>
|
||||
<a href="#breaker" data-tab="breaker" class="tab" role="tab" id="tab-breaker" aria-selected="false" aria-controls="breaker">Break it down</a>
|
||||
<a href="#timer" data-tab="timer" class="tab" role="tab" id="tab-timer" aria-selected="false" aria-controls="timer">Focus timer</a>
|
||||
<a href="#dopamine" data-tab="dopamine" class="tab" role="tab" id="tab-dopamine" aria-selected="false" aria-controls="dopamine">Dopamine menu</a>
|
||||
<a href="#now" data-tab="now" class="tab" role="tab" id="tab-now" aria-selected="false" aria-controls="now">One thing</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
|
||||
<!-- ============ WELCOME ============ -->
|
||||
<section id="welcome" class="tool" hidden>
|
||||
<div class="tool-head">
|
||||
<h1>Hey. Glad you're here.</h1>
|
||||
<p class="sub">These are free tools built for ADHD brains. No signup, no tracking, no judgment. Everything stays right here in your browser.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<p class="welcome-q">What's the vibe right now?</p>
|
||||
<div class="welcome-picks">
|
||||
<button class="btn welcome-btn" data-goto="breaker" data-label="I have a big task">😰 I have a big task</button>
|
||||
<button class="btn welcome-btn" data-goto="timer" data-label="I need to focus">⏱️ I need to focus</button>
|
||||
<button class="btn welcome-btn" data-goto="dopamine" data-label="I need a break">🧠 I need a break</button>
|
||||
<button class="btn welcome-btn" data-goto="now" data-label="I'm overwhelmed">🌀 I'm overwhelmed</button>
|
||||
<button class="btn ghost welcome-btn" data-goto="pick" data-label="Pick for me">🎲 Just pick for me</button>
|
||||
</div>
|
||||
<p class="tiny">Pick whatever feels right. You can always switch. No wrong answers.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ============ TASK BREAKER ============ -->
|
||||
<section id="breaker" class="tool" hidden>
|
||||
<section id="breaker" class="tool" role="tabpanel" aria-labelledby="tab-breaker" hidden>
|
||||
<div class="tool-head">
|
||||
<h1>Break it down</h1>
|
||||
<p class="sub">Big scary tasks are just 5–10 small boring ones wearing a trench coat. Name the monster; we'll slice it.</p>
|
||||
<p class="sub">Big unwieldy tasks are just 5–10 small manageable ones wearing a trench coat. Name the monster; we'll slice it.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<form id="breaker-form" class="row">
|
||||
<input id="breaker-input" type="text" placeholder="The big scary task… e.g. 'do my taxes'" autocomplete="off">
|
||||
<label for="breaker-input" class="sr-only">The big task</label>
|
||||
<input id="breaker-input" type="text" placeholder="The big task… e.g. 'do my taxes'" autocomplete="off">
|
||||
<button class="btn" type="submit">Break it down</button>
|
||||
</form>
|
||||
<div id="breaker-out" hidden>
|
||||
<div class="progress-wrap"><div id="breaker-progress" class="progress"></div></div>
|
||||
<p class="tiny" id="breaker-count"></p>
|
||||
<ul id="breaker-steps" class="steps"></ul>
|
||||
<div class="row gap">
|
||||
<ul id="breaker-steps" class="steps" role="list"></ul>
|
||||
<div id="breaker-done-msg" class="done-msg" hidden>
|
||||
<p class="done-text">Every step done. You did it. 🎉</p>
|
||||
<div class="row center gap">
|
||||
<button class="btn" id="breaker-new">Start something new</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="breaker-actions" class="row gap">
|
||||
<button class="btn ghost" id="breaker-add" type="button">+ add step</button>
|
||||
<button class="btn ghost" id="breaker-reset" type="button">start over</button>
|
||||
</div>
|
||||
|
|
@ -51,18 +81,22 @@
|
|||
</section>
|
||||
|
||||
<!-- ============ FOCUS TIMER ============ -->
|
||||
<section id="timer" class="tool" hidden>
|
||||
<section id="timer" class="tool" role="tabpanel" aria-labelledby="tab-timer" hidden>
|
||||
<div class="tool-head">
|
||||
<h1>Focus timer</h1>
|
||||
<p class="sub">A timer for time-blind brains: you always see how much time is left, how much is gone, and what phase you're in.</p>
|
||||
</div>
|
||||
<div id="timer-context-bar" class="context-bar" hidden>
|
||||
<span id="timer-context-label">working on:</span>
|
||||
<strong id="timer-context-text"></strong>
|
||||
</div>
|
||||
<div class="card center">
|
||||
<div class="presets">
|
||||
<button class="chip preset" data-min="10">10 min</button>
|
||||
<button class="chip preset" data-min="25">25 min</button>
|
||||
<button class="chip preset" data-min="45">45 min</button>
|
||||
<button class="chip preset break" data-min="5">5 min break</button>
|
||||
<button class="chip preset break" data-min="15">15 min break</button>
|
||||
<button class="chip preset" data-min="10" aria-label="10 minute focus">10 min</button>
|
||||
<button class="chip preset" data-min="25" aria-label="25 minute focus">25 min</button>
|
||||
<button class="chip preset" data-min="45" aria-label="45 minute focus">45 min</button>
|
||||
<button class="chip preset break" data-min="5" aria-label="5 minute break">5 min break</button>
|
||||
<button class="chip preset break" data-min="15" aria-label="15 minute break">15 min break</button>
|
||||
</div>
|
||||
<div class="timer-wrap">
|
||||
<svg viewBox="0 0 220 220" class="ring" aria-hidden="true">
|
||||
|
|
@ -75,25 +109,37 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row center gap">
|
||||
<button class="btn" id="timer-start">start</button>
|
||||
<button class="btn ghost" id="timer-reset">reset</button>
|
||||
<button class="btn" id="timer-start" aria-label="Start timer">start</button>
|
||||
<button class="btn ghost" id="timer-reset" aria-label="Reset timer">reset</button>
|
||||
</div>
|
||||
<p class="tiny" id="timer-note">Tip: 25 minutes is a suggestion, not a law. The best length is the one you'll actually start.</p>
|
||||
</div>
|
||||
<!-- Timer completion overlay -->
|
||||
<div id="timer-complete" class="completion-overlay" hidden>
|
||||
<div class="completion-card">
|
||||
<div class="completion-emoji">🎉</div>
|
||||
<h2 class="completion-title">Focus round done!</h2>
|
||||
<p id="timer-complete-sessions" class="completion-stat"></p>
|
||||
<div id="timer-complete-actions" class="row center gap">
|
||||
<button class="btn" id="timer-take-break">Take a break</button>
|
||||
<button class="btn ghost" id="timer-mark-done">Mark step done ✓</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ============ DOPAMINE MENU ============ -->
|
||||
<section id="dopamine" class="tool" hidden>
|
||||
<section id="dopamine" class="tool" role="tabpanel" aria-labelledby="tab-dopamine" hidden>
|
||||
<div class="tool-head">
|
||||
<h1>Dopamine menu</h1>
|
||||
<p class="sub">Quick, healthy mood hits so your brain stops hijacking you for worse ones. Pick how long you have.</p>
|
||||
</div>
|
||||
<div class="card center">
|
||||
<div class="presets">
|
||||
<button class="chip menu-pick" data-min="5">5 min</button>
|
||||
<button class="chip menu-pick" data-min="15">15 min</button>
|
||||
<button class="chip menu-pick" data-min="30">30 min</button>
|
||||
<button class="chip menu-pick" data-min="60">60 min</button>
|
||||
<button class="chip menu-pick" data-min="5" aria-label="5 minute activity">5 min</button>
|
||||
<button class="chip menu-pick" data-min="15" aria-label="15 minute activity">15 min</button>
|
||||
<button class="chip menu-pick" data-min="30" aria-label="30 minute activity">30 min</button>
|
||||
<button class="chip menu-pick" data-min="60" aria-label="60 minute activity">60 min</button>
|
||||
</div>
|
||||
<div id="menu-item" class="menu-item" hidden>
|
||||
<p id="menu-text" class="menu-text"></p>
|
||||
|
|
@ -107,33 +153,61 @@
|
|||
</section>
|
||||
|
||||
<!-- ============ ONE THING ============ -->
|
||||
<section id="now" class="tool" hidden>
|
||||
<section id="now" class="tool" role="tabpanel" aria-labelledby="tab-now" hidden>
|
||||
<div class="tool-head">
|
||||
<h1>One thing</h1>
|
||||
<p class="sub">Not the whole task. Not the project. The next physical action your hands can actually do.</p>
|
||||
</div>
|
||||
<div class="card center">
|
||||
<form id="now-form" class="row">
|
||||
<label for="now-input" class="sr-only">The next physical action</label>
|
||||
<input id="now-input" type="text" placeholder="The next physical action… e.g. 'open the tax folder'" autocomplete="off">
|
||||
<button class="btn" type="submit">lock it in</button>
|
||||
</form>
|
||||
<div id="now-view" hidden>
|
||||
<p class="now-label">the one thing:</p>
|
||||
<p id="now-text" class="now-text"></p>
|
||||
<div id="now-source" class="now-source" hidden>
|
||||
<span class="tiny">from your task breakdown — step <span id="now-step-num"></span> of <span id="now-step-total"></span></span>
|
||||
</div>
|
||||
<div class="row center gap">
|
||||
<button class="btn" id="now-timer" aria-label="Start a focus timer for this">⏱️ start timer</button>
|
||||
<button class="btn" id="now-done">done ✓</button>
|
||||
<button class="btn ghost" id="now-edit">change</button>
|
||||
</div>
|
||||
<p class="tiny">If it still feels too big, start with the 2-minute version: just open the thing and look at it.</p>
|
||||
</div>
|
||||
<!-- Flow: next step prompt after completing one thing -->
|
||||
<div id="now-next" class="next-step-prompt" hidden>
|
||||
<div class="completion-emoji">✅</div>
|
||||
<p class="done-text">Done. Nice work.</p>
|
||||
<div id="now-next-step" hidden>
|
||||
<p class="tiny">Next up from your breakdown:</p>
|
||||
<p id="now-next-text" class="next-step-text"></p>
|
||||
<div class="row center gap">
|
||||
<button class="btn" id="now-next-go">Let's do it</button>
|
||||
<button class="btn ghost" id="now-next-skip">Not right now</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="now-all-done" hidden>
|
||||
<p class="done-text">Every step from your breakdown is complete. 🎉</p>
|
||||
<button class="btn" id="now-fresh">Start something new</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
|
||||
<!-- Celebration canvas (confetti) -->
|
||||
<canvas id="confetti" class="confetti-canvas" aria-hidden="true"></canvas>
|
||||
|
||||
<footer class="foot">
|
||||
<p><strong>myadhd.dev</strong> — free tools, no signup, no tracking. Everything you type or save lives only in this browser (localStorage). Clear your browser data and it's gone.</p>
|
||||
<p class="tiny">Not medical advice. Just friendly scaffolding for a brain that works differently.</p>
|
||||
<div class="session-stats" id="session-stats" hidden>
|
||||
<p class="tiny" id="stats-text"></p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/static/app.js" defer></script>
|
||||
|
|
|
|||
13
site/manifest.json
Normal file
13
site/manifest.json
Normal file
|
|
@ -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" }
|
||||
]
|
||||
}
|
||||
|
|
@ -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 draft of "' + task + '". Rough is the goal.', 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,148 @@
|
|||
$('#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 () {
|
||||
|
||||
function timerReset() {
|
||||
timerStop(); timer.left = timer.total; $('#timer-start').textContent = 'start';
|
||||
timerPaint();
|
||||
});
|
||||
timerPersist(); timerPaint();
|
||||
}
|
||||
|
||||
$('#timer-reset').addEventListener('click', timerReset);
|
||||
|
||||
$$('.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();
|
||||
}
|
||||
}
|
||||
// Reset timer so it's fresh for the next step
|
||||
timerReset();
|
||||
// Clear one-thing and show next step prompt
|
||||
localStorage.removeItem('myadhd.now');
|
||||
showTab('now');
|
||||
nowShowNext(true);
|
||||
});
|
||||
|
||||
timerPaint();
|
||||
|
||||
/* ---------- dopamine menu ---------- */
|
||||
|
|
@ -197,7 +472,15 @@
|
|||
]
|
||||
};
|
||||
var lastPick = 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);
|
||||
});
|
||||
var pool = MENU[mins].filter(function (x) { return x !== lastPick; });
|
||||
var item = pool[Math.floor(Math.random() * pool.length)];
|
||||
lastPick = item;
|
||||
|
|
@ -205,13 +488,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,39 +512,181 @@
|
|||
s.last = today();
|
||||
store('streak', s);
|
||||
}
|
||||
tickSound();
|
||||
$('#menu-item').hidden = true;
|
||||
$('#menu-actions').hidden = true;
|
||||
paintStreak();
|
||||
});
|
||||
paintStreak();
|
||||
|
||||
/* ---------- one thing ---------- */
|
||||
var nowSaved = store('now');
|
||||
if (nowSaved && nowSaved.text) {
|
||||
$('#now-text').textContent = nowSaved.text;
|
||||
$('#now-form').hidden = true;
|
||||
$('#now-view').hidden = false;
|
||||
// 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');
|
||||
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(skipCelebration) {
|
||||
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;
|
||||
if (!skipCelebration) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
|||
BIN
site/static/icon-192.png
Normal file
BIN
site/static/icon-192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1 KiB |
BIN
site/static/icon-512.png
Normal file
BIN
site/static/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
BIN
site/static/og.png
Normal file
BIN
site/static/og.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
32
site/sw.js
Normal file
32
site/sw.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/* myadhd.dev — service worker for offline PWA */
|
||||
var CACHE = 'myadhd-v2';
|
||||
var ASSETS = [
|
||||
'/',
|
||||
'/index.html',
|
||||
'/static/style.css',
|
||||
'/static/app.js',
|
||||
'/static/favicon.svg',
|
||||
'/static/icon-192.png',
|
||||
'/static/icon-512.png',
|
||||
'/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); })
|
||||
);
|
||||
});
|
||||
Loading…
Reference in a new issue