From 6d33b94cf74a60ac8ff65a24773e91dcee0668e9 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 15 Jun 2026 12:57:58 -0600 Subject: [PATCH] fix(slint/discover): similarAlbums title shows "Similar to {seed}" The More From Your Library / similarAlbums row was hardcoded "More From Your Library"; Tauri titles it "Similar to {seed}" where seed is the album the suggestions are seeded from (discovery.similarTo). Thread a seed_title through apply_more_from_library: the common case passes the most-recent album title (recents_seed_title), the no-recent-history fallback passes the first favorite album title. Empty seed falls back to "More From Your Library" so the row is never titleless. Title stays a Rust data string (rendered raw at Carousel.slint), matching the other For You section titles. cc --- crates/qbz-slint/src/foryou.rs | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/crates/qbz-slint/src/foryou.rs b/crates/qbz-slint/src/foryou.rs index f61d82e79..d22e0e416 100644 --- a/crates/qbz-slint/src/foryou.rs +++ b/crates/qbz-slint/src/foryou.rs @@ -649,12 +649,21 @@ fn apply_more_from_library( weak: &slint::Weak, cache: &ImageCache, cards: Vec, + seed_title: String, ) { + // 1:1 with Tauri's `discovery.similarTo` = "Similar to {seed}", where the + // seed is the album the suggestions are seeded from. Falls back to the + // plain "More From Your Library" when there is no seed (never titleless). + let title = if seed_title.is_empty() { + "More From Your Library".to_string() + } else { + format!("Similar to {seed_title}") + }; let jobs = album_jobs(&cards, |i| ArtworkTarget::ForYouMoreFromLibrary { index: i }); let w = weak.clone(); let _ = w.upgrade_in_event_loop(move |w| { w.global::() - .set_more_from_library(section("More From Your Library", &cards)); + .set_more_from_library(section(&title, &cards)); }); crate::artwork::spawn_loads(jobs, weak.clone(), cache.clone()); } @@ -738,6 +747,10 @@ pub fn spawn_for_you( .first() .map(|a| a.id.clone()) .filter(|s| !s.is_empty()); + // Seed title for the "Similar to {seed}" header — the most-recent + // album's title (its suggestions seed the common-case row). + let recents_seed_title: Option = + recent_album_list.first().map(|a| a.title.clone()); let has_recents_seed = recents_seed.is_some(); apply_recent( @@ -816,8 +829,12 @@ pub fn spawn_for_you( .map(|a| a.id.clone()) .filter(|s| !s.is_empty()) { + let seed_title = fav_albums + .first() + .map(|a| a.title.clone()) + .unwrap_or_default(); let cards = fetch_suggest(&runtime, &id).await; - apply_more_from_library(&weak, &cache, cards); + apply_more_from_library(&weak, &cache, cards, seed_title); } } }) @@ -831,7 +848,12 @@ pub fn spawn_for_you( Box::pin(async move { if let Some(id) = recents_seed { let cards = fetch_suggest(&runtime, &id).await; - apply_more_from_library(&weak, &cache, cards); + apply_more_from_library( + &weak, + &cache, + cards, + recents_seed_title.unwrap_or_default(), + ); } }) };