diff --git a/frontend/src/components/LoopControls.tsx b/frontend/src/components/LoopControls.tsx index 0ada829f..d005d80a 100644 --- a/frontend/src/components/LoopControls.tsx +++ b/frontend/src/components/LoopControls.tsx @@ -1,10 +1,12 @@ import { useState } from 'react'; import type { LoopStatus } from '../types/task'; import type { Task } from '../types/task'; +import { formatTokens } from '../lib/formatTokens'; interface LoopControlsProps { loopStatus: LoopStatus; goals: Task[]; + totalTokenUsage: number; onStart: (goalId: string, specMode?: boolean) => void; onPause: () => void; onResume: () => void; @@ -13,15 +15,10 @@ interface LoopControlsProps { onRejectSpec: () => void; } -const STATE_LABELS: Record = { - idle: 'Idle', - running: 'Running', - paused: 'Paused', -}; - export function LoopControls({ loopStatus, goals, + totalTokenUsage, onStart, onPause, onResume, @@ -29,26 +26,27 @@ export function LoopControls({ onApproveSpec, onRejectSpec, }: LoopControlsProps) { + const [pickerOpen, setPickerOpen] = useState(false); const [selectedGoalId, setSelectedGoalId] = useState(''); const [specMode, setSpecMode] = useState(false); const { state, progress, awaitingApproval } = loopStatus; - return ( -
-
- - {STATE_LABELS[state]} - - {progress && ( - - {progress.done}/{progress.total} - - )} -
+ // ── Idle: compact trigger / expanded picker ── + if (state === 'idle') { + if (!pickerOpen) { + return ( +
+ +
+ ); + } - {state === 'idle' && ( -
+ return ( +
+