feat(slint): favorites Artists search + render the filtered set
Point the artists grid at artists-visible (the search-filtered model) and add the "No artists match your search" empty state. Add the Artists row-2 toolbar branch with the shared ExpandableSearch wired to artists-search + search-artists -> derive_artists. cc
This commit is contained in:
2 files changed
+35
-2
No files matched your search
@@ -4350,6 +4350,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
// Local search over the loaded favorite artists (name).
|
||||
let weak = window.as_weak();
|
||||
window
|
||||
.global::<FavoritesActions>()
|
||||
.on_search_artists(move |q| {
|
||||
if let Some(w) = weak.upgrade() {
|
||||
w.global::<FavoritesState>().set_artists_search(q);
|
||||
favorites::derive_artists(&w);
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
// Playlist card actions: play / play-next / queue / share / favorite.
|
||||
let runtime = app_runtime.clone();
|
||||
|
||||
@@ -793,6 +793,21 @@ export component FavoritesView inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
if FavoritesState.active-tab == "artists"
|
||||
&& FavoritesState.artists.length > 0: HorizontalLayout {
|
||||
spacing: 8px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
ExpandableSearch {
|
||||
placeholder: @tr("Search");
|
||||
sm: true;
|
||||
query <=> FavoritesState.artists-search;
|
||||
edited(q) => {
|
||||
FavoritesActions.search-artists(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { height: 14px; }
|
||||
@@ -1036,7 +1051,7 @@ export component FavoritesView inherits Rectangle {
|
||||
property <int> columns: Math.max(
|
||||
1,
|
||||
Math.floor((self.width + root.gap) / (root.artist-w + root.gap)));
|
||||
property <int> rows: Math.ceil(FavoritesState.artists.length / self.columns);
|
||||
property <int> rows: Math.ceil(FavoritesState.artists-visible.length / self.columns);
|
||||
height: self.rows > 0
|
||||
? self.rows * root.artist-h + Math.max(0, self.rows - 1) * root.gap
|
||||
: 0px;
|
||||
@@ -1045,7 +1060,13 @@ export component FavoritesView inherits Rectangle {
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.body;
|
||||
}
|
||||
for artist[i] in FavoritesState.artists: FavArtistCard {
|
||||
if FavoritesState.artists.length > 0
|
||||
&& FavoritesState.artists-shown == 0: Text {
|
||||
text: @tr("No artists match your search.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.body;
|
||||
}
|
||||
for artist[i] in FavoritesState.artists-visible: FavArtistCard {
|
||||
x: Math.mod(i, artists-grid.columns) * (root.artist-w + root.gap);
|
||||
y: Math.floor(i / artists-grid.columns) * (root.artist-h + root.gap);
|
||||
item: artist;
|
||||
|
||||
Reference in new issue
Block a user