diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-18 16:43:55 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-18 16:43:55 +0100 |
| commit | 6275aa8a064c433e5130e51268b4d937ccf2b631 (patch) | |
| tree | 2504eca3247a28a4c86dd8c5d080d6f7e0b1ac02 /static/dashboard.js | |
| parent | 0480dc62af2be80a17b98d88108cb04d7280a3bf (diff) | |
| download | deck-it-6275aa8a064c433e5130e51268b4d937ccf2b631.tar.gz deck-it-6275aa8a064c433e5130e51268b4d937ccf2b631.zip | |
feat(dashboard): the music card shows the game being played
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/dashboard.js')
| -rw-r--r-- | static/dashboard.js | 9 |
1 files changed, 7 insertions, 2 deletions
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 |
