nexus/ui/src/components/ChatStatusUpdateBadge.tsx
Nexus Dev fab74e888c feat(23-02): add ChatTaskCreatedBadge, ChatStatusUpdateBadge, useBrainstormerDefault
- ChatTaskCreatedBadge renders loading state and resolved badge with View task link
- ChatStatusUpdateBadge renders CheckCircle2 + agent completion text with task link
- useBrainstormerDefault returns general role agent ID with React Query deduplication
- Fix ChatMessageList synthetic streaming entry to include messageType: null
2026-04-02 15:08:51 +00:00

40 lines
1.2 KiB
TypeScript

import { Link } from "@/lib/router";
import { CheckCircle2 } from "lucide-react";
import { cn } from "../lib/utils";
interface ChatStatusUpdateBadgeProps {
agentName: string;
taskId: string;
taskTitle?: string;
taskUrl?: string;
}
export function ChatStatusUpdateBadge({ agentName, taskId, taskTitle, taskUrl }: ChatStatusUpdateBadgeProps) {
const displayTitle =
taskTitle && taskTitle.length > 40 ? taskTitle.slice(0, 40) + "..." : taskTitle;
return (
<div
className={cn(
"motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1",
"inline-flex items-center gap-2 rounded-md border border-border bg-card px-3 py-1 text-[13px]"
)}
role="status"
>
<CheckCircle2 className="h-3.5 w-3.5 text-green-500 dark:text-green-400" />
<span className="text-foreground">
{agentName} completed {taskId}
{displayTitle ? `: ${displayTitle}` : ""}
</span>
{taskUrl && (
<Link
to={taskUrl}
className="text-primary underline-offset-2 hover:underline"
aria-label={`View task ${taskId}`}
>
View task
</Link>
)}
</div>
);
}