From e283e399491043f19b684bc6255215b1b19511ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sun, 17 May 2026 11:47:45 +0200 Subject: [PATCH] css: route palette + body typography through hive-fr0nt::BASE_CSS --- Cargo.lock | 6 ++++++ hive-ag3nt/Cargo.toml | 1 + hive-ag3nt/assets/agent.css | 19 ++----------------- hive-ag3nt/src/web_ui.rs | 11 ++++++++--- hive-c0re/Cargo.toml | 1 + hive-c0re/assets/dashboard.css | 22 ++-------------------- hive-c0re/src/dashboard.rs | 11 ++++++++--- 7 files changed, 28 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca9b6f9..006f8fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -451,6 +451,7 @@ dependencies = [ "anyhow", "axum", "clap", + "hive-fr0nt", "hive-sh4re", "rmcp", "rusqlite", @@ -470,6 +471,7 @@ dependencies = [ "anyhow", "axum", "clap", + "hive-fr0nt", "hive-sh4re", "libc", "rusqlite", @@ -481,6 +483,10 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "hive-fr0nt" +version = "0.1.0" + [[package]] name = "hive-sh4re" version = "0.1.0" diff --git a/hive-ag3nt/Cargo.toml b/hive-ag3nt/Cargo.toml index f1a253e..5df9a20 100644 --- a/hive-ag3nt/Cargo.toml +++ b/hive-ag3nt/Cargo.toml @@ -10,6 +10,7 @@ workspace = true anyhow.workspace = true axum.workspace = true clap.workspace = true +hive-fr0nt.workspace = true hive-sh4re.workspace = true rmcp.workspace = true rusqlite.workspace = true diff --git a/hive-ag3nt/assets/agent.css b/hive-ag3nt/assets/agent.css index 0cf2227..9f6781c 100644 --- a/hive-ag3nt/assets/agent.css +++ b/hive-ag3nt/assets/agent.css @@ -1,24 +1,9 @@ -:root { - /* Catppuccin Mocha — mirrors the dashboard palette. */ - --bg: #1e1e2e; /* base */ - --bg-elev: #181825; /* mantle */ - --fg: #cdd6f4; /* text */ - --muted: #7f849c; /* overlay1 */ - --purple: #cba6f7; /* mauve */ - --purple-dim: #45475a; /* surface1 */ - --cyan: #89dceb; /* sky */ - --amber: #fab387; /* peach */ - --green: #a6e3a1; /* green */ - --red: #f38ba8; /* red */ -} +/* Palette + base body typography live in hive-fr0nt::BASE_CSS, prepended + to this stylesheet by `serve_css` at runtime. */ body { - background: var(--bg); - color: var(--fg); - font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace; max-width: 110em; margin: 1.5em auto; padding: 0 1.5em; - line-height: 1.6; } .banner { text-align: center; diff --git a/hive-ag3nt/src/web_ui.rs b/hive-ag3nt/src/web_ui.rs index 80a142f..81ac199 100644 --- a/hive-ag3nt/src/web_ui.rs +++ b/hive-ag3nt/src/web_ui.rs @@ -162,10 +162,15 @@ async fn serve_index() -> impl IntoResponse { } async fn serve_css() -> impl IntoResponse { - ( - [("content-type", "text/css")], + // Prepend the shared palette/typography so per-page styles only need + // to declare what's actually page-specific. One HTTP request, no + // per-asset cache to invalidate. + let body = format!( + "{}\n{}", + hive_fr0nt::BASE_CSS, include_str!("../assets/agent.css"), - ) + ); + ([("content-type", "text/css")], body) } async fn serve_app_js() -> impl IntoResponse { diff --git a/hive-c0re/Cargo.toml b/hive-c0re/Cargo.toml index 47ef2a8..a32e5d1 100644 --- a/hive-c0re/Cargo.toml +++ b/hive-c0re/Cargo.toml @@ -10,6 +10,7 @@ workspace = true anyhow.workspace = true axum.workspace = true clap.workspace = true +hive-fr0nt.workspace = true hive-sh4re.workspace = true libc = "0.2" rusqlite.workspace = true diff --git a/hive-c0re/assets/dashboard.css b/hive-c0re/assets/dashboard.css index 416a466..dd89399 100644 --- a/hive-c0re/assets/dashboard.css +++ b/hive-c0re/assets/dashboard.css @@ -1,27 +1,9 @@ -:root { - /* Catppuccin Mocha. Keep the legacy variable names so per-class styles - don't need to be rewritten — only the values change. */ - --bg: #1e1e2e; /* base */ - --bg-elev: #181825; /* mantle */ - --fg: #cdd6f4; /* text */ - --muted: #7f849c; /* overlay1 */ - --purple: #cba6f7; /* mauve */ - --purple-dim: #45475a; /* surface1 */ - --cyan: #89dceb; /* sky */ - --pink: #f5c2e7; /* pink */ - --amber: #fab387; /* peach */ - --green: #a6e3a1; /* green */ - --red: #f38ba8; /* red */ - --border: #313244; /* surface0 */ -} +/* Palette + base body typography live in hive-fr0nt::BASE_CSS, prepended + to this stylesheet by `serve_css` at runtime. */ body { - background: var(--bg); - color: var(--fg); - font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace; max-width: 70em; margin: 1.5em auto; padding: 0 1.5em; - line-height: 1.6; } .banner { text-align: center; diff --git a/hive-c0re/src/dashboard.rs b/hive-c0re/src/dashboard.rs index 5e3e594..023e02a 100644 --- a/hive-c0re/src/dashboard.rs +++ b/hive-c0re/src/dashboard.rs @@ -114,10 +114,15 @@ async fn serve_index() -> impl IntoResponse { } async fn serve_css() -> impl IntoResponse { - ( - [("content-type", "text/css")], + // Prepend the shared palette/typography so per-page styles only need + // to declare what's actually page-specific. One HTTP request, no + // per-asset cache to invalidate. + let body = format!( + "{}\n{}", + hive_fr0nt::BASE_CSS, include_str!("../assets/dashboard.css"), - ) + ); + ([("content-type", "text/css")], body) } async fn serve_app_js() -> impl IntoResponse {