feat(slint): wire header search input with debounced live search
The header TextInput now submits on Enter (records history, opens the results page) and live-searches on edit. Live search debounces 300 ms via a Slint Timer and requires 2+ characters. A monotonic version counter guards navigate_search so a stale load cannot overwrite newer results. cc
This commit is contained in:
3 files changed
+98
-5
No files matched your search
@@ -13,7 +13,7 @@ import { Spacing } from "../foundation/spacing.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Layout } from "../foundation/layout.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { SessionState, NavState, ContentView, ShellState, HeaderMenuState, NavMenuEntry } from "../state.slint";
|
||||
import { SessionState, NavState, ContentView, ShellState, HeaderMenuState, NavMenuEntry, SearchActions } from "../state.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
|
||||
// Sidebar collapse toggle — bare bright icon, no background. Sits at
|
||||
@@ -341,6 +341,10 @@ export component HeaderBar inherits Rectangle {
|
||||
font-size: 13px;
|
||||
vertical-alignment: center;
|
||||
single-line: true;
|
||||
// Enter submits to the full results page; every edit
|
||||
// feeds the debounced live search (Rust side).
|
||||
accepted => { SearchActions.submit(self.text); }
|
||||
edited => { SearchActions.live(self.text); }
|
||||
}
|
||||
Text {
|
||||
visible: search-input.text == "";
|
||||
|
||||
Reference in new issue
Block a user