feat(slint): add NavEntry::Search history variant

The Search variant carries the query. apply_entry gets a stub arm that
switches the view; Task 6 upgrades it to a full navigate_search call.

cc
This commit is contained in:
vicrodh committed 2026-05-19 11:26:48 -06:00
1 parent b040a1d359
commit acfb6a05cb
2 files changed
+17

No files matched your search

+6
View File
@@ -273,6 +273,12 @@ fn apply_entry(
nav::NavEntry::Artist(id) => { nav::NavEntry::Artist(id) => {
navigate_artist(runtime.clone(), weak.clone(), handle, image_cache.clone(), id); navigate_artist(runtime.clone(), weak.clone(), handle, image_cache.clone(), id);
} }
nav::NavEntry::Search(_query) => {
// Upgraded to a full navigate_search call in Task 6.
let _ = weak.upgrade_in_event_loop(|w| {
w.global::<NavState>().set_view(ContentView::Search);
});
}
} }
} }
+11
View File
@@ -16,6 +16,8 @@ pub enum NavEntry {
Album(String), Album(String),
Artist(String), Artist(String),
Settings, Settings,
/// A search results page; the string is the query.
Search(String),
} }
struct History { struct History {
@@ -123,6 +125,15 @@ mod tests {
assert_eq!(go_back(), Some(NavEntry::Album("1".into()))); assert_eq!(go_back(), Some(NavEntry::Album("1".into())));
} }
#[test]
fn search_entry_round_trips_history() {
reset();
record(NavEntry::Search("metallica".into()));
record(NavEntry::Album("5".into()));
assert_eq!(go_back(), Some(NavEntry::Search("metallica".into())));
assert_eq!(go_back(), Some(NavEntry::Home));
}
#[test] #[test]
fn record_dedupes_current_entry() { fn record_dedupes_current_entry() {
reset(); reset();