feat: optimize cover art URLs for songs and playlists with dynamic sizing
This commit is contained in:
@@ -105,7 +105,7 @@ export const AudioPlayerProvider: React.FC<{ children: React.ReactNode }> = ({ c
|
||||
artist: song.artist,
|
||||
album: song.album,
|
||||
duration: song.duration,
|
||||
coverArt: song.coverArt ? api.getCoverArtUrl(song.coverArt, 1200) : undefined,
|
||||
coverArt: song.coverArt ? api.getCoverArtUrl(song.coverArt, 512) : undefined,
|
||||
albumId: song.albumId,
|
||||
artistId: song.artistId,
|
||||
starred: !!song.starred
|
||||
|
||||
@@ -394,13 +394,13 @@ export const FullScreenPlayer: React.FC<FullScreenPlayerProps> = ({ isOpen, onCl
|
||||
|
||||
{/* Track Info - Left Aligned and Heart on Same Line */}
|
||||
<div className="w-full mb-6 shrink-0">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<div className="flex items-center justify-between mb-0">
|
||||
<h1 className="text-2xl font-bold text-foreground line-clamp-1 flex-1 text-left">
|
||||
{currentTrack.name}
|
||||
</h1>
|
||||
<button
|
||||
onClick={toggleCurrentTrackStar}
|
||||
className="p-2 hover:bg-gray-700/50 rounded-full transition-colors ml-3"
|
||||
className="p-2 hover:bg-gray-700/50 rounded-full transition-colors ml-3 pb-0"
|
||||
title={currentTrack?.starred ? 'Remove from favorites' : 'Add to favorites'}
|
||||
>
|
||||
<Heart
|
||||
|
||||
@@ -47,11 +47,14 @@ export function AlbumArtwork({
|
||||
const { addAlbumToQueue, playTrack, addToQueue } = useAudioPlayer();
|
||||
const { playlists, starItem, unstarItem } = useNavidrome();
|
||||
|
||||
// Memoize cover art URL to prevent recalculation on every render
|
||||
// Memoize cover art URL with dynamic sizing
|
||||
const coverArtUrl = useMemo(() => {
|
||||
if (!api || !album.coverArt) return '/default-user.jpg';
|
||||
return api.getCoverArtUrl(album.coverArt, 1200);
|
||||
}, [api, album.coverArt]);
|
||||
|
||||
// Use width prop or default size for optimization
|
||||
const imageSize = width || height || 300;
|
||||
return api.getCoverArtUrl(album.coverArt, imageSize);
|
||||
}, [api, album.coverArt, width, height]);
|
||||
|
||||
// Use callback to prevent function recreation on every render
|
||||
const handleImageLoad = useCallback(() => {
|
||||
|
||||
@@ -158,9 +158,9 @@ export function Menu({ toggleSidebar, isSidebarVisible, toggleStatusBar, isStatu
|
||||
<div className="flex items-center justify-between w-full">
|
||||
{/* Mobile Top Bar - Simplified since navigation is now at bottom */}
|
||||
{isMobile ? (
|
||||
<div className="flex items-center justify-center w-full p-2">
|
||||
<h1 className="font-bold text-lg">mice</h1>
|
||||
</div>
|
||||
// hey bear!
|
||||
// nothing
|
||||
null
|
||||
) : (
|
||||
/* Desktop Navigation */
|
||||
<Menubar
|
||||
|
||||
Reference in New Issue
Block a user