diff --git a/docs/4-implementation/web-ui/swarm-ui.md b/docs/4-implementation/web-ui/swarm-ui.md index 00b7c5472..e617b2ff4 100644 --- a/docs/4-implementation/web-ui/swarm-ui.md +++ b/docs/4-implementation/web-ui/swarm-ui.md @@ -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, diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx index a198b4762..bb0c45410 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx @@ -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 (
- + {sectionsFor(withTerminal).map((section) => ( void; }) { const { tone, label } = FRESHNESS[row.freshness]; const declareError = actions.actionErrors.get(row.name); @@ -70,6 +74,14 @@ export function AgentIdentity({ onDestroy={actions.requestDestroy} /> + {onClose ? ( + } + ariaLabel={`close ${row.name}'s details`} + title="close: back to the agents" + onClick={onClose} + /> + ) : null}
: the back button, then the agent's details. */ +/* : 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. */ diff --git a/frontend/packages/swarm-ui/src/pages/agents/AgentDetailPane.tsx b/frontend/packages/swarm-ui/src/pages/agents/AgentDetailPane.tsx index 0712b8b53..9608c7a1b 100644 --- a/frontend/packages/swarm-ui/src/pages/agents/AgentDetailPane.tsx +++ b/frontend/packages/swarm-ui/src/pages/agents/AgentDetailPane.tsx @@ -1,14 +1,15 @@ // — 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 (
-
- -
{row ? ( - + ) : ( <>

{name}

no agent named {name} in the swarm +
+ +
)}
diff --git a/frontend/packages/swarm-ui/src/pages/agents/AgentsLayout.tsx b/frontend/packages/swarm-ui/src/pages/agents/AgentsLayout.tsx index 2bb4a9b92..39a79759d 100644 --- a/frontend/packages/swarm-ui/src/pages/agents/AgentsLayout.tsx +++ b/frontend/packages/swarm-ui/src/pages/agents/AgentsLayout.tsx @@ -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