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
4 changed files with 689 additions and 427 deletions
|
|
@ -48,12 +48,6 @@
|
|||
.ui-tryout-classification-row > button {
|
||||
flex: none;
|
||||
}
|
||||
.ui-tryout-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.75em;
|
||||
}
|
||||
.ui-tryout-hint {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,11 @@
|
|||
import { useEffect, 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 { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js";
|
||||
import { Disclosure } from "../../ui/disclosure/Disclosure.js";
|
||||
import { ExternalLink } from "../../ui/external-link/ExternalLink.js";
|
||||
import { Panel } from "../../ui/panel/Panel.js";
|
||||
import { TextField } from "../../ui/text-field/TextField.js";
|
||||
import { ClassificationEditor } from "./ClassificationEditor.js";
|
||||
|
|
@ -396,7 +398,7 @@ export function ReviewTryOut() {
|
|||
}
|
||||
/>
|
||||
))}
|
||||
<div class="ui-tryout-actions">
|
||||
<ActionRow class="ui-tryout-actions">
|
||||
<Button
|
||||
onClick={() => setDrafts((ds) => [...ds, blankDraft()])}
|
||||
disabled={capProblem !== null}
|
||||
|
|
@ -419,7 +421,7 @@ export function ReviewTryOut() {
|
|||
>
|
||||
{opening ? "pushing…" : "open a PR"}
|
||||
</Button>
|
||||
</div>
|
||||
</ActionRow>
|
||||
{capProblem !== null ? (
|
||||
<p id={CAP_ID} class="ui-tryout-hint">
|
||||
{capProblem}
|
||||
|
|
@ -440,9 +442,9 @@ export function ReviewTryOut() {
|
|||
<p class="ui-tryout-loaded">
|
||||
Pushed <code>{opened.branch}</code> to {opened.repo}, changing{" "}
|
||||
<code>{opened.path}</code> with you as the author.{" "}
|
||||
<a href={opened.compare_url} target="_blank" rel="noopener">
|
||||
<ExternalLink href={opened.compare_url}>
|
||||
Open the PR on the forge
|
||||
</a>
|
||||
</ExternalLink>
|
||||
.
|
||||
</p>
|
||||
) : null}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/* A finished run's table, the overall verdict under it and the head commit. */
|
||||
.ui-tryout-row-error {
|
||||
color: var(--red);
|
||||
}
|
||||
.ui-tryout-overall,
|
||||
.ui-tryout-sha {
|
||||
margin: 0.75em 0 0;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// (`docs/swarm/review-classifier.md`); no token
|
||||
// counts, cache counts or cost, here or anywhere in the UI.
|
||||
import { Badge } from "@hive/shared/badge.js";
|
||||
import { Hint } from "../../ui/hint/Hint.js";
|
||||
import { Table, type TableColumn } from "../../ui/table/Table.js";
|
||||
import type { TryOutResult as Result, TryOutRow } from "./TryOutTypes.js";
|
||||
import "./TryOutResult.css";
|
||||
|
|
@ -42,7 +43,13 @@ const COLUMNS: TableColumn<TryOutRow>[] = [
|
|||
cellClass: "ui-table-prose",
|
||||
// A row that could not run says why where the reason would be.
|
||||
render: (r) =>
|
||||
r.error ? <span class="ui-tryout-row-error">{r.error}</span> : r.reason,
|
||||
r.error ? (
|
||||
<Hint tone="error" as="span" class="ui-tryout-row-error">
|
||||
{r.error}
|
||||
</Hint>
|
||||
) : (
|
||||
r.reason
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue