@@ -76,7 +76,7 @@ function CodeEditor({ file, onClose, projectPath }) {
76
76
const lineStart = pos ;
77
77
const lineEnd = pos + oldLines [ i ] . length ;
78
78
builder . add ( lineStart , lineEnd , Decoration . line ( {
79
- class : 'diff-removed-light'
79
+ class : isDarkMode ? 'diff-removed-dark' : 'diff-removed-light'
80
80
} ) ) ;
81
81
pos += oldLines [ i ] . length + 1 ;
82
82
}
@@ -171,7 +171,7 @@ function CodeEditor({ file, onClose, projectPath }) {
171
171
} ) ;
172
172
}
173
173
}
174
- } , [ content , file . diffInfo , showDiff ] ) ;
174
+ } , [ content , file . diffInfo , showDiff , isDarkMode ] ) ;
175
175
176
176
const handleSave = async ( ) => {
177
177
setSaving ( true ) ;
@@ -242,14 +242,26 @@ function CodeEditor({ file, onClose, projectPath }) {
242
242
243
243
if ( loading ) {
244
244
return (
245
- < div className = "fixed inset-0 z-50 md:bg-black/50 md:flex md:items-center md:justify-center" >
246
- < div className = "bg-white w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center" >
247
- < div className = "flex items-center gap-3" >
248
- < div className = "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600" > </ div >
249
- < span className = "text-gray-900" > Loading { file . name } ...</ span >
245
+ < >
246
+ < style >
247
+ { `
248
+ .code-editor-loading {
249
+ background-color: ${ isDarkMode ? '#111827' : '#ffffff' } !important;
250
+ }
251
+ .code-editor-loading:hover {
252
+ background-color: ${ isDarkMode ? '#111827' : '#ffffff' } !important;
253
+ }
254
+ ` }
255
+ </ style >
256
+ < div className = "fixed inset-0 z-50 md:bg-black/50 md:flex md:items-center md:justify-center" >
257
+ < div className = "code-editor-loading w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center" >
258
+ < div className = "flex items-center gap-3" >
259
+ < div className = "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600" > </ div >
260
+ < span className = "text-gray-900 dark:text-white" > Loading { file . name } ...</ span >
261
+ </ div >
250
262
</ div >
251
263
</ div >
252
- </ div >
264
+ </ >
253
265
) ;
254
266
}
255
267
@@ -288,7 +300,7 @@ function CodeEditor({ file, onClose, projectPath }) {
288
300
{ file . diffInfo && (
289
301
< button
290
302
onClick = { ( ) => setShowDiff ( ! showDiff ) }
291
- className = "p-2 md:p-2 text-gray-600 hover:text-gray-900 rounded-md hover:bg-gray-100 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
303
+ className = "p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
292
304
title = { showDiff ? "Hide diff highlighting" : "Show diff highlighting" }
293
305
>
294
306
{ showDiff ? < EyeOff className = "w-5 h-5 md:w-4 md:h-4" /> : < Eye className = "w-5 h-5 md:w-4 md:h-4" /> }
@@ -306,18 +318,18 @@ function CodeEditor({ file, onClose, projectPath }) {
306
318
>
307
319
< span className = "text-sm md:text-xs font-mono font-bold" > ↵</ span >
308
320
</ button >
309
-
321
+
310
322
< button
311
323
onClick = { ( ) => setIsDarkMode ( ! isDarkMode ) }
312
- className = "p-2 md:p-2 text-gray-600 hover:text-gray-900 rounded-md hover:bg-gray-100 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
313
- title = "Toggle editor theme"
324
+ className = "p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
325
+ title = "Toggle theme"
314
326
>
315
327
< span className = "text-lg md:text-base" > { isDarkMode ? '☀️' : '🌙' } </ span >
316
328
</ button >
317
329
318
330
< button
319
331
onClick = { handleDownload }
320
- className = "p-2 md:p-2 text-gray-600 hover:text-gray-900 rounded-md hover:bg-gray-100 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
332
+ className = "p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
321
333
title = "Download file"
322
334
>
323
335
< Download className = "w-5 h-5 md:w-4 md:h-4" />
@@ -349,15 +361,15 @@ function CodeEditor({ file, onClose, projectPath }) {
349
361
350
362
< button
351
363
onClick = { toggleFullscreen }
352
- className = "hidden md:flex p-2 text-gray-600 hover:text-gray-900 rounded-md hover:bg-gray-100 items-center justify-center"
364
+ className = "hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center"
353
365
title = { isFullscreen ? 'Exit fullscreen' : 'Fullscreen' }
354
366
>
355
367
{ isFullscreen ? < Minimize2 className = "w-4 h-4" /> : < Maximize2 className = "w-4 h-4" /> }
356
368
</ button >
357
369
358
370
< button
359
371
onClick = { onClose }
360
- className = "p-2 md:p-2 text-gray-600 hover:text-gray-900 rounded-md hover:bg-gray-100 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
372
+ className = "p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center"
361
373
title = "Close"
362
374
>
363
375
< X className = "w-6 h-6 md:w-4 md:h-4" />
@@ -399,14 +411,14 @@ function CodeEditor({ file, onClose, projectPath }) {
399
411
</ div >
400
412
401
413
{ /* Footer */ }
402
- < div className = "flex items-center justify-between p-3 border-t border-gray-200 bg-gray-50 flex-shrink-0" >
403
- < div className = "flex items-center gap-4 text-sm text-gray-600" >
414
+ < div className = "flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0" >
415
+ < div className = "flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400 " >
404
416
< span > Lines: { content . split ( '\n' ) . length } </ span >
405
417
< span > Characters: { content . length } </ span >
406
418
< span > Language: { file . name . split ( '.' ) . pop ( ) ?. toUpperCase ( ) || 'Text' } </ span >
407
419
</ div >
408
420
409
- < div className = "text-sm text-gray-500" >
421
+ < div className = "text-sm text-gray-500 dark:text-gray-400 " >
410
422
Press Ctrl+S to save • Esc to close
411
423
</ div >
412
424
</ div >
0 commit comments