mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
* Update rating types for multiserver support * Add rating mutation * Add rating support to table views * Add rating support on playerbar * Add hovercard component * Handle rating from context menu - Improve context menu components - Allow left / right icons - Allow nested menus * Add selected item count * Fix context menu auto direction * Add transition and move portal for context menu * Re-use context menu for all item dropdowns * Add ratings to detail pages / double click to clear * Bump react-query package
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { RowNode } from '@ag-grid-community/core';
|
|
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
|
|
import { createUseExternalEvents } from '@mantine/utils';
|
|
import { MutableRefObject } from 'react';
|
|
import { LibraryItem } from '/@/renderer/api/types';
|
|
|
|
export type OpenContextMenuProps = {
|
|
context?: any;
|
|
data: any[];
|
|
dataNodes?: RowNode[];
|
|
menuItems: SetContextMenuItems;
|
|
tableRef?: MutableRefObject<AgGridReactType | null>;
|
|
type: LibraryItem;
|
|
xPos: number;
|
|
yPos: number;
|
|
};
|
|
|
|
export type ContextMenuEvents = {
|
|
closeContextMenu: () => void;
|
|
openContextMenu: (args: OpenContextMenuProps) => void;
|
|
};
|
|
|
|
export type ContextMenuItemType =
|
|
| 'play'
|
|
| 'playLast'
|
|
| 'playNext'
|
|
| 'addToPlaylist'
|
|
| 'removeFromPlaylist'
|
|
| 'addToFavorites'
|
|
| 'removeFromFavorites'
|
|
| 'setRating'
|
|
| 'deletePlaylist'
|
|
| 'createPlaylist';
|
|
|
|
export type SetContextMenuItems = {
|
|
children?: boolean;
|
|
disabled?: boolean;
|
|
divider?: boolean;
|
|
id: ContextMenuItemType;
|
|
onClick?: () => void;
|
|
}[];
|
|
|
|
export const [useContextMenuEvents, createEvent] =
|
|
createUseExternalEvents<ContextMenuEvents>('context-menu');
|
|
|
|
export const openContextMenu = createEvent('openContextMenu');
|
|
export const closeContextMenu = createEvent('closeContextMenu');
|