@elice/material-exercise 1.230220.1 → 1.230220.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.
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +8 -2
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +3 -4
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +69 -78
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +9 -3
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +3 -4
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +71 -80
- package/package.json +4 -4
package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js
CHANGED
|
@@ -46,7 +46,8 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
46
46
|
|
|
47
47
|
const intl = reactIntl.useIntl();
|
|
48
48
|
const {
|
|
49
|
-
materialExerciseId
|
|
49
|
+
materialExerciseId,
|
|
50
|
+
onCodeHelpRequest
|
|
50
51
|
} = React__default["default"].useContext(context.ExerciseContext);
|
|
51
52
|
const {
|
|
52
53
|
onSubmit,
|
|
@@ -54,6 +55,7 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
54
55
|
onCancel
|
|
55
56
|
} = React__default["default"].useContext(ExerciseRunnerContext.ExerciseRunnerContext);
|
|
56
57
|
const runnerWebsocketStatus = recoil.useRecoilValue(recoil$1.exerciseRunnerWebSocketStatusQuery);
|
|
58
|
+
const editorCursorSelectionValue = recoil.useRecoilValue(recoil$1.exerciseFileEditorCursorSelectionValueState);
|
|
57
59
|
const exercise = recoil.useRecoilValue(recoil$1.exerciseState(materialExerciseId));
|
|
58
60
|
const exerciseRunType = recoil.useRecoilValue(recoil$1.exerciseRunnerRunTypeState);
|
|
59
61
|
const exerciseWithNoGrade = Boolean(exercise === null || exercise === void 0 ? void 0 : exercise.isNoSubmitGrade);
|
|
@@ -239,8 +241,12 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
239
241
|
|
|
240
242
|
|
|
241
243
|
const renderCodeHelpRequestButton = () => {
|
|
244
|
+
if (isCodeHelpHidden || !editorCursorSelectionValue || typeof onCodeHelpRequest !== 'function') {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
|
|
242
248
|
return React__default["default"].createElement(ExerciseRunnerControllerCodeHelpRequestButton, {
|
|
243
|
-
|
|
249
|
+
onClick: () => onCodeHelpRequest(editorCursorSelectionValue)
|
|
244
250
|
});
|
|
245
251
|
}; //
|
|
246
252
|
//
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.FC<ExerciseRunnerControllerCodeHelpRequestButtonProps>;
|
|
2
|
+
import type { ButtonProps } from '@elice/blocks';
|
|
3
|
+
declare type OmittedButtonProps = Omit<ButtonProps, 'size' | 'role' | 'icon' | 'iconAlign'>;
|
|
4
|
+
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.ForwardRefExoticComponent<OmittedButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
5
|
export default ExerciseRunnerControllerCodeHelpRequestButton;
|
|
@@ -4,115 +4,106 @@ var React = require('react');
|
|
|
4
4
|
var reactIntl = require('react-intl');
|
|
5
5
|
var apiClient = require('@elice/api-client');
|
|
6
6
|
var blocks = require('@elice/blocks');
|
|
7
|
-
var designTokens = require('@elice/design-tokens');
|
|
8
7
|
var icons = require('@elice/icons');
|
|
9
8
|
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
10
|
-
var recoil = require('recoil');
|
|
11
9
|
var styled = require('styled-components');
|
|
12
|
-
var recoil$1 = require('../context/recoil.js');
|
|
13
|
-
var context = require('../context/context.js');
|
|
14
|
-
require('../context/recoilTypes.js');
|
|
15
|
-
require('../context/subjects.js');
|
|
16
|
-
require('../context/ExerciseProvider.js');
|
|
17
10
|
|
|
18
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
12
|
|
|
20
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
14
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
22
15
|
|
|
23
|
-
const
|
|
24
|
-
const
|
|
16
|
+
const ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_KEY = 'elice-material-exercise-aibot-tooltip-hidden';
|
|
17
|
+
const ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_VALUE = 'true';
|
|
25
18
|
const StyledControllerButton = styled__default["default"](blocks.Button).withConfig({
|
|
26
19
|
componentId: "sc-10grd0k-0"
|
|
27
20
|
})(["position:relative;transition:none;"]);
|
|
28
|
-
const
|
|
29
|
-
componentId: "sc-10grd0k-1"
|
|
30
|
-
})(["position:absolute;top:calc(-100% - 1.25rem);left:calc(-100% - 1.5rem);display:flex;align-items:center;gap:0.25rem;padding:0.5rem 0.75rem;border-radius:0.5rem;background-color:", ";"], designTokens.base.color.white);
|
|
31
|
-
const StyledTip = styled__default["default"].svg.withConfig({
|
|
32
|
-
componentId: "sc-10grd0k-2"
|
|
33
|
-
})(["position:absolute;left:50%;bottom:calc(-0.25rem);transform:rotate(225deg);"]);
|
|
34
|
-
const StyledCustomBadge = styled__default["default"].div.withConfig({
|
|
35
|
-
componentId: "sc-10grd0k-3"
|
|
36
|
-
})(["padding:0.0625rem 0.25rem;border-radius:0.25rem;background-color:", ";font-size:0.6875rem;"], designTokens.base.color.red7);
|
|
37
|
-
|
|
38
|
-
const ExerciseRunnerControllerCodeHelpRequestButton = ({
|
|
39
|
-
isCodeHelpHidden
|
|
40
|
-
}) => {
|
|
41
|
-
const {
|
|
42
|
-
onCodeHelpRequest
|
|
43
|
-
} = React__default["default"].useContext(context.ExerciseContext);
|
|
21
|
+
const ExerciseRunnerControllerCodeHelpRequestButton = React__default["default"].forwardRef((props, ref) => {
|
|
44
22
|
const {
|
|
45
23
|
orgNameShort
|
|
46
24
|
} = materialSharedUtils.useMaterialConfig();
|
|
47
|
-
const
|
|
48
|
-
const [isTooltipOpened, setIsTooltipOpened] = React__default["default"].useState(false);
|
|
49
|
-
const [aiInfo, setAiInfo] = React__default["default"].useState(null); //
|
|
25
|
+
const [isTooltipHidden, setIsTooltipHidden] = React__default["default"].useState(false); //
|
|
50
26
|
//
|
|
51
27
|
// Get ai info from organization and check all resovle below conditions.
|
|
52
|
-
// - isEnable is true
|
|
53
|
-
// - quotaPerDay is upper than zero
|
|
54
|
-
// -
|
|
28
|
+
// - isEnable is true.
|
|
29
|
+
// - quotaPerDay is upper than zero.
|
|
30
|
+
// - tooltip hidden is false.
|
|
55
31
|
|
|
56
32
|
React__default["default"].useEffect(() => {
|
|
57
|
-
|
|
58
|
-
organizationNameShort: orgNameShort
|
|
59
|
-
}).then(res => {
|
|
60
|
-
setAiInfo(res.organization.aibotInfo);
|
|
61
|
-
});
|
|
62
|
-
const isTooltipOpend = sessionStorage.getItem(IS_TOOLTIP_OPENED_KEY);
|
|
33
|
+
const isTooltipHidden = sessionStorage.getItem(ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_KEY) === ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_VALUE;
|
|
63
34
|
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
35
|
+
if (isTooltipHidden) {
|
|
36
|
+
setIsTooltipHidden(true);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
67
39
|
|
|
40
|
+
apiClient.getGlobalOrganizationGet({
|
|
41
|
+
organizationNameShort: orgNameShort
|
|
42
|
+
}).then(res => {
|
|
43
|
+
const {
|
|
44
|
+
aibotInfo
|
|
45
|
+
} = res.organization;
|
|
46
|
+
const isHidden = !aibotInfo.isEnabled || aibotInfo.quotaPerDay <= 0;
|
|
47
|
+
setIsTooltipHidden(isHidden);
|
|
48
|
+
}).catch(() => {
|
|
49
|
+
setIsTooltipHidden(true);
|
|
50
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
51
|
}, []); //
|
|
69
52
|
//
|
|
70
53
|
//
|
|
71
54
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
const renderAiBotTooltipTitle = () => {
|
|
60
|
+
return React__default["default"].createElement(blocks.Flex, {
|
|
61
|
+
align: "center"
|
|
62
|
+
}, React__default["default"].createElement(blocks.BadgeNext, {
|
|
63
|
+
role: "red"
|
|
64
|
+
}, React__default["default"].createElement(blocks.Text, {
|
|
65
|
+
role: "white",
|
|
66
|
+
size: "tiny",
|
|
67
|
+
bold: true
|
|
68
|
+
}, "NEW")), React__default["default"].createElement(blocks.Hspace, {
|
|
69
|
+
width: 0.25
|
|
70
|
+
}), React__default["default"].createElement(blocks.Text, {
|
|
71
|
+
role: "gray7",
|
|
72
|
+
size: "small",
|
|
73
|
+
bold: true
|
|
74
|
+
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
75
|
+
id: "exerciseRunner.controller.buttonGroup.button.tooltip.aiHelp"
|
|
76
|
+
})), React__default["default"].createElement(blocks.Hspace, {
|
|
77
|
+
width: 0.25
|
|
78
|
+
}), React__default["default"].createElement(blocks.IconButton, {
|
|
79
|
+
size: "tiny",
|
|
80
|
+
role: "gray6",
|
|
81
|
+
hasPadding: false,
|
|
82
|
+
border: false,
|
|
83
|
+
icon: icons.eilMathsignMultiplyBasic,
|
|
84
|
+
onClick: () => {
|
|
85
|
+
sessionStorage.setItem(ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_KEY, ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_VALUE);
|
|
86
|
+
setIsTooltipHidden(true);
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
75
90
|
|
|
76
|
-
return React__default["default"].createElement(
|
|
91
|
+
return React__default["default"].createElement(blocks.Tooltip, {
|
|
92
|
+
placement: "top",
|
|
93
|
+
dark: false,
|
|
94
|
+
visible: !isTooltipHidden,
|
|
95
|
+
title: renderAiBotTooltipTitle()
|
|
96
|
+
}, React__default["default"].createElement(StyledControllerButton, Object.assign({}, props, {
|
|
97
|
+
ref: ref,
|
|
77
98
|
size: "tiny",
|
|
78
99
|
role: "darkblue",
|
|
79
100
|
icon: React__default["default"].createElement(blocks.Icon, {
|
|
80
101
|
icon: icons.eilArrowRightwardsBasic
|
|
81
102
|
}),
|
|
82
|
-
iconAlign: "right"
|
|
83
|
-
|
|
84
|
-
onCodeHelpRequest(editorCursorSelectionValue);
|
|
85
|
-
}
|
|
86
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
103
|
+
iconAlign: "right"
|
|
104
|
+
}), React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
87
105
|
id: "exerciseRunner.controller.buttonGroup.button.helpRequest"
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
e.stopPropagation();
|
|
91
|
-
}
|
|
92
|
-
}, React__default["default"].createElement(StyledCustomBadge, null, React__default["default"].createElement(blocks.Text, {
|
|
93
|
-
role: "white",
|
|
94
|
-
size: "tiny"
|
|
95
|
-
}, "NEW")), React__default["default"].createElement(blocks.Text, {
|
|
96
|
-
role: "gray7",
|
|
97
|
-
size: "small"
|
|
98
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
99
|
-
id: "exerciseRunner.controller.buttonGroup.button.tooltip.aiHelp"
|
|
100
|
-
})), React__default["default"].createElement(blocks.IconButton, {
|
|
101
|
-
size: "tiny",
|
|
102
|
-
hasPadding: false,
|
|
103
|
-
border: false,
|
|
104
|
-
icon: icons.eilMathsignMultiplyBasic,
|
|
105
|
-
onClick: () => {
|
|
106
|
-
sessionStorage.setItem(IS_TOOLTIP_OPENED_KEY, IS_TOOLTIP_OPENED_VALUE);
|
|
107
|
-
setIsTooltipOpened(true);
|
|
108
|
-
}
|
|
109
|
-
}), React__default["default"].createElement(StyledTip, {
|
|
110
|
-
viewBox: "0 0 50 50",
|
|
111
|
-
height: "0.5rem"
|
|
112
|
-
}, React__default["default"].createElement("path", {
|
|
113
|
-
d: "M1 50 V10 Q1 1 10 1 H50z",
|
|
114
|
-
fill: designTokens.base.color.white
|
|
115
|
-
}))) : null);
|
|
116
|
-
};
|
|
106
|
+
})));
|
|
107
|
+
});
|
|
117
108
|
|
|
118
109
|
module.exports = ExerciseRunnerControllerCodeHelpRequestButton;
|
package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useRecoilValue } from 'recoil';
|
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import 'react-use';
|
|
9
9
|
import 'socket.io-client';
|
|
10
|
-
import { exerciseRunnerWebSocketStatusQuery, exerciseState, exerciseRunnerRunTypeState, exerciseLectureState, exerciseRunnerSubmittingState, exerciseRunnerRunningState, exerciseArduinoUploadProgressState, exerciseArduinoOpenedPortNameState } from '../context/recoil.js';
|
|
10
|
+
import { exerciseRunnerWebSocketStatusQuery, exerciseFileEditorCursorSelectionValueState, exerciseState, exerciseRunnerRunTypeState, exerciseLectureState, exerciseRunnerSubmittingState, exerciseRunnerRunningState, exerciseArduinoUploadProgressState, exerciseArduinoOpenedPortNameState } from '../context/recoil.js';
|
|
11
11
|
import { ExerciseContext } from '../context/context.js';
|
|
12
12
|
import '../context/recoilTypes.js';
|
|
13
13
|
import { exerciseFileEditorSaveAction$ } from '../context/subjects.js';
|
|
@@ -39,7 +39,8 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
39
39
|
|
|
40
40
|
const intl = useIntl();
|
|
41
41
|
const {
|
|
42
|
-
materialExerciseId
|
|
42
|
+
materialExerciseId,
|
|
43
|
+
onCodeHelpRequest
|
|
43
44
|
} = React.useContext(ExerciseContext);
|
|
44
45
|
const {
|
|
45
46
|
onSubmit,
|
|
@@ -47,6 +48,7 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
47
48
|
onCancel
|
|
48
49
|
} = React.useContext(ExerciseRunnerContext);
|
|
49
50
|
const runnerWebsocketStatus = useRecoilValue(exerciseRunnerWebSocketStatusQuery);
|
|
51
|
+
const editorCursorSelectionValue = useRecoilValue(exerciseFileEditorCursorSelectionValueState);
|
|
50
52
|
const exercise = useRecoilValue(exerciseState(materialExerciseId));
|
|
51
53
|
const exerciseRunType = useRecoilValue(exerciseRunnerRunTypeState);
|
|
52
54
|
const exerciseWithNoGrade = Boolean(exercise === null || exercise === void 0 ? void 0 : exercise.isNoSubmitGrade);
|
|
@@ -232,8 +234,12 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
232
234
|
|
|
233
235
|
|
|
234
236
|
const renderCodeHelpRequestButton = () => {
|
|
237
|
+
if (isCodeHelpHidden || !editorCursorSelectionValue || typeof onCodeHelpRequest !== 'function') {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
|
|
235
241
|
return React.createElement(ExerciseRunnerControllerCodeHelpRequestButton, {
|
|
236
|
-
|
|
242
|
+
onClick: () => onCodeHelpRequest(editorCursorSelectionValue)
|
|
237
243
|
});
|
|
238
244
|
}; //
|
|
239
245
|
//
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.FC<ExerciseRunnerControllerCodeHelpRequestButtonProps>;
|
|
2
|
+
import type { ButtonProps } from '@elice/blocks';
|
|
3
|
+
declare type OmittedButtonProps = Omit<ButtonProps, 'size' | 'role' | 'icon' | 'iconAlign'>;
|
|
4
|
+
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.ForwardRefExoticComponent<OmittedButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
5
|
export default ExerciseRunnerControllerCodeHelpRequestButton;
|
|
@@ -1,111 +1,102 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormattedMessage } from 'react-intl';
|
|
3
3
|
import { getGlobalOrganizationGet } from '@elice/api-client';
|
|
4
|
-
import { Button,
|
|
5
|
-
import {
|
|
6
|
-
import { eilArrowRightwardsBasic, eilMathsignMultiplyBasic } from '@elice/icons';
|
|
4
|
+
import { Button, Tooltip, Flex, BadgeNext, Text, Hspace, IconButton, Icon } from '@elice/blocks';
|
|
5
|
+
import { eilMathsignMultiplyBasic, eilArrowRightwardsBasic } from '@elice/icons';
|
|
7
6
|
import { useMaterialConfig } from '@elice/material-shared-utils';
|
|
8
|
-
import { useRecoilValue } from 'recoil';
|
|
9
7
|
import styled from 'styled-components';
|
|
10
|
-
import { exerciseFileEditorCursorSelectionValueState } from '../context/recoil.js';
|
|
11
|
-
import { ExerciseContext } from '../context/context.js';
|
|
12
|
-
import '../context/recoilTypes.js';
|
|
13
|
-
import '../context/subjects.js';
|
|
14
|
-
import '../context/ExerciseProvider.js';
|
|
15
8
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
9
|
+
const ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_KEY = 'elice-material-exercise-aibot-tooltip-hidden';
|
|
10
|
+
const ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_VALUE = 'true';
|
|
18
11
|
const StyledControllerButton = styled(Button).withConfig({
|
|
19
12
|
componentId: "sc-10grd0k-0"
|
|
20
13
|
})(["position:relative;transition:none;"]);
|
|
21
|
-
const
|
|
22
|
-
componentId: "sc-10grd0k-1"
|
|
23
|
-
})(["position:absolute;top:calc(-100% - 1.25rem);left:calc(-100% - 1.5rem);display:flex;align-items:center;gap:0.25rem;padding:0.5rem 0.75rem;border-radius:0.5rem;background-color:", ";"], base.color.white);
|
|
24
|
-
const StyledTip = styled.svg.withConfig({
|
|
25
|
-
componentId: "sc-10grd0k-2"
|
|
26
|
-
})(["position:absolute;left:50%;bottom:calc(-0.25rem);transform:rotate(225deg);"]);
|
|
27
|
-
const StyledCustomBadge = styled.div.withConfig({
|
|
28
|
-
componentId: "sc-10grd0k-3"
|
|
29
|
-
})(["padding:0.0625rem 0.25rem;border-radius:0.25rem;background-color:", ";font-size:0.6875rem;"], base.color.red7);
|
|
30
|
-
|
|
31
|
-
const ExerciseRunnerControllerCodeHelpRequestButton = ({
|
|
32
|
-
isCodeHelpHidden
|
|
33
|
-
}) => {
|
|
34
|
-
const {
|
|
35
|
-
onCodeHelpRequest
|
|
36
|
-
} = React.useContext(ExerciseContext);
|
|
14
|
+
const ExerciseRunnerControllerCodeHelpRequestButton = React.forwardRef((props, ref) => {
|
|
37
15
|
const {
|
|
38
16
|
orgNameShort
|
|
39
17
|
} = useMaterialConfig();
|
|
40
|
-
const
|
|
41
|
-
const [isTooltipOpened, setIsTooltipOpened] = React.useState(false);
|
|
42
|
-
const [aiInfo, setAiInfo] = React.useState(null); //
|
|
18
|
+
const [isTooltipHidden, setIsTooltipHidden] = React.useState(false); //
|
|
43
19
|
//
|
|
44
20
|
// Get ai info from organization and check all resovle below conditions.
|
|
45
|
-
// - isEnable is true
|
|
46
|
-
// - quotaPerDay is upper than zero
|
|
47
|
-
// -
|
|
21
|
+
// - isEnable is true.
|
|
22
|
+
// - quotaPerDay is upper than zero.
|
|
23
|
+
// - tooltip hidden is false.
|
|
48
24
|
|
|
49
25
|
React.useEffect(() => {
|
|
50
|
-
|
|
51
|
-
organizationNameShort: orgNameShort
|
|
52
|
-
}).then(res => {
|
|
53
|
-
setAiInfo(res.organization.aibotInfo);
|
|
54
|
-
});
|
|
55
|
-
const isTooltipOpend = sessionStorage.getItem(IS_TOOLTIP_OPENED_KEY);
|
|
26
|
+
const isTooltipHidden = sessionStorage.getItem(ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_KEY) === ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_VALUE;
|
|
56
27
|
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
28
|
+
if (isTooltipHidden) {
|
|
29
|
+
setIsTooltipHidden(true);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
60
32
|
|
|
33
|
+
getGlobalOrganizationGet({
|
|
34
|
+
organizationNameShort: orgNameShort
|
|
35
|
+
}).then(res => {
|
|
36
|
+
const {
|
|
37
|
+
aibotInfo
|
|
38
|
+
} = res.organization;
|
|
39
|
+
const isHidden = !aibotInfo.isEnabled || aibotInfo.quotaPerDay <= 0;
|
|
40
|
+
setIsTooltipHidden(isHidden);
|
|
41
|
+
}).catch(() => {
|
|
42
|
+
setIsTooltipHidden(true);
|
|
43
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
44
|
}, []); //
|
|
62
45
|
//
|
|
63
46
|
//
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
const renderAiBotTooltipTitle = () => {
|
|
53
|
+
return React.createElement(Flex, {
|
|
54
|
+
align: "center"
|
|
55
|
+
}, React.createElement(BadgeNext, {
|
|
56
|
+
role: "red"
|
|
57
|
+
}, React.createElement(Text, {
|
|
58
|
+
role: "white",
|
|
59
|
+
size: "tiny",
|
|
60
|
+
bold: true
|
|
61
|
+
}, "NEW")), React.createElement(Hspace, {
|
|
62
|
+
width: 0.25
|
|
63
|
+
}), React.createElement(Text, {
|
|
64
|
+
role: "gray7",
|
|
65
|
+
size: "small",
|
|
66
|
+
bold: true
|
|
67
|
+
}, React.createElement(FormattedMessage, {
|
|
68
|
+
id: "exerciseRunner.controller.buttonGroup.button.tooltip.aiHelp"
|
|
69
|
+
})), React.createElement(Hspace, {
|
|
70
|
+
width: 0.25
|
|
71
|
+
}), React.createElement(IconButton, {
|
|
72
|
+
size: "tiny",
|
|
73
|
+
role: "gray6",
|
|
74
|
+
hasPadding: false,
|
|
75
|
+
border: false,
|
|
76
|
+
icon: eilMathsignMultiplyBasic,
|
|
77
|
+
onClick: () => {
|
|
78
|
+
sessionStorage.setItem(ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_KEY, ELICE_MATERIAL_EXERCISE_AI_BOT_TOOLTIP_VALUE);
|
|
79
|
+
setIsTooltipHidden(true);
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
68
83
|
|
|
69
|
-
return React.createElement(
|
|
84
|
+
return React.createElement(Tooltip, {
|
|
85
|
+
placement: "top",
|
|
86
|
+
dark: false,
|
|
87
|
+
visible: !isTooltipHidden,
|
|
88
|
+
title: renderAiBotTooltipTitle()
|
|
89
|
+
}, React.createElement(StyledControllerButton, Object.assign({}, props, {
|
|
90
|
+
ref: ref,
|
|
70
91
|
size: "tiny",
|
|
71
92
|
role: "darkblue",
|
|
72
93
|
icon: React.createElement(Icon, {
|
|
73
94
|
icon: eilArrowRightwardsBasic
|
|
74
95
|
}),
|
|
75
|
-
iconAlign: "right"
|
|
76
|
-
|
|
77
|
-
onCodeHelpRequest(editorCursorSelectionValue);
|
|
78
|
-
}
|
|
79
|
-
}, React.createElement(FormattedMessage, {
|
|
96
|
+
iconAlign: "right"
|
|
97
|
+
}), React.createElement(FormattedMessage, {
|
|
80
98
|
id: "exerciseRunner.controller.buttonGroup.button.helpRequest"
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
e.stopPropagation();
|
|
84
|
-
}
|
|
85
|
-
}, React.createElement(StyledCustomBadge, null, React.createElement(Text, {
|
|
86
|
-
role: "white",
|
|
87
|
-
size: "tiny"
|
|
88
|
-
}, "NEW")), React.createElement(Text, {
|
|
89
|
-
role: "gray7",
|
|
90
|
-
size: "small"
|
|
91
|
-
}, React.createElement(FormattedMessage, {
|
|
92
|
-
id: "exerciseRunner.controller.buttonGroup.button.tooltip.aiHelp"
|
|
93
|
-
})), React.createElement(IconButton, {
|
|
94
|
-
size: "tiny",
|
|
95
|
-
hasPadding: false,
|
|
96
|
-
border: false,
|
|
97
|
-
icon: eilMathsignMultiplyBasic,
|
|
98
|
-
onClick: () => {
|
|
99
|
-
sessionStorage.setItem(IS_TOOLTIP_OPENED_KEY, IS_TOOLTIP_OPENED_VALUE);
|
|
100
|
-
setIsTooltipOpened(true);
|
|
101
|
-
}
|
|
102
|
-
}), React.createElement(StyledTip, {
|
|
103
|
-
viewBox: "0 0 50 50",
|
|
104
|
-
height: "0.5rem"
|
|
105
|
-
}, React.createElement("path", {
|
|
106
|
-
d: "M1 50 V10 Q1 1 10 1 H50z",
|
|
107
|
-
fill: base.color.white
|
|
108
|
-
}))) : null);
|
|
109
|
-
};
|
|
99
|
+
})));
|
|
100
|
+
});
|
|
110
101
|
|
|
111
102
|
export { ExerciseRunnerControllerCodeHelpRequestButton as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-exercise",
|
|
3
|
-
"version": "1.230220.
|
|
3
|
+
"version": "1.230220.2",
|
|
4
4
|
"description": "User view and editing components of Elice material exercise",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"@elice/design-tokens": "^1.220803.0",
|
|
80
80
|
"@elice/icons": "^1.220803.0",
|
|
81
81
|
"@elice/markdown": "^1.220803.0",
|
|
82
|
-
"@elice/material-shared-types": "1.230220.
|
|
83
|
-
"@elice/material-shared-utils": "1.230220.
|
|
82
|
+
"@elice/material-shared-types": "1.230220.2",
|
|
83
|
+
"@elice/material-shared-utils": "1.230220.2",
|
|
84
84
|
"@elice/types": "1.230215.1",
|
|
85
85
|
"@elice/websocket": "^1.220803.0",
|
|
86
86
|
"@types/classnames": "^2.3.1",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"recoil": "^0.6.1",
|
|
103
103
|
"styled-components": "^5.2.0"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "f49499e86ce2ccbea6a1b83e070649a3167f8074"
|
|
106
106
|
}
|