feat: implement playArtist function to play all albums by an artist and update QueuePage layout

This commit is contained in:
2025-06-20 00:42:03 +00:00
committed by GitHub
parent 8dfb4b34e5
commit e02ca64d17
3 changed files with 57 additions and 17 deletions

View File

@@ -21,7 +21,7 @@ export default function ArtistPage() {
const [artist, setArtist] = useState<Artist | null>(null);
const [isPlayingArtist, setIsPlayingArtist] = useState(false);
const { getArtist, starItem, unstarItem } = useNavidrome();
const { addArtistToQueue, playAlbum, clearQueue } = useAudioPlayer();
const { playArtist } = useAudioPlayer();
const { toast } = useToast();
const api = getNavidromeAPI();
@@ -65,19 +65,7 @@ export default function ArtistPage() {
setIsPlayingArtist(true);
try {
// Clear current queue and add all artist albums
clearQueue();
await addArtistToQueue(artist.id);
// Start playing the first album if we have any
if (artistAlbums.length > 0) {
await playAlbum(artistAlbums[0].id);
}
toast({
title: "Playing Artist",
description: `Now playing all albums by ${artist.name}`,
});
await playArtist(artist.id);
} catch (error) {
console.error('Failed to play artist:', error);
toast({