File size: 1,016 Bytes
c2c8c8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { useEditorStore } from '@/stores/editorStore';
import CodeEditor from './CodeEditor';
import EditorTabs from './EditorTabs';

export default function MultiFileEditor() {
  const activeFilePath = useEditorStore((s) => s.activeFilePath);
  const activeFile = useEditorStore((s) => activeFilePath ? s.openFiles[activeFilePath] : null);

  return (
    <div className="flex flex-col h-full">
      <EditorTabs />
      <div className="flex-1 min-h-0">
        {activeFile ? (
          <CodeEditor
            key={activeFile.path}
            filePath={activeFile.path}
            language={activeFile.language}
          />
        ) : (
          <div className="h-full flex items-center justify-center text-muted-foreground">
            <div className="text-center">
              <p className="text-lg font-medium">No file open</p>
              <p className="text-sm mt-1">Select a file from the explorer to start editing</p>
            </div>
          </div>
        )}
      </div>
    </div>
  );
}