mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
add context menu
This commit is contained in:
@@ -222,6 +222,22 @@ const TrackRow = memo(
|
|||||||
[internalState, song],
|
[internalState, song],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleContextMenu = useCallback(
|
||||||
|
(event: React.MouseEvent<HTMLDivElement>) => {
|
||||||
|
if (isSongsLoading || !controls?.onMore) return;
|
||||||
|
event.preventDefault();
|
||||||
|
const index = internalState.findItemIndex(song.id);
|
||||||
|
controls.onMore({
|
||||||
|
event,
|
||||||
|
index,
|
||||||
|
internalState,
|
||||||
|
item: song,
|
||||||
|
itemType: LibraryItem.SONG,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[controls, internalState, isSongsLoading, song],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx(styles.trackRow, {
|
className={clsx(styles.trackRow, {
|
||||||
@@ -238,6 +254,7 @@ const TrackRow = memo(
|
|||||||
[styles.trackRowWithHorizontalBorder]: rowIndex > 0,
|
[styles.trackRowWithHorizontalBorder]: rowIndex > 0,
|
||||||
})}
|
})}
|
||||||
onClick={handleRowClick}
|
onClick={handleRowClick}
|
||||||
|
onContextMenu={handleContextMenu}
|
||||||
onMouseEnter={() => setIsRowHovered(true)}
|
onMouseEnter={() => setIsRowHovered(true)}
|
||||||
onMouseLeave={() => setIsRowHovered(false)}
|
onMouseLeave={() => setIsRowHovered(false)}
|
||||||
ref={dragRef ?? undefined}
|
ref={dragRef ?? undefined}
|
||||||
|
|||||||
Reference in New Issue
Block a user