frontend: one tone vocabulary for badges, hints, banners and toasts
Part of the unification order in the UI sweep issue (step b). A badge named its tones positive/warning/negative, a hint muted/warn/error/ok, a banner info/warning/error and a toast info/ok/error. They now all take the shared Tone: neutral, info, ok, warn, error (a badge adds accent for a selected choice). Warn is amber everywhere (a hint used yellow), info is cyan everywhere (a toast used purple). A test pins the list against each component's CSS.
This commit is contained in:
parent
c205c6115b
commit
25965341e0
11 changed files with 164 additions and 86 deletions
|
|
@ -89,13 +89,13 @@ export function isUpdating(row: Pick<AgentRow, "snapshot">): boolean {
|
|||
// actionable meaning.
|
||||
export const FRESHNESS: Record<Freshness, { tone: BadgeTone; label: string }> =
|
||||
{
|
||||
fresh: { tone: "positive", label: "fresh" },
|
||||
stale: { tone: "warning", label: "stale" },
|
||||
fresh: { tone: "ok", label: "fresh" },
|
||||
stale: { tone: "warn", label: "stale" },
|
||||
never_reported: { tone: "neutral", label: "never reported" },
|
||||
// `unknown` means the agent reported into the KV bucket but isn't in
|
||||
// the swarm-identity roster — a real, distinct case ("hive-reported,
|
||||
// not yet in swarm level"), not just a fallback default, so it gets a
|
||||
// label that says what to do about it rather than reusing the enum
|
||||
// name as the label.
|
||||
unknown: { tone: "negative", label: "not in swarm identity" },
|
||||
unknown: { tone: "error", label: "not in swarm identity" },
|
||||
};
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export function AgentApiKey({ hive, agent }: { hive: string; agent: string }) {
|
|||
<Badge
|
||||
label="API key"
|
||||
value={stored ? "stored" : "none"}
|
||||
tone={stored ? "positive" : "neutral"}
|
||||
tone={stored ? "ok" : "neutral"}
|
||||
/>{" "}
|
||||
</>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ export function AgentIdentity({
|
|||
<AgentStateRow key={row.name} agent={row.name} />
|
||||
{showsLoginNeeded(row) ? (
|
||||
<Badge
|
||||
tone="warning"
|
||||
tone="warn"
|
||||
value="login needed"
|
||||
title="the agent's claude has no session; its turns wait until it is logged in (log in under inference)"
|
||||
/>
|
||||
|
|
@ -117,7 +117,7 @@ export function AgentIdentity({
|
|||
) : null}
|
||||
{row.config_pr ? (
|
||||
<Badge
|
||||
tone="warning"
|
||||
tone="warn"
|
||||
value={
|
||||
<>
|
||||
config PR{" "}
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ export function AgentInternet({ agent, g }: { agent: string; g: GrantState }) {
|
|||
<BadgePopover
|
||||
label="internet"
|
||||
value={internetSummary(grant.unrestricted_internet, grant.internet_log)}
|
||||
tone={mode === "restricted" ? "neutral" : "warning"}
|
||||
tone={mode === "restricted" ? "neutral" : "warn"}
|
||||
title={`how far ${agent}'s traffic may leave the host`}
|
||||
popoverLabel={`${agent} internet access`}
|
||||
>
|
||||
|
|
@ -359,7 +359,7 @@ export function AgentRepos({ agent, g }: { agent: string; g: GrantState }) {
|
|||
<BadgePopover
|
||||
label="repositories"
|
||||
value={reposSummary(grant.max_repos)}
|
||||
tone={stored === 0 ? "neutral" : "warning"}
|
||||
tone={stored === 0 ? "neutral" : "warn"}
|
||||
title={`how many repositories ${agent}'s forge account may create`}
|
||||
popoverLabel={`${agent} repository limit`}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export function AgentSsh({ agent, g }: { agent: string; g: GrantState }) {
|
|||
<BadgePopover
|
||||
label="ssh"
|
||||
value={sshSummary(grant.ssh)}
|
||||
tone={on ? "warning" : "neutral"}
|
||||
tone={on ? "warn" : "neutral"}
|
||||
title={`whether ${agent} may get SSH certificates from the swarm`}
|
||||
popoverLabel={`${agent} SSH access`}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export function AgentCard({
|
|||
) : null}
|
||||
{hivePauseReason(row) !== null ? (
|
||||
<Badge
|
||||
tone="warning"
|
||||
tone="warn"
|
||||
value="paused by hive"
|
||||
title={`the hive paused this agent: ${hivePauseReason(row)}. Set it up again to resume it.`}
|
||||
/>
|
||||
|
|
@ -162,7 +162,7 @@ export function AgentCard({
|
|||
{...inert}
|
||||
>
|
||||
<Badge
|
||||
tone="warning"
|
||||
tone="warn"
|
||||
value="login needed"
|
||||
title="the agent's claude has no session; its turns wait until it is logged in"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ export function WantedMenu({
|
|||
const canDeclare = !!row.hive && !destroyed && !undeclared;
|
||||
const tone: BadgeTone =
|
||||
row.wanted === "up"
|
||||
? "positive"
|
||||
? "ok"
|
||||
: row.wanted === "paused"
|
||||
? "warning"
|
||||
? "warn"
|
||||
: destroyed
|
||||
? "negative"
|
||||
? "error"
|
||||
: "neutral";
|
||||
const options: DropdownOption[] = [
|
||||
{ value: "up", label: "up" },
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
const TURN_STATE_TONE: Record<string, BadgeTone> = {
|
||||
idle: "neutral",
|
||||
thinking: "accent",
|
||||
compacting: "warning",
|
||||
compacting: "warn",
|
||||
};
|
||||
|
||||
export function tokenTotal(u: TokenUsage | null): number | null {
|
||||
|
|
@ -73,7 +73,7 @@ export function StateBadges({
|
|||
own doc), never "offline"/"destroyed" — a stopped or
|
||||
destroyed agent publishes nothing at all. */}
|
||||
{header.agent_state !== "up" && (
|
||||
<Badge tone="warning" value={header.agent_state} />
|
||||
<Badge tone="warn" value={header.agent_state} />
|
||||
)}
|
||||
{withModel &&
|
||||
(agent === undefined ? (
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function BashTasksMenu({ agentName }: { agentName: string }) {
|
|||
<Badge
|
||||
icon={<TerminalIcon />}
|
||||
value={running}
|
||||
tone={running > 0 ? "positive" : "neutral"}
|
||||
tone={running > 0 ? "ok" : "neutral"}
|
||||
ariaLabel={label}
|
||||
title={`${label}: ${open ? "close" : "open"} ${agentName}'s bash tasks`}
|
||||
expanded={open}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export function CancelTurnBadge({
|
|||
if (state.status === "error") {
|
||||
return (
|
||||
<Badge
|
||||
tone="negative"
|
||||
tone="error"
|
||||
value={`cancel failed: ${state.detail}`}
|
||||
title="try cancelling again"
|
||||
onClick={cancel}
|
||||
|
|
@ -72,7 +72,7 @@ export function CancelTurnBadge({
|
|||
if (!canCancel(turnState)) return null;
|
||||
return (
|
||||
<Badge
|
||||
tone="warning"
|
||||
tone="warn"
|
||||
value={state.status === "cancelling" ? "cancelling…" : "cancel turn"}
|
||||
title="stop the agent's current turn"
|
||||
onClick={state.status === "cancelling" ? undefined : cancel}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ export function SubagentsMenu({
|
|||
<Badge
|
||||
icon={<SubagentsIcon />}
|
||||
value={running.length}
|
||||
tone={running.length > 0 ? "positive" : "neutral"}
|
||||
tone={running.length > 0 ? "ok" : "neutral"}
|
||||
ariaLabel={runningLabel(running.length)}
|
||||
title={`${runningLabel(running.length)}: ${open ? "close" : "open"} ${agentName}'s subagents`}
|
||||
expanded={open}
|
||||
|
|
|
|||
Loading…
Reference in a new issue