aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/graph/GraphPane.tsx
blob: f69f52a636b4605c9b5d6484d5b9905b96476cc7 (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
/*
 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */

import Stack from '@mui/material/Stack';
import { styled } from '@mui/material/styles';
import stringify from 'json-stringify-pretty-compact';
import { observer } from 'mobx-react-lite';

import { useRootStore } from '../RootStoreProvider';

const StyledCode = styled('code')(({ theme }) => ({
  ...theme.typography.editor,
  fontWeight: theme.typography.fontWeightEditorNormal,
  margin: theme.spacing(2),
  whiteSpace: 'pre',
}));

export default observer(function GraphPane(): JSX.Element {
  const { editorStore } = useRootStore();
  return (
    <Stack direction="column" height="100%" overflow="auto">
      <StyledCode>{stringify(editorStore?.semantics ?? {})}</StyledCode>
    </Stack>
  );
});