diff --git a/app/album/[id]/page.tsx b/app/album/[id]/page.tsx
index 238ff00..9a30334 100644
--- a/app/album/[id]/page.tsx
+++ b/app/album/[id]/page.tsx
@@ -80,8 +80,12 @@ export default function AlbumPage() {
console.error('Failed to play album from track:', error);
}
};
-
const handleAddToQueue = (song: Song) => {
+ if (!api) {
+ console.error('Navidrome API not available');
+ return;
+ }
+
const track = {
id: song.id,
name: song.title,
@@ -106,9 +110,8 @@ export default function AlbumPage() {
const seconds = duration % 60;
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
};
-
// Get cover art URL with proper fallback
- const coverArtUrl = album.coverArt
+ const coverArtUrl = album.coverArt && api
? api.getCoverArtUrl(album.coverArt, 300)
: '/default-user.jpg';
diff --git a/app/artist/[artist]/page.tsx b/app/artist/[artist]/page.tsx
index c475db9..eaa771b 100644
--- a/app/artist/[artist]/page.tsx
+++ b/app/artist/[artist]/page.tsx
@@ -89,9 +89,8 @@ export default function ArtistPage() {
);
}
-
// Get artist image URL with proper fallback
- const artistImageUrl = artist.coverArt
+ const artistImageUrl = artist.coverArt && api
? api.getCoverArtUrl(artist.coverArt, 300)
: '/default-user.jpg';
diff --git a/app/browse/page.tsx b/app/browse/page.tsx
index 5ccbebb..3f26460 100644
--- a/app/browse/page.tsx
+++ b/app/browse/page.tsx
@@ -24,8 +24,12 @@ export default function BrowsePage() {
const albumsPerPage = 84;
const api = getNavidromeAPI();
-
const loadAlbums = async (page: number, append: boolean = false) => {
+ if (!api) {
+ console.error('Navidrome API not available');
+ return;
+ }
+
try {
setIsLoadingAlbums(true);
const offset = page * albumsPerPage;
diff --git a/app/components/album-artwork.tsx b/app/components/album-artwork.tsx
index 51ab653..8b3e2d4 100644
--- a/app/components/album-artwork.tsx
+++ b/app/components/album-artwork.tsx
@@ -57,9 +57,8 @@ export function AlbumArtwork({
starItem(album.id, 'album');
}
};
-
// Get cover art URL with proper fallback
- const coverArtUrl = album.coverArt
+ const coverArtUrl = album.coverArt && api
? api.getCoverArtUrl(album.coverArt, 300)
: '/default-user.jpg';
diff --git a/app/components/artist-icon.tsx b/app/components/artist-icon.tsx
index 04370a1..c9431ef 100644
--- a/app/components/artist-icon.tsx
+++ b/app/components/artist-icon.tsx
@@ -52,9 +52,8 @@ export function ArtistIcon({
starItem(artist.id, 'artist');
}
};
-
// Get cover art URL with proper fallback
- const artistImageUrl = artist.coverArt
+ const artistImageUrl = artist.coverArt && api
? api.getCoverArtUrl(artist.coverArt, 200)
: '/default-user.jpg';
diff --git a/app/library/playlists/page.tsx b/app/library/playlists/page.tsx
index 6d3e0cf..2308bac 100644
--- a/app/library/playlists/page.tsx
+++ b/app/library/playlists/page.tsx
@@ -51,9 +51,8 @@ const PlaylistsPage: React.FC = () => {