Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions crates/app-http/src/platform/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ fn layout(

let links = metadata.as_ref().map(|m| m.links.clone()).unwrap_or_default();

let nav_link = |href: &str, text: &str, target_id: &str| {
let is_active = page_id == target_id;
html! {
a href=(href) aria-current=[is_active.then(|| "page")] { (text) }
}
};

html! {
(DOCTYPE)
html lang="en" {
Expand Down Expand Up @@ -75,6 +82,11 @@ fn layout(
nav a:hover {
text-decoration: underline;
}
nav a[aria-current="page"] {
font-weight: 700;
text-decoration: underline;
color: #4c51bf;
}
Comment on lines +85 to +89
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a small duplication of text-decoration: underline; which is also present in the nav a:hover rule. To improve maintainability and avoid them getting out of sync in the future, you could group the selectors for this shared property.

For example:

nav a:hover,
nav a[aria-current="page"] {
    text-decoration: underline;
}

nav a[aria-current="page"] {
    font-weight: 700;
    color: #4c51bf;
}

This would involve modifying the nav a:hover rule (which is outside this specific change), but it would make the styling more robust and easier to maintain.

.card {
background: white;
border-radius: 8px;
Expand Down Expand Up @@ -152,10 +164,10 @@ fn layout(
}
}
nav .container data-uiid=(format!("{}.nav", page_id)) {
a href="/" { "Dashboard" }
a href="/ui/graph" { "Graph" }
a href="/ui/flows" { "Flows & Tasks" }
a href="/ui/coverage" { "AC Coverage" }
(nav_link("/", "Dashboard", "dashboard"))
(nav_link("/ui/graph", "Graph", "graph"))
(nav_link("/ui/flows", "Flows & Tasks", "flows"))
(nav_link("/ui/coverage", "AC Coverage", "coverage"))
a href="/platform/status" target="_blank" { "API: Status" }
a href="/platform/graph" target="_blank" { "API: Graph" }
@if let Some(runbook) = links.get("kernel_contract") {
Expand Down
Loading