feat(collection): move add-by-URL into SuggestedTracks panel; remove confusing IconLink#14429
Merged
Merged
Conversation
…confusing IconLink Ray flagged the copy-link-looking IconButton on the playlist owner header as confusing — its actual behavior (open a "paste track URLs" modal) wasn't discoverable from the icon, and adding tracks by URL belongs in the same section users already think of as "where I add tracks." Per Julian's UX suggestion, the natural action for "add by URL" is to paste — no separate modal or icon required. Moves the feature inline into the SuggestedTracks panel (already titled "Add some tracks", already the obvious place to add) as an always-visible TextInput that paste-detects. Changes: - packages/web/src/components/suggested-tracks/SuggestedTracks.tsx: add an always-visible TextInput row between the heading and the collapsible suggestion list. onPaste: if the clipboard contains at least one valid Audius track URL (parsed via getPathFromTrackUrl), prevent default, resolve via sdk.tracks.getBulkTracks, run the same dedupe + capacity + delay-spaced dispatch the modal did, toast a summary. onKeyDown(Enter) handles a typed URL too. If the pasted text isn't a URL the input behaves like a normal text field — search-field UX. Routes adds through draftCollectionCache when the collection is unsaved (mirrors the suggested-row Add button's draft branch). - packages/web/src/components/collection/desktop/OwnerActionButtons.tsx: drop the IconLink IconButton and its modal-opener handler / messages / hook usage. Header is now lean (Edit, Share, Publish, OverflowMenu). - Delete the now-unused AddTracksByUrlModal entirely: the React component (packages/web/src/components/add-tracks-by-url-modal/), the common store slice (packages/common/src/store/ui/modals/add-tracks-by-url-modal/), and its registrations in parentSlice, reducers, types, the modals re-export, and Modals.tsx. No other call sites. Feature parity preserved: - Same parser (one URL per line, or comma/tab separated) — multi-URL paste still works. - Same dedupe vs existing playlist contents. - Same PLAYLIST_TRACK_LIMIT (100) capacity check. - Same getBulkTracks SDK call + userTrackMetadataFromSDK transform. - Same summary toast format (added • duplicates • not found • invalid • over-limit). - Same playlist-only / non-DDEX surface (SuggestedTracks already gated on isOwner && !isAlbum && playlist, mirrors the old IconLink condition). Verification: - tsc --noEmit clean in packages/common and packages/web. - Visual smoke needs the full protocol stack (audius web requires Docker per CLAUDE.md) — flagging on the PR for manual review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
CI lint surfaced 5 errors on the prior commit — 3 prettier formatting and 2 no-void. Auto-fixed prettier; replaced `void addTracksFromText(...)` with a bare call (the function already catches its own errors and toasts; the floating promise is intentional and now documented). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14429.audius.workers.dev Unique preview for this PR (deployed from this branch). |
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.
Per Ray's Slack feedback + Julian's UX suggestion: the copy-link-looking IconButton on the playlist owner header was confusing — its actual behavior (open a "paste track URLs" modal) wasn't discoverable from the icon, and adding tracks by URL belongs in the same section users already think of as "where I add tracks."
The natural action for "add by URL" is to paste — no separate modal or icon required. This PR moves the feature inline into the SuggestedTracks panel (already titled "Add some tracks", already the obvious place to add) as an always-visible TextInput that paste-detects, and removes the previous trigger + modal entirely.
Before / After
Before: Owner header had an
IconLinkbutton next to Edit/Share/Publish/Overflow → opened a separateAddTracksByUrlModalwith a multi-line textarea.After: Owner header is lean (Edit / Share / Publish / Overflow). The SuggestedTracks panel — already shown for playlist owners — gets an always-visible single-line input row between the "Add some tracks" heading and the (collapsible) suggested-track list. Paste a URL → it's added.
What the input does
onPastereads the clipboard text viae.clipboardData.getData('text'). IfparseTrackUrlsfinds at least one valid Audius track URL (same parser the modal used, viagetPathFromTrackUrl), itpreventDefaults and runs the add flow. If the clipboard isn't a track URL the paste falls through normally — the field behaves like a regular text input.The add flow (unchanged from the old modal)
getPathFromTrackUrl, dedupe).PLAYLIST_TRACK_LIMIT(100) using the existing playlist's track IDs.sdk.tracks.getBulkTracks({ permalink, userId }).addTrackToPlaylistper track, spaced byINTER_DISPATCH_DELAY_MSso each saga's optimistic update lands before the next one reads playlist state.isDraftCollection), route throughaddTrackToDraftCollectioninstead — same conditional the suggested-row Add button already uses. This is one improvement on the old modal, which didn't route to drafts.Added N tracks • M already in playlist • K not found • J invalid links • L skipped (playlist limit reached).Files changed
packages/web/src/components/suggested-tracks/SuggestedTracks.tsxaddTracksFromText(logic mirrored from the deleted modal), +draft routing for URL addspackages/web/src/components/collection/desktop/OwnerActionButtons.tsxIconLinkIconButton + modal-hook usage + unused messagespackages/web/src/components/add-tracks-by-url-modal/AddTracksByUrlModal.tsx+ dirpackages/common/src/store/ui/modals/add-tracks-by-url-modal/index.ts+ dirpackages/common/src/store/ui/modals/{types,parentSlice,reducers,index}.tsAddTracksByUrlModalregistrationspackages/web/src/pages/modals/Modals.tsxcommonModalsMapNet diff: +272 / −355.
Surface area preserved
The old
IconLinkbutton only showed when!is_album && !ddex_app. The SuggestedTracks panel is already gated onisOwner && !is_album && !ddex_app— same surface — so feature availability is unchanged. Albums and DDEX-imported collections continue not to have URL-add (separate decision, out of scope here).Verification
tsc --noEmitclean inpackages/commontsc --noEmitclean inpackages/webaddTrackToDraftCollection).Couldn't run a local web preview to smoke-test (audius web needs the full protocol stack via Docker per CLAUDE.md). Flagging for manual review.
Follow-ups (deliberately out of scope)
🤖 Generated with Claude Code