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
6 changed files with 689 additions and 427 deletions
|
|
@ -29,8 +29,5 @@
|
|||
overflow-wrap: anywhere;
|
||||
}
|
||||
.ui-schedule-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5em;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
// fires next. Edit, pause/resume and remove sit at the foot; edit swaps the
|
||||
// card for `ScheduleForm` (the page owns that swap).
|
||||
import { Badge, type BadgeTone } from "@hive/shared/badge.js";
|
||||
import { ActionRow } from "../../ui/action-row/ActionRow.js";
|
||||
import { Button } from "../../ui/button/Button.js";
|
||||
import { Card } from "../../ui/card/Card.js";
|
||||
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
|
||||
|
|
@ -72,7 +73,7 @@ export function ScheduleCard({
|
|||
</>
|
||||
)}
|
||||
</div>
|
||||
<div class="ui-schedule-card-actions">
|
||||
<ActionRow align="end" class="ui-schedule-card-actions">
|
||||
<Button onClick={onEdit} disabled={pending}>
|
||||
edit
|
||||
</Button>
|
||||
|
|
@ -82,7 +83,7 @@ export function ScheduleCard({
|
|||
<Button onClick={onRemove} disabled={pending}>
|
||||
remove
|
||||
</Button>
|
||||
</div>
|
||||
</ActionRow>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,17 +30,11 @@
|
|||
flex: 1 1 9em;
|
||||
}
|
||||
.ui-schedule-form-hint {
|
||||
margin: 0;
|
||||
font-size: 0.85em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.ui-schedule-form-warn {
|
||||
margin: 0;
|
||||
font-size: 0.85em;
|
||||
color: var(--yellow);
|
||||
}
|
||||
.ui-schedule-form-actions {
|
||||
display: flex;
|
||||
gap: 0.5em;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@
|
|||
import { useState } from "preact/hooks";
|
||||
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 { Hint } from "../../ui/hint/Hint.js";
|
||||
import {
|
||||
MultiselectFilterOptions,
|
||||
type MultiselectFilterState,
|
||||
|
|
@ -190,11 +192,11 @@ export function ScheduleForm({
|
|||
<div class="ui-schedule-form-agents">
|
||||
<span class="ui-form-field-label">agents</span>
|
||||
{agentOptions.length === 0 ? (
|
||||
<span class="ui-schedule-form-hint">
|
||||
<Hint as="span" class="ui-schedule-form-hint">
|
||||
{agentsError
|
||||
? `could not load the agent list: ${agentsError}`
|
||||
: "no agents to pick from"}
|
||||
</span>
|
||||
</Hint>
|
||||
) : (
|
||||
<MultiselectFilterOptions
|
||||
options={agentOptions}
|
||||
|
|
@ -250,22 +252,22 @@ export function ScheduleForm({
|
|||
/>
|
||||
</div>
|
||||
{fires.length > 0 ? (
|
||||
<p class="ui-schedule-form-hint">
|
||||
<Hint class="ui-schedule-form-hint">
|
||||
{repeat ? "next fires: " : "fires: "}
|
||||
{fires.map(fmtLocal).join(" · ")}
|
||||
</p>
|
||||
</Hint>
|
||||
) : null}
|
||||
{startInPast && (original === undefined || startChanged) ? (
|
||||
<p class="ui-schedule-form-hint">
|
||||
<Hint class="ui-schedule-form-hint">
|
||||
That start is in the past: saving fires the latest missed time once,
|
||||
right away, in every agent chosen.
|
||||
</p>
|
||||
</Hint>
|
||||
) : null}
|
||||
{cadenceChanged ? (
|
||||
<p class="ui-schedule-form-warn">
|
||||
<Hint tone="warn" class="ui-schedule-form-warn">
|
||||
Changing the start or the repeat moves when this schedule fires.
|
||||
Editing only the name, message or agents does not.
|
||||
</p>
|
||||
</Hint>
|
||||
) : null}
|
||||
{error ? (
|
||||
<ApiErrorPanel
|
||||
|
|
@ -273,7 +275,7 @@ export function ScheduleForm({
|
|||
problem={error}
|
||||
/>
|
||||
) : null}
|
||||
<div class="ui-schedule-form-actions">
|
||||
<ActionRow align="end" class="ui-schedule-form-actions">
|
||||
<Button onClick={onCancel}>cancel</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
|
|
@ -282,7 +284,7 @@ export function ScheduleForm({
|
|||
>
|
||||
{saving ? "saving…" : original ? "save" : "create"}
|
||||
</Button>
|
||||
</div>
|
||||
</ActionRow>
|
||||
</form>
|
||||
</Card>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
/* The bar at the top of the schedules card: the add button, then the refresh
|
||||
picker, to the right. */
|
||||
.ui-schedules-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 0.5em 0.75em;
|
||||
margin-block-end: 0.5em;
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
|
|||
import { Button } from "../../ui/button/Button.js";
|
||||
import { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js";
|
||||
import { FilterableView } from "../../ui/filterable-view/FilterableView.js";
|
||||
import "./SchedulesPage.css";
|
||||
import { Toolbar } from "../../ui/toolbar/Toolbar.js";
|
||||
import { LazyDisclosure } from "../../ui/disclosure/LazyDisclosure.js";
|
||||
import {
|
||||
RefreshIntervalPicker,
|
||||
|
|
@ -152,7 +152,7 @@ function SchedulesBody() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<div class="ui-schedules-bar">
|
||||
<Toolbar>
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() => setCreating(true)}
|
||||
|
|
@ -166,7 +166,7 @@ function SchedulesBody() {
|
|||
onChange={setIntervalMs}
|
||||
refreshing={schedulesRefreshing || rosterRefreshing}
|
||||
/>
|
||||
</div>
|
||||
</Toolbar>
|
||||
{error ? (
|
||||
<ApiErrorPanel context="failed to load the schedules" problem={error} />
|
||||
) : null}
|
||||
|
|
|
|||
Loading…
Reference in a new issue