From 70594a696b98d707d9c0434afb2744c336a90d7d Mon Sep 17 00:00:00 2001
From: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
Date: Sun, 31 May 2026 19:44:58 -0700
Subject: [PATCH] chore(context menu): show go to only for albums/tracks,
prefer artist over album artist where possible
---
.../context-menu/actions/go-to-action.tsx | 64 ++++++++-----------
.../menus/album-artist-context-menu.tsx | 3 -
.../menus/artist-context-menu.tsx | 3 -
3 files changed, 26 insertions(+), 44 deletions(-)
diff --git a/src/renderer/features/context-menu/actions/go-to-action.tsx b/src/renderer/features/context-menu/actions/go-to-action.tsx
index afc8938c2..2ca84933e 100644
--- a/src/renderer/features/context-menu/actions/go-to-action.tsx
+++ b/src/renderer/features/context-menu/actions/go-to-action.tsx
@@ -4,50 +4,38 @@ import { generatePath, useNavigate } from 'react-router';
import { AppRoute } from '/@/renderer/router/routes';
import { ContextMenu } from '/@/shared/components/context-menu/context-menu';
-import {
- Album,
- AlbumArtist,
- Artist,
- LibraryItem,
- QueueSong,
- Song,
-} from '/@/shared/types/domain-types';
+import { Album, LibraryItem, QueueSong, Song } from '/@/shared/types/domain-types';
interface GoToActionProps {
- items: Album[] | AlbumArtist[] | Artist[] | QueueSong[] | Song[];
+ items: Album[] | QueueSong[] | Song[];
}
export const GoToAction = ({ items }: GoToActionProps) => {
const { t } = useTranslation();
const navigate = useNavigate();
- const { albumArtists, albumId } = useMemo(() => {
+ const { albumId, artists } = useMemo(() => {
const firstItem = items[0];
- if (firstItem._itemType === LibraryItem.ALBUM) {
- return {
- albumArtists: firstItem.albumArtists || [],
- albumId: firstItem.id,
- };
- } else if (firstItem._itemType === LibraryItem.SONG) {
- return {
- albumArtists: firstItem.albumArtists || [],
- albumId: firstItem.albumId,
- };
- } else if (
- firstItem._itemType === LibraryItem.ARTIST ||
- firstItem._itemType === LibraryItem.ALBUM_ARTIST
- ) {
- return {
- albumArtists: [{ id: firstItem.id, name: firstItem.name }],
- albumId: null,
- };
+ switch (firstItem._itemType) {
+ case LibraryItem.ALBUM:
+ return {
+ albumId: firstItem.id,
+ artists: firstItem.albumArtists || [],
+ };
+ case LibraryItem.SONG:
+ return {
+ albumId: firstItem.albumId,
+ artists:
+ (firstItem.artists?.length ? firstItem.artists : firstItem.albumArtists) ||
+ [],
+ };
+ default:
+ return {
+ albumId: null,
+ artists: [],
+ };
}
-
- return {
- albumArtists: [],
- albumId: null,
- };
}, [items]);
const handleGoToAlbum = useCallback(() => {
@@ -55,7 +43,7 @@ export const GoToAction = ({ items }: GoToActionProps) => {
navigate(generatePath(AppRoute.LIBRARY_ALBUMS_DETAIL, { albumId }));
}, [albumId, navigate]);
- const handleGoToAlbumArtist = useCallback(
+ const handleGoToArtist = useCallback(
(albumArtistId: string) => {
navigate(generatePath(AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL, { albumArtistId }));
},
@@ -81,13 +69,13 @@ export const GoToAction = ({ items }: GoToActionProps) => {
{t('page.contextMenu.goToAlbum')}
)}
- {albumArtists.map((albumArtist) => (
+ {artists.map((artist) => (
handleGoToAlbumArtist(albumArtist.id)}
+ onSelect={() => handleGoToArtist(artist.id)}
>
- {`${t('page.contextMenu.goTo')} ${albumArtist.name}`}
+ {`${t('page.contextMenu.goTo')} ${artist.name}`}
))}
diff --git a/src/renderer/features/context-menu/menus/album-artist-context-menu.tsx b/src/renderer/features/context-menu/menus/album-artist-context-menu.tsx
index 7a9f6032b..fdba1ad8e 100644
--- a/src/renderer/features/context-menu/menus/album-artist-context-menu.tsx
+++ b/src/renderer/features/context-menu/menus/album-artist-context-menu.tsx
@@ -3,7 +3,6 @@ import { useMemo } from 'react';
import { AddToPlaylistAction } from '/@/renderer/features/context-menu/actions/add-to-playlist-action';
import { DownloadAction } from '/@/renderer/features/context-menu/actions/download-action';
import { GetInfoAction } from '/@/renderer/features/context-menu/actions/get-info-action';
-import { GoToAction } from '/@/renderer/features/context-menu/actions/go-to-action';
import { PlayAction } from '/@/renderer/features/context-menu/actions/play-action';
import { PlayArtistRadioAction } from '/@/renderer/features/context-menu/actions/play-artist-radio-action';
import { SetFavoriteAction } from '/@/renderer/features/context-menu/actions/set-favorite-action';
@@ -39,8 +38,6 @@ export const AlbumArtistContextMenu = ({ items, type }: AlbumArtistContextMenuPr
-
-
);
diff --git a/src/renderer/features/context-menu/menus/artist-context-menu.tsx b/src/renderer/features/context-menu/menus/artist-context-menu.tsx
index c9ce4ec75..1a73cc025 100644
--- a/src/renderer/features/context-menu/menus/artist-context-menu.tsx
+++ b/src/renderer/features/context-menu/menus/artist-context-menu.tsx
@@ -3,7 +3,6 @@ import { useMemo } from 'react';
import { AddToPlaylistAction } from '/@/renderer/features/context-menu/actions/add-to-playlist-action';
import { DownloadAction } from '/@/renderer/features/context-menu/actions/download-action';
import { GetInfoAction } from '/@/renderer/features/context-menu/actions/get-info-action';
-import { GoToAction } from '/@/renderer/features/context-menu/actions/go-to-action';
import { PlayAction } from '/@/renderer/features/context-menu/actions/play-action';
import { PlayArtistRadioAction } from '/@/renderer/features/context-menu/actions/play-artist-radio-action';
import { SetFavoriteAction } from '/@/renderer/features/context-menu/actions/set-favorite-action';
@@ -39,8 +38,6 @@ export const ArtistContextMenu = ({ items, type }: ArtistContextMenuProps) => {
-
-
);