swarm-ui: shared Hint, ActionRow, Toolbar, EmptyState, ExternalLink and ExpandableCard replace per-page copies
Hint, ActionRow, Toolbar, EmptyState and ExternalLink replace the muted text, button row, refresh bar, empty line and _blank anchor that each page restyled under its own class. ExpandableCard (with a loading twin) holds the builds and recent-runs cards, which had identical head and body CSS. The create form's raw checkbox becomes CheckboxField. The components page shows each new piece.
This commit is contained in:
parent
b74b5e77e4
commit
8a2e5203ad
3 changed files with 689 additions and 427 deletions
|
|
@ -24,6 +24,7 @@ import {
|
|||
import { Button } from "../../ui/button/Button.js";
|
||||
import { LazyDisclosure } from "../../ui/disclosure/LazyDisclosure.js";
|
||||
import { Dialog } from "../../ui/dialog/Dialog.js";
|
||||
import { Hint } from "../../ui/hint/Hint.js";
|
||||
import "../../agent/detail/AgentLimits.css";
|
||||
import "./SwarmPage.css";
|
||||
|
||||
|
|
@ -61,13 +62,13 @@ function DomainSection({
|
|||
return (
|
||||
<section class="ui-swarm-egress-section">
|
||||
<h3 class="ui-swarm-egress-heading">{heading}</h3>
|
||||
<p class="ui-swarm-egress-help">{help}</p>
|
||||
<Hint class="ui-swarm-egress-help">{help}</Hint>
|
||||
{errorPanel}
|
||||
{entries === null ? (
|
||||
errorPanel === null ? (
|
||||
<span class="ui-agent-limits-muted" role="status">
|
||||
<Hint as="span" role="status">
|
||||
loading the {kind === "deny" ? "denied" : "allowed"} domains…
|
||||
</span>
|
||||
</Hint>
|
||||
) : null
|
||||
) : (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
import { useState } from "preact/hooks";
|
||||
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
|
||||
import { Badge, type BadgeTone } from "@hive/shared/badge.js";
|
||||
import { ExternalLink } from "../../ui/external-link/ExternalLink.js";
|
||||
import { LazyDisclosure } from "../../ui/disclosure/LazyDisclosure.js";
|
||||
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
||||
import {
|
||||
|
|
@ -25,6 +26,7 @@ import {
|
|||
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
|
||||
import { Table, type TableColumn } from "../../ui/table/Table.js";
|
||||
import { TableSkeleton } from "../../ui/table/TableSkeleton.js";
|
||||
import { Toolbar } from "../../ui/toolbar/Toolbar.js";
|
||||
import { domainCell } from "../hive-domain.js";
|
||||
|
||||
type Freshness = "fresh" | "stale" | "never_reported" | "unknown";
|
||||
|
|
@ -65,13 +67,7 @@ const COLUMNS: TableColumn<HiveStatus>[] = [
|
|||
render: (h) => {
|
||||
const { text, href } = domainCell(h);
|
||||
if (!text) return "—";
|
||||
return href ? (
|
||||
<a href={href} target="_blank" rel="noreferrer">
|
||||
{text}
|
||||
</a>
|
||||
) : (
|
||||
text
|
||||
);
|
||||
return href ? <ExternalLink href={href}>{text}</ExternalLink> : text;
|
||||
},
|
||||
sortBy: (h) => domainCell(h).text,
|
||||
filterValue: (h) => domainCell(h).text,
|
||||
|
|
@ -129,14 +125,14 @@ function HiveRoster() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<div class="ui-hives-refresh">
|
||||
<Toolbar>
|
||||
<RefreshIntervalPicker
|
||||
id="hives-refresh"
|
||||
value={intervalMs}
|
||||
onChange={setIntervalMs}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
</div>
|
||||
</Toolbar>
|
||||
{error ? (
|
||||
<ApiErrorPanel
|
||||
context="failed to load the hive roster"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,6 @@
|
|||
.ui-swarm-card {
|
||||
margin-block-end: 0.5em;
|
||||
}
|
||||
/* The roster's refresh picker, at the top right of the open card. */
|
||||
.ui-hives-refresh {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-block-end: 0.5em;
|
||||
}
|
||||
/* The warning at the top of the beta notification router card. */
|
||||
.ui-swarm-beta {
|
||||
margin: 0 0 0.75em;
|
||||
|
|
@ -20,7 +14,6 @@
|
|||
/* The egress card: the swarm-wide allowed domains, one per line. */
|
||||
.ui-swarm-egress-help {
|
||||
margin: 0 0 0.75em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.ui-swarm-egress-list {
|
||||
list-style: none;
|
||||
|
|
|
|||
Loading…
Reference in a new issue