2023-10-26 04:57:00 -04:00
|
|
|
import { Panel, PanelGroup } from 'react-resizable-panels'
|
|
|
|
import { VerticalResizeHandle } from '@/features/ide-react/components/resize/vertical-resize-handle'
|
|
|
|
import { FileTree } from '@/features/ide-react/components/file-tree'
|
2023-11-03 08:15:36 -04:00
|
|
|
import classNames from 'classnames'
|
2023-12-15 04:19:42 -05:00
|
|
|
import { useLayoutContext } from '@/shared/context/layout-context'
|
|
|
|
import { OutlineContainer } from '@/features/outline/components/outline-container'
|
|
|
|
import { useOutlinePane } from '@/features/ide-react/hooks/use-outline-pane'
|
2023-10-26 04:57:00 -04:00
|
|
|
|
2023-12-15 04:19:42 -05:00
|
|
|
export default function EditorSidebar() {
|
|
|
|
const { view } = useLayoutContext()
|
|
|
|
|
2023-12-20 06:48:24 -05:00
|
|
|
const { outlineEnabled, outlinePanelRef } = useOutlinePane()
|
2023-10-26 04:57:00 -04:00
|
|
|
|
|
|
|
return (
|
2023-12-05 04:34:21 -05:00
|
|
|
<aside
|
|
|
|
className={classNames('ide-react-editor-sidebar', {
|
2023-12-15 04:19:42 -05:00
|
|
|
hidden: view === 'history',
|
2023-12-05 04:34:21 -05:00
|
|
|
})}
|
|
|
|
>
|
2023-12-05 05:19:00 -05:00
|
|
|
<PanelGroup autoSaveId="ide-editor-sidebar-layout" direction="vertical">
|
|
|
|
<Panel
|
2023-12-15 04:19:42 -05:00
|
|
|
defaultSize={50}
|
|
|
|
minSize={25}
|
2023-12-05 05:19:00 -05:00
|
|
|
className="ide-react-file-tree-panel"
|
|
|
|
id="panel-file-tree"
|
2023-12-15 04:19:42 -05:00
|
|
|
order={1}
|
2023-12-05 05:19:00 -05:00
|
|
|
>
|
2023-12-15 04:19:42 -05:00
|
|
|
<FileTree />
|
2023-12-05 04:34:21 -05:00
|
|
|
</Panel>
|
2023-12-15 04:19:42 -05:00
|
|
|
|
2023-12-20 06:48:24 -05:00
|
|
|
<VerticalResizeHandle disabled={!outlineEnabled} />
|
2023-12-15 04:19:42 -05:00
|
|
|
|
|
|
|
<Panel
|
|
|
|
defaultSize={50}
|
|
|
|
maxSize={75}
|
|
|
|
id="panel-outline"
|
|
|
|
order={2}
|
|
|
|
collapsible
|
2023-12-20 06:48:24 -05:00
|
|
|
ref={outlinePanelRef}
|
2023-12-15 04:19:42 -05:00
|
|
|
style={{ minHeight: 32 }} // keep the header visible
|
|
|
|
>
|
|
|
|
<OutlineContainer />
|
2023-12-05 04:34:21 -05:00
|
|
|
</Panel>
|
|
|
|
</PanelGroup>
|
|
|
|
</aside>
|
2023-10-26 04:57:00 -04:00
|
|
|
)
|
|
|
|
}
|