Fix table row actions button on album detail and play queue

This commit is contained in:
jeffvli 2023-10-07 17:32:59 -07:00
parent ca39409cc3
commit 49b6478b72
2 changed files with 10 additions and 4 deletions

View file

@ -216,7 +216,7 @@ export const AlbumDetailContent = ({ tableRef, background }: AlbumDetailContentP
}); });
}; };
const handleContextMenu = useHandleTableContextMenu(LibraryItem.SONG, SONG_CONTEXT_MENU_ITEMS); const onCellContextMenu = useHandleTableContextMenu(LibraryItem.SONG, SONG_CONTEXT_MENU_ITEMS);
const handleRowDoubleClick = (e: RowDoubleClickedEvent<QueueSong>) => { const handleRowDoubleClick = (e: RowDoubleClickedEvent<QueueSong>) => {
if (!e.data || e.node.isFullWidthCell()) return; if (!e.data || e.node.isFullWidthCell()) return;
@ -360,6 +360,9 @@ export const AlbumDetailContent = ({ tableRef, background }: AlbumDetailContentP
suppressRowDrag suppressRowDrag
autoFitColumns={tableConfig.autoFit} autoFitColumns={tableConfig.autoFit}
columnDefs={columnDefs} columnDefs={columnDefs}
context={{
onCellContextMenu,
}}
enableCellChangeFlash={false} enableCellChangeFlash={false}
fullWidthCellRenderer={FullWidthDiscCell} fullWidthCellRenderer={FullWidthDiscCell}
getRowHeight={getRowHeight} getRowHeight={getRowHeight}
@ -374,7 +377,7 @@ export const AlbumDetailContent = ({ tableRef, background }: AlbumDetailContentP
rowClassRules={rowClassRules} rowClassRules={rowClassRules}
rowData={songsRowData} rowData={songsRowData}
rowSelection="multiple" rowSelection="multiple"
onCellContextMenu={handleContextMenu} onCellContextMenu={onCellContextMenu}
onRowDoubleClicked={handleRowDoubleClick} onRowDoubleClicked={handleRowDoubleClick}
/> />
</Box> </Box>

View file

@ -206,7 +206,7 @@ export const PlayQueue = forwardRef(({ type }: QueueProps, ref: Ref<any>) => {
} }
}, [currentSong, previousSong, tableConfig.followCurrentSong]); }, [currentSong, previousSong, tableConfig.followCurrentSong]);
const handleContextMenu = useHandleTableContextMenu(LibraryItem.SONG, QUEUE_CONTEXT_MENU_ITEMS); const onCellContextMenu = useHandleTableContextMenu(LibraryItem.SONG, QUEUE_CONTEXT_MENU_ITEMS);
return ( return (
<ErrorBoundary FallbackComponent={ErrorFallback}> <ErrorBoundary FallbackComponent={ErrorFallback}>
@ -218,6 +218,9 @@ export const PlayQueue = forwardRef(({ type }: QueueProps, ref: Ref<any>) => {
rowDragMultiRow rowDragMultiRow
autoFitColumns={tableConfig.autoFit} autoFitColumns={tableConfig.autoFit}
columnDefs={columnDefs} columnDefs={columnDefs}
context={{
onCellContextMenu,
}}
deselectOnClickOutside={type === 'fullScreen'} deselectOnClickOutside={type === 'fullScreen'}
getRowId={(data) => data.data.uniqueId} getRowId={(data) => data.data.uniqueId}
rowBuffer={50} rowBuffer={50}
@ -225,7 +228,7 @@ export const PlayQueue = forwardRef(({ type }: QueueProps, ref: Ref<any>) => {
rowData={queue} rowData={queue}
rowHeight={tableConfig.rowHeight || 40} rowHeight={tableConfig.rowHeight || 40}
suppressCellFocus={type === 'fullScreen'} suppressCellFocus={type === 'fullScreen'}
onCellContextMenu={handleContextMenu} onCellContextMenu={onCellContextMenu}
onCellDoubleClicked={handleDoubleClick} onCellDoubleClicked={handleDoubleClick}
onColumnMoved={handleColumnChange} onColumnMoved={handleColumnChange}
onColumnResized={debouncedColumnChange} onColumnResized={debouncedColumnChange}