Skip to content

feat: drag and drop tracks onto sidebar playlists - #363

Open
tsibog wants to merge 2 commits into
sozercan:mainfrom
tsibog:pr/drag-drop-playlist
Open

feat: drag and drop tracks onto sidebar playlists#363
tsibog wants to merge 2 commits into
sozercan:mainfrom
tsibog:pr/drag-drop-playlist

Conversation

@tsibog

@tsibog tsibog commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Adds drag-and-drop of tracks onto playlists in the sidebar. Any track row (search results, history, home sections, playlist detail, etc.) can be dragged onto an owned playlist in the sidebar to add it. The target playlist highlights while dragging over it, and a brief success badge confirms the drop.

AI Prompt (Optional)

🤖 AI Prompt Used
Developed interactively with Claude Code across multiple sessions; the original
initiating prompt was not preserved. Gist: "Add drag and drop so I can drag any
track row onto a playlist in the sidebar to add it to that playlist. Only owned
playlists should accept drops, show visual feedback while hovering a valid
target, and confirm success."

AI Tool: Claude Code

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

Related Issues

Changes Made

  • Every rendered Song is a drag source (via the existing Transferable conformance), attached at the shared wrappers rather than per view: playlist track rows, HoverObservingRow (search, history, artist pages, top songs), and HomeSectionItemCard song cards (home, explore, charts, moods, new releases)
  • .dropDestination(for: Song.self, action:isTargeted:) on owned sidebar playlist rows; drops call YTMusicClient.addSongToPlaylist
  • Drag-over highlight on the targeted playlist row; transient success badge after a completed drop
  • Dropping onto Liked Music (Collection row or pinned LM playlist) likes the song instead — LM is the auto-playlist where membership means "liked", so drops route through SongLikeStatusManager (optimistic, broadcasts so like buttons update everywhere, rollback on failure)
  • Error handling with user-facing feedback when the add fails

Testing

  • Unit tests pass (swift test --skip KasetUITests) — 1774 passed, 148 suites
  • Manual testing performed — dragged tracks from search/history/playlist views onto sidebar playlists
  • UI tested on macOS 26+

Checklist

  • My code follows the project's style guidelines
  • I have run swiftlint --strict && swiftformat .
  • I have added tests that prove my fix/feature works (view-layer only; no service changes)
  • New and existing unit tests pass locally
  • I have updated documentation if needed
  • I have checked for any performance implications
  • My changes generate no new warnings

Screenshots

kaset-drag-drop-pr363.mp4

Additional Notes

View-layer only: no API or model changes. The drop path reuses the existing add-to-playlist client call (and the existing like flow for Liked Music).

@tsibog
tsibog force-pushed the pr/drag-drop-playlist branch 2 times, most recently from 6c8a7a2 to c440b97 Compare July 10, 2026 23:07
@tsibog

tsibog commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40e52941ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Kaset/Views/Sidebar.swift Outdated
@tsibog

tsibog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 6d506594a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tsibog
tsibog force-pushed the pr/drag-drop-playlist branch from e341b45 to f334553 Compare July 13, 2026 09:41
@tsibog
tsibog force-pushed the pr/drag-drop-playlist branch from f334553 to ecba1be Compare August 15, 2026 18:52
tsibog added 2 commits August 17, 2026 14:11
Rebased onto current main. 3-way merge integrates drag-drop features
with upstream's account boundary guards, reselect navigation, and
create-playlist-from-sidebar.

Key merge decisions:
- Sidebar: combined upstream reselect + create-playlist with drag-drop
  dropDestination + feedback badge. Both sides added 'client' param.
- LibraryMutationActions: added AddSongOutcome + addSong() integrated
  with upstream's runTrackedAccountBoundaryMutation guards.
  addSongToPlaylist now delegates to addSong.
- SearchView: combined upstream's resultRow(index:) with drag-drop's
  HoverObservingRow(song:) call.
- Tests: added 3 new tests inside upstream's restructured test suite.
- ArtistDetailView/HistoryView/TopSongsView: HoverObservingRow(song:)
  on top of upstream's localized string changes.
- PlaylistDetailView: .songDraggable on top of upstream's changes.
Test used SongLikeStatusManager.shared; concurrent suites clearCache()/
setActiveAccountID() bump sessionGeneration, so the enqueued rating bails
before rateSong. Use a fresh instance (repo convention).

Also apply swiftformat (markTypes, blankLinesBetweenScopes).
@tsibog
tsibog force-pushed the pr/drag-drop-playlist branch from 6c7de4b to 9f53cb9 Compare August 17, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant