swarm ui: the terminal's status badges overhaul
The connection is a light on the agent's icon instead of a "live" badge, the model and the effort are one badge, the context badge has an icon, subagents and a new bash tasks badge are an icon and a count, and an agent's tab shows a drag grip on hover. It also removes two things the overhaul replaces: the cost badge, and the "split" badge with its menu in group panes (splitting is by dragging a tab, or from the subagents list).
This commit is contained in:
parent
e9e71a09ac
commit
3a846c8c45
2 changed files with 430 additions and 199 deletions
|
|
@ -75,6 +75,11 @@ export interface BadgeProps {
|
|||
disabled?: boolean;
|
||||
class?: string;
|
||||
title?: string;
|
||||
/**
|
||||
* The accessible name, when the visible text is not enough of one: a badge that
|
||||
* is an icon and a number, say.
|
||||
*/
|
||||
ariaLabel?: string;
|
||||
}
|
||||
|
||||
export function Badge({
|
||||
|
|
@ -88,6 +93,7 @@ export function Badge({
|
|||
disabled,
|
||||
class: extraClass,
|
||||
title,
|
||||
ariaLabel,
|
||||
}: BadgeProps) {
|
||||
// `disabled` alone still means "button, just not clickable right
|
||||
// now" — see the prop's own doc above for why this can't just check
|
||||
|
|
@ -123,6 +129,7 @@ export function Badge({
|
|||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
aria-expanded={expanded}
|
||||
aria-label={ariaLabel}
|
||||
title={title}
|
||||
>
|
||||
{content}
|
||||
|
|
@ -130,7 +137,7 @@ export function Badge({
|
|||
);
|
||||
}
|
||||
return (
|
||||
<span class={classes} title={title}>
|
||||
<span class={classes} title={title} aria-label={ariaLabel}>
|
||||
{content}
|
||||
</span>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
// when `SettingsMenu` was extracted into `@hive/shared`, undoing this
|
||||
// fix — restoring the SVG here, in the shared component this time,
|
||||
// fixes it for both pages at once instead of just one).
|
||||
import type { ComponentChildren } from "preact";
|
||||
|
||||
export function GearIcon() {
|
||||
return (
|
||||
<svg
|
||||
|
|
@ -167,3 +169,77 @@ export function SendIcon() {
|
|||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
// The shared recipe of the line icons below: a 24-unit box, round strokes in
|
||||
// the text colour, so each reads as part of the same family.
|
||||
function LineIcon({ children }: { children: ComponentChildren }) {
|
||||
return (
|
||||
<svg
|
||||
width="1.15em"
|
||||
height="1.15em"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{children}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
/** A chip with pins: the model an agent runs on. */
|
||||
export function ChipIcon() {
|
||||
return (
|
||||
<LineIcon>
|
||||
<rect x="6" y="6" width="12" height="12" rx="2" />
|
||||
<rect x="10" y="10" width="4" height="4" />
|
||||
<path d="M9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3" />
|
||||
</LineIcon>
|
||||
);
|
||||
}
|
||||
|
||||
/** A dial: how full the context window is. */
|
||||
export function GaugeIcon() {
|
||||
return (
|
||||
<LineIcon>
|
||||
<path d="M4 17a8 8 0 1 1 16 0" />
|
||||
<path d="M12 17l4-5" />
|
||||
<circle cx="12" cy="17" r="1" />
|
||||
</LineIcon>
|
||||
);
|
||||
}
|
||||
|
||||
/** One node branching into two: the subagents an agent started. */
|
||||
export function SubagentsIcon() {
|
||||
return (
|
||||
<LineIcon>
|
||||
<circle cx="12" cy="5" r="2" />
|
||||
<circle cx="6" cy="19" r="2" />
|
||||
<circle cx="18" cy="19" r="2" />
|
||||
<path d="M12 7v4M12 11H6v6M12 11h6v6" />
|
||||
</LineIcon>
|
||||
);
|
||||
}
|
||||
|
||||
/** Six dots in two columns: the handle of something that can be dragged. */
|
||||
export function GripIcon() {
|
||||
return (
|
||||
<svg
|
||||
width="0.8em"
|
||||
height="1.15em"
|
||||
viewBox="0 0 10 16"
|
||||
fill="currentColor"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<circle cx="2.5" cy="3" r="1.3" />
|
||||
<circle cx="7.5" cy="3" r="1.3" />
|
||||
<circle cx="2.5" cy="8" r="1.3" />
|
||||
<circle cx="7.5" cy="8" r="1.3" />
|
||||
<circle cx="2.5" cy="13" r="1.3" />
|
||||
<circle cx="7.5" cy="13" r="1.3" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue