Dim quick actions that don't fit the current sleep state

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.
This commit is contained in:
Alexander Heldt
2026-07-15 09:53:22 +00:00
parent 7cb59a7a23
commit b030cfb72a
3 changed files with 21 additions and 0 deletions
+17
View File
@@ -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);