mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
handle playback on new artist list
This commit is contained in:
parent
b9611589ba
commit
4a3604b1a8
12 changed files with 121 additions and 31 deletions
|
|
@ -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={{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue