@elice/material-runbox 1.240718.0-trasncript.1 → 1.240718.0-trasncript.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +386 -0
  2. package/cjs/assets/queue.gif.js +1 -2
  3. package/cjs/assets/runbox_logo.png.js +1 -2
  4. package/cjs/assets/terminated.png.js +1 -2
  5. package/cjs/components/material-runbox/MaterialRunbox.js +24 -20
  6. package/cjs/components/material-runbox/MaterialRunboxBody.js +10 -4
  7. package/cjs/components/material-runbox/MaterialRunboxContent.js +132 -103
  8. package/cjs/components/material-runbox/MaterialRunboxFooter.js +27 -18
  9. package/cjs/components/material-runbox/MaterialRunboxHeader.js +103 -87
  10. package/cjs/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +31 -27
  11. package/cjs/components/material-runbox/actions/MaterialRunboxActionGrade.js +242 -159
  12. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +32 -28
  13. package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.js +125 -76
  14. package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +84 -53
  15. package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.js +40 -28
  16. package/cjs/components/material-runbox/contexts/MaterialRunboxApiContext.js +27 -15
  17. package/cjs/components/material-runbox/contexts/MaterialRunboxCommandContext.js +52 -36
  18. package/cjs/components/material-runbox/contexts/MaterialRunboxContext.js +11 -8
  19. package/cjs/components/material-runbox/contexts/index.js +17 -0
  20. package/cjs/components/material-runbox/hooks/index.js +7 -0
  21. package/cjs/components/material-runbox/hooks/useRunboxControl.js +62 -38
  22. package/cjs/components/material-runbox/index.js +7 -0
  23. package/cjs/components/material-runbox/locales/index.js +13 -0
  24. package/cjs/components/material-runbox/runtime/Runtime.js +25 -17
  25. package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +33 -29
  26. package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +40 -39
  27. package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +72 -57
  28. package/es/_virtual/_rollupPluginBabelHelpers.js +377 -0
  29. package/es/assets/queue.gif.js +1 -2
  30. package/es/assets/runbox_logo.png.js +1 -2
  31. package/es/assets/terminated.png.js +1 -2
  32. package/es/components/material-runbox/MaterialRunbox.js +24 -20
  33. package/es/components/material-runbox/MaterialRunboxBody.js +6 -4
  34. package/es/components/material-runbox/MaterialRunboxContent.js +128 -103
  35. package/es/components/material-runbox/MaterialRunboxFooter.js +23 -18
  36. package/es/components/material-runbox/MaterialRunboxHeader.js +99 -88
  37. package/es/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +27 -27
  38. package/es/components/material-runbox/actions/MaterialRunboxActionGrade.js +237 -159
  39. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +28 -28
  40. package/es/components/material-runbox/actions/MaterialRunboxActionReset.js +121 -76
  41. package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +80 -53
  42. package/es/components/material-runbox/actions/MaterialRunboxActionShare.js +36 -28
  43. package/es/components/material-runbox/contexts/MaterialRunboxApiContext.js +22 -14
  44. package/es/components/material-runbox/contexts/MaterialRunboxCommandContext.js +47 -35
  45. package/es/components/material-runbox/contexts/MaterialRunboxContext.js +6 -7
  46. package/es/components/material-runbox/contexts/index.js +3 -0
  47. package/es/components/material-runbox/hooks/index.js +1 -0
  48. package/es/components/material-runbox/hooks/useRunboxControl.js +62 -38
  49. package/es/components/material-runbox/index.js +1 -0
  50. package/es/components/material-runbox/locales/index.js +4 -0
  51. package/es/components/material-runbox/runtime/Runtime.js +21 -17
  52. package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +34 -30
  53. package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +41 -40
  54. package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +69 -58
  55. package/package.json +8 -11
@@ -3,18 +3,22 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _styled = require('@emotion/styled/base');
6
- var React = require('react');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
7
  var intl = require('@elice/intl');
8
8
  var material = require('@mui/material');
9
9
  var MaterialRunboxApiContext = require('../contexts/MaterialRunboxApiContext.js');
10
10
  require('../contexts/MaterialRunboxCommandContext.js');
11
11
  require('../contexts/MaterialRunboxContext.js');
12
12
 
13
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
+
15
+ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
16
+
13
17
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
14
18
  //
15
19
  //
16
20
  //
17
- const StyledFormControlLabel = /*#__PURE__*/_styled(material.FormControlLabel, {
21
+ var StyledFormControlLabel = /*#__PURE__*/_styled__default.default(material.FormControlLabel, {
18
22
  target: "e1ket70c0"
19
23
  })("production" === "production" ? {
20
24
  name: "1ep9nyp",
@@ -27,19 +31,18 @@ const StyledFormControlLabel = /*#__PURE__*/_styled(material.FormControlLabel, {
27
31
  //
28
32
  //
29
33
  //
30
- const MaterialRunboxActionAutoShutdown = ({
31
- runtime,
32
- runtimeTemplate,
33
- courseId,
34
- refetch
35
- }) => {
34
+ var MaterialRunboxActionAutoShutdown = function MaterialRunboxActionAutoShutdown(_ref) {
35
+ var runtime = _ref.runtime,
36
+ runtimeTemplate = _ref.runtimeTemplate,
37
+ courseId = _ref.courseId,
38
+ refetch = _ref.refetch;
36
39
  var _a;
37
- const intl$1 = intl.useRawEliceIntl();
38
- const materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
40
+ var intl$1 = intl.useRawEliceIntl();
41
+ var materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
39
42
  /**
40
43
  *
41
44
  */
42
- const handleAction = (_, shutdown) => {
45
+ var handleAction = function handleAction(_, shutdown) {
43
46
  if (!runtime) {
44
47
  return;
45
48
  }
@@ -49,14 +52,14 @@ const MaterialRunboxActionAutoShutdown = ({
49
52
  autoShutdown: !shutdown
50
53
  },
51
54
  eliceCourseId: courseId
52
- }).then(refetch).catch(() => {
55
+ }).then(refetch).catch(function () {
53
56
  //
54
57
  });
55
58
  };
56
59
  //
57
60
  //
58
61
  //
59
- return React.createElement(material.Tooltip, {
62
+ return jsxRuntime.jsx(material.Tooltip, {
60
63
  title: intl$1.formatMessage({
61
64
  id: runtimeTemplate.autoShutdown ? 'runbox.action.autoShutdown.tooltip.disabled' : 'runbox.action.autoShutdown.tooltip.enabled'
62
65
  }, {
@@ -65,22 +68,23 @@ const MaterialRunboxActionAutoShutdown = ({
65
68
  unit: 'minute',
66
69
  unitDisplay: 'short'
67
70
  })
68
- })
69
- }, React.createElement(StyledFormControlLabel, {
70
- control: React.createElement(material.Switch, {
71
- checked: !(runtime === null || runtime === void 0 ? void 0 : runtime.autoShutdown),
72
- disabled: !runtime || runtimeTemplate.autoShutdown,
73
- onChange: handleAction
74
71
  }),
75
- label: intl$1.formatMessage({
76
- id: 'runbox.action.autoShutdown.title'
77
- }),
78
- componentsProps: {
79
- typography: {
80
- variant: 'body2'
72
+ children: jsxRuntime.jsx(StyledFormControlLabel, {
73
+ control: jsxRuntime.jsx(material.Switch, {
74
+ checked: !(runtime === null || runtime === void 0 ? void 0 : runtime.autoShutdown),
75
+ disabled: !runtime || runtimeTemplate.autoShutdown,
76
+ onChange: handleAction
77
+ }),
78
+ label: intl$1.formatMessage({
79
+ id: 'runbox.action.autoShutdown.title'
80
+ }),
81
+ componentsProps: {
82
+ typography: {
83
+ variant: 'body2'
84
+ }
81
85
  }
82
- }
83
- }));
86
+ })
87
+ });
84
88
  };
85
89
 
86
90
  exports.default = MaterialRunboxActionAutoShutdown;
@@ -2,7 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
5
6
  var _styled = require('@emotion/styled/base');
7
+ var jsxRuntime = require('react/jsx-runtime');
6
8
  var React = require('react');
7
9
  var reactTransitionGroup = require('react-transition-group');
8
10
  var intl = require('@elice/intl');
@@ -17,12 +19,17 @@ var MaterialRunboxApiContext = require('../contexts/MaterialRunboxApiContext.js'
17
19
  var MaterialRunboxCommandContext = require('../contexts/MaterialRunboxCommandContext.js');
18
20
  require('../contexts/MaterialRunboxContext.js');
19
21
 
22
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
23
+
24
+ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
25
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
26
+
20
27
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
21
28
  //
22
29
  //
23
30
  //
24
- const TRANSITION_DURATION = 300;
25
- const TRANSITION_STYLE_MAP = {
31
+ var TRANSITION_DURATION = 300;
32
+ var TRANSITION_STYLE_MAP = {
26
33
  entering: {
27
34
  maxWidth: 0
28
35
  },
@@ -42,7 +49,7 @@ const TRANSITION_STYLE_MAP = {
42
49
  //
43
50
  //
44
51
  //
45
- const StyledMainActionButton = /*#__PURE__*/_styled(lab.LoadingButton, {
52
+ var StyledMainActionButton = /*#__PURE__*/_styled__default.default(lab.LoadingButton, {
46
53
  target: "eae460y2"
47
54
  })("production" === "production" ? {
48
55
  name: "tssn5p",
@@ -52,139 +59,184 @@ const StyledMainActionButton = /*#__PURE__*/_styled(lab.LoadingButton, {
52
59
  styles: "min-width:4rem!important",
53
60
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
54
61
  });
55
- const StyledSubActionButton = /*#__PURE__*/_styled(material.Button, {
62
+ var StyledSubActionButton = /*#__PURE__*/_styled__default.default(material.Button, {
56
63
  target: "eae460y1"
57
64
  })("transition:max-width ", TRANSITION_DURATION, "ms cubic-bezier(0.25, 0.46, 0.45, 1);");
58
- const StyledTerminal = /*#__PURE__*/_styled("textarea", {
65
+ var StyledTerminal = /*#__PURE__*/_styled__default.default("textarea", {
59
66
  target: "eae460y0"
60
- })("padding:1rem;width:100%;color:", ({
61
- theme
62
- }) => theme.palette.common.white, ";background-color:", ({
63
- theme
64
- }) => theme.palette.common.black, ";border:none;border-radius:0.5rem;font-family:'Elice Digital Coding',monospace;font-size:", ({
65
- theme
66
- }) => theme.typography.body2.fontSize, ";line-height:", ({
67
- theme
68
- }) => theme.typography.body2.lineHeight, ";outline:none;resize:none;");
67
+ })("padding:1rem;width:100%;color:", function (_ref) {
68
+ var theme = _ref.theme;
69
+ return theme.palette.common.white;
70
+ }, ";background-color:", function (_ref2) {
71
+ var theme = _ref2.theme;
72
+ return theme.palette.common.black;
73
+ }, ";border:none;border-radius:0.5rem;font-family:'Elice Digital Coding',monospace;font-size:", function (_ref3) {
74
+ var theme = _ref3.theme;
75
+ return theme.typography.body2.fontSize;
76
+ }, ";line-height:", function (_ref4) {
77
+ var theme = _ref4.theme;
78
+ return theme.typography.body2.lineHeight;
79
+ }, ";outline:none;resize:none;");
69
80
  //
70
81
  //
71
82
  //
72
- const MaterialRunboxActionGrade = ({
73
- runtime,
74
- courseId
75
- }) => {
83
+ var MaterialRunboxActionGrade = function MaterialRunboxActionGrade(_ref5) {
84
+ var runtime = _ref5.runtime,
85
+ courseId = _ref5.courseId;
76
86
  var _a;
77
- const intl$1 = intl.useRawEliceIntl();
78
- const {
79
- enqueueSnackbar
80
- } = muiXSnackbar.useSnackbar();
81
- const materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
82
- const {
83
- isLastCommandRunning,
84
- lastCommand,
85
- setCommandIdToPing
86
- } = MaterialRunboxCommandContext.useMaterialRunboxCommandContext();
87
- const {
88
- status
89
- } = runboxClient.useEliceRunboxRunning();
90
- const leaderboardSubmitInfoQuery = reactQuery.useQuery({
87
+ var intl$1 = intl.useRawEliceIntl();
88
+ var _useSnackbar = muiXSnackbar.useSnackbar(),
89
+ enqueueSnackbar = _useSnackbar.enqueueSnackbar;
90
+ var materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
91
+ var _useMaterialRunboxCom = MaterialRunboxCommandContext.useMaterialRunboxCommandContext(),
92
+ isLastCommandRunning = _useMaterialRunboxCom.isLastCommandRunning,
93
+ lastCommand = _useMaterialRunboxCom.lastCommand,
94
+ setCommandIdToPing = _useMaterialRunboxCom.setCommandIdToPing;
95
+ var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
96
+ status = _useEliceRunboxRunnin.status;
97
+ var leaderboardSubmitInfoQuery = reactQuery.useQuery({
91
98
  queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdSubmitInfoGet', {
92
- courseId,
93
- runtime
99
+ courseId: courseId,
100
+ runtime: runtime
94
101
  }],
95
- queryFn: ({
96
- signal
97
- }) => materialRunboxApi.runbox.runboxRunboxIdSubmitInfoGet({
98
- eliceCourseId: courseId,
99
- runboxId: runtime === null || runtime === void 0 ? void 0 : runtime.runboxId
100
- }, {
101
- signal
102
- }),
102
+ queryFn: function queryFn(_ref6) {
103
+ var signal = _ref6.signal;
104
+ return materialRunboxApi.runbox.runboxRunboxIdSubmitInfoGet({
105
+ eliceCourseId: courseId,
106
+ runboxId: runtime === null || runtime === void 0 ? void 0 : runtime.runboxId
107
+ }, {
108
+ signal: signal
109
+ });
110
+ },
103
111
  enabled: Boolean(runtime === null || runtime === void 0 ? void 0 : runtime.runboxId),
104
112
  retry: false
105
113
  });
106
- const isSubmitCountRemained = ((_a = leaderboardSubmitInfoQuery.data) === null || _a === void 0 ? void 0 : _a.remainSubmitCount) !== 0;
107
- const [isActionLoading, setActionLoading] = React.useState(false);
108
- const [isGradeResultDialogOpen, setGradeResultDialogOpen] = React.useState(false);
109
- const [isSubmitCountInfoDialogOpen, setSubmitCountInfoDialogOpen] = React.useState(false);
110
- const [hasUnreadResult, setHasUnreadResult] = React.useState(false);
111
- const isRunboxRunning = status === 'running';
112
- const isGradeDoneWithOutput = !isLastCommandRunning && (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade && Boolean(lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.output);
114
+ var isSubmitCountRemained = ((_a = leaderboardSubmitInfoQuery.data) === null || _a === void 0 ? void 0 : _a.remainSubmitCount) !== 0;
115
+ var _React$useState = React__default.default.useState(false),
116
+ _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
117
+ isActionLoading = _React$useState2[0],
118
+ setActionLoading = _React$useState2[1];
119
+ var _React$useState3 = React__default.default.useState(false),
120
+ _React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
121
+ isGradeResultDialogOpen = _React$useState4[0],
122
+ setGradeResultDialogOpen = _React$useState4[1];
123
+ var _React$useState5 = React__default.default.useState(false),
124
+ _React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
125
+ isSubmitCountInfoDialogOpen = _React$useState6[0],
126
+ setSubmitCountInfoDialogOpen = _React$useState6[1];
127
+ var _React$useState7 = React__default.default.useState(false),
128
+ _React$useState8 = _rollupPluginBabelHelpers.slicedToArray(_React$useState7, 2),
129
+ hasUnreadResult = _React$useState8[0],
130
+ setHasUnreadResult = _React$useState8[1];
131
+ var isRunboxRunning = status === 'running';
132
+ var isGradeDoneWithOutput = !isLastCommandRunning && (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade && Boolean(lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.output);
113
133
  /**
114
134
  *
115
135
  */
116
- const handleGradeResultDialogOpen = () => {
136
+ var handleGradeResultDialogOpen = function handleGradeResultDialogOpen() {
117
137
  setGradeResultDialogOpen(true);
118
138
  };
119
139
  /**
120
140
  *
121
141
  */
122
- const handleGradeResultDialogClose = () => {
142
+ var handleGradeResultDialogClose = function handleGradeResultDialogClose() {
123
143
  setGradeResultDialogOpen(false);
124
144
  };
125
145
  /**
126
146
  *
127
147
  */
128
- const handleSubmitCountInfoDialogClose = () => {
148
+ var handleSubmitCountInfoDialogClose = function handleSubmitCountInfoDialogClose() {
129
149
  setSubmitCountInfoDialogOpen(false);
130
150
  };
131
151
  /**
132
152
  *
133
153
  */
134
- const handleAction = async () => {
135
- setActionLoading(true);
136
- try {
137
- const {
138
- data: currentLeaderboardSubmitInfo
139
- } = await leaderboardSubmitInfoQuery.refetch();
140
- const isCurrentSubmitCountEmpty = (currentLeaderboardSubmitInfo === null || currentLeaderboardSubmitInfo === void 0 ? void 0 : currentLeaderboardSubmitInfo.remainSubmitCount) === 0;
141
- if (isCurrentSubmitCountEmpty) {
142
- setSubmitCountInfoDialogOpen(true);
143
- return;
144
- }
145
- const runtimeId = runtime === null || runtime === void 0 ? void 0 : runtime.id;
146
- const {
147
- id: commandId
148
- } = await materialRunboxApi.runtime.runtimeRuntimeIdCommandPost({
149
- runtimeId,
150
- eliceCourseId: courseId,
151
- runboxCommandPostRequest: {
152
- commandType: openapiClientMaterialRunbox.CommandType.Grade
154
+ var handleAction = /*#__PURE__*/function () {
155
+ var _ref7 = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
156
+ var _yield$leaderboardSub, currentLeaderboardSubmitInfo, isCurrentSubmitCountEmpty, runtimeId, _yield$materialRunbox, commandId;
157
+ return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
158
+ while (1) switch (_context.prev = _context.next) {
159
+ case 0:
160
+ setActionLoading(true);
161
+ _context.prev = 1;
162
+ _context.next = 4;
163
+ return leaderboardSubmitInfoQuery.refetch();
164
+ case 4:
165
+ _yield$leaderboardSub = _context.sent;
166
+ currentLeaderboardSubmitInfo = _yield$leaderboardSub.data;
167
+ isCurrentSubmitCountEmpty = (currentLeaderboardSubmitInfo === null || currentLeaderboardSubmitInfo === void 0 ? void 0 : currentLeaderboardSubmitInfo.remainSubmitCount) === 0;
168
+ if (!isCurrentSubmitCountEmpty) {
169
+ _context.next = 10;
170
+ break;
171
+ }
172
+ setSubmitCountInfoDialogOpen(true);
173
+ return _context.abrupt("return");
174
+ case 10:
175
+ runtimeId = runtime === null || runtime === void 0 ? void 0 : runtime.id;
176
+ _context.next = 13;
177
+ return materialRunboxApi.runtime.runtimeRuntimeIdCommandPost({
178
+ runtimeId: runtimeId,
179
+ eliceCourseId: courseId,
180
+ runboxCommandPostRequest: {
181
+ commandType: openapiClientMaterialRunbox.CommandType.Grade
182
+ }
183
+ });
184
+ case 13:
185
+ _yield$materialRunbox = _context.sent;
186
+ commandId = _yield$materialRunbox.id;
187
+ setCommandIdToPing(commandId);
188
+ _context.next = 21;
189
+ break;
190
+ case 18:
191
+ _context.prev = 18;
192
+ _context.t0 = _context["catch"](1);
193
+ enqueueSnackbar(intl$1.formatMessage({
194
+ id: 'runbox.action.grade.noti.error'
195
+ }), {
196
+ variant: 'error'
197
+ });
198
+ case 21:
199
+ _context.prev = 21;
200
+ setActionLoading(false);
201
+ return _context.finish(21);
202
+ case 24:
203
+ case "end":
204
+ return _context.stop();
153
205
  }
154
- });
155
- setCommandIdToPing(commandId);
156
- } catch (err) {
157
- enqueueSnackbar(intl$1.formatMessage({
158
- id: 'runbox.action.grade.noti.error'
159
- }), {
160
- variant: 'error'
161
- });
162
- } finally {
163
- setActionLoading(false);
164
- }
165
- };
206
+ }, _callee, null, [[1, 18, 21, 24]]);
207
+ }));
208
+ return function handleAction() {
209
+ return _ref7.apply(this, arguments);
210
+ };
211
+ }();
166
212
  //
167
213
  // set `hasUnreadResult` when last command output exists
168
214
  //
169
- React.useEffect(() => setHasUnreadResult(isGradeDoneWithOutput), [isGradeDoneWithOutput]);
215
+ React__default.default.useEffect(function () {
216
+ return setHasUnreadResult(isGradeDoneWithOutput);
217
+ }, [isGradeDoneWithOutput]);
170
218
  //
171
219
  // reset `hasUnreadResult` when dialog state toggled
172
220
  //
173
- React.useEffect(() => setHasUnreadResult(false), [isGradeResultDialogOpen]);
221
+ React__default.default.useEffect(function () {
222
+ return setHasUnreadResult(false);
223
+ }, [isGradeResultDialogOpen]);
174
224
  //
175
225
  // toggle dialog state when last command output exists
176
226
  //
177
- React.useEffect(() => setGradeResultDialogOpen(isGradeDoneWithOutput), [isGradeDoneWithOutput]);
227
+ React__default.default.useEffect(function () {
228
+ return setGradeResultDialogOpen(isGradeDoneWithOutput);
229
+ }, [isGradeDoneWithOutput]);
178
230
  /**
179
231
  *
180
232
  */
181
- const renderActionButton = () => {
182
- const isGradeType = (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade;
183
- const isGrading = isActionLoading || isLastCommandRunning && isGradeType;
233
+ var renderActionButton = function renderActionButton() {
234
+ var isGradeType = (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade;
235
+ var isGrading = isActionLoading || isLastCommandRunning && isGradeType;
184
236
  /**
185
237
  *
186
238
  */
187
- const getActionTooltipMessage = () => {
239
+ var getActionTooltipMessage = function getActionTooltipMessage() {
188
240
  if (!isSubmitCountRemained) {
189
241
  return intl$1.formatMessage({
190
242
  id: 'runbox.action.submitCountInfo.tooltip.disabled'
@@ -197,97 +249,128 @@ const MaterialRunboxActionGrade = ({
197
249
  }
198
250
  return '';
199
251
  };
200
- return React.createElement(material.Tooltip, {
252
+ return jsxRuntime.jsx(material.Tooltip, {
201
253
  title: getActionTooltipMessage(),
202
- placement: "bottom-end"
203
- }, React.createElement(material.ButtonGroup, {
204
- variant: "contained"
205
- }, React.createElement(StyledMainActionButton, {
206
- variant: "contained",
207
- loading: isGrading,
208
- disabled: !isRunboxRunning || isLastCommandRunning || !isSubmitCountRemained,
209
- size: "small",
210
- onClick: handleAction
211
- }, intl$1.formatMessage({
212
- id: 'runbox.action.grade.title'
213
- })), isGradeDoneWithOutput ? React.createElement(reactTransitionGroup.Transition, {
214
- in: isGradeDoneWithOutput,
215
- timeout: 0,
216
- mountOnEnter: true,
217
- unmountOnExit: true
218
- }, state => React.createElement(StyledSubActionButton, {
219
- size: "small",
220
- disabled: isLastCommandRunning,
221
- onClick: handleGradeResultDialogOpen,
222
- style: TRANSITION_STYLE_MAP[state]
223
- }, React.createElement(material.Badge, {
224
- color: "error",
225
- variant: "dot",
226
- invisible: !hasUnreadResult
227
- }, React.createElement(iconsMaterial.Terminal, {
228
- fontSize: "small"
229
- })))) : null));
254
+ placement: "bottom-end",
255
+ children: jsxRuntime.jsxs(material.ButtonGroup, {
256
+ variant: "contained",
257
+ children: [jsxRuntime.jsx(StyledMainActionButton, {
258
+ variant: "contained",
259
+ loading: isGrading,
260
+ disabled: !isRunboxRunning || isLastCommandRunning || !isSubmitCountRemained,
261
+ size: "small",
262
+ onClick: handleAction,
263
+ children: intl$1.formatMessage({
264
+ id: 'runbox.action.grade.title'
265
+ })
266
+ }), isGradeDoneWithOutput ? jsxRuntime.jsx(reactTransitionGroup.Transition, {
267
+ in: isGradeDoneWithOutput,
268
+ timeout: 0,
269
+ mountOnEnter: true,
270
+ unmountOnExit: true,
271
+ children: function children(state) {
272
+ return jsxRuntime.jsx(StyledSubActionButton, {
273
+ size: "small",
274
+ disabled: isLastCommandRunning,
275
+ onClick: handleGradeResultDialogOpen,
276
+ style: TRANSITION_STYLE_MAP[state],
277
+ children: jsxRuntime.jsx(material.Badge, {
278
+ color: "error",
279
+ variant: "dot",
280
+ invisible: !hasUnreadResult,
281
+ children: jsxRuntime.jsx(iconsMaterial.Terminal, {
282
+ fontSize: "small"
283
+ })
284
+ })
285
+ });
286
+ }
287
+ }) : null]
288
+ })
289
+ });
230
290
  };
231
291
  /**
232
292
  *
233
293
  */
234
- const renderActionGradeResultDialog = () => {
294
+ var renderActionGradeResultDialog = function renderActionGradeResultDialog() {
235
295
  if ((lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) !== openapiClientMaterialRunbox.CommandType.Grade) {
236
296
  return null;
237
297
  }
238
- return React.createElement(material.Dialog, {
298
+ return jsxRuntime.jsxs(material.Dialog, {
239
299
  open: isGradeResultDialogOpen,
240
300
  maxWidth: "md",
241
301
  fullWidth: true,
242
- onClose: handleGradeResultDialogClose
243
- }, React.createElement(material.DialogTitle, null, intl$1.formatMessage({
244
- id: 'runbox.action.grade.dialog.title'
245
- })), React.createElement(material.DialogContent, null, React.createElement(material.Stack, {
246
- gap: "0.75rem"
247
- }, lastCommand.terminatedReason === 'done' ? React.createElement(material.Alert, {
248
- severity: "success"
249
- }, intl$1.formatMessage({
250
- id: 'runbox.action.grade.dialog.description.success'
251
- })) : React.createElement(material.Alert, {
252
- severity: "error"
253
- }, intl$1.formatMessage({
254
- id: 'runbox.action.grade.dialog.description.error'
255
- })), React.createElement(StyledTerminal, {
256
- value: lastCommand.output,
257
- readOnly: true,
258
- rows: 20
259
- }))), React.createElement(material.DialogActions, null, React.createElement(material.Button, {
260
- color: "inherit",
261
- disabled: isActionLoading,
262
- onClick: handleGradeResultDialogClose
263
- }, intl$1.formatMessage({
264
- id: 'runbox.common.close'
265
- }))));
302
+ onClose: handleGradeResultDialogClose,
303
+ children: [jsxRuntime.jsx(material.DialogTitle, {
304
+ children: intl$1.formatMessage({
305
+ id: 'runbox.action.grade.dialog.title'
306
+ })
307
+ }), jsxRuntime.jsx(material.DialogContent, {
308
+ children: jsxRuntime.jsxs(material.Stack, {
309
+ gap: "0.75rem",
310
+ children: [lastCommand.terminatedReason === 'done' ? jsxRuntime.jsx(material.Alert, {
311
+ severity: "success",
312
+ children: intl$1.formatMessage({
313
+ id: 'runbox.action.grade.dialog.description.success'
314
+ })
315
+ }) : jsxRuntime.jsx(material.Alert, {
316
+ severity: "error",
317
+ children: intl$1.formatMessage({
318
+ id: 'runbox.action.grade.dialog.description.error'
319
+ })
320
+ }), jsxRuntime.jsx(StyledTerminal, {
321
+ value: lastCommand.output,
322
+ readOnly: true,
323
+ rows: 20
324
+ })]
325
+ })
326
+ }), jsxRuntime.jsx(material.DialogActions, {
327
+ children: jsxRuntime.jsx(material.Button, {
328
+ color: "inherit",
329
+ disabled: isActionLoading,
330
+ onClick: handleGradeResultDialogClose,
331
+ children: intl$1.formatMessage({
332
+ id: 'runbox.common.close'
333
+ })
334
+ })
335
+ })]
336
+ });
266
337
  };
267
338
  /**
268
339
  *
269
340
  */
270
- const renderActionSubmitCountInfoDialog = () => {
271
- return React.createElement(material.Dialog, {
341
+ var renderActionSubmitCountInfoDialog = function renderActionSubmitCountInfoDialog() {
342
+ return jsxRuntime.jsxs(material.Dialog, {
272
343
  fullWidth: true,
273
344
  maxWidth: "xs",
274
345
  open: isSubmitCountInfoDialogOpen,
275
- onClick: handleSubmitCountInfoDialogClose
276
- }, React.createElement(material.DialogTitle, null, intl$1.formatMessage({
277
- id: 'runbtox.action.submitCountInfo.dialog.title'
278
- })), React.createElement(material.DialogContent, null, React.createElement(material.Typography, null, intl$1.formatMessage({
279
- id: 'runbox.action.submitCountInfo.dialog.description'
280
- }))), React.createElement(material.DialogActions, null, React.createElement(material.Button, {
281
- color: "inherit",
282
- onClick: handleSubmitCountInfoDialogClose
283
- }, intl$1.formatMessage({
284
- id: 'runbox.common.close'
285
- }))));
346
+ onClick: handleSubmitCountInfoDialogClose,
347
+ children: [jsxRuntime.jsx(material.DialogTitle, {
348
+ children: intl$1.formatMessage({
349
+ id: 'runbtox.action.submitCountInfo.dialog.title'
350
+ })
351
+ }), jsxRuntime.jsx(material.DialogContent, {
352
+ children: jsxRuntime.jsx(material.Typography, {
353
+ children: intl$1.formatMessage({
354
+ id: 'runbox.action.submitCountInfo.dialog.description'
355
+ })
356
+ })
357
+ }), jsxRuntime.jsx(material.DialogActions, {
358
+ children: jsxRuntime.jsx(material.Button, {
359
+ color: "inherit",
360
+ onClick: handleSubmitCountInfoDialogClose,
361
+ children: intl$1.formatMessage({
362
+ id: 'runbox.common.close'
363
+ })
364
+ })
365
+ })]
366
+ });
286
367
  };
287
368
  //
288
369
  //
289
370
  //
290
- return React.createElement(React.Fragment, null, renderActionButton(), renderActionGradeResultDialog(), renderActionSubmitCountInfoDialog());
371
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
372
+ children: [renderActionButton(), renderActionGradeResultDialog(), renderActionSubmitCountInfoDialog()]
373
+ });
291
374
  };
292
375
 
293
376
  exports.default = MaterialRunboxActionGrade;