feat(ui): wire artist click through all views using AlbumCard

Pass artistId and onArtistClick to AlbumCard in HomeView, SearchView,
FavoritesView, LabelView, and AlbumDetailView. Add artistId to
AlbumCardData interface. Add onArtistClick prop to LabelView and wire
it from +page.svelte.
This commit is contained in:
vicrodh committed 2026-02-08 13:10:02 -06:00
1 parent f5d947e8f1
commit f3be2b737f
8 files changed
+42 -2

No files matched your search

+1 -1
View File
@@ -81,7 +81,7 @@
let titleRef: HTMLDivElement | null = $state(null); let titleRef: HTMLDivElement | null = $state(null);
let titleTextRef: HTMLSpanElement | null = $state(null); let titleTextRef: HTMLSpanElement | null = $state(null);
let titleOverflow = $state(0); let titleOverflow = $state(0);
let artistRef: HTMLDivElement | null = $state(null); let artistRef: HTMLElement | null = $state(null);
let artistTextRef: HTMLSpanElement | null = $state(null); let artistTextRef: HTMLSpanElement | null = $state(null);
let artistOverflow = $state(0); let artistOverflow = $state(0);
const titleOffset = $derived(titleOverflow > 0 ? `-${titleOverflow + 16}px` : '0px'); const titleOffset = $derived(titleOverflow > 0 ? `-${titleOverflow + 16}px` : '0px');
@@ -515,6 +515,8 @@
artwork={relatedAlbum.artwork} artwork={relatedAlbum.artwork}
title={relatedAlbum.title} title={relatedAlbum.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onTrackGoToArtist}
genre={relatedAlbum.genre} genre={relatedAlbum.genre}
releaseDate={relatedAlbum.releaseDate} releaseDate={relatedAlbum.releaseDate}
size="large" size="large"
@@ -1639,6 +1639,8 @@
artwork={album.image?.large || album.image?.thumbnail || ''} artwork={album.image?.large || album.image?.thumbnail || ''}
title={album.title} title={album.title}
artist={album.artist.name} artist={album.artist.name}
artistId={album.artist.id}
onArtistClick={onArtistClick}
genre={getGenreLabel(album)} genre={getGenreLabel(album)}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
size="large" size="large"
@@ -1715,6 +1717,8 @@
artwork={album.image?.large || album.image?.thumbnail || ''} artwork={album.image?.large || album.image?.thumbnail || ''}
title={album.title} title={album.title}
artist={album.artist.name} artist={album.artist.name}
artistId={album.artist.id}
onArtistClick={onArtistClick}
genre={getGenreLabel(album)} genre={getGenreLabel(album)}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
size="large" size="large"
@@ -1889,6 +1893,8 @@
artwork={getQobuzImage(album.image)} artwork={getQobuzImage(album.image)}
title={album.title} title={album.title}
artist={album.artist.name} artist={album.artist.name}
artistId={album.artist.id}
onArtistClick={onArtistClick}
genre={album.genre?.name} genre={album.genre?.name}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)} quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)}
@@ -1941,6 +1947,8 @@
artwork={getQobuzImage(album.image)} artwork={getQobuzImage(album.image)}
title={album.title} title={album.title}
artist={album.artist.name} artist={album.artist.name}
artistId={album.artist.id}
onArtistClick={onArtistClick}
genre={album.genre?.name} genre={album.genre?.name}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)} quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)}
@@ -1993,6 +2001,8 @@
artwork={getQobuzImage(album.image)} artwork={getQobuzImage(album.image)}
title={album.title} title={album.title}
artist={album.artist.name} artist={album.artist.name}
artistId={album.artist.id}
onArtistClick={onArtistClick}
genre={album.genre?.name} genre={album.genre?.name}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)} quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)}
+18
View File
@@ -71,6 +71,7 @@
artwork: string; artwork: string;
title: string; title: string;
artist: string; artist: string;
artistId?: number;
genre: string; genre: string;
quality?: string; quality?: string;
releaseDate?: string; releaseDate?: string;
@@ -554,6 +555,7 @@
artwork: getQobuzImage(album.image), artwork: getQobuzImage(album.image),
title: album.title, title: album.title,
artist: album.artist?.name || 'Unknown Artist', artist: album.artist?.name || 'Unknown Artist',
artistId: album.artist?.id,
genre: album.genre?.name || 'Unknown genre', genre: album.genre?.name || 'Unknown genre',
quality: formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate), quality: formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate),
releaseDate: album.release_date_original releaseDate: album.release_date_original
@@ -946,6 +948,8 @@
artwork={album.artwork} artwork={album.artwork}
title={album.title} title={album.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onArtistClick}
genre={album.genre} genre={album.genre}
releaseDate={album.releaseDate} releaseDate={album.releaseDate}
size="large" size="large"
@@ -987,6 +991,8 @@
artwork={album.artwork} artwork={album.artwork}
title={album.title} title={album.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onArtistClick}
genre={album.genre} genre={album.genre}
releaseDate={album.releaseDate} releaseDate={album.releaseDate}
size="large" size="large"
@@ -1028,6 +1034,8 @@
artwork={album.artwork} artwork={album.artwork}
title={album.title} title={album.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onArtistClick}
genre={album.genre} genre={album.genre}
releaseDate={album.releaseDate} releaseDate={album.releaseDate}
size="large" size="large"
@@ -1069,6 +1077,8 @@
artwork={album.artwork} artwork={album.artwork}
title={album.title} title={album.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onArtistClick}
genre={album.genre} genre={album.genre}
releaseDate={album.releaseDate} releaseDate={album.releaseDate}
size="large" size="large"
@@ -1110,6 +1120,8 @@
artwork={album.artwork} artwork={album.artwork}
title={album.title} title={album.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onArtistClick}
genre={album.genre} genre={album.genre}
releaseDate={album.releaseDate} releaseDate={album.releaseDate}
size="large" size="large"
@@ -1201,6 +1213,8 @@
artwork={album.image?.large || album.image?.small || ''} artwork={album.image?.large || album.image?.small || ''}
title={album.title} title={album.title}
artist={album.artists?.[0]?.name || 'Unknown Artist'} artist={album.artists?.[0]?.name || 'Unknown Artist'}
artistId={album.artists?.[0]?.id}
onArtistClick={onArtistClick}
genre={album.genre?.name || ''} genre={album.genre?.name || ''}
releaseDate={album.dates?.original} releaseDate={album.dates?.original}
size="large" size="large"
@@ -1246,6 +1260,8 @@
artwork={album.artwork} artwork={album.artwork}
title={album.title} title={album.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onArtistClick}
genre={album.genre} genre={album.genre}
releaseDate={album.releaseDate} releaseDate={album.releaseDate}
size="large" size="large"
@@ -1392,6 +1408,8 @@
artwork={album.artwork} artwork={album.artwork}
title={album.title} title={album.title}
artist={album.artist} artist={album.artist}
artistId={album.artistId}
onArtistClick={onArtistClick}
genre={album.genre} genre={album.genre}
releaseDate={album.releaseDate} releaseDate={album.releaseDate}
size="large" size="large"
+5 -1
View File
@@ -22,6 +22,7 @@
onReDownloadAlbum?: (albumId: string) => void; onReDownloadAlbum?: (albumId: string) => void;
checkAlbumFullyDownloaded?: (albumId: string) => Promise<boolean>; checkAlbumFullyDownloaded?: (albumId: string) => Promise<boolean>;
downloadStateVersion?: number; downloadStateVersion?: number;
onArtistClick?: (artistId: number) => void;
} }
let { let {
@@ -39,7 +40,8 @@
onOpenAlbumFolder, onOpenAlbumFolder,
onReDownloadAlbum, onReDownloadAlbum,
checkAlbumFullyDownloaded, checkAlbumFullyDownloaded,
downloadStateVersion downloadStateVersion,
onArtistClick
}: Props = $props(); }: Props = $props();
// State // State
@@ -277,6 +279,8 @@
artwork={album.image?.large || album.image?.thumbnail || ''} artwork={album.image?.large || album.image?.thumbnail || ''}
title={album.title} title={album.title}
artist={album.artist?.name || 'Unknown Artist'} artist={album.artist?.name || 'Unknown Artist'}
artistId={album.artist?.id}
onArtistClick={onArtistClick}
genre={getGenreLabel(album)} genre={getGenreLabel(album)}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
quality={getQualityLabel(album)} quality={getQualityLabel(album)}
@@ -1287,6 +1287,8 @@
artwork={getAlbumArtwork(album)} artwork={getAlbumArtwork(album)}
title={album.title} title={album.title}
artist={album.artist?.name || 'Unknown Artist'} artist={album.artist?.name || 'Unknown Artist'}
artistId={album.artist?.id}
onArtistClick={onArtistClick}
genre={getGenreLabel(album)} genre={getGenreLabel(album)}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
size="large" size="large"
@@ -1459,6 +1461,8 @@
artwork={getAlbumArtwork(album)} artwork={getAlbumArtwork(album)}
title={album.title} title={album.title}
artist={album.artist?.name || 'Unknown Artist'} artist={album.artist?.name || 'Unknown Artist'}
artistId={album.artist?.id}
onArtistClick={onArtistClick}
genre={getGenreLabel(album)} genre={getGenreLabel(album)}
releaseDate={album.release_date_original} releaseDate={album.release_date_original}
size="large" size="large"
+1
View File
@@ -13,6 +13,7 @@ export interface AlbumCardData {
artwork: string; artwork: string;
title: string; title: string;
artist: string; artist: string;
artistId?: number;
genre: string; genre: string;
quality?: string; quality?: string;
releaseDate?: string; releaseDate?: string;
+1
View File
@@ -3219,6 +3219,7 @@
onReDownloadAlbum={reDownloadAlbumById} onReDownloadAlbum={reDownloadAlbumById}
checkAlbumFullyDownloaded={checkAlbumFullyDownloaded} checkAlbumFullyDownloaded={checkAlbumFullyDownloaded}
{downloadStateVersion} {downloadStateVersion}
onArtistClick={handleArtistClick}
/> />
{:else if activeView === 'library' || activeView === 'library-album'} {:else if activeView === 'library' || activeView === 'library-album'}
<LocalLibraryView <LocalLibraryView