diff options
Diffstat (limited to 'subprojects/frontend/src/editor/GenerateButton.tsx')
-rw-r--r-- | subprojects/frontend/src/editor/GenerateButton.tsx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/subprojects/frontend/src/editor/GenerateButton.tsx b/subprojects/frontend/src/editor/GenerateButton.tsx index 5bac0464..b8dcd531 100644 --- a/subprojects/frontend/src/editor/GenerateButton.tsx +++ b/subprojects/frontend/src/editor/GenerateButton.tsx | |||
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | import CancelIcon from '@mui/icons-material/Cancel'; | 7 | import CancelIcon from '@mui/icons-material/Cancel'; |
8 | import CloseIcon from '@mui/icons-material/Close'; | ||
8 | import PlayArrowIcon from '@mui/icons-material/PlayArrow'; | 9 | import PlayArrowIcon from '@mui/icons-material/PlayArrow'; |
9 | import { observer } from 'mobx-react-lite'; | 10 | import { observer } from 'mobx-react-lite'; |
10 | 11 | ||
@@ -28,8 +29,10 @@ const GenerateButton = observer(function GenerateButton({ | |||
28 | ); | 29 | ); |
29 | } | 30 | } |
30 | 31 | ||
31 | const { analyzing, errorCount, warningCount, semanticsError } = | 32 | const { |
32 | editorStore.delayedErrors; | 33 | delayedErrors: { analyzing, errorCount, warningCount, semanticsError }, |
34 | generating, | ||
35 | } = editorStore; | ||
33 | 36 | ||
34 | if (analyzing) { | 37 | if (analyzing) { |
35 | return ( | 38 | return ( |
@@ -39,6 +42,18 @@ const GenerateButton = observer(function GenerateButton({ | |||
39 | ); | 42 | ); |
40 | } | 43 | } |
41 | 44 | ||
45 | if (generating) { | ||
46 | return ( | ||
47 | <AnimatedButton | ||
48 | color="inherit" | ||
49 | onClick={() => editorStore.cancelModelGeneration()} | ||
50 | startIcon={<CloseIcon />} | ||
51 | > | ||
52 | Cancel | ||
53 | </AnimatedButton> | ||
54 | ); | ||
55 | } | ||
56 | |||
42 | if (semanticsError !== undefined && editorStore.opened) { | 57 | if (semanticsError !== undefined && editorStore.opened) { |
43 | return ( | 58 | return ( |
44 | <AnimatedButton | 59 | <AnimatedButton |
@@ -83,6 +98,7 @@ const GenerateButton = observer(function GenerateButton({ | |||
83 | disabled={!editorStore.opened} | 98 | disabled={!editorStore.opened} |
84 | color={warningCount > 0 ? 'warning' : 'primary'} | 99 | color={warningCount > 0 ? 'warning' : 'primary'} |
85 | startIcon={<PlayArrowIcon />} | 100 | startIcon={<PlayArrowIcon />} |
101 | onClick={() => editorStore.startModelGeneration()} | ||
86 | > | 102 | > |
87 | {summary === '' ? GENERATE_LABEL : `${GENERATE_LABEL} (${summary})`} | 103 | {summary === '' ? GENERATE_LABEL : `${GENERATE_LABEL} (${summary})`} |
88 | </AnimatedButton> | 104 | </AnimatedButton> |