feat(dashboard): breakpilot branding and the portal's ledger design (#357)
This commit was merged in pull request #357.
This commit is contained in:
1 parent
6752f54036
commit
9d23b2c8e0
8 files changed
+572
-635
No files matched your search
@@ -144,7 +144,7 @@ pub fn HelpChat() -> Element {
|
||||
div { class: "help-chat-messages",
|
||||
if messages().is_empty() {
|
||||
div { class: "help-chat-empty",
|
||||
p { "Ask me anything about the Compliance Scanner." }
|
||||
p { "Ask me anything about Prüfwerk." }
|
||||
p { class: "help-chat-hint",
|
||||
"e.g. \"How do I add a repository?\" or \"What is SBOM?\""
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@ struct NavItem {
|
||||
#[component]
|
||||
pub fn Sidebar() -> Element {
|
||||
let current_route = use_route::<Route>();
|
||||
let mut collapsed = use_signal(|| true);
|
||||
// Open, like the portal's nav rail; the toggle collapses it.
|
||||
let mut collapsed = use_signal(|| false);
|
||||
let source_only = use_source_only();
|
||||
let lang = use_lang()();
|
||||
|
||||
@@ -98,10 +99,15 @@ pub fn Sidebar() -> Element {
|
||||
|
||||
rsx! {
|
||||
nav { class: "{sidebar_class}",
|
||||
// The breakpilot brand, as the portal shows it; Prüfwerk is the
|
||||
// product within it.
|
||||
div { class: "sidebar-header",
|
||||
Icon { icon: BsShieldCheck, width: 24, height: 24 }
|
||||
span { class: "brand-mark", aria_hidden: "true", "B" }
|
||||
if !collapsed() {
|
||||
h1 { "Prüfwerk" }
|
||||
div { class: "brand-text",
|
||||
span { class: "brand-name", "Breakpilot" }
|
||||
span { class: "brand-sub", "Prüfwerk" }
|
||||
}
|
||||
}
|
||||
}
|
||||
div { class: "sidebar-nav",
|
||||
|
||||
@@ -31,13 +31,13 @@ pub fn ThemeToggle(collapsed: bool) -> Element {
|
||||
let lang = use_lang()();
|
||||
let label = if collapsed {
|
||||
""
|
||||
} else if is_dark().unwrap_or(true) {
|
||||
} else if is_dark().unwrap_or(false) {
|
||||
nav::LIGHT_MODE.get(lang)
|
||||
} else {
|
||||
nav::DARK_MODE.get(lang)
|
||||
};
|
||||
|
||||
let title = if is_dark().unwrap_or(true) {
|
||||
let title = if is_dark().unwrap_or(false) {
|
||||
nav::SWITCH_TO_LIGHT.get(lang)
|
||||
} else {
|
||||
nav::SWITCH_TO_DARK.get(lang)
|
||||
@@ -50,11 +50,11 @@ pub fn ThemeToggle(collapsed: bool) -> Element {
|
||||
title: "{title}",
|
||||
"aria-label": "{title}",
|
||||
onclick: move |_| {
|
||||
let next_dark = !is_dark().unwrap_or(true);
|
||||
let next_dark = !is_dark().unwrap_or(false);
|
||||
is_dark.set(Some(next_dark));
|
||||
apply_theme(next_dark);
|
||||
},
|
||||
if is_dark().unwrap_or(true) {
|
||||
if is_dark().unwrap_or(false) {
|
||||
Icon { icon: BsSun, width: 16, height: 16 }
|
||||
} else {
|
||||
Icon { icon: BsMoonStars, width: 16, height: 16 }
|
||||
@@ -68,7 +68,7 @@ pub fn ThemeToggle(collapsed: bool) -> Element {
|
||||
|
||||
/// Returns `(is_dark, from_storage)`. `from_storage` is true when an explicit
|
||||
/// user choice is in localStorage; false when we fell back to OS preference
|
||||
/// (or to the dark default).
|
||||
/// (or to light, the ledger default, as the breakpilot portal).
|
||||
#[cfg(feature = "web")]
|
||||
fn initial_theme() -> (bool, bool) {
|
||||
if let Some(window) = web_sys::window() {
|
||||
@@ -81,12 +81,12 @@ fn initial_theme() -> (bool, bool) {
|
||||
return (mql.matches(), false);
|
||||
}
|
||||
}
|
||||
(true, false)
|
||||
(false, false)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "web"))]
|
||||
fn initial_theme() -> (bool, bool) {
|
||||
(true, false)
|
||||
(false, false)
|
||||
}
|
||||
|
||||
#[cfg(feature = "web")]
|
||||
|
||||
@@ -186,7 +186,7 @@ pub fn FindingDetailPage(id: String) -> Element {
|
||||
let label = tx::status(&status).get(lang);
|
||||
rsx! {
|
||||
button {
|
||||
class: if current { "btn btn-primary" } else { "btn btn-ghost" },
|
||||
class: if current { "btn btn-primary btn-current" } else { "btn btn-ghost" },
|
||||
title: "{label}",
|
||||
disabled: current,
|
||||
onclick: move |_| {
|
||||
|
||||
@@ -68,22 +68,22 @@ pub fn OverviewPage() -> Element {
|
||||
StatCard {
|
||||
label: common::CRITICAL.get(lang),
|
||||
value: s.critical_findings.to_string(),
|
||||
color: "var(--danger)",
|
||||
color: "var(--sev-critical)",
|
||||
}
|
||||
StatCard {
|
||||
label: common::HIGH.get(lang),
|
||||
value: s.high_findings.to_string(),
|
||||
color: "#f97316",
|
||||
color: "var(--sev-high)",
|
||||
}
|
||||
StatCard {
|
||||
label: common::MEDIUM.get(lang),
|
||||
value: s.medium_findings.to_string(),
|
||||
color: "var(--warning)",
|
||||
color: "var(--sev-medium)",
|
||||
}
|
||||
StatCard {
|
||||
label: common::LOW.get(lang),
|
||||
value: s.low_findings.to_string(),
|
||||
color: "var(--success)",
|
||||
color: "var(--sev-low)",
|
||||
}
|
||||
StatCard { label: overview::DEPENDENCIES.get(lang), value: s.total_sbom_entries.to_string() }
|
||||
StatCard { label: overview::CVE_ALERTS.get(lang), value: s.total_cve_alerts.to_string() }
|
||||
@@ -93,10 +93,10 @@ pub fn OverviewPage() -> Element {
|
||||
div { class: "card",
|
||||
div { class: "card-header", {overview::SEVERITY_DISTRIBUTION.get(lang)} }
|
||||
div { class: "severity-chart",
|
||||
SeverityBar { label: common::CRITICAL.get(lang), count: s.critical_findings, max: s.total_findings, color: "var(--danger)" }
|
||||
SeverityBar { label: common::HIGH.get(lang), count: s.high_findings, max: s.total_findings, color: "var(--orange)" }
|
||||
SeverityBar { label: common::MEDIUM.get(lang), count: s.medium_findings, max: s.total_findings, color: "var(--warning)" }
|
||||
SeverityBar { label: common::LOW.get(lang), count: s.low_findings, max: s.total_findings, color: "var(--success)" }
|
||||
SeverityBar { label: common::CRITICAL.get(lang), count: s.critical_findings, max: s.total_findings, color: "var(--sev-critical)" }
|
||||
SeverityBar { label: common::HIGH.get(lang), count: s.high_findings, max: s.total_findings, color: "var(--sev-high)" }
|
||||
SeverityBar { label: common::MEDIUM.get(lang), count: s.medium_findings, max: s.total_findings, color: "var(--sev-medium)" }
|
||||
SeverityBar { label: common::LOW.get(lang), count: s.low_findings, max: s.total_findings, color: "var(--sev-low)" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user