Skip to content

feat(macOS): unify song table columns with All Songs View Options, add interactive Like column and clickable Artist/Album links - #544

Open
vizmoe wants to merge 1 commit into
chenqi92:mainfrom
vizmoe:issue/542-macos-song-columns-view-options
Open

vizmoe wants to merge 1 commit into
chenqi92:mainfrom
vizmoe:issue/542-macos-song-columns-view-options

Conversation

@vizmoe

@vizmoe vizmoe commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closes #542

Summary

Unifies macOS song table columns across All Songs, Album Detail, Artist Detail (Popular Songs), and Artist → All Songs using All Songs as the canonical source of truth and honoring shared View Options settings, adds an interactive Favorite (Like) column and immediate Play Count display, and makes Artist and Album cells clickable to navigate to their detail views.

Changes

  • Shared Table Layout & View Options (Primuse/Views/Mac/MacSongTableLayout.swift, Primuse/Views/Mac/MacSongTableRowCells.swift):
    • Added shared MacSongTableLayout.sharedLibrary, persisted row density (MacSongsRowDensity: Compact 34pt / Standard 40pt / Relaxed 48pt), and reusable MacSongTableViewOptionsPopover.
    • Added toggleable .liked column (using existing localized key smart_field_isFavorite) enabled by default with a one-time migration for existing saved library layouts that respects subsequent user hides.
    • Refactored MacSongTableLayout class body to store only properties and init (tightening observable-class-body.tsv from 13 → 0).
    • Extracted shared SwiftUI table primitives (MacSongTableHorizontalContainer, MacSongTableOrdinalCell, MacSongTableRowCells, MacSongTableRowButton, MacSongTableLikeButton, MacSongTableArtistCell, MacSongTableAlbumCell) and AppKit interactive cells (MacSongLikedCellView, MacSongLinkTextCellView).
  • Unified Views (AlbumDetailView.swift, ArtistDetailView.swift, ArtistDetailView+Catalog.swift, SongListView.swift, SongListView+Catalog.swift, SongListView+HeaderActions.swift, SongListView+SortOrder.swift):
    • Migrated macOS AlbumDetailView tracks and ArtistDetailView popular songs to the shared layout with View Options popovers (albumDetail.viewOptions, artistDetail.viewOptions) synced in real time with SongListView.
    • Migrated macOS ArtistAllSongsView from a stacked SongRowView card list to MacSongNativeTableView with shared View Options, header sorting, resize/reorder writeback, context menu, and locate-current-song support.
    • Fixed MacSongFormatCellView pill width calculation (ceil(pillLabel.fittingSize.width)) so short codec labels like "WAV" / "FLAC" no longer truncate to "...".
    • Added immediate PlayHistoryStore.shared.playCountsBySongID fallback on first frame in SongListView so Play Count populates without waiting for the async refresh.
  • Interactive Like & Clickable Artist/Album Navigation (MacSongTableRowCells.swift, SongListView+SortOrder.swift, PlaylistDetailView.swift, MacRoute.swift, MacDetailContainer.swift):
    • Clicking the heart button toggles library.toggleLiked(songID:) without triggering row playback; duplicate heart icon in .title is hidden while .liked is visible; interactive cells yield to row selection when batch selection is active.
    • Clicking Artist or Album text navigates to the corresponding Artist / Album detail view with hover underline and pointing-hand cursor, tight text-bounded hit-testing (leaving trailing whitespace for row clicks), batch-selection suppression, multi-artist individual links in SwiftUI tables, and self-navigation suppression on the current Album/Artist view.
    • Pushed ArtistAllSongsView onto MacDetailContainer's NavigationPath (MacArtistAllSongsDestination via .primuseDetailOpenArtistAllSongs) so drilling Artist → All Songs → Album/Artist and navigating back behaves consistently.
    • Updated PlaylistDetailView (MacPlaylistSongCells) with the .liked button and clickable Artist / Album cells for consistency.
  • Project, Tests & Baselines (Primuse.xcodeproj/project.pbxproj, PrimuseMacTests/MacUnifiedSongTableTests.swift, scripts/gate/baselines/):
    • Regenerated Primuse.xcodeproj with XcodeGen 2.46.0.
    • Added 8 unit tests in MacUnifiedSongTableTests covering row-density persistence/reset, one-time column migration, format pill non-truncation, ArtistAllSongsView native table sync/sorting/Like/navigation, AlbumDetailView and ArtistDetailView View Options sync, and tight hit-testing / batch-selection passthrough.
    • Tightened observable-class-body.tsv and file-size.tsv for modified files.

Cross-Platform Impact

  • macOS: All behavioral changes apply here.
  • iOS / iPadOS: Shared files (AlbumDetailView, ArtistDetailView, ArtistDetailView+Catalog, SongListView, PlaylistDetailView) preserve existing iOS layouts and navigation; verified via iOS compilation.
  • tvOS: Untouched.

Verification

  • PrimuseMacTests: xcodebuild test -scheme PrimuseMac (MacUnifiedSongTableTests, MacSongTableAndIconTests, MacPageKindRoutingTests) — 25/25 passed on 9528f80c09.
  • Primuse (iOS): xcodebuild build-for-testing -scheme Primuse -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO — TEST BUILD SUCCEEDED (local CoreSimulator runtime version mismatch prevented launching an iOS simulator; compilation of Primuse + PrimuseTests passed).
  • MISE_XCODEGEN_VERSION=2.46.0 ruby scripts/check-widget-platforms.rb — passed.
  • MISE_XCODEGEN_VERSION=2.46.0 python3 -I scripts/gate/gate.py --root . --require-all --strict-baselines --range origin/main..HEAD & --commits origin/main..HEAD — 0 errors, 0 warnings, 0 skipped.

@chenqi92 chenqi92 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

  • Album page: the track list changed from LazyVStack to VStack, so every row of a large album or box set is built at once. Please keep it lazy.
  • Artist / album text cells: MacSongLinkTextCellView.hitTest returns the button whenever the click lands on the text, so a single click there navigates instead of playing, and Cmd/Shift-click selection is lost over that text. Songs without an album or artist ID still look like links. Please drop this, or make it a View Options switch that is off by default and ignores clicks with modifiers.
  • View Options: Album, Artist and Playlist pages now share the All Songs layout (all 12 columns, widths and order), so changing one page changes every page and All Songs too. Please give the detail pages their own scope with the defaults they had before.
  • Artist page, Popular: the "N plays" text is gone and the row is now the full table row. Please keep the existing Popular row.
  • macOS 15 scrolling: the new cells use plain Button, .onHover and .help. In scrolling lists main uses PMScrollingButton / pmScrolling* because each pointer region is re-registered every frame on macOS 15 (#380). Please use those.
  • layout() calls fittingSize on the format pill and the link button for every row on every layout pass. Measure the text once (attributedStringValue.size() as before, or cache by string).
  • Like column: for saved column orders it lands at the end, after Bit Depth; place it after Format. Show the outline heart only on hover, and the filled heart when the song is liked.
  • ArtistAllSongsView.displayedSongs sorts the artist's whole song list inside body on the main actor. Sort off the main actor, as SongListSnapshot does for All Songs.
  • Album rows went from Button to onTapGesture, so VoiceOver no longer finds a button to play the row. Add .isButton and a default action, or keep the Button.
  • Tests: MacSongTableLayout.sharedLibrary writes UserDefaults.standard. Snapshot/restore puts it back, but a crashed run resets the developer's table settings and sets the migration flag. Inject a suite instead. Task.sleep(160 ms) in settle makes the tests timing-dependent.
  • The iOS artist song list gained .songRowColumnsContainer() and lost its Mac padding/background. The PR doesn't mention iOS, so please say what this changes there.
  • The commit message is missing refs #542. After rebasing, the PlaylistDetailView.swift file-size baseline needs recomputing (main has changed it).

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.

feat(macOS): unify song table columns with All Songs View Options, add interactive Like column and clickable Artist/Album links

2 participants