feat(slint): Discover tabs are history entries

Home / Editor's Picks / For You were plain tab swaps with no history
footprint. Each is now a NavEntry::Discover { tab } pushed on click
(both the in-view pill and the Discover header dropdown), so
back/forward navigates between the three Discover pages. apply_entry
replays a Discover entry by selecting that tab's cached section set
and re-firing artwork.

cc
This commit is contained in:
vicrodh committed 2026-05-20 23:35:26 -06:00
1 parent 21a909185f
commit 066890a7dd
2 files changed
+21

No files matched your search

+15
View File
@@ -403,6 +403,15 @@ fn apply_entry(
w.global::<NavState>().set_view(ContentView::Home);
});
}
nav::NavEntry::Discover { tab } => {
let weak = weak.clone();
let image_cache = image_cache.clone();
let _ = weak.clone().upgrade_in_event_loop(move |w| {
w.global::<NavState>().set_view(ContentView::Home);
let jobs = home::select_tab(&w, &tab);
artwork::spawn_loads(jobs, weak.clone(), image_cache.clone());
});
}
nav::NavEntry::Settings => {
let _ = weak.upgrade_in_event_loop(|w| {
w.global::<NavState>().set_view(ContentView::Settings);
@@ -1771,8 +1780,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.global::<HomeActions>()
.on_select_tab(move |tab| {
if let Some(w) = weak.upgrade() {
nav::record(nav::NavEntry::Discover {
tab: tab.to_string(),
});
let jobs = home::select_tab(&w, tab.as_str());
artwork::spawn_loads(jobs, weak.clone(), image_cache.clone());
update_nav_flags(&w);
}
});
}
@@ -1939,9 +1952,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
if let Some(tab) = route.strip_prefix("discover-") {
let tab = tab.to_string();
if let Some(w) = weak.upgrade() {
nav::record(nav::NavEntry::Discover { tab: tab.clone() });
w.global::<NavState>().set_view(ContentView::Home);
let jobs = home::select_tab(&w, &tab);
artwork::spawn_loads(jobs, weak.clone(), image_cache.clone());
update_nav_flags(&w);
}
return;
}
+6
View File
@@ -13,6 +13,12 @@ use std::cell::RefCell;
#[derive(Clone, Debug, PartialEq)]
pub enum NavEntry {
Home,
/// A Discover tab page ("home" | "editorPicks" | "forYou"). Each
/// tab is its own history entry so back/forward moves between the
/// three Discover pages.
Discover {
tab: String,
},
Album(String),
Artist(String),
Settings,