diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-16 11:01:02 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-16 11:01:02 +0200 |
| commit | 20706fb9a4ec646816b44a10842aa8f58ea0fd75 (patch) | |
| tree | 126be97d794491196c6033ae76d4680f24188595 /packages/meshbay-hub/src/meshbay_hub/static/group-page.js | |
| parent | a79a38a22a6145c475f50eeadb79b451aee31c11 (diff) | |
| download | meshbay-20706fb9a4ec646816b44a10842aa8f58ea0fd75.tar.gz | |
music: play, play next, add to queue
The player's queue could only be replaced: every onPlayQueue reset
tracks/order/pos together. It becomes one reducer (queue-ops.js) with
an `op`, because two appends batched into one tick cannot both read the
track count out of separate useStates.
A shared pop-up menu (menu.js) carries the three verbs, on right-click
and on a dots button. A track row is now a div holding two buttons: a
button cannot contain a button.
Found by the browser probe: both music wrappers took two arguments and
forwarded two, so every "add to queue" arrived as a plain play.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/group-page.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/group-page.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js index 4de33b9..060fd6e 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js @@ -173,11 +173,18 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, const [searchListed, setSearchListed] = useState(true); // MusicBrainz on/off (per-group) — docs/musicbay.md §3.2. const [musicbrainzConfig, setMusicbrainzConfig] = useState(null); - const onPlayQueue = useCallback((tracks, startIndex) => { - setVideoEntry(null); + // `op` rides through to the shell — 'replace', 'next' or 'append' + // (docs/playlists.md §9.2). It has to be named here: a wrapper that takes + // two arguments and forwards two silently turns every "add to queue" in this + // group into a "play", and nothing about that reads as wrong at the call + // site or here. + const onPlayQueue = useCallback((tracks, startIndex, op) => { + // Only a replace changes what is on screen; enqueueing something does not + // close whatever the reader was already looking at. + if (!op || op === 'replace') setVideoEntry(null); if (parentOnPlayQueue) { const annotated = tracks.map(tr => tr.groupId ? tr : { ...tr, groupId }); - parentOnPlayQueue(annotated, startIndex, { transportRef, gekRef, groupId }); + parentOnPlayQueue(annotated, startIndex, { transportRef, gekRef, groupId }, op); } }, [parentOnPlayQueue, groupId]); // Paired ≠ operator account. `is_node_admin` says the hub account owning this |