aboutsummaryrefslogtreecommitdiffstats
path: root/static/modules
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-16 17:24:13 +0100
committerDanilo M. <danix@danix.xyz>2026-11-16 17:24:13 +0100
commitdb13056723c0c13fcf9ea98ed258a619f9654ab8 (patch)
tree6dfdb7ae782d3101bec7f0188086150b2bbddede /static/modules
parent5e18a133f779d5f344e592b4e3c122c43b2a4982 (diff)
downloaddeck-it-db13056723c0c13fcf9ea98ed258a619f9654ab8.tar.gz
deck-it-db13056723c0c13fcf9ea98ed258a619f9654ab8.zip
fix(xbox): a redrawn hold never fires, and start clears the flag
A power button rebuilt mid-hold lost its pointerup, so letting go early still turned the console off; hold.js now drops a hold whose button is no longer in the page. status.xbox is written 0 on start, in case a crash left it at 1. The "ago" texts move on each minute, and missing storage names and achievement percentages no longer print null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/modules')
-rw-r--r--static/modules/xbox.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/static/modules/xbox.js b/static/modules/xbox.js
index 7e2f075..ec4a14a 100644
--- a/static/modules/xbox.js
+++ b/static/modules/xbox.js
@@ -113,7 +113,7 @@ function consoleCard(c) {
for (const d of c.storage ?? []) {
const row = h("div", "xb-disk");
const used = d.total ? (d.total - d.free) / d.total : 0;
- row.append(h("span", "", `${d.name} · ${gb(d.free)} free of ${gb(d.total)}`));
+ row.append(h("span", "", `${d.name ?? ""} · ${gb(d.free)} free of ${gb(d.total)}`));
const bar = h("div", "gbar");
bar.append(h("i"));
bar.firstChild.style.width = `${Math.round(used * 100)}%`;
@@ -144,10 +144,10 @@ function nowPlaying(st) {
h("div", "xb-nrich", g.rich ?? ""), h("div", "xb-clock num", clock(st.session)));
if (t) {
const a = t.achievements;
- info.append(h("div", "xb-nach", `${a.score} / ${a.max} G · ${Math.round(a.pct)}%`));
+ info.append(h("div", "xb-nach", `${a.score} / ${a.max} G · ${Math.round(a.pct ?? 0)}%`));
const bar = h("div", "gbar");
bar.append(h("i"));
- bar.firstChild.style.width = `${a.pct}%`;
+ bar.firstChild.style.width = `${a.pct ?? 0}%`;
info.append(bar);
}
card.append(info);
@@ -161,7 +161,7 @@ function gameTile(t) {
const a = t.achievements;
const bar = h("div", "gbar");
bar.append(h("i"));
- bar.firstChild.style.width = `${a.pct}%`;
+ bar.firstChild.style.width = `${a.pct ?? 0}%`;
tile.append(bar, h("div", "xb-gmeta", [`${a.score}/${a.max} G`, hours(t.minutes)].filter(Boolean).join(" · ")));
} else {
tile.append(h("div", "xb-gmeta", ago(t.last)));
@@ -261,8 +261,9 @@ export default {
}
// Drawn again only when the data changed: a redraw restarts the images
// and would cut a held power button short.
- // ponytail: a hold across a 30s data change still restarts; key per card if it bites.
- const key = JSON.stringify(st);
+ // ponytail: a hold across a data change is dropped (hold.js); key per card if it bites.
+ // The minute is in the key so the "ago" texts move on with idle data.
+ const key = JSON.stringify(st) + Math.floor(Date.now() / 60000);
if (on._key !== key) {
on._key = key;
if (st.signed_in === false) signIn(on, st);