From b27702797fbf90a4ec4135eb10e3d89b955d491e Mon Sep 17 00:00:00 2001 From: simos Date: Tue, 8 Jul 2025 16:53:08 +0000 Subject: [PATCH] Refactor CodeEditor component to improve dark mode support and enhance loading styles --- src/components/CodeEditor.jsx | 48 ++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/components/CodeEditor.jsx b/src/components/CodeEditor.jsx index ee30230..64c0258 100755 --- a/src/components/CodeEditor.jsx +++ b/src/components/CodeEditor.jsx @@ -76,7 +76,7 @@ function CodeEditor({ file, onClose, projectPath }) { const lineStart = pos; const lineEnd = pos + oldLines[i].length; builder.add(lineStart, lineEnd, Decoration.line({ - class: 'diff-removed-light' + class: isDarkMode ? 'diff-removed-dark' : 'diff-removed-light' })); pos += oldLines[i].length + 1; } @@ -171,7 +171,7 @@ function CodeEditor({ file, onClose, projectPath }) { }); } } - }, [content, file.diffInfo, showDiff]); + }, [content, file.diffInfo, showDiff, isDarkMode]); const handleSave = async () => { setSaving(true); @@ -242,14 +242,26 @@ function CodeEditor({ file, onClose, projectPath }) { if (loading) { return ( -
-
-
-
- Loading {file.name}... + <> + +
+
+
+
+ Loading {file.name}... +
-
+ ); } @@ -288,7 +300,7 @@ function CodeEditor({ file, onClose, projectPath }) { {file.diffInfo && ( - +
{/* Footer */} -
-
+
+
Lines: {content.split('\n').length} Characters: {content.length} Language: {file.name.split('.').pop()?.toUpperCase() || 'Text'}
-
+
Press Ctrl+S to save • Esc to close