overleaf-cep/services/web/frontend/js/features/ide-redesign/components/editor-panel.tsx
Tim Down affd1bea49 Merge pull request #26586 from overleaf/td-file-view-error-reset
Reset file view loading and error state when switching between files

GitOrigin-RevId: 44be9bf71fe9541ed78db3421bf356997850e6ec
2025-07-02 08:05:57 +00:00

26 lines
1 KiB
TypeScript

import NoSelectionPane from '@/features/ide-react/components/editor/no-selection-pane'
import { Editor } from './editor'
import { useFileTreeOpenContext } from '@/features/ide-react/context/file-tree-open-context'
import FileView from '@/features/file-view/components/file-view'
import { fileViewFile } from '@/features/ide-react/util/file-view'
import MultipleSelectionPane from '@/features/ide-react/components/editor/multiple-selection-pane'
export default function EditorPanel() {
const { selectedEntityCount, openEntity } = useFileTreeOpenContext()
return (
<div className="ide-redesign-editor-container">
{selectedEntityCount === 0 && <NoSelectionPane />}
{selectedEntityCount === 1 && openEntity?.type === 'fileRef' && (
<FileView
file={fileViewFile(openEntity.entity)}
key={openEntity.entity._id}
/>
)}
{selectedEntityCount > 1 && (
<MultipleSelectionPane selectedEntityCount={selectedEntityCount} />
)}
<Editor />
</div>
)
}