feat(slint): favorites Playlists two-source load (Library + Following)

Replace the single merged get_user_playlists load with the two real
sources mirroring Tauri: Following = playlists the user follows but does
not own (get_user_playlists filtered owner.id != current_user_id);
Library = locally-favorited ids (SQLite get_favorite_playlist_ids) in
favorited order, intersected with the fetched set and falling back to a
single get_playlist for ids not present. Both map to the rich
SearchPlaylistItem (4-cover collage) via search::map_playlist/playlist_item,
replacing the single-cover PlaylistCard. derive_playlists picks the active
sub-tab source and applies the name|owner search filter; the 4-cover
artwork pipeline (FavPlaylistCover{following,index,slot}) fills the collage
and propagates into the search-filtered visible model. The tab badge now
counts the local Library set. Adds library_db::current_user_id.

cc
This commit is contained in:
vicrodh committed 2026-05-27 13:43:12 -06:00
1 parent bfb3c9b9b5
commit 2d2f65a1cb
4 files changed
+147 -75

No files matched your search

+23 -9
View File
@@ -80,10 +80,11 @@ pub enum ArtworkTarget {
DiscoverBrowseAlbum { index: usize },
/// A card in FavoritesState.artists[index].
FavoriteArtist { index: usize },
/// A card in FavoritesState.playlists[index].
FavoritePlaylist { index: usize },
/// A card in FavoritesState.labels[index].
FavoriteLabel { index: usize },
/// One collage cover slot (0-3) of a favorites playlist card. `following`
/// picks the sub-tab source model (Following vs Library/favorites).
FavPlaylistCover { following: bool, index: usize, slot: usize },
/// A card in ForYouState.release-watch.albums[index].
ForYouReleaseWatch { index: usize },
/// A card in ForYouState.recent-albums.albums[index].
@@ -536,13 +537,6 @@ fn apply_artwork(
model.set_row_data(index, item);
}
}
ArtworkTarget::FavoritePlaylist { index } => {
let model = window.global::<crate::FavoritesState>().get_playlists();
if let Some(mut item) = model.row_data(index) {
item.cover = image;
model.set_row_data(index, item);
}
}
ArtworkTarget::FavoriteLabel { index } => {
let model = window.global::<crate::FavoritesState>().get_labels();
if let Some(mut item) = model.row_data(index) {
@@ -550,6 +544,26 @@ fn apply_artwork(
model.set_row_data(index, item);
}
}
ArtworkTarget::FavPlaylistCover { following, index, slot } => {
let st = window.global::<crate::FavoritesState>();
let model = if following {
st.get_playlists_following()
} else {
st.get_playlists_favorites()
};
if let Some(mut item) = model.row_data(index) {
let id = item.id.to_string();
match slot {
0 => item.cover1 = image.clone(),
1 => item.cover2 = image.clone(),
2 => item.cover3 = image.clone(),
_ => item.cover4 = image.clone(),
}
model.set_row_data(index, item);
// Also reach the rendered (possibly search-filtered) model.
crate::favorites::set_playlist_cover(window, &id, slot, image);
}
}
ArtworkTarget::ForYouReleaseWatch { index } => {
let model = window.global::<crate::ForYouState>().get_release_watch().albums;
if let Some(mut item) = model.row_data(index) {