fix(web): label compact agents action

Co-authored-by: Utkarsh Patil <[email protected]>
This commit is contained in:
t3-code[bot]andUtkarsh Patil committed 2026-08-12 16:40:34 +00:00
1 parent 4cd17fdf84
commit 6bd7bdb99c
2 files changed
+23 -5

No files matched your search

@@ -1,6 +1,10 @@
import { describe, expect, it } from "vite-plus/test";
import { AGENT_SPAWN_CTA_CLASS_NAME, AGENT_SPAWN_CTA_TRIGGER_CLASS_NAME } from "./MessagesTimeline";
import {
AGENT_SPAWN_CTA_CLASS_NAME,
AGENT_SPAWN_CTA_TRIGGER_CLASS_NAME,
resolveAgentSpawnActionLabel,
} from "./MessagesTimeline";
describe("AgentSpawnCtaRow", () => {
it("uses the changed-files card shell", () => {
@@ -15,4 +19,9 @@ describe("AgentSpawnCtaRow", () => {
expect(AGENT_SPAWN_CTA_TRIGGER_CLASS_NAME).toContain("flex-1");
expect(AGENT_SPAWN_CTA_TRIGGER_CLASS_NAME).toContain("rounded-lg");
});
it("names the agents action when its visible label is hidden", () => {
expect(resolveAgentSpawnActionLabel(true)).toBe("Open agents");
expect(resolveAgentSpawnActionLabel(false)).toBe("View agents");
});
});
@@ -2130,6 +2130,9 @@ export const AGENT_SPAWN_CTA_CLASS_NAME =
export const AGENT_SPAWN_CTA_TRIGGER_CLASS_NAME =
"group flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden rounded-lg px-1 py-1.5 text-left transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
export const resolveAgentSpawnActionLabel = (live: boolean) =>
live ? "Open agents" : "View agents";
const AgentSpawnCtaRow = memo(function AgentSpawnCtaRow(props: { workEntry: TimelineWorkEntry }) {
const { workEntry } = props;
const { agentPanelModel, onOpenAgents } = use(TimelineRowCtx);
@@ -2194,6 +2197,8 @@ const AgentSpawnCtaRow = memo(function AgentSpawnCtaRow(props: { workEntry: Time
? `${failed} failed`
: "✓ completed";
const actionLabel = resolveAgentSpawnActionLabel(live);
return (
<div className={AGENT_SPAWN_CTA_CLASS_NAME}>
<div className="flex items-center justify-between gap-2 rounded-xl px-1">
@@ -2217,11 +2222,15 @@ const AgentSpawnCtaRow = memo(function AgentSpawnCtaRow(props: { workEntry: Time
{totalTokens > 0 ? ` · Σ ${formatSubagentTokenCount(totalTokens)}` : ""}
</span>
</button>
<Button type="button" size="xs" variant="outline" onClick={onOpenAgents}>
<Button
type="button"
size="xs"
variant="outline"
aria-label={actionLabel}
onClick={onOpenAgents}
>
<BotIcon className="size-3" />
<span className="hidden @[24rem]/agent-spawn:inline">
{live ? "Open agents" : "View agents"}
</span>
<span className="hidden @[24rem]/agent-spawn:inline">{actionLabel}</span>
</Button>
</div>
</div>