Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: the terminal message box has a placeholder and a spinner instead of a label and a sent line

The label 'message <agent>' is the input's placeholder (the label stays for
screen readers). The send button shows a spinner over its label while the
request is pending and keeps its width, and the 'sent' line is gone: the box
empties when the message is held. Spinner is a component of its own now, used
by the button and the refresh picker.
This commit is contained in:
iris 2026-11-06 19:37:26 +01:00 • committed by mara
commit c37205e8f5
2 changed files with 103 additions and 51 deletions

View file

@ -11,6 +11,3 @@
.ui-agent-input-form > :first-child {
flex: 1;
}
.ui-agent-input-sent {
margin-block-start: 0.25rem;
}

View file

@ -7,7 +7,6 @@ import { useState } from "preact/hooks";
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { TextField } from "../../ui/text-field/TextField.js";
import { Button } from "../../ui/button/Button.js";
import { Hint } from "../../ui/hint/Hint.js";
import { useSubmit } from "../../ui/submit/useSubmit.js";
import "./AgentInputForm.css";
@ -34,19 +33,16 @@ export function AgentInputForm({ agentName }: { agentName: string }) {
<TextField
id={`agent-input-${agentName}`}
label={`message ${agentName}`}
hideLabel
placeholder={`message ${agentName}`}
value={body}
required
onInput={setBody}
/>
<Button variant="primary" type="submit" disabled={submitting}>
{submitting ? "sending…" : "send"}
<Button variant="primary" type="submit" busy={submitting}>
send
</Button>
</form>
{state.status === "done" && (
<Hint tone="ok" class="ui-agent-input-sent">
sent
</Hint>
)}
{state.status === "error" && (
<ApiErrorPanel context="failed to send" problem={state.problem} />
)}