/** * CodeAgentIndicator — shows when a code editing request is being * processed by the frame (local dev frame or Builder.io). * * Renders as a subtle status bar that appears at the top of the chat area. */ import { useEffect, useState } from "react"; export interface CodeAgentIndicatorProps { /** Whether the code agent is currently working */ isWorking: boolean; /** Optional label describing what's being done */ label?: string; } export function CodeAgentIndicator({ isWorking, label, }: CodeAgentIndicatorProps) { const [visible, setVisible] = useState(false); useEffect(() => { if (isWorking) { setVisible(true); } else { // Brief delay before hiding so the user sees "done" const t = setTimeout(() => setVisible(false), 1500); return () => clearTimeout(t); } }, [isWorking]); if (!visible) return null; return (
{isWorking ? ( <> {label || "Code agent is working on your request..."} ) : ( <> Code changes applied )}
); }