diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-08-21 03:19:03 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-08-21 03:19:03 +0200 |
commit | 70dd02be202ae1b87ef8f7a2563ba09a3e7b0947 (patch) | |
tree | ddd34efea882a00e324000f84062c4cce28da814 /subprojects/frontend/src/editor/GenerateButton.tsx | |
parent | feat(frontend): overlay window controls (diff) | |
download | refinery-70dd02be202ae1b87ef8f7a2563ba09a3e7b0947.tar.gz refinery-70dd02be202ae1b87ef8f7a2563ba09a3e7b0947.tar.zst refinery-70dd02be202ae1b87ef8f7a2563ba09a3e7b0947.zip |
refactor(frontend): improve code splitting
Diffstat (limited to 'subprojects/frontend/src/editor/GenerateButton.tsx')
-rw-r--r-- | subprojects/frontend/src/editor/GenerateButton.tsx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/subprojects/frontend/src/editor/GenerateButton.tsx b/subprojects/frontend/src/editor/GenerateButton.tsx index 4b998af6..a28f6b4b 100644 --- a/subprojects/frontend/src/editor/GenerateButton.tsx +++ b/subprojects/frontend/src/editor/GenerateButton.tsx | |||
@@ -3,12 +3,23 @@ import Button from '@mui/material/Button'; | |||
3 | import { observer } from 'mobx-react-lite'; | 3 | import { observer } from 'mobx-react-lite'; |
4 | import React from 'react'; | 4 | import React from 'react'; |
5 | 5 | ||
6 | import { useRootStore } from '../RootStore'; | 6 | import type EditorStore from './EditorStore'; |
7 | 7 | ||
8 | const GENERATE_LABEL = 'Generate'; | 8 | const GENERATE_LABEL = 'Generate'; |
9 | 9 | ||
10 | function GenerateButton(): JSX.Element { | 10 | function GenerateButton({ |
11 | const { editorStore } = useRootStore(); | 11 | editorStore, |
12 | }: { | ||
13 | editorStore: EditorStore | undefined; | ||
14 | }): JSX.Element { | ||
15 | if (editorStore === undefined) { | ||
16 | return ( | ||
17 | <Button color="inherit" className="rounded" disabled> | ||
18 | Loading… | ||
19 | </Button> | ||
20 | ); | ||
21 | } | ||
22 | |||
12 | const { errorCount, warningCount } = editorStore; | 23 | const { errorCount, warningCount } = editorStore; |
13 | 24 | ||
14 | const diagnostics: string[] = []; | 25 | const diagnostics: string[] = []; |