From a6f96d59433096622d7c5f8e12d1d8256dcad009 Mon Sep 17 00:00:00 2001 From: Benjamin Hardy Date: Mon, 28 Sep 2026 22:15:36 +0200 Subject: [PATCH] Improved play buttons in list --- frontend/src/App.tsx | 7 +++++++ frontend/src/components/PrepStrip.tsx | 4 ++++ frontend/src/components/TrackTable.tsx | 28 +++++++++++++++++++------- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 2e693f6..d06c35d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -66,6 +66,7 @@ export default function App() { const [showPaths, setShowPaths] = useState(false) const [showHistory, setShowHistory] = useState(false) const [prepTrack, setPrepTrack] = useState(null) + const [deckPlaying, setDeckPlaying] = useState(false) // Which library the DECK's track came from — not the view's. Browsing to a // playlist while a device or folder track is loaded must not switch the deck // to endpoints that do not know that track. @@ -1019,6 +1020,7 @@ export default function App() { onNotify={notify} origin={prepOrigin} cuesRefresh={cuesRefresh} + onPlayingChange={setDeckPlaying} /> @@ -1177,6 +1179,7 @@ export default function App() { onPlay={playTrack} onEditField={canEdit ? editField : undefined} activeTrackId={prepTrack?.id ?? null} + activePlaying={deckPlaying} columnVisibility={columnVisibility} columnOrder={columnOrder} columnSizing={columnSizing} @@ -1215,6 +1218,7 @@ export default function App() { onHeaderContextMenu={(x, y) => setHeaderMenu({ x, y })} onPlay={playTrack} activeTrackId={prepTrack?.id ?? null} + activePlaying={deckPlaying} columnVisibility={columnVisibility} columnOrder={columnOrder} columnSizing={columnSizing} @@ -1248,6 +1252,7 @@ export default function App() { onHeaderContextMenu={(x, y) => setHeaderMenu({ x, y })} onPlay={playTrack} activeTrackId={prepTrack?.id ?? null} + activePlaying={deckPlaying} columnVisibility={columnVisibility} columnOrder={columnOrder} columnSizing={columnSizing} @@ -1272,6 +1277,7 @@ export default function App() { onPlay={playTrack} onEditField={canEdit ? editField : undefined} activeTrackId={prepTrack?.id ?? null} + activePlaying={deckPlaying} columnVisibility={columnVisibility} columnOrder={columnOrder} columnSizing={columnSizing} @@ -1309,6 +1315,7 @@ export default function App() { onPlay={playTrack} onEditField={canEdit ? editField : undefined} activeTrackId={prepTrack?.id ?? null} + activePlaying={deckPlaying} columnVisibility={columnVisibility} columnOrder={columnOrder} columnSizing={columnSizing} diff --git a/frontend/src/components/PrepStrip.tsx b/frontend/src/components/PrepStrip.tsx index dce8e81..58a5899 100644 --- a/frontend/src/components/PrepStrip.tsx +++ b/frontend/src/components/PrepStrip.tsx @@ -50,6 +50,8 @@ interface Props { /** Bumped when something outside the deck (batch grid analysis) rewrote the * loaded track's cues/grid, so the deck re-reads them. */ cuesRefresh?: number + /** Reports whether the deck is playing, so the library can light its row. */ + onPlayingChange?: (playing: boolean) => void } /** m:ss.t — the deck's readouts show tenths, as a CDJ does. */ @@ -92,9 +94,11 @@ export function PrepStrip({ onNotify, origin = 'collection', cuesRefresh = 0, + onPlayingChange, }: Props) { const qc = useQueryClient() const [playing, setPlaying] = useState(false) + useEffect(() => onPlayingChange?.(playing), [playing, onPlayingChange]) const [previewing, setPreviewing] = useState(false) // momentary hold-to-play active // CUE is held down (mouse OR the C key) — drives the button's pressed look, // which the pointer's :active alone cannot, since the key never touches it. diff --git a/frontend/src/components/TrackTable.tsx b/frontend/src/components/TrackTable.tsx index c53b36d..e61e2aa 100644 --- a/frontend/src/components/TrackTable.tsx +++ b/frontend/src/components/TrackTable.tsx @@ -79,31 +79,39 @@ interface Props { onPlay?: (track: Track) => void onEditField?: (track: Track, field: keyof Track, value: string | number) => void activeTrackId?: string | null + /** Whether the deck is playing `activeTrackId` (vs. loaded but paused). */ + activePlaying?: boolean } -/** The per-row play button. - * Fades in on row hover; stays lit for the active deck track. */ +/** The per-row play button, in three states: a small triangle always, an + * outlined circle on row hover, and a filled circle while its track plays in + * the deck (the loaded track, paused, keeps an accent triangle). */ function PlayButton({ track, isActive, + isPlaying, onPlay, }: { track: Track isActive: boolean + isPlaying: boolean onPlay: (track: Track) => void }) { + const look = isPlaying + ? 'border-accent bg-accent text-ink-950' + : `border-transparent group-hover:border-ink-600 hover:!border-accent hover:text-accent ${ + isActive ? 'text-accent' : 'text-faint group-hover:text-text' + }` return ( @@ -275,6 +283,7 @@ export function TrackTable({ onPlay, onEditField, activeTrackId, + activePlaying = false, }: Props) { // A local copy so a reorder shows instantly; re-syncs when the data changes. const [data, setData] = useState(tracks) @@ -599,7 +608,12 @@ export function TrackTable({ {hasPlay && ( - {onPlay && } + {onPlay && } )}