aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/EditorPane.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/editor/EditorPane.tsx')
-rw-r--r--subprojects/frontend/src/editor/EditorPane.tsx23
1 files changed, 20 insertions, 3 deletions
diff --git a/subprojects/frontend/src/editor/EditorPane.tsx b/subprojects/frontend/src/editor/EditorPane.tsx
index 935a84e8..df43d2c9 100644
--- a/subprojects/frontend/src/editor/EditorPane.tsx
+++ b/subprojects/frontend/src/editor/EditorPane.tsx
@@ -1,10 +1,10 @@
1import Box from '@mui/material/Box'; 1import Box from '@mui/material/Box';
2import Skeleton from '@mui/material/Skeleton';
2import Stack from '@mui/material/Stack'; 3import Stack from '@mui/material/Stack';
3import Toolbar from '@mui/material/Toolbar'; 4import Toolbar from '@mui/material/Toolbar';
4import { observer } from 'mobx-react-lite'; 5import { observer } from 'mobx-react-lite';
5import React from 'react'; 6import React, { useState } from 'react';
6 7
7import Loading from '../Loading';
8import { useRootStore } from '../RootStore'; 8import { useRootStore } from '../RootStore';
9 9
10import EditorArea from './EditorArea'; 10import EditorArea from './EditorArea';
@@ -12,6 +12,23 @@ import EditorButtons from './EditorButtons';
12import GenerateButton from './GenerateButton'; 12import GenerateButton from './GenerateButton';
13import SearchPanelPortal from './SearchPanelPortal'; 13import SearchPanelPortal from './SearchPanelPortal';
14 14
15function EditorLoading(): JSX.Element {
16 const [skeletonSizes] = useState(() =>
17 new Array(10).fill(0).map(() => Math.random() * 60 + 10),
18 );
19
20 return (
21 <Box mx={2}>
22 {skeletonSizes.map((length, i) => (
23 /* eslint-disable-next-line react/no-array-index-key --
24 Random placeholders have no identity.
25 */
26 <Skeleton key={i} width={`${length}%`} />
27 ))}
28 </Box>
29 );
30}
31
15function EditorPane(): JSX.Element { 32function EditorPane(): JSX.Element {
16 const { editorStore } = useRootStore(); 33 const { editorStore } = useRootStore();
17 34
@@ -23,7 +40,7 @@ function EditorPane(): JSX.Element {
23 </Toolbar> 40 </Toolbar>
24 <Box flexGrow={1} flexShrink={1} overflow="auto"> 41 <Box flexGrow={1} flexShrink={1} overflow="auto">
25 {editorStore === undefined ? ( 42 {editorStore === undefined ? (
26 <Loading /> 43 <EditorLoading />
27 ) : ( 44 ) : (
28 <> 45 <>
29 <SearchPanelPortal editorStore={editorStore} /> 46 <SearchPanelPortal editorStore={editorStore} />