import React from "react"; import { motion, AnimatePresence } from "framer-motion"; import { StopCircle, Clock, Hash } from "lucide-react"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; interface ExecutionControlBarProps { isExecuting: boolean; onStop: () => void; totalTokens?: number; elapsedTime?: number; // in seconds className?: string; } /** * Floating control bar shown during agent execution * Provides stop functionality and real-time statistics */ export const ExecutionControlBar: React.FC = ({ isExecuting, onStop, totalTokens = 0, elapsedTime = 0, className }) => { // Format elapsed time const formatTime = (seconds: number) => { const mins = Math.floor(seconds / 60); const secs = seconds % 60; if (mins > 0) { return `${mins}m ${secs.toFixed(0)}s`; } return `${secs.toFixed(1)}s`; }; // Format token count const formatTokens = (tokens: number) => { if (tokens >= 1000) { return `${(tokens / 1000).toFixed(1)}k`; } return tokens.toString(); }; return ( {isExecuting && ( {/* Rotating symbol indicator */}
{/* Status text */} Executing... {/* Divider */}
{/* Stats */}
{/* Time */}
{formatTime(elapsedTime)}
{/* Tokens */}
{formatTokens(totalTokens)} tokens
{/* Divider */}
{/* Stop button */} )} ); };