Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: an open agent's details close with a cross in the identity card

The "← agents" button sat on a row of its own above the card and read as a
stray control, and "back" was the wrong word beside a visible list. The card's
top line now ends in a close cross (the shared Badge with the close icon, as in
the group page's panes), at every width. A name the roster doesn't have keeps
the "← agents" button, since there is no card to carry the cross.
This commit is contained in:
iris 2026-11-27 23:10:45 +01:00
commit c0f6118c78
6 changed files with 46 additions and 28 deletions

View file

@ -152,10 +152,11 @@ the right, which scroll on their own while the list stays in view, and the
selected card gets a purple border and fill. The page spreads to 160em for the
two columns, so a wide screen shows more of the details. The widths animate, and
stand still where motion is off. A screen narrower than 60em has room for one
column, so the details replace the list. At any width, the **← agents** button
above the details shuts them and the list takes the width again, and focus
column, so the details replace the list. At any width, the **✕** at the end of the identity
card's top line shuts the details and the list takes the width again, and focus
returns to the agent's card. A name the roster doesn't have, from a stale link,
shows "no agent named …" and the same button. The filter card, which also holds
shows "no agent named …" and a **← agents** button, since there is no card to
carry the cross. The filter card, which also holds
the **+ agent** button and the refresh picker, filters by name, hive, status,
message and wanted state.
While an agent is open the list is a column with no room for them side by side,

View file

@ -192,9 +192,12 @@ export function AgentDetail({
actions,
withTerminal = false,
showName = true,
onClose,
}: {
row: AgentRow;
actions: AgentActions;
/** A close cross in the identity card; omit it where something else closes the details. */
onClose?: () => void;
/** Add the live terminal and the activity (todos, subagents, background tasks) sections. */
withTerminal?: boolean;
/** Draw the icon and name in the identity card: off where a header names the agent. */
@ -202,7 +205,12 @@ export function AgentDetail({
}) {
return (
<div class="ui-agent-detail ui-agent-detail-sections">
<AgentIdentity row={row} actions={actions} showName={showName} />
<AgentIdentity
row={row}
actions={actions}
showName={showName}
onClose={onClose}
/>
{sectionsFor(withTerminal).map((section) => (
<LazyDisclosure
key={section}

View file

@ -9,6 +9,7 @@
// page's popover), which leaves the icon and name out and the rest as is.
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { Badge } from "@hive/shared/badge.js";
import { CloseIcon } from "@hive/shared/icons.js";
import { Button } from "../../ui/button/Button.js";
import { Card } from "../../ui/card/Card.js";
import { ExternalLink } from "../../ui/external-link/ExternalLink.js";
@ -32,10 +33,13 @@ export function AgentIdentity({
row,
actions,
showName = true,
onClose,
}: {
row: AgentRow;
actions: AgentActions;
showName?: boolean;
/** Given, a close cross ends the line: the details take the agents page's column. */
onClose?: () => void;
}) {
const { tone, label } = FRESHNESS[row.freshness];
const declareError = actions.actionErrors.get(row.name);
@ -70,6 +74,14 @@ export function AgentIdentity({
onDestroy={actions.requestDestroy}
/>
</span>
{onClose ? (
<Badge
value={<CloseIcon />}
ariaLabel={`close ${row.name}'s details`}
title="close: back to the agents"
onClick={onClose}
/>
) : null}
</div>
<div class="ui-agent-identity-badges">
<Badge

View file

@ -1,22 +1,12 @@
/* <AgentDetailPane>: the back button, then the agent's details. */
/* <AgentDetailPane>: the agent's details, or the note for a name that has none. */
.agent-detail-pane {
display: flex;
flex-direction: column;
gap: 0.75em;
}
/* The way back from a missing agent is a plain button, as wide as its label. */
.agent-detail-pane-back {
appearance: none;
background: none;
border: 0;
padding: 0.5em 0;
min-height: 2.75em;
color: var(--muted);
font: inherit;
cursor: pointer;
}
.agent-detail-pane-back:hover,
.agent-detail-pane-back:focus-visible {
color: var(--fg);
align-self: flex-start;
}
/* The name of an agent the roster does not have, over its "no agent" note; it
takes the focus when the details open and is not a control. */

View file

@ -1,14 +1,15 @@
// <AgentDetailPane> — the selected agent's details, in the column beside the
// agents list (or alone on a narrow screen): the back button, then
// `AgentDetail`: the identity card with the agent's icon and name, and the
// folded sections.
// agents list (or alone on a narrow screen): `AgentDetail`, the identity card
// with the agent's icon and name and a close cross, then the folded sections.
//
// The agent comes from the roster the page already polls, so a state change made
// here or a refresh shows at once. A name the roster does not have (a stale link,
// an agent destroyed meanwhile) says so and still offers the way back.
// an agent destroyed meanwhile) says so and still offers the way back, as a
// button, since there is no card to carry the cross.
import type { AgentActions } from "../../agent/roster/AgentActions.js";
import type { AgentRow } from "../../agent/AgentTypes.js";
import { AgentDetail } from "../../agent/detail/AgentDetail.js";
import { Button } from "../../ui/button/Button.js";
import { EmptyState } from "../../ui/empty-state/EmptyState.js";
import "./AgentDetailPane.css";
@ -27,19 +28,25 @@ export function AgentDetailPane({
}) {
return (
<div class="agent-detail-pane">
<div class="agent-detail-pane-head">
<button type="button" class="agent-detail-pane-back" onClick={onClose}>
<span aria-hidden="true">←</span> agents
</button>
</div>
{row ? (
<AgentDetail key={name} row={row} actions={actions} withTerminal />
<AgentDetail
key={name}
row={row}
actions={actions}
withTerminal
onClose={onClose}
/>
) : (
<>
<h2 class="agent-detail-pane-title" tabIndex={-1} data-details-title>
{name}
</h2>
<EmptyState>no agent named {name} in the swarm</EmptyState>
<div class="agent-detail-pane-back">
<Button onClick={onClose}>
<span aria-hidden="true">←</span> agents
</Button>
</div>
</>
)}
</div>

View file

@ -6,7 +6,7 @@
// `shown` is the agent that was selected last.
//
// A narrow screen has room for one column, so the details replace the list
// while an agent is selected, and a back button in them returns to it.
// while an agent is selected, and the close cross in them returns to it.
//
// The CSS owns the widths and the breakpoint (`AgentsLayout.css`); this
// component owns what is in each column and who has the focus: opening an