From b030cfb72a1c49ca147471db75111fd8fde0827c Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Wed, 15 Jul 2026 09:53:22 +0000 Subject: [PATCH] Dim quick actions that don't fit the current sleep state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Asleep: everything but Sleep end fades; awake: only Sleep end fades; no sleep history: nothing. Buttons stay clickable — it's a visual nudge for the thumb, not a lockout, so corrections still work. --- src/app.js | 17 +++++++++++++++++ src/changelog.json | 1 + src/style.css | 3 +++ 3 files changed, 21 insertions(+) diff --git a/src/app.js b/src/app.js index 4875995..27d1335 100644 --- a/src/app.js +++ b/src/app.js @@ -1590,12 +1590,28 @@ if (sleepTitle) sleepTitle.textContent = cfg.name ? `When ${cfg.name} sleeps` : "When sleeping"; } + // Dim the quick actions that don't fit the current sleep state — a nudge + // toward the likely next tap, never a block: everything stays clickable so + // corrections (a missed sleep-end, a mid-nap pee) are always possible. + function renderActionHints(events) { + const { state } = currentSleepState(events); + document.querySelectorAll("button.action").forEach(btn => { + const type = btn.dataset.type; + const unlikely = + state === "asleep" ? type !== "sleep-end" + : state === "awake" ? type === "sleep-end" + : false; // no sleep history yet — no hints to give + btn.classList.toggle("unlikely", unlikely); + }); + } + function render() { const events = live(); renderHeader(); renderDayBar(); renderChartWindow(); renderBigClock(events); + renderActionHints(events); renderStats(events); renderLasts(events); renderTiming(events); @@ -2549,6 +2565,7 @@ const evs = live(); renderHeader(); renderBigClock(evs); + renderActionHints(evs); renderStats(evs); renderLasts(evs); renderTiming(evs); diff --git a/src/changelog.json b/src/changelog.json index 7566a24..52fa4d3 100644 --- a/src/changelog.json +++ b/src/changelog.json @@ -1,4 +1,5 @@ [ + { "date": "2026-07-15", "text": "Quick actions that don't fit right now are dimmed (asleep → everything but Sleep end; awake → Sleep end) — still tappable for corrections" }, { "date": "2026-07-15", "text": "Editing an event no longer pops the date picker over the whole screen on iPhone" }, { "date": "2026-07-15", "text": "Weight and amount fields no longer show up on events that don't use them (e.g. editing a pee)" }, { "date": "2026-07-15", "text": "The date in the top bar is shorter (no year), so the whole bar fits on smaller iPhones" }, diff --git a/src/style.css b/src/style.css index f5a3780..3cb607d 100644 --- a/src/style.css +++ b/src/style.css @@ -255,6 +255,9 @@ button.action.eat { background: var(--eat); } button.action.pee { background: var(--pee); color: #2b240a; } button.action.poo { background: var(--poo); } button.action.weight { background: var(--weight); } +/* Unlikely given the current sleep state (see renderActionHints) — dimmed + but fully tappable, so corrections are never blocked. */ +button.action.unlikely { opacity: 0.4; } button.ghost { background: transparent;