diff --git a/src/lib/components/Header.svelte b/src/lib/components/Header.svelte index 78e70a1..8e86cef 100644 --- a/src/lib/components/Header.svelte +++ b/src/lib/components/Header.svelte @@ -2,6 +2,7 @@ import Avatar from './Avatar.svelte' import SegmentedController from './SegmentedController.svelte' import NavDropdown from './NavDropdown.svelte' + import NowPlayingBar from './NowPlayingBar.svelte' import { albumStream } from '$lib/stores/album-stream' import { nowPlayingStream } from '$lib/stores/now-playing-stream' import type { Album } from '$lib/types/lastfm' @@ -23,6 +24,15 @@ const nowPlaying = state.albums.find((album) => album.isNowPlaying) currentlyPlayingAlbum = nowPlaying || null isPlayingMusic = !!nowPlaying + + // Debug logging + if (nowPlaying) { + console.log('Header: Now playing detected:', { + artist: nowPlaying.artist.name, + album: nowPlaying.name, + track: nowPlaying.nowPlayingTrack + }) + } }) return unsubscribe @@ -32,7 +42,12 @@ $effect(() => { const unsubscribe = nowPlayingStream.subscribe((state) => { const hasNowPlaying = Array.from(state.updates.values()).some((update) => update.isNowPlaying) - if (!hasNowPlaying && currentlyPlayingAlbum) { + console.log('Header: nowPlayingStream update:', { + hasNowPlaying, + updatesCount: state.updates.size + }) + // Only clear if we explicitly know music stopped + if (!hasNowPlaying && currentlyPlayingAlbum && state.updates.size > 0) { // Music stopped currentlyPlayingAlbum = null isPlayingMusic = false @@ -82,31 +97,25 @@ style="--gradient-opacity: {gradientOpacity}; --padding-progress: {paddingProgress}" >