diff --git a/gadget-code/frontend/src/components/EditorPanel.tsx b/gadget-code/frontend/src/components/EditorPanel.tsx index 0de3237..a1a2c21 100644 --- a/gadget-code/frontend/src/components/EditorPanel.tsx +++ b/gadget-code/frontend/src/components/EditorPanel.tsx @@ -1,5 +1,5 @@ import { useState, useCallback, useEffect } from 'react'; -import AceEditor from 'react-ace'; +import Ace from 'react-ace'; import 'ace-builds/src-noconflict/mode-text'; import 'ace-builds/src-noconflict/theme-tomorrow'; import 'ace-builds/src-noconflict/ext-language_tools'; @@ -298,7 +298,7 @@ export default function EditorPanel({ workspaceMode, filePath, onCloseFile }: Ed {/* ACE Editor */} {!state.isLoading && (
- void; } -export default function FilesPanel({ workspaceMode }: FilesPanelProps) { - const [selectedFilePath, setSelectedFilePath] = useState(undefined); +export default function FilesPanel({ workspaceMode, onFileSelect }: FilesPanelProps) { const isReadOnly = workspaceMode === WorkspaceMode.Agent; const isReadWrite = workspaceMode === WorkspaceMode.User; - const handleFileSelect = (path: string) => { - setSelectedFilePath(path); - }; - - const handleCloseFile = () => { - setSelectedFilePath(undefined); - }; - return (
@@ -49,27 +39,12 @@ export default function FilesPanel({ workspaceMode }: FilesPanelProps) {
- - {/* Split view: File tree on left, editor on right */} -
- {/* File Tree - 30% width, resizable in future */} -
- -
- - {/* Editor Panel - remaining space */} -
- -
+
+
-

{isReadOnly diff --git a/gadget-code/frontend/src/pages/ChatSessionView.tsx b/gadget-code/frontend/src/pages/ChatSessionView.tsx index 50928e5..7a32306 100644 --- a/gadget-code/frontend/src/pages/ChatSessionView.tsx +++ b/gadget-code/frontend/src/pages/ChatSessionView.tsx @@ -7,6 +7,7 @@ import WorkspaceModeIndicator from '../components/WorkspaceModeIndicator'; import FilesPanel from '../components/FilesPanel'; import LogPanel from '../components/LogPanel'; import ChatTurnComponent from '../components/ChatTurn'; +import EditorPanel from '../components/EditorPanel'; import { AppContext } from '../App'; interface LogEntry { @@ -74,6 +75,7 @@ export default function ChatSessionView() { const [_connectionState, setConnectionState] = useState<'disconnected' | 'connecting' | 'connected' | 'error'>('disconnected'); const [isOtherTab, setIsOtherTab] = useState(false); const [reconnectAttempts, setReconnectAttempts] = useState(0); + const [editorFilePath, setEditorFilePath] = useState(undefined); const messagesEndRef = useRef(null); const inputRef = useRef(null); @@ -1086,18 +1088,27 @@ export default function ChatSessionView() { {isEditingProvider && (

)} - {/* Chat View (75%) */} -
- {/* Messages */} -
- {turns.map((turn) => ( - - ))} -
-
+ + {/* File Editor View (replaces Chat View when file is open) */} + {editorFilePath ? ( + setEditorFilePath(undefined)} + /> + ) : ( + /* Chat View (75%) */ +
+ {/* Messages */} +
+ {turns.map((turn) => ( + + ))} +
+
{/* Prompt Input */}
@@ -1138,6 +1149,7 @@ export default function ChatSessionView() {
+ )} {/* Log Panel (25%) */} {/* FILES Panel */} - + { + setEditorFilePath(path); + }} + />
);