From 6275aa8a064c433e5130e51268b4d937ccf2b631 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 18 Nov 2026 16:43:55 +0100 Subject: feat(dashboard): the music card shows the game being played Co-Authored-By: Claude Opus 5.5 --- static/dashboard.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'static/dashboard.js') diff --git a/static/dashboard.js b/static/dashboard.js index 1f89da8..828d36b 100644 --- a/static/dashboard.js +++ b/static/dashboard.js @@ -262,10 +262,15 @@ export default { w.rssi == null ? 0 : 2 * (w.rssi + 100)); // -100 dBm empty, -50 full }); - if (on.has("music")) import("./modules/music.js").then(({ default: music }) => { + if (on.has("music")) import("./modules/music.js").then(({ default: music, pickGame }) => { const el = $(".dash-music"); music.mount(el); - poll("music", music.interval ?? 2, (st) => music.update(st, el)); + // The card shows a running game (PC or Xbox) instead of the music. + const last = { music: {}, games: null, xbox: null }; + const draw = () => music.update(last.music, el, pickGame(last.games, last.xbox)); + poll("music", music.interval ?? 2, (st) => { last.music = st; draw(); }); + if (on.has("games")) poll("games", 5, (st) => { last.games = st; draw(); }); + if (on.has("xbox")) poll("xbox", 30, (st) => { last.xbox = st; draw(); }); }); // The running row: a chip per module, created now in RUNNING order and -- cgit v1.2.3