music: dismiss the dock when playback ends

The in-flow music dock reserves its height whenever a track is loaded (current),
even paused — so after a queue finished (onEndOfQueue set playing=false but kept
the queue) the dock lingered, shifting the layout up with a faint idle bar. On
natural end-of-queue, close() the queue so the dock releases its space. The saved
now-playing snapshot is untouched, so reload still resumes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 18:34:44 +00:00
co-authored by Claude Opus 4.8
parent c1594594f5
commit e5950b6493
@@ -67,6 +67,8 @@ export const MusicPlayerHost = () => {
syncIndexRef.current = syncIndex; syncIndexRef.current = syncIndex;
const setPlayingRef = useRef(setPlaying); const setPlayingRef = useRef(setPlaying);
setPlayingRef.current = setPlaying; setPlayingRef.current = setPlaying;
const closeRef = useRef(close);
closeRef.current = close;
const withToken = (u: string) => (token ? `${u}${u.includes('?') ? '&' : '?'}token=${encodeURIComponent(token)}` : u); const withToken = (u: string) => (token ? `${u}${u.includes('?') ? '&' : '?'}token=${encodeURIComponent(token)}` : u);
const streamUrl = (t: PlayerTrack) => const streamUrl = (t: PlayerTrack) =>
@@ -101,7 +103,9 @@ export const MusicPlayerHost = () => {
engineIndexRef.current = i; // engine advanced on its own → mirror to UI without restarting engineIndexRef.current = i; // engine advanced on its own → mirror to UI without restarting
syncIndexRef.current(i); syncIndexRef.current(i);
}, },
onEndOfQueue: () => setPlayingRef.current(false), // Queue finished on its own → clear it so the in-flow dock releases its space (no idle bar lingering
// after playback). The saved snapshot is left intact, so a reload still resumes where you left off.
onEndOfQueue: () => closeRef.current(),
onLoadingChange: setLoading, onLoadingChange: setLoading,
}); });
engineRef.current = engine; engineRef.current = engine;