From a8b3944c66afbe4bfc08ad153507f323a8175c6e Mon Sep 17 00:00:00 2001 From: jeffvli Date: Wed, 9 Oct 2024 18:20:04 -0700 Subject: [PATCH] Set row play button to switch to song on queue lists --- .../cells/combined-title-cell-controls.tsx | 15 ++++++++++++++- .../virtual-table/cells/combined-title-cell.tsx | 10 +++++++++- .../now-playing/components/play-queue.tsx | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx b/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx index 5bf3537c..c12b9704 100644 --- a/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx +++ b/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx @@ -52,12 +52,17 @@ const ListConverControlsContainer = styled.div` export const ListCoverControls = ({ itemData, itemType, + context, + uniqueId, }: { + context: Record; itemData: any; itemType: LibraryItem; + uniqueId?: string; }) => { const playButtonBehavior = usePlayButtonBehavior(); const handlePlayQueueAdd = usePlayQueueAdd(); + const isQueue = Boolean(context?.isQueue); const handlePlay = async (e: MouseEvent, playType?: Play) => { e.preventDefault(); @@ -72,10 +77,18 @@ export const ListCoverControls = ({ }); }; + const handlePlayFromQueue = () => { + context.handleDoubleClick({ + data: { + uniqueId, + }, + }); + }; + return ( <> - + diff --git a/src/renderer/components/virtual-table/cells/combined-title-cell.tsx b/src/renderer/components/virtual-table/cells/combined-title-cell.tsx index b2b344da..7e1489fa 100644 --- a/src/renderer/components/virtual-table/cells/combined-title-cell.tsx +++ b/src/renderer/components/virtual-table/cells/combined-title-cell.tsx @@ -59,7 +59,13 @@ const StyledImage = styled(SimpleImg)` } `; -export const CombinedTitleCell = ({ value, rowIndex, node, context }: ICellRendererParams) => { +export const CombinedTitleCell = ({ + value, + rowIndex, + node, + context, + data, +}: ICellRendererParams) => { const artists = useMemo(() => { if (!value) return null; return value.artists?.length ? value.artists : value.albumArtists; @@ -114,8 +120,10 @@ export const CombinedTitleCell = ({ value, rowIndex, node, context }: ICellRende )} diff --git a/src/renderer/features/now-playing/components/play-queue.tsx b/src/renderer/features/now-playing/components/play-queue.tsx index 5af2cdf2..8e69614c 100644 --- a/src/renderer/features/now-playing/components/play-queue.tsx +++ b/src/renderer/features/now-playing/components/play-queue.tsx @@ -256,7 +256,9 @@ export const PlayQueue = forwardRef(({ type }: QueueProps, ref: Ref) => { columnDefs={columnDefs} context={{ currentSong, + handleDoubleClick, isFocused, + isQueue: true, itemType: LibraryItem.SONG, onCellContextMenu, status,