feat(web): copy source tracks when duplicating a playlist#14321
Open
dylanjeffers wants to merge 4 commits into
Open
feat(web): copy source tracks when duplicating a playlist#14321dylanjeffers wants to merge 4 commits into
dylanjeffers wants to merge 4 commits into
Conversation
|
The "New" button in the playlist library sidebar (and the empty-state nav link) used to immediately create a playlist named "New Playlist" and route the user into the edit page. Replace that one-shot dispatch with a Create Playlist modal that lets the user set a title, optional description, and optional artwork before the playlist is created. - New `CreatePlaylistModal` slice via `createModal` helper, wired into the modals reducer/state. - New `CreatePlaylistModal` component (Harmony Modal + TextInput + TextArea + UploadArtwork) reusing the existing `resizeImage` pipeline. - The sidebar "New" popup item and the empty-library nav link both open the modal instead of dispatching `createPlaylist` directly. - Playlists still default to private (enforced by the existing `optimisticallySavePlaylist` saga) and the saga still routes the user to the new playlist page after creation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a "Duplicate Playlist" secondary action to the sidebar's New (+) popup menu. Opens a modal where the user pastes any public Audius playlist URL, sees a preview of the source playlist (title, description, cover art), and toggles per-field switches to customize what should differ in the copy. The duplicated playlist is created as private by default (enforced by the existing optimisticallySavePlaylist saga). Scope: - Metadata-only duplication for now. Tracks are not copied — a follow-up PR will support full duplicate including track contents. The modal surfaces this with a helper line so users know they need to add tracks separately. - Reuses the existing createPlaylist saga: when artwork is not customized, we pass the source playlist's cover_art_sizes CID through so the saga reuses the cover instead of treating it as a new upload. Implementation: - New `DuplicatePlaylistModal` Redux modal slice (createModal helper). - New `DuplicatePlaylistModal` component (Harmony Modal + TextInput + Switch + TextArea + Artwork + UploadArtwork). - Resolves pasted URL → permalink via `getPathFromPlaylistUrl`, then loads the source via `useCollectionByPermalink`. - Wires "Duplicate Playlist" into `CreatePlaylistLibraryItemButton`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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>
6116b0b to
2a42659
Compare
Promotes the duplicate-playlist flow from metadata-only to a true
duplicate that also copies every track from the source.
- New DUPLICATE_PLAYLIST action carries the source playlist id, the
composed form fields, the full source track id list, and an isAlbum
flag.
- New duplicatePlaylistSaga drives the full sequence: it dispatches the
existing createPlaylist / createAlbum saga with the first source
track as initTrackId, takes() the resulting CREATE_PLAYLIST_REQUESTED
to learn the new playlist id, then sequentially dispatches
addTrackToPlaylist({ silent: true }) for every remaining track with
a small inter-dispatch delay so each saga sees the previous
optimistic update. Closes with a single summary toast.
- DuplicatePlaylistModal now dispatches DUPLICATE_PLAYLIST and exposes
the actual track count to the user ("All N tracks will be copied")
instead of the previous "tracks not copied" note.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
12936a4 to
24e8a3b
Compare
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14321.audius.workers.dev Unique preview for this PR (deployed from this branch). |
2a42659 to
b85318e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Promotes the duplicate-playlist flow (#14319) from metadata-only to a true duplicate that also copies every track from the source playlist.
Stacked on #14320 → #14319 → #14318.
Implementation
DUPLICATE_PLAYLISTaction (incacheCollectionsActions) carries{ sourcePlaylistId, formFields, trackIds, source, isAlbum }.duplicatePlaylistSagaorchestrates the full sequence:createPlaylist/createAlbumaction withinitTrackId = trackIds[0]so the first track lands as part of the create flow.take()s the resultingCREATE_PLAYLIST_REQUESTEDto learn the new playlist id.addTrackToPlaylist(trackId, newPlaylistId, { silent: true })with a 30 ms inter-dispatch delay so each saga's optimistic update is visible to the next iteration.DuplicatePlaylistModalnow dispatchesDUPLICATE_PLAYLISTand surfaces the actual track count to the user ("All N tracks will be copied to the new playlist") instead of the previous "tracks not copied" note.Test plan
🤖 Generated with Claude Code