Skip to content

feat(web): add tracks to a playlist by pasting Audius URLs#14320

Open
dylanjeffers wants to merge 1 commit into
claude/duplicate-playlist-modalfrom
claude/add-tracks-by-url
Open

feat(web): add tracks to a playlist by pasting Audius URLs#14320
dylanjeffers wants to merge 1 commit into
claude/duplicate-playlist-modalfrom
claude/add-tracks-by-url

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

Adds an Add Tracks by URL affordance to the owner action row on playlist detail pages. Clicking it opens a modal where the user pastes Audius track links — line-, comma-, or tab-separated — and the modal batch-resolves and adds them to the current playlist. Hidden for albums and DDEX-imported collections.

Stacks on top of #14319 (Duplicate Playlist) → which stacks on #14318 (Create Playlist Modal). Review/merge those first.

Implementation

  • Redux: new AddTracksByUrlModal slice via createModal, wired into modals types / parent state / reducers / index.
  • Modal component (AddTracksByUrlModal.tsx):
    • Splits pasted text by newline / comma / tab; trims; dedupes.
    • Validates each line via getPathFromTrackUrl (existing util).
    • Resolves all permalinks in one round-trip via sdk.tracks.getBulkTracks.
    • Filters out tracks already in the playlist; enforces a 100-track cap.
    • Reports the counts (added / already-in-playlist / not-found / invalid / over-limit) in a single summary toast.
    • Dispatches addTrackToPlaylist per resolved track with a 30 ms gap so each saga's optimistic update is visible to the next iteration.
  • Saga: addTrackToPlaylist action now accepts { silent: true }, and the saga skips the per-track "Added track to playlist" toast when set — so a single summary toast wins for batch adds. Default behavior for everywhere else (Add to Playlist menu, etc.) is unchanged.
  • UI hook: new IconLink button in OwnerActionButtons opens the modal preloaded with the current collectionId. Hidden when is_album or ddex_app is set.

Test plan

  • Sign in. Open one of your playlists (not an album, not DDEX).
  • Click the new link icon in the owner action row → modal opens.
  • Paste 3 valid Audius track URLs on separate lines → submit → all three added, single summary toast shows "Added 3 tracks".
  • Paste a mix of: valid URLs, comma-separated URLs, tab-separated URLs, an invalid string, a duplicate of an already-in-playlist track, a URL for a non-existent track → submit → summary toast accurately reports added / duplicates / not found / invalid counts.
  • Try to paste more than (100 − current_count) tracks → excess tracks reported as "X skipped (playlist limit reached)".
  • Submit with an empty textarea → button disabled.
  • Submit with only invalid links → "No valid Audius track links found." toast.
  • Network drop while resolving → "Could not load tracks." toast; modal stays open.
  • Confirm the button is hidden on an album detail page (owner view) and on a DDEX-imported playlist.

Follow-ups

  • Replace the sequential addTrackToPlaylist dispatches with a dedicated addTracksToPlaylistBatch(trackIds, playlistId) saga that issues one SDK update — cleaner semantics on large pastes and removes the 30 ms gap.
  • Track curation features from the spec still to come: multi-select, shift-range select, multi-row drag, undo/redo, copy selected URLs, keyboard shortcuts.

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

⚠️ No Changeset found

Latest commit: 2a42659

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

Adds a new "Add Tracks by URL" affordance to the owner action row on
playlist detail pages. Clicking it opens a modal where the user pastes
Audius track links — line, comma, or tab separated — and submits to
batch-add them to the current playlist. Albums and DDEX-imported
collections are intentionally excluded.

Implementation details:
- New `AddTracksByUrlModal` Redux modal slice (createModal helper) wired
  through types/parentSlice/reducers/index.
- New `AddTracksByUrlModal` component:
  - Parses pasted text into a deduped list of permalinks via
    `getPathFromTrackUrl`.
  - Resolves them in one round-trip via `sdk.tracks.getBulkTracks`.
  - Filters out tracks already in the playlist, enforces a 100-track
    cap, and reports invalid/unresolved/duplicate/over-limit counts in a
    single summary toast.
  - Dispatches `addTrackToPlaylist` per track with a 30 ms gap so each
    saga's optimistic update reads the previous one's state.
- `addTrackToPlaylist` now accepts `{ silent: true }` so the per-track
  "Added track to playlist" toast can be suppressed during batch adds;
  default behavior (single-track adds elsewhere) is unchanged.
- New `IconLink` button in `OwnerActionButtons` opens the modal,
  prefilled with the current collection id. Hidden for albums and
  DDEX-imported collections.

Scope notes:
- Resolution uses the existing `addTrackToPlaylist` saga path
  (sequential dispatches with small delay). A future PR could replace
  this with a dedicated `addTracksToPlaylistBatch` saga that issues a
  single SDK update for cleaner semantics on large pastes.
- Larger track-curation features from the spec (multi-select, range
  select, undo/redo, copy selected URLs, multi-row drag) are deferred
  to follow-up PRs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers force-pushed the claude/add-tracks-by-url branch from 6116b0b to 2a42659 Compare May 15, 2026 18:11
@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14320.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