Watch
0
0
Fork
You've already forked hyperhive
0

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:
iris 2026-11-06 17:54:24 +01:00 • committed by mara
commit 8a2e5203ad
6 changed files with 689 additions and 427 deletions

View file

@ -1,6 +1,7 @@
// <Deliveries> — the notification router's recent deliveries, newest first.
// The router keeps the newest 500 rows; this shows what
// `GET /api/notify/deliveries` returns.
import { EmptyState } from "../../ui/empty-state/EmptyState.js";
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
import { Table, type TableColumn } from "../../ui/table/Table.js";
import { issueRef, outcomeText, type Delivery } from "./RouterLive.js";
@ -48,7 +49,7 @@ const COLUMNS: TableColumn<Row>[] = [
];
export function Deliveries({ rows }: { rows: Delivery[] }) {
if (rows.length === 0) return <p>no deliveries yet</p>;
if (rows.length === 0) return <EmptyState>no deliveries yet</EmptyState>;
const placed = rows.map((d, place) => ({ ...d, place }));
return (
<>

View file

@ -21,6 +21,7 @@ import {
type Edit,
type Limits,
} from "./FlowDraft.js";
import { Hint } from "../../ui/hint/Hint.js";
import { BoxFace, hitsText } from "./FlowBox.js";
import { layoutFlow, neighbour, nodeAt } from "./FlowLayout.js";
import { describeNode, ordinal, type Flow } from "./FlowTypes.js";
@ -282,7 +283,9 @@ export function FlowCanvas({
return (
<div class="notify-canvas-wrap">
<div class="notify-palette" role="group" aria-label="add a node">
<span class="notify-hint">add</span>
<Hint as="span" class="notify-hint">
add
</Hint>
{palette.map((p) => (
<button
key={p.kind}

View file

@ -22,7 +22,9 @@ import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
import { Button } from "../../ui/button/Button.js";
import { CheckboxField } from "../../ui/checkbox-field/CheckboxField.js";
import { ActionRow } from "../../ui/action-row/ActionRow.js";
import { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js";
import { Hint } from "../../ui/hint/Hint.js";
import { Panel } from "../../ui/panel/Panel.js";
import { TextField } from "../../ui/text-field/TextField.js";
import { fetchJson, ProblemError } from "../../ui/polled/usePolled.js";
@ -322,11 +324,11 @@ export function FlowEditorPage({
checked={draft.enabled}
onChange={(enabled) => setDraft({ ...draft, enabled })}
/>
<div class="notify-editor-actions">
<ActionRow class="notify-editor-actions">
{dirty ? (
<span class="notify-hint" role="status">
<Hint as="span" role="status" class="notify-hint">
not saved yet
</span>
</Hint>
) : null}
<Button
variant="primary"
@ -355,7 +357,7 @@ export function FlowEditorPage({
delete flow
</Button>
)}
</div>
</ActionRow>
</div>
{shown ? (
<p class="notify-hint" role="status">

View file

@ -2,9 +2,11 @@
// it: move it under another node, change when it runs among its siblings,
// remove it. Every change goes out as an `Edit` of the flow; the editor shows
// the reason when one is refused. New nodes come from the canvas palette.
import { ActionRow } from "../../ui/action-row/ActionRow.js";
import { Button } from "../../ui/button/Button.js";
import { Card } from "../../ui/card/Card.js";
import { CheckboxField } from "../../ui/checkbox-field/CheckboxField.js";
import { Hint } from "../../ui/hint/Hint.js";
import { SelectField } from "../../ui/select-field/SelectField.js";
import { TextAreaField } from "../../ui/text-area-field/TextAreaField.js";
import { TextField } from "../../ui/text-field/TextField.js";
@ -204,10 +206,10 @@ export function NodeInspector({
) : null}
{order.count > 1 ? (
<div class="notify-inspector-actions">
<span class="notify-hint">
<ActionRow class="notify-inspector-actions">
<Hint as="span" class="notify-hint">
runs {ordinal(order.index + 1)} of {order.count} below its parent
</span>
</Hint>
<Button
disabled={order.index === 0}
onClick={() => onEdit(moveAmongSiblings(flow, node.id, -1))}
@ -220,10 +222,10 @@ export function NodeInspector({
>
run later
</Button>
</div>
</ActionRow>
) : null}
<div class="notify-inspector-actions">
<ActionRow class="notify-inspector-actions">
{node.kind !== "source" ? (
<Button
onClick={() =>
@ -236,7 +238,7 @@ export function NodeInspector({
: ""}
</Button>
) : null}
</div>
</ActionRow>
{node.kind !== "source" && parent !== undefined ? (
<SelectField

View file

@ -27,9 +27,6 @@
.notify-flow-actions,
.notify-panel-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5em;
}
@ -53,9 +50,6 @@
}
.notify-editor-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5em;
margin-left: auto;
}
@ -250,8 +244,6 @@
}
.notify-inspector-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5em;
margin-bottom: 0.75em;
}

View file

@ -11,6 +11,7 @@ import { useState } from "preact/hooks";
import { useLocation } from "wouter-preact";
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
import { ActionRow } from "../../ui/action-row/ActionRow.js";
import { Button } from "../../ui/button/Button.js";
import { Card } from "../../ui/card/Card.js";
import { CheckboxField } from "../../ui/checkbox-field/CheckboxField.js";
@ -103,7 +104,7 @@ export function NotificationRouter() {
return (
<>
<div class="notify-panel-actions">
<ActionRow class="notify-panel-actions">
<RefreshIntervalPicker
id="notifications-refresh"
value={intervalMs}
@ -113,7 +114,7 @@ export function NotificationRouter() {
<Button variant="primary" onClick={() => draftFrom()}>
create flow
</Button>
</div>
</ActionRow>
{error ? (
<ApiErrorPanel context="failed to load the flows" problem={error} />
) : null}
@ -149,11 +150,11 @@ export function NotificationRouter() {
disabled={pending}
onChange={(checked) => setBuiltin(flow.id, checked)}
/>
<div class="notify-flow-actions">
<ActionRow class="notify-flow-actions">
<Button onClick={() => draftFrom(flow.id)}>
duplicate to edit
</Button>
</div>
</ActionRow>
</div>
<FlowGraph flow={flow} hits={hitsOf(shown, flow.id)} />
</Card>
@ -168,7 +169,7 @@ export function NotificationRouter() {
<span class="notify-flow-state">
{flow.enabled ? "on" : "off"}
</span>
<div class="notify-flow-actions">
<ActionRow class="notify-flow-actions">
<Button
onClick={() =>
navigate(`/notifications/${encodeURIComponent(flow.id)}`)
@ -177,7 +178,7 @@ export function NotificationRouter() {
edit
</Button>
<Button onClick={() => draftFrom(flow.id)}>duplicate</Button>
</div>
</ActionRow>
</div>
<FlowGraph flow={flow} hits={hitsOf(shown, flow.id)} />
</Card>