diff --git a/src/components/CodeEditor.jsx b/src/components/CodeEditor.jsx index abdce7d..770a1c8 100644 --- a/src/components/CodeEditor.jsx +++ b/src/components/CodeEditor.jsx @@ -13,7 +13,7 @@ import { showMinimap } from '@replit/codemirror-minimap'; import { X, Save, Download, Maximize2, Minimize2, Eye, EyeOff } from 'lucide-react'; import { api } from '../utils/api'; -function CodeEditor({ file, onClose, projectPath }) { +function CodeEditor({ file, onClose, projectPath, isSidebar = false }) { const [content, setContent] = useState(''); const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); @@ -321,14 +321,23 @@ function CodeEditor({ file, onClose, projectPath }) { } `} -
-
+ {isSidebar ? ( +
Loading {file.name}...
-
+ ) : ( +
+
+
+
+ Loading {file.name}... +
+
+
+ )} ); } @@ -403,33 +412,32 @@ function CodeEditor({ file, onClose, projectPath }) { } `} -
-
+
{/* Header */} -
+
-
- - {file.name.split('.').pop()?.toUpperCase() || 'FILE'} - -
-

{file.name}

+

{file.name}

{file.diffInfo && ( - + 📝 Has changes )}
-

{file.path}

+

{file.path}

@@ -496,13 +504,15 @@ function CodeEditor({ file, onClose, projectPath }) { )} - + {!isSidebar && ( + + )}
diff --git a/src/components/MainContent.jsx b/src/components/MainContent.jsx index a9b1b81..dc84661 100644 --- a/src/components/MainContent.jsx +++ b/src/components/MainContent.jsx @@ -11,7 +11,7 @@ * No session protection logic is implemented here - it's purely a props bridge. */ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import ChatInterface from './ChatInterface'; import FileTree from './FileTree'; import CodeEditor from './CodeEditor'; @@ -28,13 +28,13 @@ import { useTaskMaster } from '../contexts/TaskMasterContext'; import { useTasksSettings } from '../contexts/TasksSettingsContext'; import { api } from '../utils/api'; -function MainContent({ - selectedProject, - selectedSession, - activeTab, - setActiveTab, - ws, - sendMessage, +function MainContent({ + selectedProject, + selectedSession, + activeTab, + setActiveTab, + ws, + sendMessage, messages, isMobile, isPWA, @@ -61,6 +61,9 @@ function MainContent({ const [editingFile, setEditingFile] = useState(null); const [selectedTask, setSelectedTask] = useState(null); const [showTaskDetail, setShowTaskDetail] = useState(false); + const [editorWidth, setEditorWidth] = useState(600); + const [isResizing, setIsResizing] = useState(false); + const resizeRef = useRef(null); // PRD Editor state const [showPRDEditor, setShowPRDEditor] = useState(false); @@ -153,6 +156,52 @@ function MainContent({ console.log('Update task status:', taskId, newStatus); refreshTasks?.(); }; + + // Handle resize functionality + const handleMouseDown = (e) => { + if (isMobile) return; // Disable resize on mobile + setIsResizing(true); + e.preventDefault(); + }; + + useEffect(() => { + const handleMouseMove = (e) => { + if (!isResizing) return; + + const container = resizeRef.current?.parentElement; + if (!container) return; + + const containerRect = container.getBoundingClientRect(); + const newWidth = containerRect.right - e.clientX; + + // Min width: 300px, Max width: 80% of container + const minWidth = 300; + const maxWidth = containerRect.width * 0.8; + + if (newWidth >= minWidth && newWidth <= maxWidth) { + setEditorWidth(newWidth); + } + }; + + const handleMouseUp = () => { + setIsResizing(false); + }; + + if (isResizing) { + document.addEventListener('mousemove', handleMouseMove); + document.addEventListener('mouseup', handleMouseUp); + document.body.style.cursor = 'col-resize'; + document.body.style.userSelect = 'none'; + } + + return () => { + document.removeEventListener('mousemove', handleMouseMove); + document.removeEventListener('mouseup', handleMouseUp); + document.body.style.cursor = ''; + document.body.style.userSelect = ''; + }; + }, [isResizing]); + if (isLoading) { return (
@@ -234,10 +283,10 @@ function MainContent({ return (
{/* Header with tabs */} -
-
+
{isMobile && (
- {/* Content Area */} -
-
- - + {/* Main Content */} +
+
+ + setServerLogs([])} /> */}
+
+ + {/* Code Editor Right Sidebar - Desktop only, Mobile uses modal */} + {editingFile && !isMobile && ( + <> + {/* Resize Handle */} +
+ {/* Visual indicator on hover */} +
+
+ + {/* Editor Sidebar */} +
+ +
+ + )}
- {/* Code Editor Modal */} - {editingFile && ( + {/* Code Editor Modal for Mobile */} + {editingFile && isMobile && ( )}