mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 18:33:33 +00:00
allow hiding context menu items
This commit is contained in:
parent
f746114041
commit
004c9a8d06
6 changed files with 100 additions and 1 deletions
|
|
@ -57,6 +57,7 @@ import {
|
|||
useCurrentServer,
|
||||
usePlayerStore,
|
||||
useQueueControls,
|
||||
useSettingsStore,
|
||||
} from '/@/renderer/store';
|
||||
import { usePlaybackType } from '/@/renderer/store/settings.store';
|
||||
import { Play, PlaybackType } from '/@/renderer/types';
|
||||
|
|
@ -99,6 +100,7 @@ export interface ContextMenuProviderProps {
|
|||
}
|
||||
|
||||
export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
||||
const disabledItems = useSettingsStore((state) => state.general.disabledContextMenu);
|
||||
const { t } = useTranslation();
|
||||
const [opened, setOpened] = useState(false);
|
||||
const clickOutsideRef = useClickOutside(() => setOpened(false));
|
||||
|
|
@ -927,7 +929,8 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
|
|||
>
|
||||
{ctx.menuItems?.map((item) => {
|
||||
return (
|
||||
!contextMenuItems[item.id].disabled && (
|
||||
!contextMenuItems[item.id].disabled &&
|
||||
!disabledItems[item.id] && (
|
||||
<Fragment key={`context-menu-${item.id}`}>
|
||||
{item.children ? (
|
||||
<HoverCard
|
||||
|
|
|
|||
|
|
@ -39,6 +39,30 @@ export type ContextMenuItemType =
|
|||
| 'playSimilarSongs'
|
||||
| 'download';
|
||||
|
||||
export const CONFIGURABLE_CONTEXT_MENU_ITEMS: ContextMenuItemType[] = [
|
||||
'moveToBottomOfQueue',
|
||||
'moveToTopOfQueue',
|
||||
'play',
|
||||
'playLast',
|
||||
'playNext',
|
||||
'playSimilarSongs',
|
||||
'addToPlaylist',
|
||||
'removeFromPlaylist',
|
||||
'addToFavorites',
|
||||
'removeFromFavorites',
|
||||
'setRating',
|
||||
'download',
|
||||
'shareItem',
|
||||
'showDetails',
|
||||
];
|
||||
|
||||
export const CONTEXT_MENU_ITEM_MAPPING: { [k in ContextMenuItemType]?: string } = {
|
||||
moveToBottomOfQueue: 'moveToBottom',
|
||||
moveToTopOfQueue: 'moveToTop',
|
||||
playLast: 'addLast',
|
||||
playNext: 'addNext',
|
||||
};
|
||||
|
||||
export type SetContextMenuItems = {
|
||||
children?: boolean;
|
||||
disabled?: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue