diff --git a/src/app.js b/src/app.js index 231e70d..93dd366 100644 --- a/src/app.js +++ b/src/app.js @@ -674,28 +674,27 @@ let bigClockSince = 0; function renderBigClock(events) { - const card = document.getElementById("big-clock"); - const label = document.getElementById("bc-label"); - const time = document.getElementById("bc-time"); - const since = document.getElementById("bc-since"); + const pill = document.getElementById("bar-clock"); + const icon = document.getElementById("bar-clock-icon"); + const time = document.getElementById("bar-clock-time"); const { state, since: ts } = currentSleepState(events); bigClockState = state; bigClockSince = ts; if (!state) { - card.hidden = true; + pill.hidden = true; return; } - card.hidden = false; - card.classList.toggle("asleep", state === "asleep"); - card.classList.toggle("awake", state === "awake"); - label.textContent = state === "asleep" ? "Asleep for" : "Awake for"; - time.textContent = formatCounter(Date.now() - ts); - since.textContent = `since ${formatTime(ts)}`; + pill.hidden = false; + pill.classList.toggle("asleep", state === "asleep"); + pill.classList.toggle("awake", state === "awake"); + icon.textContent = state === "asleep" ? "😴" : "☀️"; + pill.title = `${state === "asleep" ? "Asleep" : "Awake"} since ${formatTime(ts)}`; + time.textContent = formatCounter(Date.now() - ts); } function tickBigClock() { if (!bigClockState) return; - const time = document.getElementById("bc-time"); + const time = document.getElementById("bar-clock-time"); if (time) time.textContent = formatCounter(Date.now() - bigClockSince); } diff --git a/src/changelog.json b/src/changelog.json index 558dab0..c9b0fe9 100644 --- a/src/changelog.json +++ b/src/changelog.json @@ -1,4 +1,5 @@ [ + { "date": "2026-07-13", "text": "The awake/asleep timer lives in the frozen top bar" }, { "date": "2026-07-13", "text": "The day picker is a bar frozen at the top of the page" }, { "date": "2026-07-13", "text": "Attach multiple photos to an event — the photo picker now also offers the gallery with multi-select" }, { "date": "2026-07-13", "text": "Track food by weight: logging a meal asks for grams (optional), with a daily total in the overview and a weekly chart" }, diff --git a/src/index.html b/src/index.html index b7f2b0c..9df038e 100644 --- a/src/index.html +++ b/src/index.html @@ -82,12 +82,12 @@ - - -
diff --git a/src/style.css b/src/style.css index e86368e..e625de0 100644 --- a/src/style.css +++ b/src/style.css @@ -159,34 +159,20 @@ body::before { opacity: 0.4; cursor: not-allowed; } -.big-clock { - text-align: center; - padding: 24px 16px; -} -.big-clock .bc-label { - font-size: 0.8rem; - text-transform: uppercase; - letter-spacing: 0.08em; - color: var(--muted); - margin-bottom: 6px; -} -.big-clock .bc-time { - font-size: 3.25rem; +.bar-clock { + display: flex; + align-items: center; + gap: 6px; + padding: 7px 12px; + border-radius: 999px; font-weight: 700; + font-size: 0.9rem; font-variant-numeric: tabular-nums; - line-height: 1.05; - letter-spacing: -0.01em; + flex-shrink: 0; } -.big-clock .bc-since { - margin-top: 6px; - font-size: 0.8rem; - color: var(--muted); - font-variant-numeric: tabular-nums; -} -.big-clock.asleep { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--sleep) 10%, var(--surface))); } -.big-clock.asleep .bc-time { color: var(--sleep); } -.big-clock.awake { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent) 10%, var(--surface))); } -.big-clock.awake .bc-time { color: var(--accent); } +.bar-clock[hidden] { display: none; } +.bar-clock.asleep { background: color-mix(in srgb, var(--sleep) 18%, var(--surface)); color: var(--sleep); } +.bar-clock.awake { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--accent); } .grid { display: grid;