fix(home): properly show offline cache status in Continue Listening

- Add getTrackOfflineCacheStatus prop to HomeView
- Pass downloadStatus and downloadProgress to TrackRow
- Use reactive cache status function that depends on downloadStateVersion

Tracks in Continue Listening now correctly show their cached state.
This commit is contained in:
vicrodh committed 2026-01-27 19:24:23 -06:00
1 parent 79a667fb50
commit 655aaf4c88
2 files changed
+7 -1

No files matched your search

+6 -1
View File
@@ -76,6 +76,7 @@
onTrackRemoveDownload?: (trackId: number) => void;
onTrackReDownload?: (track: DisplayTrack) => void;
checkTrackDownloaded?: (trackId: number) => boolean;
getTrackOfflineCacheStatus?: (trackId: number) => { status: string; progress: number };
activeTrackId?: number | null;
isPlaybackActive?: boolean;
sidebarExpanded?: boolean;
@@ -109,6 +110,7 @@
onTrackRemoveDownload,
onTrackReDownload,
checkTrackDownloaded,
getTrackOfflineCacheStatus,
activeTrackId = null,
isPlaybackActive = false,
sidebarExpanded = true
@@ -839,7 +841,8 @@
<div class="track-list compact">
{#each continueTracks as track, index (`${track.id}-${downloadStateVersion}`)}
{@const isActiveTrack = isPlaybackActive && activeTrackId === track.id}
{@const isTrackDownloaded = checkTrackDownloaded?.(track.id) || false}
{@const cacheStatus = getTrackOfflineCacheStatus?.(track.id) ?? { status: 'none', progress: 0 }}
{@const isTrackDownloaded = cacheStatus.status === 'ready'}
<TrackRow
trackId={track.id}
number={index + 1}
@@ -850,6 +853,8 @@
quality={getTrackQuality(track)}
isPlaying={isActiveTrack}
compact={true}
downloadStatus={cacheStatus.status}
downloadProgress={cacheStatus.progress}
onArtistClick={track.artistId && onArtistClick ? () => onArtistClick(track.artistId!) : undefined}
onAlbumClick={track.albumId && onAlbumClick ? () => onAlbumClick(track.albumId!) : undefined}
onPlay={() => handleContinueTrackPlay(track, index)}