fix: artist images
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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[];
|
||||
|
||||
Reference in New Issue
Block a user