Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kgarner7 committed Mar 28, 2024
1 parent 22f320e commit 842e5ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/renderer/api/navidrome/navidrome-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,11 @@ const removeFromPlaylist = async (
return null;
};

// The order should be in decreasing version, as the highest version match
// will automatically consider all lower versions matched
const VERSION_INFO: Array<[string, Record<string, number[]>]> = [
['0.48.0', { [ServerFeature.PLAYLISTS_SMART]: [1] }],
['0.49.3', { [ServerFeature.SHARING_ALBUM_SONG]: [1] }],
['0.48.0', { [ServerFeature.PLAYLISTS_SMART]: [1] }],
];

const getFeatures = (version: string): Record<string, number[]> => {
Expand Down Expand Up @@ -545,7 +547,7 @@ const getServerInfo = async (args: ServerInfoArgs): Promise<ServerInfo> => {
const features: ServerFeatures = {
lyricsMultipleStructured: !!navidromeFeatures[SubsonicExtensions.SONG_LYRICS],
playlistsSmart: !!navidromeFeatures[NavidromeExtensions.SMART_PLAYLISTS],
sharingAlbumSong: !!navidromeFeatures[NavidromeExtensions.SHARING],
sharingAlbumSong: !!navidromeFeatures[ServerFeature.SHARING_ALBUM_SONG],
};

return { features, id: apiClientProps.server?.id, version: ping.body.serverVersion! };
Expand Down
1 change: 0 additions & 1 deletion src/renderer/api/navidrome/navidrome-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ const shareItemParameters = z.object({
});

export enum NavidromeExtensions {
SHARING = 'sharing',
SMART_PLAYLISTS = 'smartPlaylists',
}

Expand Down
16 changes: 9 additions & 7 deletions src/renderer/features/context-menu/context-menu-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const ContextMenuContext = createContext<ContextMenuContextProps>({
},
});

const JELLYFIN_IGNORED_MENU_ITEMS: ContextMenuItemType[] = ['setRating'];
const JELLYFIN_IGNORED_MENU_ITEMS: ContextMenuItemType[] = ['setRating', 'shareItem'];
// const NAVIDROME_IGNORED_MENU_ITEMS: ContextMenuItemType[] = [];
// const SUBSONIC_IGNORED_MENU_ITEMS: ContextMenuItemType[] = [];

Expand Down Expand Up @@ -795,10 +795,7 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
rightIcon: <RiArrowRightSFill size="1.2rem" />,
},
shareItem: {
disabled: !(
server?.type === ServerType.NAVIDROME &&
hasFeature(server, ServerFeature.SHARING_ALBUM_SONG)
),
disabled: !hasFeature(server, ServerFeature.SHARING_ALBUM_SONG),
id: 'shareItem',
label: t('page.contextMenu.shareItem', { postProcess: 'sentenceCase' }),
leftIcon: <RiShareForwardFill size="1.1rem" />,
Expand Down Expand Up @@ -858,7 +855,10 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
>
<HoverCard.Target>
<ContextMenuButton
disabled={item.disabled}
disabled={
contextMenuItems[item.id]
.disabled
}
leftIcon={
contextMenuItems[item.id]
.leftIcon
Expand Down Expand Up @@ -895,7 +895,9 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
</HoverCard>
) : (
<ContextMenuButton
disabled={item.disabled}
disabled={
contextMenuItems[item.id].disabled
}
leftIcon={
contextMenuItems[item.id].leftIcon
}
Expand Down

0 comments on commit 842e5ff

Please sign in to comment.