Files
next-tjwater-frontend/src/features/agent/components/agent-progress-status-icon.tsx
T
jiang 692bbf609c refactor: consolidate requests and finalize agent tool states
Share project JSON transport, interaction replies and report selectors.
Settle tool progress consistently for direct streams, reconnects and history, preserving failure reasons and stopped state.
2026-11-09 17:55:00 +08:00

33 lines
1.1 KiB
TypeScript

import { Ban, CheckCircle2, LoaderCircle, XCircle } from "lucide-react";
import { StatusIcon, type StatusTone } from "@/shared/ui/status";
import type { AgentChatProgress } from "../types";
const states = {
completed: { label: "已完成", tone: "success", Icon: CheckCircle2 },
cancelled: { label: "已中止", tone: "neutral", Icon: Ban },
error: { label: "失败", tone: "danger", Icon: XCircle },
running: { label: "进行中", tone: "info", Icon: LoaderCircle }
} satisfies Record<
AgentChatProgress["status"],
{ label: string; tone: StatusTone; Icon: typeof CheckCircle2 }
>;
/** Ordinary steps and tool calls share the same status glyph, size and tone. */
export function AgentProgressStatusIcon({ status }: { status: AgentChatProgress["status"] }) {
const { label, tone, Icon } = states[status];
return (
<StatusIcon
data-progress-status={status}
role="img"
aria-label={label}
tone={tone}
activity={status === "running" ? "loading" : "static"}
shape="circle"
size="sm"
className="border-0"
>
<Icon className="size-3.5" aria-hidden="true" />
</StatusIcon>
);
}