({
isExecuting,
onStop,
totalTokens = 0,
elapsedTime = 0,
className
})
| 17 | * Provides stop functionality and real-time statistics |
| 18 | */ |
| 19 | export const ExecutionControlBar: React.FC<ExecutionControlBarProps> = ({ |
| 20 | isExecuting, |
| 21 | onStop, |
| 22 | totalTokens = 0, |
| 23 | elapsedTime = 0, |
| 24 | className |
| 25 | }) => { |
| 26 | // Format elapsed time |
| 27 | const formatTime = (seconds: number) => { |
| 28 | const mins = Math.floor(seconds / 60); |
| 29 | const secs = seconds % 60; |
| 30 | if (mins > 0) { |
| 31 | return `${mins}m ${secs.toFixed(0)}s`; |
| 32 | } |
| 33 | return `${secs.toFixed(1)}s`; |
| 34 | }; |
| 35 | |
| 36 | // Format token count |
| 37 | const formatTokens = (tokens: number) => { |
| 38 | if (tokens >= 1000) { |
| 39 | return `${(tokens / 1000).toFixed(1)}k`; |
| 40 | } |
| 41 | return tokens.toString(); |
| 42 | }; |
| 43 | |
| 44 | return ( |
| 45 | <AnimatePresence> |
| 46 | {isExecuting && ( |
| 47 | <motion.div |
| 48 | initial={{ y: 100, opacity: 0 }} |
| 49 | animate={{ y: 0, opacity: 1 }} |
| 50 | exit={{ y: 100, opacity: 0 }} |
| 51 | transition={{ type: "spring", stiffness: 300, damping: 30 }} |
| 52 | className={cn( |
| 53 | "fixed bottom-6 left-1/2 -translate-x-1/2 z-50", |
| 54 | "bg-background/95 backdrop-blur-md border rounded-full shadow-lg", |
| 55 | "px-6 py-3 flex items-center gap-4", |
| 56 | className |
| 57 | )} |
| 58 | > |
| 59 | {/* Rotating symbol indicator */} |
| 60 | <div className="relative flex items-center justify-center"> |
| 61 | <div className="rotating-symbol text-primary"></div> |
| 62 | </div> |
| 63 | |
| 64 | {/* Status text */} |
| 65 | <span className="text-sm font-medium">Executing...</span> |
| 66 | |
| 67 | {/* Divider */} |
| 68 | <div className="h-4 w-px bg-border" /> |
| 69 | |
| 70 | {/* Stats */} |
| 71 | <div className="flex items-center gap-4 text-xs text-muted-foreground"> |
| 72 | {/* Time */} |
| 73 | <div className="flex items-center gap-1.5"> |
| 74 | <Clock className="h-3.5 w-3.5" /> |
| 75 | <span>{formatTime(elapsedTime)}</span> |
| 76 | </div> |
nothing calls this directly
no test coverage detected