Square corners, a full-screen mobile drawer, and populated settings

The design system retired every radius step on 2026-07-14 (tokens/radius.json
resolves xs..pill to 0), so the cards, buttons, inputs, pills and code blocks
lose their rounded corners.

Below 901px the rail is now the design's mobile menu: a full-screen drawer on
the page background with the brand and a close control in its head, rows split
by 1px dividers. It closes by the X, the backdrop, Escape, or picking a
destination; without a script the :target fragment still opens it.

Settings stops being a bare list: System now groups Identity, Network and
Updates the way the Warden console does, and Drivers groups Chains and
Firmware. Verified on the bench S21 Pro at port 80.
This commit is contained in:
2026-11-04 14:06:24 -06:00
parent 5a6b895113
commit 13b1787e1a
2 changed files with 158 additions and 12 deletions
+70 -10
View File
@@ -200,9 +200,9 @@ pub fn page(active: &str, title: &str, body: &str) -> String {
"<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\">\
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\
<title>{title} - Alkane</title><style>{CSS}</style></head>\
<body class=\"shell\"><aside class=\"rail\" id=\"rail\">{rail_head}{nav}</aside>\
<body class=\"shell\"><aside class=\"rail\" id=\"rail\">{rail_head}{nav}</aside><div class=\"rail-backdrop\" id=\"rail-backdrop\"></div>\
<main class=\"content\"><header class=\"appbar\">\
<a class=\"appbar__menu\" href=\"#rail\" aria-label=\"Menu\">Menu</a>\
<a class=\"appbar__menu\" href=\"#rail\" aria-label=\"Open menu\">Menu</a>\
<h1 class=\"page-title\">{title}</h1><span id=\"live\" class=\"pill\">connecting</span></header>\
<div class=\"frame\">{body}</div></main>\
<script>{JS}</script></body></html>",
@@ -214,7 +214,8 @@ pub fn page(active: &str, title: &str, body: &str) -> String {
fn rail_head() -> String {
"<div class=\"rail__head\"><span class=\"rail__brand\">Alkane</span>\
<button class=\"rail__toggle\" type=\"button\" aria-label=\"Collapse sidebar\" title=\"Collapse sidebar\">&#9776;</button></div>"
<button class=\"rail__toggle\" type=\"button\" aria-label=\"Collapse sidebar\" title=\"Collapse sidebar\">&#9776;</button>\
<a class=\"rail__close\" href=\"#\" aria-label=\"Close menu\" title=\"Close menu\">&#10005;</a></div>"
.to_string()
}
@@ -353,6 +354,20 @@ pub fn kv_page(rows: &[(&str, String)]) -> String {
out
}
/// Several titled sections in one page: the settings pages' shape in the
/// Warden console, where each group (Identity, Network, ...) is its own block.
pub fn sections_page(sections: &[(&str, String)]) -> String {
let mut out = String::new();
for (title, body) in sections {
out.push_str(&format!(
"<section class=\"section\"><h2 class=\"section__title\">{}</h2>{}</section>",
escape(title),
body
));
}
out
}
/// A table page with a header row.
pub fn table_page(headers: &[&str], rows: &[Vec<String>]) -> String {
let mut out = String::from("<table><thead><tr>");
@@ -449,7 +464,7 @@ a{color:var(--cyan-400);text-decoration:none}
.page-title{font-family:var(--font-display);font-size:22px;font-weight:700;line-height:1.1;
margin:0;letter-spacing:-.01em}
.appbar__menu{display:none;font-size:var(--text-sm);color:var(--cyan-400)}
.pill{margin-left:auto;font-size:var(--text-xs);padding:3px 9px;border-radius:999px;
.pill{border-radius:0;margin-left:auto;font-size:var(--text-xs);padding:3px 9px;
background:var(--navy-800);color:var(--text-muted);border:1px solid var(--border)}
.pill.ok{color:#7EE787;border-color:#1F4D2C}
.pill.bad{color:#FF9B9B;border-color:#552323}
@@ -459,15 +474,15 @@ a{color:var(--cyan-400);text-decoration:none}
.bar{display:flex;gap:var(--space-3);align-items:center;flex-wrap:wrap}
h2,.card h2{font-family:var(--font-display);font-size:11px;font-weight:600;line-height:1.15;
text-transform:uppercase;letter-spacing:2px;color:var(--text-muted);margin:0 0 var(--space-2)}
button{font:inherit;cursor:pointer;border-radius:6px;padding:7px 12px;
button{border-radius:0;font:inherit;cursor:pointer;padding:7px 12px;
background:var(--navy-700);color:var(--text);border:1px solid #1E2A4E}
button:hover:not(:disabled){background:var(--navy-600)}
button:disabled{opacity:.4;cursor:default}
select,input[type=text]{font:inherit;color:var(--text);background:var(--navy-900);
border:1px solid #1E2A4E;border-radius:6px;padding:6px 8px}
select,input[type=text]{border-radius:0;font:inherit;color:var(--text);background:var(--navy-900);
border:1px solid #1E2A4E;padding:6px 8px}
input[type=text]{min-width:320px;padding:8px 10px}
.grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--space-4)}
.card{background:var(--navy-800);border:1px solid var(--border);border-radius:8px;
.card{background:var(--navy-800);border:1px solid var(--border);border-radius:0;
padding:var(--space-4);min-height:96px}
.card.drag{outline:1px dashed var(--cyan-400);outline-offset:2px}
.card .big{font-family:var(--font-display);font-size:28px;font-weight:700;letter-spacing:-.5px}
@@ -480,17 +495,43 @@ th{font-family:var(--font-display);font-size:11px;font-weight:600;text-transform
table.kv th{width:220px;color:var(--text-muted);font-weight:600;text-transform:none;
letter-spacing:0;font-family:var(--font-body);font-size:var(--text-sm)}
.muted{color:var(--text-muted)}
pre{background:var(--navy-900);border:1px solid var(--border);border-radius:8px;
.section{display:flex;flex-direction:column;gap:var(--space-2)}
.section__title{font-family:var(--font-display);font-size:11px;font-weight:600;line-height:1.15;
text-transform:uppercase;letter-spacing:2px;color:var(--text-muted);margin:0;
padding-bottom:var(--space-2);border-bottom:1px solid var(--border)}
pre{background:var(--navy-900);border:1px solid var(--border);border-radius:0;
padding:var(--space-4);overflow:auto;max-height:60vh;
font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace}
/* Off-canvas below 901px, reopened by the fragment so it works without a
script, exactly as portal.css does it. */
.rail__close{display:none;margin-left:var(--space-2);background:transparent;border:0;
color:#9AA5BB;font-size:16px;line-height:1;padding:6px;cursor:pointer}
.rail__close:hover{color:#E6ECF5}
.rail-backdrop{display:none}
@media (max-width:900px){
.shell{display:block}
.rail{position:fixed;inset:0 auto 0 0;transform:translateX(-100%);z-index:60}
/* Full-screen drawer, as the design's mobile menu: page background, its own
top bar with the brand and a close, rows split by 1px dividers. */
.rail{position:fixed;inset:0;width:100%;max-width:none;transform:translateX(-100%);
z-index:60;background:var(--navy-900);border-right:0}
.rail:target{transform:none}
body.drawer-open .rail{transform:none}
body.drawer-open{overflow:hidden}
body.drawer-open .rail-backdrop{display:block;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:55}
.rail__head{min-height:56px;padding:0 var(--space-4);border-bottom:1px solid var(--border)}
.rail__brand{font-size:18px}
.rail__toggle{display:none}
.rail__close{display:inline-flex}
.rail__link{padding:var(--space-4);border-bottom:1px solid var(--border);border-left:0}
.rail__link[aria-current='page']{border-left:0;background:rgba(255,255,255,.06)}
.tree__leaf{padding:var(--space-4) var(--space-4) var(--space-4) calc(var(--space-4) * 2);min-height:48px}
.appbar__menu{display:inline-flex}
.appbar{padding:0 var(--space-4)}
.frame{padding:var(--space-4)}
.grid{grid-template-columns:1fr}
.span2,.span3,.span4{grid-column:span 1}
}
"#;
@@ -507,6 +548,25 @@ function poll(){fetch("/api/summary").then(function(r){return r.json()}).then(fu
}).catch(function(){var el=$("live"); if(el){el.textContent="offline"; el.className="pill bad"}})}
setInterval(poll,5000); poll();
// Mobile drawer. The rail is full-screen below 901px; Menu opens it and the
// close control, the backdrop or Escape puts it away. Without a script the
// :target fragment still opens it, which is why the Menu link is an anchor.
(function(){
var body=document.body;
var menu=document.querySelector(".appbar__menu");
var close=document.querySelector(".rail__close");
var backdrop=document.getElementById("rail-backdrop");
function open(){body.classList.add("drawer-open")}
function shut(){body.classList.remove("drawer-open")}
if(menu)menu.addEventListener("click",function(e){e.preventDefault();open()});
if(close)close.addEventListener("click",function(e){e.preventDefault();shut()});
if(backdrop)backdrop.addEventListener("click",shut);
document.addEventListener("keydown",function(e){if(e.key==="Escape")shut()});
document.querySelectorAll(".rail__link").forEach(function(link){
link.addEventListener("click",function(){shut()});
});
})();
// Rail collapse. The state is remembered so a reload keeps the operator's
// choice; the button is the only control that needs a script.
(function(){
+88 -2
View File
@@ -251,8 +251,23 @@ fn route(stream: &mut TcpStream, status: &MiningStatus, request: &Request) -> io
&ui::table_page(&["fan", "zones it cools"], &rows),
)
}
("GET", "/settings/system") => html(stream, "System", &ui::kv_page(&system_rows())),
("GET", "/settings/drivers") => html(stream, "Drivers", &ui::kv_page(&driver_rows(status))),
("GET", "/settings/system") => html(
stream,
"System",
&ui::sections_page(&[
("Identity", ui::kv_page(&system_rows())),
("Network", ui::kv_page(&network_rows())),
("Updates", ui::kv_page(&update_rows())),
]),
),
("GET", "/settings/drivers") => html(
stream,
"Drivers",
&ui::sections_page(&[
("Chains", ui::kv_page(&driver_rows(status))),
("Firmware", ui::kv_page(&update_rows())),
]),
),
("GET", "/settings/security") => html(stream, "Security", &ui::kv_page(&security_rows())),
("GET", "/settings/services") => html(
stream,
@@ -453,6 +468,77 @@ fn system_rows() -> Vec<(&'static str, String)> {
]
}
fn network_rows() -> Vec<(&'static str, String)> {
let mut rows: Vec<(&'static str, String)> = Vec::new();
if let Ok(text) = fs::read_to_string("/proc/net/route") {
let default: Vec<String> = text
.lines()
.skip(1)
.filter_map(|line| {
let mut fields = line.split_whitespace();
let iface = fields.next()?.to_string();
let dest = fields.next().unwrap_or("");
if dest == "00000000" {
Some(iface)
} else {
None
}
})
.collect();
rows.push((
"default route",
if default.is_empty() {
"none".into()
} else {
default.join(", ")
},
));
}
for iface in ["eth0", "wlan0"] {
if let Ok(text) = fs::read_to_string("/proc/net/dev") {
if let Some(line) = text.lines().find(|l| l.trim_start().starts_with(iface)) {
let counters: Vec<&str> = line.split_whitespace().collect();
if counters.len() > 9 {
rows.push((
iface,
format!("rx {} bytes, tx {} bytes", counters[1], counters[9]),
));
}
}
}
}
rows.push((
"ssh",
if running("dropbear") {
"listening".into()
} else {
"not running".into()
},
));
rows
}
fn update_rows() -> Vec<(&'static str, String)> {
vec![
(
"image",
read_trim("/etc/alkane-version").unwrap_or_else(|| "alkane-os".into()),
),
(
"kernel",
read_trim("/proc/sys/kernel/osrelease").unwrap_or_else(|| "unknown".into()),
),
(
"binary",
read_trim("/etc/alkane-build").unwrap_or_else(|| "unknown".into()),
),
(
"update channel",
"manual (no updater installed yet)".to_string(),
),
]
}
fn driver_rows(status: &MiningStatus) -> Vec<(&'static str, String)> {
let hw = status.hardware_document();
vec![