diff --git a/crates/qbz-slint/ui/shell/HeaderBar.slint b/crates/qbz-slint/ui/shell/HeaderBar.slint index 5e31d4bda..b7b5babe7 100644 --- a/crates/qbz-slint/ui/shell/HeaderBar.slint +++ b/crates/qbz-slint/ui/shell/HeaderBar.slint @@ -16,6 +16,29 @@ import { Radius } from "../foundation/radius.slint"; import { SessionState, NavState, ContentView, ShellState } from "../state.slint"; import { QbzIcon } from "../primitives/QbzIcon.slint"; +// Sidebar collapse toggle — bare bright icon, no background. Sits at +// the very left of the header, before the Discover tab. +component SidebarToggle inherits Rectangle { + width: 30px; + height: 30px; + + QbzIcon { + source: @image-url("../assets/icons/panel-left.svg"); + width: 19px; + height: 19px; + x: (parent.width - self.width) / 2; + y: (parent.height - self.height) / 2; + tint: Theme.text-primary; + } + + ta := TouchArea { + mouse-cursor: pointer; + clicked => { + ShellState.sidebar-collapsed = !ShellState.sidebar-collapsed; + } + } +} + component NavTab inherits Rectangle { in property icon; in property label; @@ -344,6 +367,10 @@ export component HeaderBar inherits Rectangle { y: (root.height - self.height) / 2; height: 30px; spacing: Spacing.xs; + VerticalLayout { + alignment: center; + SidebarToggle { } + } NavTabWithMenu { icon: @image-url("../assets/icons/compass.svg"); label: @tr("Discover"); @@ -430,6 +457,11 @@ export component HeaderBar inherits Rectangle { Text { visible: search-input.text == ""; text: @tr("Search"); + // Span the input box so vertical-alignment centers the + // placeholder the same way the TextInput centers its + // own text — otherwise it rides at the top. + width: 100%; + height: 100%; color: Theme.text-muted; font-size: 13px; vertical-alignment: center; diff --git a/crates/qbz-slint/ui/shell/NavButtons.slint b/crates/qbz-slint/ui/shell/NavButtons.slint index decb04171..1692c191e 100644 --- a/crates/qbz-slint/ui/shell/NavButtons.slint +++ b/crates/qbz-slint/ui/shell/NavButtons.slint @@ -1,40 +1,14 @@ -// Sidebar-collapse toggle + browser-like back / forward navigation pair. +// Browser-like back / forward navigation pair. // -// The sidebar toggle is a bare icon button (no background). The [<] [>] -// history pair uses the same circular elevated style as the Discover -// carousel page navigators. Used inline beside the Discover tabs and in -// place of the per-page Back button. +// The [<] [>] history pair uses the same circular elevated style as the +// Discover carousel page navigators. Used inline beside the Discover +// tabs and in place of the per-page Back button. (The sidebar-collapse +// toggle lives in the header now, not here.) import { Theme } from "../foundation/semantic-colors.slint"; -import { NavState, ShellState } from "../state.slint"; +import { NavState } from "../state.slint"; import { QbzIcon } from "../primitives/QbzIcon.slint"; -// Bare icon button — no background, brightest icon tint. Used for the -// sidebar collapse toggle. -component PlainNavBtn inherits Rectangle { - in property icon; - callback clicked(); - - width: 32px; - height: 28px; - - QbzIcon { - source: root.icon; - width: 17px; - height: 17px; - x: (parent.width - self.width) / 2; - y: (parent.height - self.height) / 2; - tint: Theme.text-primary; - } - - ta := TouchArea { - mouse-cursor: pointer; - clicked => { - root.clicked(); - } - } -} - // Circular elevated icon button — same look as the Discover carousel // page navigators (Carousel.slint NavButton). component HistoryNavBtn inherits Rectangle { @@ -71,40 +45,25 @@ component HistoryNavBtn inherits Rectangle { } export component NavButtons inherits HorizontalLayout { - spacing: 8px; + spacing: 4px; - // Sidebar collapse toggle — bare icon, no pill. VerticalLayout { alignment: center; - PlainNavBtn { - icon: @image-url("../assets/icons/panel-left.svg"); + HistoryNavBtn { + icon: @image-url("../assets/icons/chevron-left.svg"); + enabled: NavState.can-back; clicked => { - ShellState.sidebar-collapsed = !ShellState.sidebar-collapsed; + NavState.request-back(); } } } - - // Back / forward history pair — circular carousel-navigator style. - HorizontalLayout { - spacing: 4px; - VerticalLayout { - alignment: center; - HistoryNavBtn { - icon: @image-url("../assets/icons/chevron-left.svg"); - enabled: NavState.can-back; - clicked => { - NavState.request-back(); - } - } - } - VerticalLayout { - alignment: center; - HistoryNavBtn { - icon: @image-url("../assets/icons/chevron-right.svg"); - enabled: NavState.can-forward; - clicked => { - NavState.request-forward(); - } + VerticalLayout { + alignment: center; + HistoryNavBtn { + icon: @image-url("../assets/icons/chevron-right.svg"); + enabled: NavState.can-forward; + clicked => { + NavState.request-forward(); } } }