handle playback on new artist list

This commit is contained in:
jeffvli 2025-05-06 14:43:42 -07:00
parent b9611589ba
commit 4a3604b1a8
12 changed files with 121 additions and 31 deletions

View file

@ -16,15 +16,21 @@ const AlbumArtistDetailRoute = () => {
const headerRef = useRef<HTMLDivElement>(null);
const server = useCurrentServer();
const { albumArtistId } = useParams() as { albumArtistId: string };
const { albumArtistId, artistId } = useParams() as {
albumArtistId?: string;
artistId?: string;
};
const routeId = (artistId || albumArtistId) as string;
const handlePlayQueueAdd = usePlayQueueAdd();
const playButtonBehavior = usePlayButtonBehavior();
const detailQuery = useAlbumArtistDetail({
query: { id: albumArtistId },
query: { id: routeId },
serverId: server?.id,
});
const { color: background, colorId } = useFastAverageColor({
id: albumArtistId,
id: routeId,
src: detailQuery.data?.imageUrl,
srcLoaded: !detailQuery.isLoading,
});
@ -32,19 +38,19 @@ const AlbumArtistDetailRoute = () => {
const handlePlay = () => {
handlePlayQueueAdd?.({
byItemType: {
id: [albumArtistId],
id: [routeId],
type: LibraryItem.ALBUM_ARTIST,
},
playType: playButtonBehavior,
});
};
if (!background || colorId !== albumArtistId) {
if (!background || colorId !== routeId) {
return <Spinner container />;
}
return (
<AnimatedPage key={`album-artist-detail-${albumArtistId}`}>
<AnimatedPage key={`album-artist-detail-${routeId}`}>
<NativeScrollArea
ref={scrollAreaRef}
pageHeaderProps={{