From 7d91db78a5e463a413b769950059e87a991974f0 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Sat, 26 Sep 2026 09:50:35 +0200 Subject: [PATCH] feat(dashboard): navigation on a phone Below 768 px the sidebar was moved off-screen and nothing replaced it: on a phone there was no way to reach another page. A top bar now carries a menu button and the wordmark; the menu slides the sidebar in over a backdrop and closes when a page is chosen or the backdrop is tapped. The notification bell sits in the bar. The wordmark is one component, shared by the sidebar and the bar. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p --- compliance-dashboard/assets/main.css | 68 +++++++++++++++++ .../src/components/sidebar.rs | 76 +++++++++++++------ compliance-dashboard/src/i18n/texts.rs | 8 ++ 3 files changed, 129 insertions(+), 23 deletions(-) diff --git a/compliance-dashboard/assets/main.css b/compliance-dashboard/assets/main.css index 531956f..2ccff33 100644 --- a/compliance-dashboard/assets/main.css +++ b/compliance-dashboard/assets/main.css @@ -4903,3 +4903,71 @@ tbody tr:last-child td { padding-left: 0; } } + +/* ── Phone navigation: a top bar, the sidebar off-canvas ── */ +.mobile-bar, +.mobile-backdrop { + display: none; +} + +@media (max-width: 768px) { + .mobile-bar { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 60; + display: flex; + align-items: center; + gap: 10px; + height: calc(52px + env(safe-area-inset-top, 0px)); + padding: env(safe-area-inset-top, 0px) 16px 0; + background: var(--bg-secondary); + border-bottom: 1px solid var(--border); + } + + .mobile-menu-btn { + display: grid; + place-items: center; + width: 36px; + height: 36px; + border: 1px solid var(--border); + border-radius: var(--radius); + background: var(--bg-card); + color: var(--text-primary); + cursor: pointer; + } + + .mobile-bar-brand { + display: flex; + align-items: center; + gap: 8px; + } + + .mobile-backdrop { + display: block; + position: fixed; + inset: 0; + z-index: 69; + background: rgb(15 18 37 / 0.45); + } + + .sidebar { + z-index: 70; + } + + .main-content { + padding-top: calc(68px + env(safe-area-inset-top, 0px)); + } + + /* The bell sits in the top bar, above it. */ + .notification-bell-wrapper { + top: calc(8px + env(safe-area-inset-top, 0px)); + right: 16px; + z-index: 61; + } + + .notification-panel { + width: min(380px, calc(100vw - 32px)); + } +} diff --git a/compliance-dashboard/src/components/sidebar.rs b/compliance-dashboard/src/components/sidebar.rs index 9859ab4..84dbf46 100644 --- a/compliance-dashboard/src/components/sidebar.rs +++ b/compliance-dashboard/src/components/sidebar.rs @@ -99,36 +99,38 @@ pub fn Sidebar() -> Element { .. } = use_context::>()(); - let sidebar_class = if collapsed() { - "sidebar collapsed" - } else { - "sidebar" + // On a phone the sidebar is off-canvas: the top bar's menu button slides + // it in, and choosing a page or the backdrop closes it. + let mut mobile_open = use_signal(|| false); + let sidebar_class = match (collapsed(), mobile_open()) { + (true, _) => "sidebar collapsed", + (false, true) => "sidebar open", + (false, false) => "sidebar", }; rsx! { + div { class: "mobile-bar", + button { + class: "mobile-menu-btn", + "aria-label": if mobile_open() { nav::CLOSE_MENU.get(lang) } else { nav::MENU.get(lang) }, + "aria-expanded": if mobile_open() { "true" } else { "false" }, + onclick: move |_| mobile_open.set(!mobile_open()), + if mobile_open() { + Icon { icon: BsXLg, width: 18, height: 18 } + } else { + Icon { icon: BsList, width: 20, height: 20 } + } + } + div { class: "mobile-bar-brand", Wordmark { with_name: true } } + } + if mobile_open() { + div { class: "mobile-backdrop", onclick: move |_| mobile_open.set(false) } + } nav { class: "{sidebar_class}", // The breakpilot brand, as the portal shows it; Prüfwerk is the // product within it. div { class: "sidebar-header", - svg { - class: "brand-chevron", - view_box: "8.75 2.25 46.5 45", - fill: "none", - stroke_linecap: "round", - stroke_linejoin: "round", - "aria-hidden": "true", - path { d: "M12 44 L32 20 L52 44", stroke: "var(--brand-chevron)", stroke_width: "6.5" } - path { d: "M24 13 L32 5 L40 13", stroke: "var(--brand-chevron-top)", stroke_width: "5.5" } - } - if !collapsed() { - div { class: "brand-text", - span { class: "brand-name", - "Break" - span { class: "bp-pilot", "Pilot" } - } - span { class: "brand-sub", "Prüfwerk" } - } - } + Wordmark { with_name: !collapsed() } } if !portal_url.is_empty() { a { @@ -186,6 +188,7 @@ pub fn Sidebar() -> Element { to: item.route.clone(), class: class, title: "{label}", + onclick: move |_| mobile_open.set(false), {item.icon} if !collapsed() { span { "{label}" } @@ -262,3 +265,30 @@ pub fn Sidebar() -> Element { } } } + +/// The BreakPilot wordmark, as on breakpilot.com and the portal: the chevron, +/// and unless `with_name` is off, "BreakPilot" with "Prüfwerk" beneath. +#[component] +fn Wordmark(with_name: bool) -> Element { + rsx! { + svg { + class: "brand-chevron", + view_box: "8.75 2.25 46.5 45", + fill: "none", + stroke_linecap: "round", + stroke_linejoin: "round", + "aria-hidden": "true", + path { d: "M12 44 L32 20 L52 44", stroke: "var(--brand-chevron)", stroke_width: "6.5" } + path { d: "M24 13 L32 5 L40 13", stroke: "var(--brand-chevron-top)", stroke_width: "5.5" } + } + if with_name { + div { class: "brand-text", + span { class: "brand-name", + "Break" + span { class: "bp-pilot", "Pilot" } + } + span { class: "brand-sub", "Prüfwerk" } + } + } + } +} diff --git a/compliance-dashboard/src/i18n/texts.rs b/compliance-dashboard/src/i18n/texts.rs index 18b64db..03e4331 100644 --- a/compliance-dashboard/src/i18n/texts.rs +++ b/compliance-dashboard/src/i18n/texts.rs @@ -115,6 +115,14 @@ pub mod nav { de: "Dokumentation", en: "Docs", }; + pub const MENU: Text = Text { + de: "Menü öffnen", + en: "Open the menu", + }; + pub const CLOSE_MENU: Text = Text { + de: "Menü schließen", + en: "Close the menu", + }; pub const NOT_AVAILABLE_SHORT: Text = Text { de: "n. v.", en: "n/a", -- 2.54.1