mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-20 19:04:23 +02:00
move artist radio button to page content
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { useQueryClient, useSuspenseQuery } from '@tanstack/react-query';
|
||||
import { useSuspenseQuery } from '@tanstack/react-query';
|
||||
import { forwardRef, Fragment, Ref, useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useParams } from 'react-router';
|
||||
|
||||
import styles from './album-artist-detail-header.module.css';
|
||||
|
||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||
import { useItemImageUrl } from '/@/renderer/components/item-image/item-image';
|
||||
import { artistsQueries } from '/@/renderer/features/artists/api/artists-api';
|
||||
import { ContextMenuController } from '/@/renderer/features/context-menu/context-menu-controller';
|
||||
@@ -14,9 +13,8 @@ import {
|
||||
LibraryHeader,
|
||||
LibraryHeaderMenu,
|
||||
} from '/@/renderer/features/shared/components/library-header';
|
||||
import { songsQueries } from '/@/renderer/features/songs/api/songs-api';
|
||||
import { AppRoute } from '/@/renderer/router/routes';
|
||||
import { useCurrentServer, useGeneralSettings } from '/@/renderer/store';
|
||||
import { useCurrentServer } from '/@/renderer/store';
|
||||
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
|
||||
import { formatDurationString } from '/@/renderer/utils';
|
||||
import { Group } from '/@/shared/components/group/group';
|
||||
@@ -26,7 +24,6 @@ import { LibraryItem, ServerType } from '/@/shared/types/domain-types';
|
||||
import { Play } from '/@/shared/types/types';
|
||||
|
||||
export const AlbumArtistDetailHeader = forwardRef((_props, ref: Ref<HTMLDivElement>) => {
|
||||
const { artistRadioCount } = useGeneralSettings();
|
||||
const { albumArtistId, artistId } = useParams() as {
|
||||
albumArtistId?: string;
|
||||
artistId?: string;
|
||||
@@ -67,31 +64,8 @@ export const AlbumArtistDetailHeader = forwardRef((_props, ref: Ref<HTMLDivEleme
|
||||
},
|
||||
];
|
||||
|
||||
const { addToQueueByData, addToQueueByFetch, setFavorite, setRating } = usePlayer();
|
||||
const { addToQueueByFetch, setFavorite, setRating } = usePlayer();
|
||||
const playButtonBehavior = usePlayButtonBehavior();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const handleArtistRadio = async () => {
|
||||
if (!server?.id || !routeId) return;
|
||||
|
||||
try {
|
||||
const artistRadioSongs = await queryClient.fetchQuery({
|
||||
...songsQueries.artistRadio({
|
||||
query: {
|
||||
artistId: routeId,
|
||||
count: artistRadioCount,
|
||||
},
|
||||
serverId: server.id,
|
||||
}),
|
||||
queryKey: queryKeys.player.fetch({ artistId: routeId }),
|
||||
});
|
||||
if (artistRadioSongs && artistRadioSongs.length > 0) {
|
||||
addToQueueByData(artistRadioSongs, Play.NOW);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load artist radio:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handlePlay = useCallback(
|
||||
(type?: Play) => {
|
||||
@@ -182,7 +156,6 @@ export const AlbumArtistDetailHeader = forwardRef((_props, ref: Ref<HTMLDivEleme
|
||||
</Group>
|
||||
<LibraryHeaderMenu
|
||||
favorite={detailQuery.data?.userFavorite}
|
||||
onArtistRadio={handleArtistRadio}
|
||||
onFavorite={handleFavorite}
|
||||
onMore={handleMoreOptions}
|
||||
onPlay={(type) => handlePlay(type)}
|
||||
|
||||
Reference in New Issue
Block a user