()
| 11 | } |
| 12 | |
| 13 | export const WorkspacePanel: React.FC = () => { |
| 14 | const [activeTab, setActiveTab] = useState<Tab>('code'); |
| 15 | |
| 16 | // Terminal State |
| 17 | const [terminals, setTerminals] = useState<TerminalInstance[]>([ |
| 18 | { id: '1', title: 'npm run dev', status: 'running', command: 'vite v5.1.4' }, |
| 19 | { id: '2', title: 'agent-exec', status: 'idle' } |
| 20 | ]); |
| 21 | const [activeTerminalId, setActiveTerminalId] = useState<string>('1'); |
| 22 | |
| 23 | const addTerminal = () => { |
| 24 | const newId = Date.now().toString(); |
| 25 | const newTerminal: TerminalInstance = { id: newId, title: 'bash', status: 'idle' }; |
| 26 | setTerminals([...terminals, newTerminal]); |
| 27 | setActiveTerminalId(newId); |
| 28 | }; |
| 29 | |
| 30 | const removeTerminal = (id: string, e: React.MouseEvent) => { |
| 31 | e.stopPropagation(); |
| 32 | const newTerminals = terminals.filter(t => t.id !== id); |
| 33 | setTerminals(newTerminals); |
| 34 | if (activeTerminalId === id && newTerminals.length > 0) { |
| 35 | setActiveTerminalId(newTerminals[0].id); |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | const activeTerminal = terminals.find(t => t.id === activeTerminalId) || terminals[0]; |
| 40 | |
| 41 | return ( |
| 42 | <div className="flex flex-col h-full bg-white"> |
| 43 | {/* Workspace Tabs - Folder Style */} |
| 44 | <div className="flex items-center px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 flex-shrink-0 gap-1 select-none"> |
| 45 | <TabButton |
| 46 | active={activeTab === 'code'} |
| 47 | onClick={() => setActiveTab('code')} |
| 48 | icon={<Code2 size={14} />} |
| 49 | label="Editor" |
| 50 | /> |
| 51 | <TabButton |
| 52 | active={activeTab === 'terminal'} |
| 53 | onClick={() => setActiveTab('terminal')} |
| 54 | icon={<Terminal size={14} />} |
| 55 | label="Terminal" |
| 56 | /> |
| 57 | <TabButton |
| 58 | active={activeTab === 'preview'} |
| 59 | onClick={() => setActiveTab('preview')} |
| 60 | icon={<Globe size={14} />} |
| 61 | label="Preview" |
| 62 | /> |
| 63 | <TabButton |
| 64 | active={activeTab === 'git'} |
| 65 | onClick={() => setActiveTab('git')} |
| 66 | icon={<GitGraph size={14} />} |
| 67 | label="Changes" |
| 68 | /> |
| 69 | </div> |
| 70 |
nothing calls this directly
no test coverage detected