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:
+17
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user