From 8e2a107d4a4c36a6d55e7dc44b3d9d44aaa4cef0 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Thu, 19 Oct 2023 03:36:16 -0700 Subject: [PATCH] Fix className clash on current song --- .../virtual-table/cells/row-index-cell.tsx | 2 +- .../components/virtual-table/index.tsx | 23 +++++-------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/renderer/components/virtual-table/cells/row-index-cell.tsx b/src/renderer/components/virtual-table/cells/row-index-cell.tsx index c9a4c76f..13d46142 100644 --- a/src/renderer/components/virtual-table/cells/row-index-cell.tsx +++ b/src/renderer/components/virtual-table/cells/row-index-cell.tsx @@ -137,7 +137,7 @@ export const RowIndexCell = ({ value, eGridCell }: ICellRendererParams) => { const isFocused = classList.contains('focused'); const isPlaying = classList.contains('playing'); const isCurrentSong = - classList.contains('current-song') || classList.contains('current-playlist-song'); + classList.contains('current-song-cell') || classList.contains('current-playlist-song-cell'); return ( diff --git a/src/renderer/components/virtual-table/index.tsx b/src/renderer/components/virtual-table/index.tsx index a6b528b3..42c7ab92 100644 --- a/src/renderer/components/virtual-table/index.tsx +++ b/src/renderer/components/virtual-table/index.tsx @@ -266,21 +266,7 @@ const tableColumns: { [key: string]: ColDef } = { }, rowIndex: { cellClass: 'row-index', - cellClassRules: { - 'current-playlist-song': (params) => { - return params.data?.uniqueId === params.context?.currentSong?.uniqueId; - }, - 'current-song': (params) => { - return params.data?.uniqueId === params.context?.currentSong?.uniqueId; - }, - focused: (params) => { - return params.context?.isFocused; - }, - playing: (params) => { - return params.context?.status === PlayerStatus.PLAYING; - }, - }, - cellRenderer: RowIndexCell, + cellRenderer: (params: ICellRendererParams) => GenericCell(params, { position: 'right' }), colId: TableColumn.ROW_INDEX, headerComponent: (params: IHeaderParams) => GenericTableHeader(params, { position: 'right', preset: 'rowIndex' }), @@ -293,7 +279,10 @@ const tableColumns: { [key: string]: ColDef } = { rowIndexGeneric: { cellClass: 'row-index', cellClassRules: { - 'current-song': (params) => { + 'current-playlist-song-cell': (params) => { + return params.data?.uniqueId === params.context?.currentSong?.uniqueId; + }, + 'current-song-cell': (params) => { return ( params.data?.id === params.context?.currentSong?.id && params.data?.albumId === params.context?.currentSong?.albumId @@ -372,7 +361,7 @@ const tableColumns: { [key: string]: ColDef } = { trackNumberDetail: { cellClass: 'row-index', cellClassRules: { - 'current-song': (params) => { + 'current-song-cell': (params) => { return ( params.data?.id === params.context?.currentSong?.id && params.data?.albumId === params.context?.currentSong?.albumId