From d192bc2e6bd06432cd1308f397267bec8cb81cc1 Mon Sep 17 00:00:00 2001 From: AndyMik90 Date: Sun, 14 Dec 2025 11:12:07 +0100 Subject: [PATCH] Improve terminal experience with task feature and visual feedback --- .../src/renderer/components/Terminal.tsx | 143 +++++++++++++++--- 1 file changed, 120 insertions(+), 23 deletions(-) diff --git a/auto-claude-ui/src/renderer/components/Terminal.tsx b/auto-claude-ui/src/renderer/components/Terminal.tsx index 0e334128..363e4735 100644 --- a/auto-claude-ui/src/renderer/components/Terminal.tsx +++ b/auto-claude-ui/src/renderer/components/Terminal.tsx @@ -4,11 +4,11 @@ import { FitAddon } from '@xterm/addon-fit'; import { WebLinksAddon } from '@xterm/addon-web-links'; import { useDroppable } from '@dnd-kit/core'; import '@xterm/xterm/css/xterm.css'; -import { X, Sparkles, TerminalSquare, ListTodo, FileDown } from 'lucide-react'; +import { X, Sparkles, TerminalSquare, ListTodo, FileDown, ChevronDown, Circle, Loader2, CheckCircle2, AlertCircle, Clock, Code2, Search, Wrench } from 'lucide-react'; import { Button } from './ui/button'; import { cn } from '../lib/utils'; import { useTerminalStore, type TerminalStatus } from '../stores/terminal-store'; -import type { Task } from '../../shared/types'; +import type { Task, ExecutionPhase } from '../../shared/types'; import { Select, SelectContent, @@ -16,6 +16,13 @@ import { SelectTrigger, SelectValue, } from './ui/select'; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from './ui/dropdown-menu'; import { Tooltip, TooltipContent, @@ -40,6 +47,17 @@ const STATUS_COLORS: Record = { exited: 'bg-destructive', }; +// Execution phase display configuration +const PHASE_CONFIG: Record = { + idle: { label: 'Ready', color: 'bg-muted text-muted-foreground', icon: Circle }, + planning: { label: 'Planning', color: 'bg-info/20 text-info', icon: Search }, + coding: { label: 'Coding', color: 'bg-primary/20 text-primary', icon: Code2 }, + qa_review: { label: 'QA Review', color: 'bg-warning/20 text-warning', icon: Search }, + qa_fixing: { label: 'Fixing', color: 'bg-warning/20 text-warning', icon: Wrench }, + complete: { label: 'Complete', color: 'bg-success/20 text-success', icon: CheckCircle2 }, + failed: { label: 'Failed', color: 'bg-destructive/20 text-destructive', icon: AlertCircle }, +}; + export function Terminal({ id, cwd, projectPath, isActive, onClose, onActivate, tasks = [] }: TerminalProps) { const terminalRef = useRef(null); const xtermRef = useRef(null); @@ -370,6 +388,17 @@ Please confirm you're ready by saying: I'm ready to work on ${selectedTask.title window.electronAPI.sendTerminalInput(id, contextMessage + '\r'); }, [id, tasks, setAssociatedTask, updateTerminal]); + // Handle clearing the associated task + const handleClearTask = useCallback(() => { + setAssociatedTask(id, undefined); + updateTerminal(id, { title: 'Claude' }); + }, [id, setAssociatedTask, updateTerminal]); + + // Get execution phase from associated task + const executionPhase = associatedTask?.executionProgress?.phase || 'idle'; + const phaseConfig = PHASE_CONFIG[executionPhase]; + const PhaseIcon = phaseConfig.icon; + return (
)} - {/* Task selection dropdown - only show when Claude is active and there are backlog tasks */} - {terminal?.isClaudeMode && backlogTasks.length > 0 && ( - + {/* Task selection/status - only show when Claude is active */} + {terminal?.isClaudeMode && ( + <> + {/* Show status pill when task is selected */} + {associatedTask ? ( + + + + + +
+ Current task +
+
+ {associatedTask.title} +
+ {associatedTask.executionProgress?.message && ( +
+ {associatedTask.executionProgress.message} +
+ )} + + {backlogTasks.length > 0 && ( + <> +
+ Switch to... +
+ {backlogTasks.filter(t => t.id !== associatedTask.id).slice(0, 5).map((task) => ( + handleTaskSelect(task.id)} + className="text-xs" + > + + {task.title} + + ))} + + + )} + + + Clear task + +
+
+ ) : ( + /* Show task selector when no task is selected */ + backlogTasks.length > 0 && ( + + ) + )} + )}