From 2c0cb7a67a552db6d8543b21f8e1977dece81f85 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 6 Mar 2026 09:39:27 +0100 Subject: [PATCH] fix: volume slider disappearing + theme overlapping favorites - SSE handler now distinguishes per-guild events (single NowPlaying) from snapshots (Record) to prevent state corruption - Theme selector moved left (right: 72px) to not overlap favorites button Co-Authored-By: Claude Opus 4.6 --- web/src/plugins/radio/RadioTab.tsx | 15 ++++++++++++++- web/src/styles.css | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/web/src/plugins/radio/RadioTab.tsx b/web/src/plugins/radio/RadioTab.tsx index 755b355..1a53a2c 100644 --- a/web/src/plugins/radio/RadioTab.tsx +++ b/web/src/plugins/radio/RadioTab.tsx @@ -100,7 +100,20 @@ export default function RadioTab({ data }: { data: any }) { // ── Handle SSE data ── useEffect(() => { - if (data?.playing) setNowPlaying(data.playing); + if (data?.guildId && 'playing' in data) { + // Per-guild SSE event (broadcastState): playing is single NowPlaying | null + setNowPlaying(prev => { + if (data.playing) { + return { ...prev, [data.guildId]: data.playing }; + } + const next = { ...prev }; + delete next[data.guildId]; + return next; + }); + } else if (data?.playing) { + // Snapshot: playing is Record + setNowPlaying(data.playing); + } if (data?.favorites) setFavorites(data.favorites); // Volume from snapshot or radio_volume event if (data?.volumes && selectedGuild && data.volumes[selectedGuild] != null) { diff --git a/web/src/styles.css b/web/src/styles.css index cf2032e..dd35ca1 100644 --- a/web/src/styles.css +++ b/web/src/styles.css @@ -972,7 +972,7 @@ html, body { .radio-theme { position: absolute; top: 16px; - right: 16px; + right: 72px; z-index: 25; display: flex; align-items: center;