Skip to content

feat(web): bulk track actions toolbar with select-all, copy URLs, remove, undo/redo#14323

Open
dylanjeffers wants to merge 1 commit into
claude/inline-edit-modefrom
claude/track-multi-select
Open

feat(web): bulk track actions toolbar with select-all, copy URLs, remove, undo/redo#14323
dylanjeffers wants to merge 1 commit into
claude/inline-edit-modefrom
claude/track-multi-select

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

Adds a bulk track-curation toolbar to the playlist detail page when in edit mode (added in #14322), with multi-track selection, the bulk operations called out in the spec (copy URLs, remove), and an undo/redo stack for those operations.

Stacked on #14322#14321#14320#14319#14318.

Implementation

  • TrackSelectionProvider + useTrackSelection: a Set of selected track IDs plus a "last clicked index" ref. Toggle takes an { shift?: boolean } option that fills in the range across an ordered id list — wired through but not yet hooked up to row clicks (see scope notes).
  • TrackHistoryProvider + useTrackHistoryContext: separate undo/redo stacks for remove and add operations. Undoing a remove dispatches addTrackToPlaylist(trackId, collectionId, { silent: true }) so it doesn't fire the per-track "Added track to playlist" toast; redo re-issues removeTrackFromPlaylist.
  • TrackBulkActionsBar sticks to the top of the track table when edit mode is active. Shows the count of selected tracks and five bulk operations:
    • Copy URLs — writes ${origin}${permalink} for each selected track to the clipboard via navigator.clipboard.writeText, with a toast summary ("Copied N track URLs to clipboard").
    • Remove — dispatches removeTrackFromPlaylist per selected id and pushes a remove history entry so each one is undoable.
    • Undo / Redo — replays inverse operations against the playlist.
    • Select all / Clear — convenience pair.
  • Keyboard shortcuts (active while in edit mode and focus isn't in a text input):
    • Cmd/Ctrl+A → Select all tracks
    • Cmd/Ctrl+Z → Undo
    • Cmd/Ctrl+Shift+Z or Cmd/Ctrl+Y → Redo
    • Escape → Clear selection
    • Delete / Backspace → Remove selected
  • The desktop CollectionPage is wrapped in both providers alongside the existing edit-mode provider; the bar renders only when there's a selection or when the history stacks are non-empty.

Scope notes / follow-ups

  • Per-row checkbox UI and shift-range row-click select require deeper changes to the existing TracksTable (react-table) component and are deferred. Users can currently select all via the bar or Cmd/Ctrl+A and operate on the full set; future PR will add row-level selection.
  • Undo of a remove re-adds the track but uses the existing addTrackToPlaylist saga, which appends rather than reinserting at the original index. The history entry already captures the original index for when the saga grows the option to slot a track at a specific position.
  • Multi-row drag is similarly deferred to a follow-up that introduces row-level checkbox UI.

Test plan

  • Enter edit mode on a playlist you own (✏️ in the action row).
  • Press Cmd+A → all tracks select; bar shows "N selected".
  • Click Copy URLs → clipboard contains one URL per line; toast confirms count.
  • Click Remove → all selected tracks are removed; selection clears; single "Removed N tracks" toast.
  • Click Undo → tracks reappear at the end of the playlist (note: not original positions — see scope notes).
  • Click Redo → tracks are removed again.
  • In a focused TextInput in the header, press Cmd+A → selects text inside the input, does NOT select tracks.
  • Escape clears selection.
  • Delete removes when there's a selection.
  • Visit a playlist you don't own → bar never appears (not in edit mode).

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

⚠️ No Changeset found

Latest commit: c539a7b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

… undo/redo)

Adds the bulk track-curation toolbar to the playlist detail page when
in edit mode, plus keyboard shortcuts for the common operations.

- New `TrackSelectionProvider` + `useTrackSelection` hook: a Set of
  selected track IDs with toggle (including shift-range across an
  ordered id list), select-all, clear, and a "last clicked index" ref
  so range select works in chronological click order.
- New `TrackHistoryProvider` + `useTrackHistoryContext`: undo/redo
  stacks for `remove` and `add` operations. Undo of a `remove`
  dispatches `addTrackToPlaylist({ silent: true })` (note: the
  existing saga appends rather than re-inserting at the original
  index — current ordering is a known limitation surfaced as a
  follow-up).
- New `TrackBulkActionsBar` sticks to the top of the track table
  while in edit mode and shows a count of selected tracks plus the
  five bulk actions: Copy URLs (clipboard-writes
  `${origin}${permalink}` for each selected track), Remove
  (dispatches removeTrackFromPlaylist per id and pushes history
  entries so each remove is undoable), Undo, Redo, and Select all /
  Clear pair.
- Keyboard shortcuts wired through the same component while in edit
  mode: Cmd/Ctrl+A select all, Cmd/Ctrl+Z undo, Cmd/Ctrl+Shift+Z /
  Cmd/Ctrl+Y redo, Escape clears selection, Delete/Backspace removes
  selected (and skips when focus is in a text input).
- CollectionPage is wrapped in the selection + history providers
  alongside the existing edit-mode provider.

Scope notes — per-row checkbox UI and shift-range row-click select
require deeper changes to the existing TracksTable component and are
deferred to a follow-up PR; users can still select-all via the bar
or Cmd/Ctrl+A and operate on the full set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers force-pushed the claude/track-multi-select branch from 46c2b73 to c539a7b Compare May 15, 2026 18:12
@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14323.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant