diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-10 19:58:53 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-10 19:58:53 +0100 |
| commit | d0ef71dc2e15860fb99e8d49810dc6d91ec76f79 (patch) | |
| tree | f82a5d7c95765a142584f7d44cd82e412c55f7f2 /static/dashboard.js | |
| parent | f363c7052251da945724eb9c7e6fcd5eebadd393 (diff) | |
| download | deck-it-d0ef71dc2e15860fb99e8d49810dc6d91ec76f79.tar.gz deck-it-d0ef71dc2e15860fb99e8d49810dc6d91ec76f79.zip | |
fix(dashboard): review fixes
- The OBS slot has no one-tap stop: a tap opens the OBS tab, so a
stray touch cannot end a recording.
- Scrolling lines are measured once their slot is on screen, and
every slot again when one comes or goes.
- The lock watcher survives a missing pidof.
- Trend gradients are in user space, so a flat line still paints.
- Uptime under an hour shows minutes.
- The shell no longer imports panel files for the modules the
dashboard draws.
- The spec matches the build VM and OBS slots and the error wording.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/dashboard.js')
| -rw-r--r-- | static/dashboard.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/static/dashboard.js b/static/dashboard.js index 5dc8939..de8aaae 100644 --- a/static/dashboard.js +++ b/static/dashboard.js @@ -44,7 +44,7 @@ const pct = (v) => (v == null ? "—" : `${Math.round(v)}%`); const short = (m) => String(m ?? "").split("/").pop(); const uptime = (s) => { const d = Math.floor(s / 86400), h = Math.floor((s % 86400) / 3600); - return d ? `${d}d ${h}h` : `${h}h`; + return d ? `${d}d ${h}h` : h ? `${h}h` : `${Math.floor(s / 60)}m`; }; export function push(list, v, n = HISTORY) { @@ -78,6 +78,7 @@ export function batteryGlyph(b) { // one that fits stays still. Only changed values are written, so the // animation is not restarted by every poll. function marquee(el) { + if (!el.offsetParent) return; // another tab is in front: nothing to measure for (const line of el.querySelectorAll(".what, .meta")) { const over = line.firstElementChild.offsetWidth - line.clientWidth; line.classList.toggle("marq", over > 0); @@ -91,9 +92,9 @@ function marquee(el) { const SKELETON = ` <svg class="dash-defs" width="0" height="0" aria-hidden="true"><defs> - <linearGradient id="hyline"><stop offset="0" style="stop-color:var(--udt-border-1)"/> + <linearGradient id="hyline" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="120" y2="0"><stop offset="0" style="stop-color:var(--udt-border-1)"/> <stop offset=".5" style="stop-color:var(--udt-border-2)"/><stop offset="1" style="stop-color:var(--udt-border-3)"/></linearGradient> - <linearGradient id="hyfill" x1="0" y1="0" x2="0" y2="1"> + <linearGradient id="hyfill" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="0" y2="100"> <stop offset="0" style="stop-color:var(--udt-border-2);stop-opacity:.45"/> <stop offset="1" style="stop-color:var(--udt-border-1);stop-opacity:.05"/></linearGradient> </defs></svg> @@ -245,11 +246,10 @@ export default { // ponytail: the K1C and OBS tabs poll the same API; two polls a second, one cache if it matters. poll(name, mod.interval ?? mod.default?.interval ?? 2, (st) => { el.hidden = !mod.busy(st); - if (!el.hidden) { - mod.slot(st, el); - marquee(el); - } + if (!el.hidden) mod.slot(st, el); row.hidden = !row.querySelector(".slot:not([hidden])"); + // a slot coming or going changes the others' widths + for (const s of row.querySelectorAll(".slot:not([hidden])")) marquee(s); }); }); } |
