From 16a5bff2b1751095b44fe91852acd8ca40442d42 Mon Sep 17 00:00:00 2001 From: iris Date: Thu, 19 Nov 2026 19:24:59 +0100 Subject: [PATCH] dashboard: action buttons use the swarm UI's button, with its danger tone and touch height Button.css moves to @hive/shared, a rename from swarm-ui/src/ui/button/Button.css to shared/src/button/Button.css; the swarm UI's Button imports it from there and the dashboard imports it too. The dashboard's own .btn rules and its eleven per-action colour modifiers are gone: the bulk action buttons, the per-row purge and the selection bar's clear are ui-button, destroy and purge are ui-button-danger, and all of them have the 2.75em height the dashboard buttons were under. The form() and addBulkButton helpers take a tone (danger or default) in place of a btn-* class. The danger variant is the one the confirmations PR adds, identical, so the two merge in either order. --- frontend/packages/dashboard/src/agents.js | 22 ++-- frontend/packages/dashboard/src/common.css | 115 +----------------- frontend/packages/dashboard/src/common.js | 12 +- frontend/packages/dashboard/src/dashboard.css | 10 -- frontend/packages/dashboard/src/index.html | 2 +- frontend/packages/dashboard/src/kept.js | 2 +- frontend/packages/shared/package.json | 1 + .../src/ui => shared/src}/button/Button.css | 0 .../swarm-ui/src/ui/button/Button.tsx | 2 +- 9 files changed, 26 insertions(+), 140 deletions(-) rename frontend/packages/{swarm-ui/src/ui => shared/src}/button/Button.css (100%) diff --git a/frontend/packages/dashboard/src/agents.js b/frontend/packages/dashboard/src/agents.js index daa78905e..a9b032990 100644 --- a/frontend/packages/dashboard/src/agents.js +++ b/frontend/packages/dashboard/src/agents.js @@ -4,7 +4,7 @@ // job-queue-rollup ops. See docs/4-implementation/web-ui/dashboard.md::Container row for the // rendering contract. -import { $, form, fmtAgeSecs } from "./common.js"; +import { $, buttonClass, form, fmtAgeSecs } from "./common.js"; import { el } from "@hive/shared/dom.js"; import { themedConfirm, themedToast } from "@hive/shared/modal.js"; import { h, render } from "preact"; @@ -731,7 +731,7 @@ export function renderSelectionBar(containers) { return `${label} not available — ${blockers.join(", ")} ${blockers.length === 1 ? "is" : "are"} blocking it`; } - addBulkButton(actions, "btn-restart", "↺ R3ST4RT", allRunning, selected, { + addBulkButton(actions, "default", "↺ R3ST4RT", allRunning, selected, { action: "/api/restart/", confirm: (names) => `restart ${names.length} agent${names.length === 1 ? "" : "s"} (${names.join(", ")})?`, @@ -743,7 +743,7 @@ export function renderSelectionBar(containers) { stoppedNames.map((n) => `\`${n}\` is stopped`), ), }); - addBulkButton(actions, "btn-stop", "■ ST0P", allRunning, selected, { + addBulkButton(actions, "default", "■ ST0P", allRunning, selected, { action: "/api/kill/", confirm: (names) => `stop ${names.length} agent${names.length === 1 ? "" : "s"} (${names.join(", ")})?`, @@ -754,7 +754,7 @@ export function renderSelectionBar(containers) { stoppedNames.map((n) => `\`${n}\` is already stopped`), ), }); - addBulkButton(actions, "btn-start", "▶ ST4RT", allStopped, selected, { + addBulkButton(actions, "default", "▶ ST4RT", allStopped, selected, { action: "/api/start/", confirm: (names) => `start ${names.length} agent${names.length === 1 ? "" : "s"} (${names.join(", ")})?`, @@ -763,7 +763,7 @@ export function renderSelectionBar(containers) { runningNames.map((n) => `\`${n}\` is already running`), ), }); - addBulkButton(actions, "btn-pause", "⏸ P4US3", allUnpaused, selected, { + addBulkButton(actions, "default", "⏸ P4US3", allUnpaused, selected, { action: "/api/pause/", confirm: (names) => `pause ${names.length} agent${names.length === 1 ? "" : "s"} (${names.join(", ")})? parks the turn loop — inbox messages queue unacked.`, @@ -772,7 +772,7 @@ export function renderSelectionBar(containers) { pausedNames.map((n) => `\`${n}\` is already paused`), ), }); - addBulkButton(actions, "btn-resume", "▶ R3SUM3", allPaused, selected, { + addBulkButton(actions, "default", "▶ R3SUM3", allPaused, selected, { action: "/api/resume/", confirm: (names) => `resume ${names.length} agent${names.length === 1 ? "" : "s"} (${names.join(", ")})? the turn loop restarts and drains queued messages.`, @@ -781,17 +781,17 @@ export function renderSelectionBar(containers) { unpausedNames.map((n) => `\`${n}\` is not paused`), ), }); - addBulkButton(actions, "btn-rebuild", "↻ R3BU1LD", true, selected, { + addBulkButton(actions, "default", "↻ R3BU1LD", true, selected, { action: "/api/rebuild/", confirm: (names) => `rebuild ${names.length} agent${names.length === 1 ? "" : "s"} (${names.join(", ")})? hot-reloads each container.`, }); - addBulkButton(actions, "btn-destroy", "DESTR0Y", true, selected, { + addBulkButton(actions, "danger", "DESTR0Y", true, selected, { action: "/api/destroy/", confirm: (names) => `destroy ${names.length} agent${names.length === 1 ? "" : "s"} (${names.join(", ")})? containers are removed; state + creds kept.`, }); - addBulkButton(actions, "btn-destroy", "PURG3", true, selected, { + addBulkButton(actions, "danger", "PURG3", true, selected, { action: "/api/destroy/", body: { purge: "on" }, confirm: (names) => @@ -799,13 +799,13 @@ export function renderSelectionBar(containers) { }); } -function addBulkButton(parent, btnClass, label, enabled, selected, opts) { +function addBulkButton(parent, tone, label, enabled, selected, opts) { const names = selected.map((c) => c.name); const btn = el( "button", { type: "button", - class: "btn " + btnClass, + class: buttonClass(tone), }, label, ); diff --git a/frontend/packages/dashboard/src/common.css b/frontend/packages/dashboard/src/common.css index e548e8272..fa03f0b02 100644 --- a/frontend/packages/dashboard/src/common.css +++ b/frontend/packages/dashboard/src/common.css @@ -1,6 +1,7 @@ /* Shared Catppuccin palette + body typography + terminal pane styles. Bundled in front of the page-specific rules via esbuild. */ @import "@hive/shared/base.css"; +@import "@hive/shared/button.css"; @import "@hive/shared/terminal.css"; @import "@hive/shared/tabs.css"; /* Shared pill/chip/badge shape (the "extract pill component" issue, @@ -128,120 +129,6 @@ code { border-color: var(--amber); } -/* ─── buttons ─────────────────────────────────────────────────────── - .btn base + semantic colour/size modifiers. */ -.btn { - font-family: inherit; - font-weight: bold; - text-transform: uppercase; - letter-spacing: 0.1em; - background: transparent; - /* Strip browser UA button chrome (solid fill, system text colour). - Without this, native