From b5fc05382e9a35c0e4d1b3448704094c7c3b6b8c Mon Sep 17 00:00:00 2001 From: angel Date: Sun, 25 Jan 2026 01:16:17 +0000 Subject: [PATCH] Fix menubar, add lazy loading, improve image quality, limit search results, filter browse artists --- app/album/[id]/page.tsx | 12 ++++++------ app/browse/page.tsx | 10 +++++++--- app/components/album-artwork.tsx | 4 +++- app/components/artist-icon.tsx | 4 ++++ app/components/menu.tsx | 11 +++-------- app/search/page.tsx | 7 ++++++- 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/app/album/[id]/page.tsx b/app/album/[id]/page.tsx index 35991e2..bbe5adc 100644 --- a/app/album/[id]/page.tsx +++ b/app/album/[id]/page.tsx @@ -124,13 +124,13 @@ export default function AlbumPage() { // Dynamic cover art URLs based on image size const getMobileCoverArtUrl = () => { return album.coverArt && api - ? api.getCoverArtUrl(album.coverArt, 280) + ? api.getCoverArtUrl(album.coverArt, 600) : '/default-user.jpg'; }; const getDesktopCoverArtUrl = () => { return album.coverArt && api - ? api.getCoverArtUrl(album.coverArt, 300) + ? api.getCoverArtUrl(album.coverArt, 600) : '/default-user.jpg'; }; @@ -146,8 +146,8 @@ export default function AlbumPage() { {album.name} @@ -182,8 +182,8 @@ export default function AlbumPage() { {album.name}
diff --git a/app/browse/page.tsx b/app/browse/page.tsx index fcc7da4..354dfa5 100644 --- a/app/browse/page.tsx +++ b/app/browse/page.tsx @@ -19,7 +19,9 @@ import Loading from '@/app/components/loading'; import { useInView } from 'react-intersection-observer'; export default function BrowsePage() { - const { artists, isLoading: contextLoading } = useNavidrome(); + const { artists: allArtists, isLoading: contextLoading } = useNavidrome(); + // Filter to only show album artists (artists with at least one album) + const artists = allArtists.filter(artist => artist.albumCount && artist.albumCount > 0); const { shuffleAllAlbums } = useAudioPlayer(); // Use our progressive loading hook @@ -78,12 +80,13 @@ export default function BrowsePage() {
- {artists.map((artist) => ( + {artists.map((artist, index) => ( ))}
@@ -110,7 +113,7 @@ export default function BrowsePage() {
- {albums.map((album) => ( + {albums.map((album, index) => ( ))}
diff --git a/app/components/album-artwork.tsx b/app/components/album-artwork.tsx index cc8d4bb..c7efa3b 100644 --- a/app/components/album-artwork.tsx +++ b/app/components/album-artwork.tsx @@ -36,6 +36,7 @@ interface AlbumArtworkProps extends Omit< aspectRatio?: "portrait" | "square" width?: number height?: number + loading?: 'eager' | 'lazy' } export function AlbumArtwork({ @@ -43,6 +44,7 @@ export function AlbumArtwork({ aspectRatio = "portrait", width, height, + loading = 'lazy', className, ...props }: AlbumArtworkProps) { @@ -160,7 +162,7 @@ export function AlbumArtwork({ onLoad={handleImageLoad} onError={handleImageError} priority={false} - loading="lazy" + loading={loading} /> ) : (
diff --git a/app/components/artist-icon.tsx b/app/components/artist-icon.tsx index 076a7ea..cc510a3 100644 --- a/app/components/artist-icon.tsx +++ b/app/components/artist-icon.tsx @@ -27,6 +27,7 @@ interface ArtistIconProps extends React.HTMLAttributes { size?: number imageOnly?: boolean responsive?: boolean + loading?: 'eager' | 'lazy' } export function ArtistIcon({ @@ -34,6 +35,7 @@ export function ArtistIcon({ size = 150, imageOnly = false, responsive = false, + loading = 'lazy', className, ...props }: ArtistIconProps) { @@ -77,6 +79,7 @@ export function ArtistIcon({ width={size} height={size} className="w-full h-full object-cover transition-all hover:scale-105" + loading={loading} />
); @@ -116,6 +119,7 @@ export function ArtistIcon({ } )} className={isResponsive ? "object-cover" : "object-cover w-full h-full"} + loading={loading} />
diff --git a/app/components/menu.tsx b/app/components/menu.tsx index 20ed9b0..4a78932 100644 --- a/app/components/menu.tsx +++ b/app/components/menu.tsx @@ -191,11 +191,8 @@ export function Menu({ toggleSidebar, isSidebarVisible, toggleStatusBar, isStatu File - - New - - - Playlist ⌘N + router.push('/library/playlists')}> + View Playlists Playlist from Selection ⇧⌘N @@ -205,8 +202,6 @@ export function Menu({ toggleSidebar, isSidebarVisible, toggleStatusBar, isStatu Playlist Folder Genius Playlist - - Open Stream URL ⌘U @@ -386,7 +381,7 @@ export function Menu({ toggleSidebar, isSidebarVisible, toggleStatusBar, isStatu ) : navidromeUrl ? ( navidromeUrl ) : ( - Not set + Auto-configured )}
diff --git a/app/search/page.tsx b/app/search/page.tsx index 29977b5..16bf57d 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -35,7 +35,12 @@ export default function SearchPage() { try { setIsSearching(true); const results = await search2(query); - setSearchResults(results); + // Limit results to 5 of each type + setSearchResults({ + artists: results.artists.slice(0, 5), + albums: results.albums.slice(0, 5), + songs: results.songs.slice(0, 5) + }); } catch (error) { console.error('Search failed:', error); setSearchResults({ artists: [], albums: [], songs: [] });