aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/EditorPane.tsx
blob: 935a84e813d69bbb44c79c0e83125773c5d5e692 (plain) (blame)
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
32
33
34
35
36
37
38
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import Toolbar from '@mui/material/Toolbar';
import { observer } from 'mobx-react-lite';
import React from 'react';

import Loading from '../Loading';
import { useRootStore } from '../RootStore';

import EditorArea from './EditorArea';
import EditorButtons from './EditorButtons';
import GenerateButton from './GenerateButton';
import SearchPanelPortal from './SearchPanelPortal';

function EditorPane(): JSX.Element {
  const { editorStore } = useRootStore();

  return (
    <Stack direction="column" flexGrow={1} flexShrink={1} overflow="auto">
      <Toolbar variant="dense">
        <EditorButtons editorStore={editorStore} />
        <GenerateButton editorStore={editorStore} />
      </Toolbar>
      <Box flexGrow={1} flexShrink={1} overflow="auto">
        {editorStore === undefined ? (
          <Loading />
        ) : (
          <>
            <SearchPanelPortal editorStore={editorStore} />
            <EditorArea editorStore={editorStore} />
          </>
        )}
      </Box>
    </Stack>
  );
}

export default observer(EditorPane);