fix: volume slider disappearing + theme overlapping favorites
- SSE handler now distinguishes per-guild events (single NowPlaying) from snapshots (Record<string, NowPlaying>) to prevent state corruption - Theme selector moved left (right: 72px) to not overlap favorites button Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bac2e3b17f
commit
2c0cb7a67a
2 changed files with 15 additions and 2 deletions
|
|
@ -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<string, NowPlaying>
|
||||
setNowPlaying(data.playing);
|
||||
}
|
||||
if (data?.favorites) setFavorites(data.favorites);
|
||||
// Volume from snapshot or radio_volume event
|
||||
if (data?.volumes && selectedGuild && data.volumes[selectedGuild] != null) {
|
||||
|
|
|
|||
|
|
@ -972,7 +972,7 @@ html, body {
|
|||
.radio-theme {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
right: 16px;
|
||||
right: 72px;
|
||||
z-index: 25;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue