Support genres in context menu

This commit is contained in:
jeffvli 2023-08-04 02:27:04 -07:00
parent 0b207c78e7
commit d0aba6e16e
12 changed files with 182 additions and 56 deletions

View file

@ -25,6 +25,7 @@ import {
getAlbumSongsById,
getAlbumArtistSongsById,
getSongsByQuery,
getGenreSongsById,
} from '/@/renderer/features/player/utils';
import { queryKeys } from '/@/renderer/api/query-keys';
@ -38,6 +39,9 @@ const getRootQueryKey = (itemType: LibraryItem, serverId: string) => {
case LibraryItem.ALBUM_ARTIST:
queryKey = queryKeys.songs.list(serverId);
break;
case LibraryItem.GENRE:
queryKey = queryKeys.songs.list(serverId);
break;
case LibraryItem.PLAYLIST:
queryKey = queryKeys.playlists.songList(serverId);
break;
@ -112,6 +116,8 @@ export const useHandlePlayQueueAdd = () => {
queryClient,
server,
});
} else if (itemType === LibraryItem.GENRE) {
songList = await getGenreSongsById({ id, query, queryClient, server });
} else if (itemType === LibraryItem.SONG) {
if (id?.length === 1) {
songList = await getSongById({ id: id?.[0], queryClient, server });