@elice/material-exercise 1.230217.0-sepmatlec.3 → 1.230220.0
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/context/ExerciseProvider.js +3 -3
- package/cjs/components/material-exercise/context/recoil.js +1 -11
- package/cjs/components/material-exercise/context/recoilTypes.d.ts +1 -6
- package/cjs/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +1 -1
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +1 -1
- package/cjs/components/material-exercise/exercise-room/ExerciseRoomDetail.js +6 -6
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +3 -9
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +4 -3
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +74 -69
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +8 -12
- package/es/components/material-exercise/context/ExerciseProvider.js +3 -3
- package/es/components/material-exercise/context/recoil.js +2 -12
- package/es/components/material-exercise/context/recoilTypes.d.ts +1 -6
- package/es/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +1 -1
- package/es/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +1 -1
- package/es/components/material-exercise/exercise-room/ExerciseRoomDetail.js +6 -6
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +4 -10
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +4 -3
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +76 -71
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +8 -12
- package/package.json +8 -8
|
@@ -44,8 +44,8 @@ const ExerciseProvider = _a => {
|
|
|
44
44
|
const exercise = recoil.useRecoilValue(recoil$1.exerciseState(materialExerciseId));
|
|
45
45
|
const exerciseRoom = recoil.useRecoilValue(recoil$1.exerciseRoomState(exerciseRoomId)); // lecture
|
|
46
46
|
|
|
47
|
-
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
48
|
-
const resetLecture = recoil.useResetRecoilState(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
47
|
+
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
48
|
+
const resetLecture = recoil.useResetRecoilState(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId)); // multilang languages
|
|
49
49
|
|
|
50
50
|
const exerciseMultilangLanguages = recoil.useRecoilValue(recoil$1.exerciseMultilangLanguagesState(exercise === null || exercise === void 0 ? void 0 : exercise.id));
|
|
51
51
|
const resetExerciseMultilangLanguages = recoil.useResetRecoilState(recoil$1.exerciseMultilangLanguagesState(exercise === null || exercise === void 0 ? void 0 : exercise.id)); // etc
|
|
@@ -83,7 +83,7 @@ const ExerciseProvider = _a => {
|
|
|
83
83
|
//
|
|
84
84
|
|
|
85
85
|
React__default["default"].useEffect(() => {
|
|
86
|
-
if (!(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
86
|
+
if (!(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId)) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -74,17 +74,7 @@ const exerciseState = recoil.atomFamily({
|
|
|
74
74
|
const get = async () => {
|
|
75
75
|
setSelf(await apiClient.getOrgMaterialExerciseGet({
|
|
76
76
|
materialExerciseId
|
|
77
|
-
}).then(res => res.materialExercise).
|
|
78
|
-
materialId: materialExercise.id,
|
|
79
|
-
materialType: types.enums.LectureMaterialType.Exercise
|
|
80
|
-
}).then(res => ({
|
|
81
|
-
_courseId: res.courseId,
|
|
82
|
-
_lectureId: res.lectureId,
|
|
83
|
-
_lecturePageId: res.lecturePageId,
|
|
84
|
-
_orderNo: res.orderNo
|
|
85
|
-
})).catch(err => {
|
|
86
|
-
throw err;
|
|
87
|
-
})])).then(([materialExercise, lecturePageResolve]) => Object.assign(Object.assign({}, materialExercise), lecturePageResolve)).catch(() => null));
|
|
77
|
+
}).then(res => res.materialExercise).catch(() => null));
|
|
88
78
|
};
|
|
89
79
|
|
|
90
80
|
if (trigger === 'get') {
|
|
@@ -10,12 +10,7 @@ export declare type AtomLectureState = GetOrgLectureGetResponses['lecture'] | nu
|
|
|
10
10
|
/**
|
|
11
11
|
* Material exercise.
|
|
12
12
|
*/
|
|
13
|
-
export declare type AtomExerciseState =
|
|
14
|
-
_courseId: number;
|
|
15
|
-
_lectureId: number;
|
|
16
|
-
_lecturePageId: number;
|
|
17
|
-
_orderNo: number;
|
|
18
|
-
}) | null;
|
|
13
|
+
export declare type AtomExerciseState = GetOrgMaterialExerciseGetResponses['materialExercise'] | null;
|
|
19
14
|
/**
|
|
20
15
|
* Material exercise room.
|
|
21
16
|
*/
|
|
@@ -53,7 +53,7 @@ const ExerciseFileEditor = () => {
|
|
|
53
53
|
} = React__default["default"].useContext(context.ExerciseContext);
|
|
54
54
|
const exercise = recoil.useRecoilValue(recoil$1.exerciseState(materialExerciseId));
|
|
55
55
|
const exerciseRoom = recoil.useRecoilValue(recoil$1.exerciseRoomState(exerciseRoomId));
|
|
56
|
-
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
56
|
+
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
57
57
|
const preference = recoil.useRecoilValue(recoil$1.exerciseEditorPreferenceState);
|
|
58
58
|
const activeFilename = recoil.useRecoilValue(recoil$1.exerciseActiveFilenameState);
|
|
59
59
|
const readOnly = readOnlyEditor || readOnlyActiveFile;
|
|
@@ -27,7 +27,7 @@ const ExerciseMenuDropdown = () => {
|
|
|
27
27
|
} = React__default["default"].useContext(context.ExerciseContext);
|
|
28
28
|
const user = recoil.useRecoilValue(recoil$1.exerciseUserState);
|
|
29
29
|
const exercise = recoil.useRecoilValue(recoil$1.exerciseState(materialExerciseId));
|
|
30
|
-
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
30
|
+
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
31
31
|
const activeFilename = recoil.useRecoilValue(recoil$1.exerciseActiveFilenameState);
|
|
32
32
|
const setRightpaneActiveState = recoil.useSetRecoilState(recoil$1.exerciseRightpaneActiveState);
|
|
33
33
|
const [isSubmitHistoryModalOpen, setIsSubmitHistoryModalOpen] = React__default["default"].useState(false);
|
|
@@ -34,7 +34,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
34
34
|
goToList,
|
|
35
35
|
onHide
|
|
36
36
|
}) => {
|
|
37
|
-
var _a, _b, _c, _d, _e;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f;
|
|
38
38
|
|
|
39
39
|
const intl = reactIntl.useIntl();
|
|
40
40
|
const {
|
|
@@ -52,7 +52,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
52
52
|
const [isLeaveDialogOpen, setIsLeaveDialogOpen] = React__default["default"].useState(false);
|
|
53
53
|
const [isDeleting, setIsDeleting] = React__default["default"].useState(false);
|
|
54
54
|
const isThisChatRoomOwner = (_b = ((_a = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.roomUsers.find(roomUser => roomUser.user.id === (user === null || user === void 0 ? void 0 : user.id))) === null || _a === void 0 ? void 0 : _a.permission) === types.enums.ExerciseRoomPermission.Owner) !== null && _b !== void 0 ? _b : false;
|
|
55
|
-
const shareLink = materialExercise ? `https://${window.location.host}/courses/${materialExercise.
|
|
55
|
+
const shareLink = materialExercise ? `https://${window.location.host}/courses/${materialExercise.courseId}/lectures/${materialExercise.lectureId}/materials/${(_c = materialExercise === null || materialExercise === void 0 ? void 0 : materialExercise.mainOrderNo) !== null && _c !== void 0 ? _c : 0}/projects/${selectedExerciseRoomId}` : '';
|
|
56
56
|
const [, copyToClipboard] = reactUse.useCopyToClipboard();
|
|
57
57
|
const doGetOrgMaterialExerciseExerciseRoomGet = React__default["default"].useCallback(() => {
|
|
58
58
|
return apiClient.getOrgMaterialExerciseExerciseRoomGet({
|
|
@@ -100,7 +100,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
100
100
|
const doGetOrgCourseUserList = React__default["default"].useCallback(() => {
|
|
101
101
|
if (materialExercise) {
|
|
102
102
|
return apiClient.getOrgCourseUserList({
|
|
103
|
-
courseId: materialExercise.
|
|
103
|
+
courseId: materialExercise.courseId,
|
|
104
104
|
isForTutoring: false,
|
|
105
105
|
count: 20,
|
|
106
106
|
offset: 0,
|
|
@@ -174,7 +174,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
174
174
|
return React__default["default"].createElement(StyledModal, {
|
|
175
175
|
theme: "dark",
|
|
176
176
|
onHide: onHide,
|
|
177
|
-
title: (
|
|
177
|
+
title: (_d = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.title) !== null && _d !== void 0 ? _d : '',
|
|
178
178
|
headerIcon: icons.eilArrowLeftwardsSingle,
|
|
179
179
|
onHeaderIconClick: goToList,
|
|
180
180
|
footerChild: exerciseRoom ? exerciseRoom.isDefaultRoom ? React__default["default"].createElement(blocks.Flex, {
|
|
@@ -217,7 +217,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
217
217
|
label: intl.formatMessage({
|
|
218
218
|
id: 'materialExerciseExerciseRoom.leave'
|
|
219
219
|
}),
|
|
220
|
-
disabled: (
|
|
220
|
+
disabled: (_e = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.isDefaultRoom) !== null && _e !== void 0 ? _e : false,
|
|
221
221
|
role: 'gray6',
|
|
222
222
|
onClick: () => {
|
|
223
223
|
setIsLeaveDialogOpen(true);
|
|
@@ -449,7 +449,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
449
449
|
}), isThisChatRoomOwner ? React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(blocks.Select, {
|
|
450
450
|
size: "small",
|
|
451
451
|
width: "small",
|
|
452
|
-
value: (
|
|
452
|
+
value: (_f = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.publicPermission) !== null && _f !== void 0 ? _f : types.enums.ExerciseRoomPermission.Nothing,
|
|
453
453
|
onChange: value => {
|
|
454
454
|
doPostOrgMaterialExerciseExerciseRoomEdit(value);
|
|
455
455
|
},
|
package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js
CHANGED
|
@@ -46,8 +46,7 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
46
46
|
|
|
47
47
|
const intl = reactIntl.useIntl();
|
|
48
48
|
const {
|
|
49
|
-
materialExerciseId
|
|
50
|
-
onCodeHelpRequest
|
|
49
|
+
materialExerciseId
|
|
51
50
|
} = React__default["default"].useContext(context.ExerciseContext);
|
|
52
51
|
const {
|
|
53
52
|
onSubmit,
|
|
@@ -55,11 +54,10 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
55
54
|
onCancel
|
|
56
55
|
} = React__default["default"].useContext(ExerciseRunnerContext.ExerciseRunnerContext);
|
|
57
56
|
const runnerWebsocketStatus = recoil.useRecoilValue(recoil$1.exerciseRunnerWebSocketStatusQuery);
|
|
58
|
-
const editorCursorSelectionValue = recoil.useRecoilValue(recoil$1.exerciseFileEditorCursorSelectionValueState);
|
|
59
57
|
const exercise = recoil.useRecoilValue(recoil$1.exerciseState(materialExerciseId));
|
|
60
58
|
const exerciseRunType = recoil.useRecoilValue(recoil$1.exerciseRunnerRunTypeState);
|
|
61
59
|
const exerciseWithNoGrade = Boolean(exercise === null || exercise === void 0 ? void 0 : exercise.isNoSubmitGrade);
|
|
62
|
-
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
60
|
+
const lecture = recoil.useRecoilValue(recoil$1.exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
63
61
|
const isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === types.enums.LectureType.Test;
|
|
64
62
|
const isTestLectureCompleted = (lecture === null || lecture === void 0 ? void 0 : lecture.testAdmissionStatus) === types.enums.TestAdmissionStatus.Completed; // runner states
|
|
65
63
|
|
|
@@ -241,12 +239,8 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
241
239
|
|
|
242
240
|
|
|
243
241
|
const renderCodeHelpRequestButton = () => {
|
|
244
|
-
if (isCodeHelpHidden || !editorCursorSelectionValue || typeof onCodeHelpRequest !== 'function') {
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
242
|
return React__default["default"].createElement(ExerciseRunnerControllerCodeHelpRequestButton, {
|
|
249
|
-
|
|
243
|
+
isCodeHelpHidden: isCodeHelpHidden
|
|
250
244
|
});
|
|
251
245
|
}; //
|
|
252
246
|
//
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
interface ExerciseRunnerControllerCodeHelpRequestButtonProps {
|
|
3
|
+
isCodeHelpHidden: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.FC<ExerciseRunnerControllerCodeHelpRequestButtonProps>;
|
|
5
6
|
export default ExerciseRunnerControllerCodeHelpRequestButton;
|
|
@@ -4,106 +4,111 @@ 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');
|
|
7
8
|
var icons = require('@elice/icons');
|
|
8
9
|
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
10
|
+
var recoil = require('recoil');
|
|
9
11
|
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');
|
|
10
17
|
|
|
11
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
19
|
|
|
13
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
21
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
22
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
23
|
+
const IS_TOOLTIP_OPENED_KEY = 'isTooltipOpened';
|
|
24
|
+
const IS_TOOLTIP_OPENED_VALUE = 'true';
|
|
18
25
|
const StyledControllerButton = styled__default["default"](blocks.Button).withConfig({
|
|
19
26
|
componentId: "sc-10grd0k-0"
|
|
20
27
|
})(["position:relative;transition:none;"]);
|
|
21
|
-
const
|
|
28
|
+
const StyledCustomTooltip = styled__default["default"].div.withConfig({
|
|
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);
|
|
22
44
|
const {
|
|
23
45
|
orgNameShort
|
|
24
46
|
} = materialSharedUtils.useMaterialConfig();
|
|
25
|
-
const
|
|
47
|
+
const editorCursorSelectionValue = recoil.useRecoilValue(recoil$1.exerciseFileEditorCursorSelectionValueState);
|
|
48
|
+
const [isTooltipOpened, setIsTooltipOpened] = React__default["default"].useState(false);
|
|
49
|
+
const [aiInfo, setAiInfo] = React__default["default"].useState(null); //
|
|
26
50
|
//
|
|
27
51
|
// Get ai info from organization and check all resovle below conditions.
|
|
28
|
-
// - isEnable is true
|
|
29
|
-
// - quotaPerDay is upper than zero
|
|
30
|
-
// -
|
|
52
|
+
// - isEnable is true
|
|
53
|
+
// - quotaPerDay is upper than zero
|
|
54
|
+
// - tooltipOpenSession is false
|
|
31
55
|
|
|
32
56
|
React__default["default"].useEffect(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (isTooltipHidden) {
|
|
36
|
-
setIsTooltipHidden(true);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
apiClient.getGlobalOrganizationGet({
|
|
57
|
+
void apiClient.getGlobalOrganizationGet({
|
|
41
58
|
organizationNameShort: orgNameShort
|
|
42
59
|
}).then(res => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
setAiInfo(res.organization.aibotInfo);
|
|
61
|
+
});
|
|
62
|
+
const isTooltipOpend = sessionStorage.getItem(IS_TOOLTIP_OPENED_KEY);
|
|
63
|
+
|
|
64
|
+
if (isTooltipOpend === IS_TOOLTIP_OPENED_VALUE) {
|
|
65
|
+
setIsTooltipOpened(true);
|
|
66
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
+
|
|
51
68
|
}, []); //
|
|
52
69
|
//
|
|
53
70
|
//
|
|
54
71
|
|
|
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
|
-
};
|
|
72
|
+
if (isCodeHelpHidden || !editorCursorSelectionValue || typeof onCodeHelpRequest !== 'function') {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
90
75
|
|
|
91
|
-
return React__default["default"].createElement(
|
|
92
|
-
placement: "top",
|
|
93
|
-
dark: false,
|
|
94
|
-
visible: !isTooltipHidden,
|
|
95
|
-
title: renderAiBotTooltipTitle()
|
|
96
|
-
}, React__default["default"].createElement(StyledControllerButton, Object.assign({}, props, {
|
|
97
|
-
ref: ref,
|
|
76
|
+
return React__default["default"].createElement(StyledControllerButton, {
|
|
98
77
|
size: "tiny",
|
|
99
78
|
role: "darkblue",
|
|
100
79
|
icon: React__default["default"].createElement(blocks.Icon, {
|
|
101
80
|
icon: icons.eilArrowRightwardsBasic
|
|
102
81
|
}),
|
|
103
|
-
iconAlign: "right"
|
|
104
|
-
|
|
82
|
+
iconAlign: "right",
|
|
83
|
+
onClick: () => {
|
|
84
|
+
onCodeHelpRequest(editorCursorSelectionValue);
|
|
85
|
+
}
|
|
86
|
+
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
105
87
|
id: "exerciseRunner.controller.buttonGroup.button.helpRequest"
|
|
106
|
-
})
|
|
107
|
-
|
|
88
|
+
}), aiInfo && aiInfo.isEnabled && aiInfo.quotaPerDay > 0 && !isTooltipOpened ? React__default["default"].createElement(StyledCustomTooltip, null, React__default["default"].createElement(StyledCustomBadge, null, React__default["default"].createElement(blocks.Text, {
|
|
89
|
+
role: "white",
|
|
90
|
+
size: "tiny"
|
|
91
|
+
}, "NEW")), React__default["default"].createElement(blocks.Text, {
|
|
92
|
+
role: "gray7",
|
|
93
|
+
size: "small"
|
|
94
|
+
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
95
|
+
id: "exerciseRunner.controller.buttonGroup.button.tooltip.aiHelp"
|
|
96
|
+
})), React__default["default"].createElement(blocks.IconButton, {
|
|
97
|
+
size: "tiny",
|
|
98
|
+
hasPadding: false,
|
|
99
|
+
border: false,
|
|
100
|
+
icon: icons.eilMathsignMultiplyBasic,
|
|
101
|
+
onClick: () => {
|
|
102
|
+
sessionStorage.setItem(IS_TOOLTIP_OPENED_KEY, IS_TOOLTIP_OPENED_VALUE);
|
|
103
|
+
setIsTooltipOpened(true);
|
|
104
|
+
}
|
|
105
|
+
}), React__default["default"].createElement(StyledTip, {
|
|
106
|
+
viewBox: "0 0 50 50",
|
|
107
|
+
height: "0.5rem"
|
|
108
|
+
}, React__default["default"].createElement("path", {
|
|
109
|
+
d: "M1 50 V10 Q1 1 10 1 H50z",
|
|
110
|
+
fill: designTokens.base.color.white
|
|
111
|
+
}))) : null);
|
|
112
|
+
};
|
|
108
113
|
|
|
109
114
|
module.exports = ExerciseRunnerControllerCodeHelpRequestButton;
|
package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js
CHANGED
|
@@ -104,19 +104,15 @@ const ExerciseRunnerControllerRunningInfo = () => {
|
|
|
104
104
|
//
|
|
105
105
|
|
|
106
106
|
React__default["default"].useEffect(() => {
|
|
107
|
-
if (
|
|
108
|
-
|
|
107
|
+
if (exercise === null || exercise === void 0 ? void 0 : exercise.courseId) {
|
|
108
|
+
apiClient.getOrgCourseGet({
|
|
109
|
+
courseId: exercise.courseId
|
|
110
|
+
}).then(({
|
|
111
|
+
course
|
|
112
|
+
}) => {
|
|
113
|
+
setCourse(course);
|
|
114
|
+
}).catch(console.error);
|
|
109
115
|
}
|
|
110
|
-
|
|
111
|
-
const abortCtrl = new AbortController();
|
|
112
|
-
apiClient.getOrgCourseGet({
|
|
113
|
-
courseId: exercise._courseId
|
|
114
|
-
}, {
|
|
115
|
-
signal: abortCtrl.signal
|
|
116
|
-
}).then(res => res.course).then(setCourse).catch(console.error);
|
|
117
|
-
return () => {
|
|
118
|
-
abortCtrl.abort();
|
|
119
|
-
};
|
|
120
116
|
}, [exercise]);
|
|
121
117
|
/**
|
|
122
118
|
* Last running score.
|
|
@@ -37,8 +37,8 @@ const ExerciseProvider = _a => {
|
|
|
37
37
|
const exercise = useRecoilValue(exerciseState(materialExerciseId));
|
|
38
38
|
const exerciseRoom = useRecoilValue(exerciseRoomState(exerciseRoomId)); // lecture
|
|
39
39
|
|
|
40
|
-
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
41
|
-
const resetLecture = useResetRecoilState(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
40
|
+
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
41
|
+
const resetLecture = useResetRecoilState(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId)); // multilang languages
|
|
42
42
|
|
|
43
43
|
const exerciseMultilangLanguages = useRecoilValue(exerciseMultilangLanguagesState(exercise === null || exercise === void 0 ? void 0 : exercise.id));
|
|
44
44
|
const resetExerciseMultilangLanguages = useResetRecoilState(exerciseMultilangLanguagesState(exercise === null || exercise === void 0 ? void 0 : exercise.id)); // etc
|
|
@@ -76,7 +76,7 @@ const ExerciseProvider = _a => {
|
|
|
76
76
|
//
|
|
77
77
|
|
|
78
78
|
React.useEffect(() => {
|
|
79
|
-
if (!(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
79
|
+
if (!(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId)) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { postGlobalAccountPreferenceEdit, postOrgMaterialExerciseExerciseRoomUserFileAdd, getOrgLectureGet, getOrgMaterialExerciseGet,
|
|
1
|
+
import { postGlobalAccountPreferenceEdit, postOrgMaterialExerciseExerciseRoomUserFileAdd, getOrgLectureGet, getOrgMaterialExerciseGet, getOrgMaterialExerciseExerciseRoomGet, getOrgUserGet, getGlobalAccountPreferenceGet, getOrgMaterialExerciseExerciseImageExerciseFileGet, getOrgMaterialExerciseExerciseRoomUserFileGet } from '@elice/api-client';
|
|
2
2
|
import { enums } from '@elice/types';
|
|
3
3
|
import { EliceWebSocket } from '@elice/websocket';
|
|
4
4
|
import { camelizeKeys } from 'humps';
|
|
@@ -66,17 +66,7 @@ const exerciseState = atomFamily({
|
|
|
66
66
|
const get = async () => {
|
|
67
67
|
setSelf(await getOrgMaterialExerciseGet({
|
|
68
68
|
materialExerciseId
|
|
69
|
-
}).then(res => res.materialExercise).
|
|
70
|
-
materialId: materialExercise.id,
|
|
71
|
-
materialType: enums.LectureMaterialType.Exercise
|
|
72
|
-
}).then(res => ({
|
|
73
|
-
_courseId: res.courseId,
|
|
74
|
-
_lectureId: res.lectureId,
|
|
75
|
-
_lecturePageId: res.lecturePageId,
|
|
76
|
-
_orderNo: res.orderNo
|
|
77
|
-
})).catch(err => {
|
|
78
|
-
throw err;
|
|
79
|
-
})])).then(([materialExercise, lecturePageResolve]) => Object.assign(Object.assign({}, materialExercise), lecturePageResolve)).catch(() => null));
|
|
69
|
+
}).then(res => res.materialExercise).catch(() => null));
|
|
80
70
|
};
|
|
81
71
|
|
|
82
72
|
if (trigger === 'get') {
|
|
@@ -10,12 +10,7 @@ export declare type AtomLectureState = GetOrgLectureGetResponses['lecture'] | nu
|
|
|
10
10
|
/**
|
|
11
11
|
* Material exercise.
|
|
12
12
|
*/
|
|
13
|
-
export declare type AtomExerciseState =
|
|
14
|
-
_courseId: number;
|
|
15
|
-
_lectureId: number;
|
|
16
|
-
_lecturePageId: number;
|
|
17
|
-
_orderNo: number;
|
|
18
|
-
}) | null;
|
|
13
|
+
export declare type AtomExerciseState = GetOrgMaterialExerciseGetResponses['materialExercise'] | null;
|
|
19
14
|
/**
|
|
20
15
|
* Material exercise room.
|
|
21
16
|
*/
|
|
@@ -47,7 +47,7 @@ const ExerciseFileEditor = () => {
|
|
|
47
47
|
} = React.useContext(ExerciseContext);
|
|
48
48
|
const exercise = useRecoilValue(exerciseState(materialExerciseId));
|
|
49
49
|
const exerciseRoom = useRecoilValue(exerciseRoomState(exerciseRoomId));
|
|
50
|
-
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
50
|
+
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
51
51
|
const preference = useRecoilValue(exerciseEditorPreferenceState);
|
|
52
52
|
const activeFilename = useRecoilValue(exerciseActiveFilenameState);
|
|
53
53
|
const readOnly = readOnlyEditor || readOnlyActiveFile;
|
|
@@ -21,7 +21,7 @@ const ExerciseMenuDropdown = () => {
|
|
|
21
21
|
} = React.useContext(ExerciseContext);
|
|
22
22
|
const user = useRecoilValue(exerciseUserState);
|
|
23
23
|
const exercise = useRecoilValue(exerciseState(materialExerciseId));
|
|
24
|
-
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
24
|
+
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
25
25
|
const activeFilename = useRecoilValue(exerciseActiveFilenameState);
|
|
26
26
|
const setRightpaneActiveState = useSetRecoilState(exerciseRightpaneActiveState);
|
|
27
27
|
const [isSubmitHistoryModalOpen, setIsSubmitHistoryModalOpen] = React.useState(false);
|
|
@@ -26,7 +26,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
26
26
|
goToList,
|
|
27
27
|
onHide
|
|
28
28
|
}) => {
|
|
29
|
-
var _a, _b, _c, _d, _e;
|
|
29
|
+
var _a, _b, _c, _d, _e, _f;
|
|
30
30
|
|
|
31
31
|
const intl = useIntl();
|
|
32
32
|
const {
|
|
@@ -44,7 +44,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
44
44
|
const [isLeaveDialogOpen, setIsLeaveDialogOpen] = React.useState(false);
|
|
45
45
|
const [isDeleting, setIsDeleting] = React.useState(false);
|
|
46
46
|
const isThisChatRoomOwner = (_b = ((_a = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.roomUsers.find(roomUser => roomUser.user.id === (user === null || user === void 0 ? void 0 : user.id))) === null || _a === void 0 ? void 0 : _a.permission) === enums.ExerciseRoomPermission.Owner) !== null && _b !== void 0 ? _b : false;
|
|
47
|
-
const shareLink = materialExercise ? `https://${window.location.host}/courses/${materialExercise.
|
|
47
|
+
const shareLink = materialExercise ? `https://${window.location.host}/courses/${materialExercise.courseId}/lectures/${materialExercise.lectureId}/materials/${(_c = materialExercise === null || materialExercise === void 0 ? void 0 : materialExercise.mainOrderNo) !== null && _c !== void 0 ? _c : 0}/projects/${selectedExerciseRoomId}` : '';
|
|
48
48
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
49
49
|
const doGetOrgMaterialExerciseExerciseRoomGet = React.useCallback(() => {
|
|
50
50
|
return getOrgMaterialExerciseExerciseRoomGet({
|
|
@@ -92,7 +92,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
92
92
|
const doGetOrgCourseUserList = React.useCallback(() => {
|
|
93
93
|
if (materialExercise) {
|
|
94
94
|
return getOrgCourseUserList({
|
|
95
|
-
courseId: materialExercise.
|
|
95
|
+
courseId: materialExercise.courseId,
|
|
96
96
|
isForTutoring: false,
|
|
97
97
|
count: 20,
|
|
98
98
|
offset: 0,
|
|
@@ -166,7 +166,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
166
166
|
return React.createElement(StyledModal, {
|
|
167
167
|
theme: "dark",
|
|
168
168
|
onHide: onHide,
|
|
169
|
-
title: (
|
|
169
|
+
title: (_d = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.title) !== null && _d !== void 0 ? _d : '',
|
|
170
170
|
headerIcon: eilArrowLeftwardsSingle,
|
|
171
171
|
onHeaderIconClick: goToList,
|
|
172
172
|
footerChild: exerciseRoom ? exerciseRoom.isDefaultRoom ? React.createElement(Flex, {
|
|
@@ -209,7 +209,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
209
209
|
label: intl.formatMessage({
|
|
210
210
|
id: 'materialExerciseExerciseRoom.leave'
|
|
211
211
|
}),
|
|
212
|
-
disabled: (
|
|
212
|
+
disabled: (_e = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.isDefaultRoom) !== null && _e !== void 0 ? _e : false,
|
|
213
213
|
role: 'gray6',
|
|
214
214
|
onClick: () => {
|
|
215
215
|
setIsLeaveDialogOpen(true);
|
|
@@ -441,7 +441,7 @@ const MaterialExerciseExerciseRoomDetail = ({
|
|
|
441
441
|
}), isThisChatRoomOwner ? React.createElement(React.Fragment, null, React.createElement(Select, {
|
|
442
442
|
size: "small",
|
|
443
443
|
width: "small",
|
|
444
|
-
value: (
|
|
444
|
+
value: (_f = exerciseRoom === null || exerciseRoom === void 0 ? void 0 : exerciseRoom.publicPermission) !== null && _f !== void 0 ? _f : enums.ExerciseRoomPermission.Nothing,
|
|
445
445
|
onChange: value => {
|
|
446
446
|
doPostOrgMaterialExerciseExerciseRoomEdit(value);
|
|
447
447
|
},
|
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,
|
|
10
|
+
import { exerciseRunnerWebSocketStatusQuery, 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,8 +39,7 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
39
39
|
|
|
40
40
|
const intl = useIntl();
|
|
41
41
|
const {
|
|
42
|
-
materialExerciseId
|
|
43
|
-
onCodeHelpRequest
|
|
42
|
+
materialExerciseId
|
|
44
43
|
} = React.useContext(ExerciseContext);
|
|
45
44
|
const {
|
|
46
45
|
onSubmit,
|
|
@@ -48,11 +47,10 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
48
47
|
onCancel
|
|
49
48
|
} = React.useContext(ExerciseRunnerContext);
|
|
50
49
|
const runnerWebsocketStatus = useRecoilValue(exerciseRunnerWebSocketStatusQuery);
|
|
51
|
-
const editorCursorSelectionValue = useRecoilValue(exerciseFileEditorCursorSelectionValueState);
|
|
52
50
|
const exercise = useRecoilValue(exerciseState(materialExerciseId));
|
|
53
51
|
const exerciseRunType = useRecoilValue(exerciseRunnerRunTypeState);
|
|
54
52
|
const exerciseWithNoGrade = Boolean(exercise === null || exercise === void 0 ? void 0 : exercise.isNoSubmitGrade);
|
|
55
|
-
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.
|
|
53
|
+
const lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise.lectureId));
|
|
56
54
|
const isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === enums.LectureType.Test;
|
|
57
55
|
const isTestLectureCompleted = (lecture === null || lecture === void 0 ? void 0 : lecture.testAdmissionStatus) === enums.TestAdmissionStatus.Completed; // runner states
|
|
58
56
|
|
|
@@ -234,12 +232,8 @@ const ExerciseRunnerControllerButtonGroup = () => {
|
|
|
234
232
|
|
|
235
233
|
|
|
236
234
|
const renderCodeHelpRequestButton = () => {
|
|
237
|
-
if (isCodeHelpHidden || !editorCursorSelectionValue || typeof onCodeHelpRequest !== 'function') {
|
|
238
|
-
return null;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
235
|
return React.createElement(ExerciseRunnerControllerCodeHelpRequestButton, {
|
|
242
|
-
|
|
236
|
+
isCodeHelpHidden: isCodeHelpHidden
|
|
243
237
|
});
|
|
244
238
|
}; //
|
|
245
239
|
//
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
interface ExerciseRunnerControllerCodeHelpRequestButtonProps {
|
|
3
|
+
isCodeHelpHidden: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.FC<ExerciseRunnerControllerCodeHelpRequestButtonProps>;
|
|
5
6
|
export default ExerciseRunnerControllerCodeHelpRequestButton;
|
|
@@ -1,102 +1,107 @@
|
|
|
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 {
|
|
4
|
+
import { Button, Icon, Text, IconButton } from '@elice/blocks';
|
|
5
|
+
import { base } from '@elice/design-tokens';
|
|
6
|
+
import { eilArrowRightwardsBasic, eilMathsignMultiplyBasic } from '@elice/icons';
|
|
6
7
|
import { useMaterialConfig } from '@elice/material-shared-utils';
|
|
8
|
+
import { useRecoilValue } from 'recoil';
|
|
7
9
|
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';
|
|
8
15
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
16
|
+
const IS_TOOLTIP_OPENED_KEY = 'isTooltipOpened';
|
|
17
|
+
const IS_TOOLTIP_OPENED_VALUE = 'true';
|
|
11
18
|
const StyledControllerButton = styled(Button).withConfig({
|
|
12
19
|
componentId: "sc-10grd0k-0"
|
|
13
20
|
})(["position:relative;transition:none;"]);
|
|
14
|
-
const
|
|
21
|
+
const StyledCustomTooltip = styled.div.withConfig({
|
|
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);
|
|
15
37
|
const {
|
|
16
38
|
orgNameShort
|
|
17
39
|
} = useMaterialConfig();
|
|
18
|
-
const
|
|
40
|
+
const editorCursorSelectionValue = useRecoilValue(exerciseFileEditorCursorSelectionValueState);
|
|
41
|
+
const [isTooltipOpened, setIsTooltipOpened] = React.useState(false);
|
|
42
|
+
const [aiInfo, setAiInfo] = React.useState(null); //
|
|
19
43
|
//
|
|
20
44
|
// Get ai info from organization and check all resovle below conditions.
|
|
21
|
-
// - isEnable is true
|
|
22
|
-
// - quotaPerDay is upper than zero
|
|
23
|
-
// -
|
|
45
|
+
// - isEnable is true
|
|
46
|
+
// - quotaPerDay is upper than zero
|
|
47
|
+
// - tooltipOpenSession is false
|
|
24
48
|
|
|
25
49
|
React.useEffect(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (isTooltipHidden) {
|
|
29
|
-
setIsTooltipHidden(true);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getGlobalOrganizationGet({
|
|
50
|
+
void getGlobalOrganizationGet({
|
|
34
51
|
organizationNameShort: orgNameShort
|
|
35
52
|
}).then(res => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
setAiInfo(res.organization.aibotInfo);
|
|
54
|
+
});
|
|
55
|
+
const isTooltipOpend = sessionStorage.getItem(IS_TOOLTIP_OPENED_KEY);
|
|
56
|
+
|
|
57
|
+
if (isTooltipOpend === IS_TOOLTIP_OPENED_VALUE) {
|
|
58
|
+
setIsTooltipOpened(true);
|
|
59
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
+
|
|
44
61
|
}, []); //
|
|
45
62
|
//
|
|
46
63
|
//
|
|
47
64
|
|
|
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
|
-
};
|
|
65
|
+
if (isCodeHelpHidden || !editorCursorSelectionValue || typeof onCodeHelpRequest !== 'function') {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
83
68
|
|
|
84
|
-
return React.createElement(
|
|
85
|
-
placement: "top",
|
|
86
|
-
dark: false,
|
|
87
|
-
visible: !isTooltipHidden,
|
|
88
|
-
title: renderAiBotTooltipTitle()
|
|
89
|
-
}, React.createElement(StyledControllerButton, Object.assign({}, props, {
|
|
90
|
-
ref: ref,
|
|
69
|
+
return React.createElement(StyledControllerButton, {
|
|
91
70
|
size: "tiny",
|
|
92
71
|
role: "darkblue",
|
|
93
72
|
icon: React.createElement(Icon, {
|
|
94
73
|
icon: eilArrowRightwardsBasic
|
|
95
74
|
}),
|
|
96
|
-
iconAlign: "right"
|
|
97
|
-
|
|
75
|
+
iconAlign: "right",
|
|
76
|
+
onClick: () => {
|
|
77
|
+
onCodeHelpRequest(editorCursorSelectionValue);
|
|
78
|
+
}
|
|
79
|
+
}, React.createElement(FormattedMessage, {
|
|
98
80
|
id: "exerciseRunner.controller.buttonGroup.button.helpRequest"
|
|
99
|
-
})
|
|
100
|
-
|
|
81
|
+
}), aiInfo && aiInfo.isEnabled && aiInfo.quotaPerDay > 0 && !isTooltipOpened ? React.createElement(StyledCustomTooltip, null, React.createElement(StyledCustomBadge, null, React.createElement(Text, {
|
|
82
|
+
role: "white",
|
|
83
|
+
size: "tiny"
|
|
84
|
+
}, "NEW")), React.createElement(Text, {
|
|
85
|
+
role: "gray7",
|
|
86
|
+
size: "small"
|
|
87
|
+
}, React.createElement(FormattedMessage, {
|
|
88
|
+
id: "exerciseRunner.controller.buttonGroup.button.tooltip.aiHelp"
|
|
89
|
+
})), React.createElement(IconButton, {
|
|
90
|
+
size: "tiny",
|
|
91
|
+
hasPadding: false,
|
|
92
|
+
border: false,
|
|
93
|
+
icon: eilMathsignMultiplyBasic,
|
|
94
|
+
onClick: () => {
|
|
95
|
+
sessionStorage.setItem(IS_TOOLTIP_OPENED_KEY, IS_TOOLTIP_OPENED_VALUE);
|
|
96
|
+
setIsTooltipOpened(true);
|
|
97
|
+
}
|
|
98
|
+
}), React.createElement(StyledTip, {
|
|
99
|
+
viewBox: "0 0 50 50",
|
|
100
|
+
height: "0.5rem"
|
|
101
|
+
}, React.createElement("path", {
|
|
102
|
+
d: "M1 50 V10 Q1 1 10 1 H50z",
|
|
103
|
+
fill: base.color.white
|
|
104
|
+
}))) : null);
|
|
105
|
+
};
|
|
101
106
|
|
|
102
107
|
export { ExerciseRunnerControllerCodeHelpRequestButton as default };
|
package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js
CHANGED
|
@@ -97,19 +97,15 @@ const ExerciseRunnerControllerRunningInfo = () => {
|
|
|
97
97
|
//
|
|
98
98
|
|
|
99
99
|
React.useEffect(() => {
|
|
100
|
-
if (
|
|
101
|
-
|
|
100
|
+
if (exercise === null || exercise === void 0 ? void 0 : exercise.courseId) {
|
|
101
|
+
getOrgCourseGet({
|
|
102
|
+
courseId: exercise.courseId
|
|
103
|
+
}).then(({
|
|
104
|
+
course
|
|
105
|
+
}) => {
|
|
106
|
+
setCourse(course);
|
|
107
|
+
}).catch(console.error);
|
|
102
108
|
}
|
|
103
|
-
|
|
104
|
-
const abortCtrl = new AbortController();
|
|
105
|
-
getOrgCourseGet({
|
|
106
|
-
courseId: exercise._courseId
|
|
107
|
-
}, {
|
|
108
|
-
signal: abortCtrl.signal
|
|
109
|
-
}).then(res => res.course).then(setCourse).catch(console.error);
|
|
110
|
-
return () => {
|
|
111
|
-
abortCtrl.abort();
|
|
112
|
-
};
|
|
113
109
|
}, [exercise]);
|
|
114
110
|
/**
|
|
115
111
|
* Last running score.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-exercise",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.230220.0",
|
|
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",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@elice/api-client": "1.
|
|
32
|
+
"@elice/api-client": "1.230215.1",
|
|
33
33
|
"@elice/blocks": "^1.220803.0",
|
|
34
34
|
"@elice/design-tokens": "^1.220803.0",
|
|
35
35
|
"@elice/icons": "^1.220803.0",
|
|
36
36
|
"@elice/markdown": "^1.220803.0",
|
|
37
37
|
"@elice/material-shared-types": "*",
|
|
38
38
|
"@elice/material-shared-utils": "*",
|
|
39
|
-
"@elice/types": "1.
|
|
39
|
+
"@elice/types": "1.230215.1",
|
|
40
40
|
"@elice/websocket": "^1.220803.0",
|
|
41
41
|
"humps": "^2.0.1",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"xterm-addon-fit": "^0.5.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@elice/api-client": "1.
|
|
77
|
+
"@elice/api-client": "1.230215.1",
|
|
78
78
|
"@elice/blocks": "^1.220803.0",
|
|
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.
|
|
83
|
-
"@elice/material-shared-utils": "1.
|
|
84
|
-
"@elice/types": "1.
|
|
82
|
+
"@elice/material-shared-types": "1.230220.0",
|
|
83
|
+
"@elice/material-shared-utils": "1.230220.0",
|
|
84
|
+
"@elice/types": "1.230215.1",
|
|
85
85
|
"@elice/websocket": "^1.220803.0",
|
|
86
86
|
"@types/classnames": "^2.3.1",
|
|
87
87
|
"@types/color": "^3.0.3",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"recoil": "^0.6.1",
|
|
103
103
|
"styled-components": "^5.2.0"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "11ff1f7b809e77e19752569a5a7c852d180ee140"
|
|
106
106
|
}
|