aboutsummaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-16 17:38:23 +0100
committerDanilo M. <danix@danix.xyz>2026-11-16 17:38:23 +0100
commitdf7b5062118467dc02d3baade9a6b74390c050ba (patch)
tree8627ca013e237c3494d4b13bea97a3a4ba6fe651 /static
parentaaf950fa5461d7879ca28371f1c788f4daaaaed2 (diff)
downloaddeck-it-df7b5062118467dc02d3baade9a6b74390c050ba.tar.gz
deck-it-df7b5062118467dc02d3baade9a6b74390c050ba.zip
feat(xbox): console model, region, flags and installed titles
Diffstat (limited to 'static')
-rw-r--r--static/deck.css15
-rw-r--r--static/modules/xbox.js39
2 files changed, 50 insertions, 4 deletions
diff --git a/static/deck.css b/static/deck.css
index d5aef6b..6681c3e 100644
--- a/static/deck.css
+++ b/static/deck.css
@@ -897,7 +897,20 @@ dialog.vm-sheet::backdrop { background: color-mix(in srgb, var(--udt-crust) 55%,
.xbox .xb-console { display: flex; flex-direction: column; gap: 10px; }
.xbox .xb-chead { display: flex; align-items: center; gap: 10px; }
.xbox .xb-glyph { font-size: 1.8rem; color: var(--udt-green); }
-.xbox .xb-cname { flex: 1; font-size: 1.15rem; font-weight: 600; }
+.xbox .xb-cnames { flex: 1; min-width: 0; }
+.xbox .xb-cline { display: flex; align-items: center; gap: 10px; min-width: 0; }
+.xbox .xb-cname { font-size: 1.15rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.xbox .xb-cline .xb-pill { flex: none; }
+.xbox .xb-cmodel { color: var(--udt-subtext0); font-size: 0.857rem; }
+.xbox .xb-flags { display: flex; flex-wrap: wrap; gap: 8px; }
+.xbox .xb-flag { padding: 2px 10px; border-radius: 999px; font-size: 0.857rem;
+ border: 1px solid var(--udt-surface1); color: var(--udt-subtext0); }
+.xbox .xb-flag.on { border-color: var(--udt-green); color: var(--udt-green); }
+.xbox .xb-apps { display: flex; flex-direction: column; gap: 8px; }
+.xbox .xb-apps > summary { cursor: pointer; min-height: 32px; }
+.xbox .xb-app { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
+.xbox .xb-app.game .xb-rtitle { color: var(--udt-text); }
+.xbox .xb-app:not(.game) .xb-rtitle { color: var(--udt-subtext1); }
.xbox .xb-pill { padding: 4px 12px; border-radius: 999px; background: var(--udt-surface1); font-weight: 600; }
.xbox .xb-pill.good { background: var(--udt-green); color: var(--udt-crust); }
.xbox .xb-pill.warn { background: var(--udt-yellow); color: var(--udt-crust); }
diff --git a/static/modules/xbox.js b/static/modules/xbox.js
index 65aa7f7..858d4c1 100644
--- a/static/modules/xbox.js
+++ b/static/modules/xbox.js
@@ -97,12 +97,39 @@ function presenceLine(st) {
return p.last_seen ? `Last seen ${ago(p.last_seen.when)} · ${p.last_seen.title ?? ""}` : (p.state ?? "");
}
-function consoleCard(c) {
+// "XboxSeriesX" -> "Xbox Series X"
+const model = (t) => (t ?? "").replace(/([a-z])([A-Z])/g, "$1 $2");
+// The installed list stays open across redraws once opened.
+let appsOpen = false;
+
+function appsList(apps) {
+ const box = h("details", "xb-apps");
+ box.open = appsOpen;
+ box.ontoggle = () => { appsOpen = box.open; };
+ const total = apps.reduce((n, a) => n + a.size, 0);
+ box.append(h("summary", "xb-section", `Installed · ${apps.length} · ${gb(total)}`));
+ for (const a of apps) {
+ const sub = [a.version != null ? `v${a.version}` : null, a.updated ? `updated ${ago(a.updated)}` : null,
+ a.last ? `played ${ago(a.last)}` : null].filter(Boolean).join(" · ");
+ const r = h("div", `xb-app${a.game ? " game" : ""}`);
+ const text = h("div", "xb-rtext");
+ text.append(h("div", "xb-rtitle", a.name ?? ""), h("div", "xb-rsub", sub));
+ r.append(text, h("span", "xb-rside num", gb(a.size)));
+ box.append(r);
+ }
+ return box;
+}
+
+function consoleCard(c, apps) {
const on = c.power === "On";
const card = h("div", "xb-card xb-console");
const head = h("div", "xb-chead");
const [label, cls] = POWER[c.power] ?? [c.power ?? "?", ""];
- head.append(h("i", "nf xb-glyph", G.xbox), h("span", "xb-cname", c.name), h("span", `xb-pill ${cls}`, label));
+ const names = h("div", "xb-cnames");
+ const line = h("div", "xb-cline");
+ line.append(h("span", "xb-cname", c.name), h("span", `xb-pill ${cls}`, label));
+ names.append(line, h("div", "xb-cmodel", [model(c.type), c.region].filter(Boolean).join(" · ")));
+ head.append(h("i", "nf xb-glyph", G.xbox), names);
// Tap wakes, hold turns off: a stray touch must not switch a game off.
const power = h("button", `ib hold xb-power${on ? " on" : ""}`, G.power);
power.classList.add("nf");
@@ -130,6 +157,12 @@ function consoleCard(c) {
}
card.append(media);
}
+ const flags = h("div", "xb-flags");
+ for (const [on_, text] of [[c.remote, "Remote"], [c.streaming, "Streaming"]]) {
+ if (on_ != null) flags.append(h("span", `xb-flag${on_ ? " on" : ""}`, `${text} ${on_ ? "on" : "off"}`));
+ }
+ card.append(flags);
+ if (apps?.length) card.append(appsList(apps));
card.append(h("div", "xb-err"));
return card;
}
@@ -212,7 +245,7 @@ function render(box, st) {
if (st.stale) box.append(h("div", "xb-stale", "Xbox Live is not answering; this is the last data."));
const top = h("div", "xb-top");
if (st.playing) top.append(nowPlaying(st));
- for (const c of st.consoles ?? []) top.append(consoleCard(c));
+ for (const c of st.consoles ?? []) top.append(consoleCard(c, st.apps?.[c.id]));
if (!st.consoles?.length && st.reason?.startsWith("consoles")) {
top.append(h("div", "xb-stale", "Console control is unavailable: Xbox Live refused the console list."));
}