Skip to content

feat(web): find in a playlist, sort it, and a compact view - #1431

Open
saliltimalsina wants to merge 1 commit into
kushagrasinghx:mainfrom
saliltimalsina:feat/playlist-find-sort
Open

saliltimalsina wants to merge 1 commit into
kushagrasinghx:mainfrom
saliltimalsina:feat/playlist-find-sort

Conversation

@saliltimalsina

Copy link
Copy Markdown

What

A toolbar above a playlist's songs, as Spotify's playlist page has:

  • Find in playlist: filters by title, artist or album, every word in any order, ignoring case and accents. Esc clears it.
  • Sort by: Custom order, Title, Artist, Album, Shortest first, Longest first. Each playlist remembers its own sort.
  • List / Compact: compact rows are numbered with no artwork, 36 px instead of 54. The choice is remembered for all playlists.

Finding or sorting loads the rest of a long playlist first ("Loading the rest of the playlist…"), so it covers every song, not just the first page. Play, Shuffle and playing a row follow the order shown.

How

  • playlistView.ts: pure filterTracks and sortTracks. Sorting is stable, uses Intl.Collator with numeric compare, and puts songs with no album or no duration last.
  • playlistPrefs.ts: localStorage, with nothing breaking when storage is unavailable.
  • TrackList takes compact. The virtualizer's estimate follows it and re-measures when it changes.
  • The find field is type="text", role="searchbox". The / shortcut focuses the first input[type="search"], and that should stay the site search.

No new dependencies.

Testing

  • pnpm typecheck, pnpm test (7 new tests) and the app build pass.
  • By hand in Chrome on a 499-track playlist: sorting by Title loaded all 5 pages (488 playable rows) and sorted them ("7 rings", "7 Years", "10,000 Hours", "24K Magic", "2002" …). Compact view kept the virtualized rows aligned while scrolling. Double-clicking row 27 of the sorted list queued it in sorted order (488 in context). Find "queen" gave 6 rows, and Esc cleared it. Sort and view survived a reload.

A toolbar above a playlist's songs: Find in playlist (title, artist or
album, any word order, accents ignored), Sort by (custom order, title,
artist, album, shortest or longest first; remembered per playlist) and
list or compact rows (remembered for all). Finding or sorting loads the
rest of a long playlist first, and playing from a sorted list queues it
in that order.

This branch has not been deployed

No deployments
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