fix: artist images

This commit is contained in:
Xoconoch
2025-08-30 07:27:13 -06:00
parent 5942e6ea36
commit 3ff6134712
3 changed files with 10 additions and 5 deletions

View File

@@ -93,7 +93,7 @@ export const Artist = () => {
setArtist(data);
// Lazy-load banner image after render
const allImages = [...(data.portrait_group ?? []), ...(data.biography?.portrait_group ?? [])];
const allImages = [...(data.portrait_group.image ?? []), ...(data.biography?.[0].portrait_group.image ?? [])];
const candidateBanner = allImages
.filter(img => img && typeof img === 'object' && 'url' in img)
.sort((a, b) => (b.width ?? 0) - (a.width ?? 0))[0]?.url || "/placeholder.jpg";

View File

@@ -176,7 +176,7 @@ export const Watchlist = () => {
<img
src={
item.itemType === "artist"
? (item as WatchedArtist).portrait_group[0]?.url || "/images/placeholder.jpg"
? (item as WatchedArtist).portrait_group.image[0].url || "/images/placeholder.jpg"
: (item as WatchedPlaylist).picture || "/images/placeholder.jpg"
}
alt={item.name}

View File

@@ -20,21 +20,26 @@ export interface LibrespotArtistStub {
export interface LibrespotBiographyType {
text: string;
portrait_group: LibrespotImage[];
portrait_group: LibrespotArtistImageType;
}
export interface LibrespotTopTrackType {
country: string;
track: string[];
}
export interface LibrespotArtistImageType {
image: LibrespotImage[];
}
// Full artist object (get_artist)
export interface LibrespotArtistType {
id: string;
name: string;
top_track: LibrespotTopTrackType[];
portrait_group: LibrespotImage[];
portrait_group: LibrespotArtistImageType;
popularity: number;
biography: LibrespotBiographyType;
biography?: LibrespotBiographyType[];
album_group?: string[];
single_group?: string[];
compilation_group?: string[];