@elice/material-quiz 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.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +423 -0
- package/cjs/components/eb-sortable/EbDraggable.js +42 -33
- package/cjs/components/eb-sortable/EbDroppable.js +27 -20
- package/cjs/components/markdown-editor/index.d.ts +1 -2
- package/cjs/components/markdown-editor/index.js +19 -10
- package/cjs/components/material-quiz/MaterialQuiz.js +114 -83
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +36 -29
- package/cjs/components/material-quiz/MaterialQuizInfo.js +151 -149
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +175 -127
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +360 -286
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +172 -126
- package/cjs/components/material-quiz/MaterialQuizShimmer.js +46 -39
- package/cjs/components/material-quiz/MaterialQuizText.js +163 -115
- package/cjs/components/material-quiz/QuizResultBadge.js +32 -22
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +21 -16
- package/cjs/components/material-quiz/constants/color.js +5 -5
- package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/cjs/components/material-quiz/context/MaterialQuizContext.js +156 -93
- package/cjs/components/material-quiz/index.js +9 -0
- package/cjs/components/material-quiz/locales/index.js +13 -0
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +259 -161
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +134 -100
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +130 -101
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +64 -52
- package/cjs/components/material-quiz/material-quiz-group/context/context.js +5 -1
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +47 -36
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +280 -232
- package/cjs/components/material-quiz-edit/context.js +8 -2
- package/cjs/components/material-quiz-edit/index.js +7 -0
- package/cjs/components/material-quiz-edit/locales/index.js +13 -0
- package/cjs/components/material-quiz-edit/options/OptionEditor.js +70 -46
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +174 -148
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +175 -149
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +164 -144
- package/cjs/components/material-quiz-edit/options/OptionText.js +90 -82
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +156 -112
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +288 -196
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +88 -75
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +108 -92
- package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/cjs/components/material-quiz-edit/utils/editValue.js +21 -12
- package/cjs/components/shared/QuestionBox.js +198 -165
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/cjs/components/shared/QuizDraggbleDummyOption.js +23 -16
- package/cjs/components/shared/QuizDraggbleOption.js +65 -59
- package/cjs/components/shared/StyledMarkdown.js +5 -1
- package/cjs/components/shared/index.js +19 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +59 -68
- package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +52 -59
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/cjs/components/shared/utils/mergeRefs.js +15 -6
- package/cjs/constant/element.js +3 -3
- package/cjs/constant/index.js +9 -0
- package/cjs/helpers/index.js +8 -10
- package/cjs/hooks/index.js +7 -0
- package/cjs/hooks/useCaculatePassage.js +21 -20
- package/es/_virtual/_rollupPluginBabelHelpers.js +408 -0
- package/es/components/eb-sortable/EbDraggable.js +37 -33
- package/es/components/eb-sortable/EbDroppable.js +22 -20
- package/es/components/markdown-editor/index.d.ts +1 -2
- package/es/components/markdown-editor/index.js +15 -10
- package/es/components/material-quiz/MaterialQuiz.js +109 -83
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +32 -29
- package/es/components/material-quiz/MaterialQuizInfo.js +148 -150
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +171 -127
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +356 -287
- package/es/components/material-quiz/MaterialQuizSelectOne.js +168 -126
- package/es/components/material-quiz/MaterialQuizShimmer.js +42 -39
- package/es/components/material-quiz/MaterialQuizText.js +158 -115
- package/es/components/material-quiz/QuizResultBadge.js +27 -22
- package/es/components/material-quiz/QuizSubmitStatusText.js +17 -16
- package/es/components/material-quiz/constants/color.js +5 -5
- package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/es/components/material-quiz/context/MaterialQuizContext.js +153 -94
- package/es/components/material-quiz/index.js +2 -0
- package/es/components/material-quiz/locales/index.js +4 -0
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +253 -161
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +129 -100
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +125 -101
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +60 -52
- package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
- package/es/components/material-quiz-edit/MaterialQuizEdit.js +43 -36
- package/es/components/material-quiz-edit/MaterialQuizEditContent.js +272 -229
- package/es/components/material-quiz-edit/context.js +4 -2
- package/es/components/material-quiz-edit/index.js +1 -0
- package/es/components/material-quiz-edit/locales/index.js +4 -0
- package/es/components/material-quiz-edit/options/OptionEditor.js +64 -46
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +170 -148
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +171 -149
- package/es/components/material-quiz-edit/options/OptionSelectOne.js +159 -144
- package/es/components/material-quiz-edit/options/OptionText.js +86 -82
- package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +151 -112
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +283 -197
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +83 -75
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +103 -92
- package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/es/components/material-quiz-edit/utils/editValue.js +17 -12
- package/es/components/shared/QuestionBox.js +192 -165
- package/es/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/es/components/shared/QuizDraggbleDummyOption.js +19 -16
- package/es/components/shared/QuizDraggbleOption.js +61 -59
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/index.js +7 -0
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +54 -68
- package/es/components/shared/question-radio/QuestionRadio.js +9 -7
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
- package/es/components/shared/question-radio/QuestionRadioOption.js +47 -59
- package/es/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/es/components/shared/utils/mergeRefs.js +15 -6
- package/es/constant/element.js +3 -3
- package/es/constant/index.js +1 -0
- package/es/helpers/index.js +8 -10
- package/es/hooks/index.js +1 -0
- package/es/hooks/useCaculatePassage.js +21 -20
- package/package.json +12 -15
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { getOrgMaterialQuizResponseGet, getOrgMaterialQuizResponseList, postOrgMaterialQuizResponseAdd } from '@elice/api-client';
|
|
3
5
|
import { Flex } from '@elice/blocks';
|
|
@@ -15,69 +17,76 @@ import MaterialQuizInfo from './MaterialQuizInfo.js';
|
|
|
15
17
|
import QuizResultBadge from './QuizResultBadge.js';
|
|
16
18
|
import QuizSubmitStatusText from './QuizSubmitStatusText.js';
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
var StyledTextarea = styled.textarea.withConfig({
|
|
19
21
|
componentId: "sc-186cnpj-0"
|
|
20
|
-
})(["min-height:12rem;width:100%;padding:1rem 1.375rem;font-size:1rem;color:", ";border-radius:4px;resize:vertical;line-height:1.5rem;outline:none;border:1px solid ", ";background-color:", ";&::placeholder{color:", ";}&:hover{cursor:", ";}"], base.color.navy2, base.color.navy6, base.color.navy7, base.color.navy2, ({
|
|
21
|
-
disabled
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
})(["min-height:12rem;width:100%;padding:1rem 1.375rem;font-size:1rem;color:", ";border-radius:4px;resize:vertical;line-height:1.5rem;outline:none;border:1px solid ", ";background-color:", ";&::placeholder{color:", ";}&:hover{cursor:", ";}"], base.color.navy2, base.color.navy6, base.color.navy7, base.color.navy2, function (_ref) {
|
|
23
|
+
var disabled = _ref.disabled;
|
|
24
|
+
return disabled ? 'not-allowed' : 'text';
|
|
25
|
+
});
|
|
26
|
+
var StyledLabel = styled.label.withConfig({
|
|
24
27
|
componentId: "sc-186cnpj-1"
|
|
25
28
|
})(["font-size:0.875rem;margin-bottom:0.5rem;color:", ";"], base.color.navy1);
|
|
26
|
-
|
|
27
|
-
hasInlinePassage
|
|
28
|
-
}) => {
|
|
29
|
+
var MaterialQuizText = function MaterialQuizText(_ref2) {
|
|
30
|
+
var hasInlinePassage = _ref2.hasInlinePassage;
|
|
29
31
|
// context
|
|
30
|
-
|
|
31
|
-
lecture,
|
|
32
|
-
materialQuiz,
|
|
33
|
-
userId
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = useMaterialQuizDispatch();
|
|
41
|
-
const theme = useTheme();
|
|
32
|
+
var _useMaterialQuizState = useMaterialQuizState(),
|
|
33
|
+
lecture = _useMaterialQuizState.lecture,
|
|
34
|
+
materialQuiz = _useMaterialQuizState.materialQuiz,
|
|
35
|
+
userId = _useMaterialQuizState.userId;
|
|
36
|
+
var _useMaterialQuizDispa = useMaterialQuizDispatch(),
|
|
37
|
+
onSubmit = _useMaterialQuizDispa.onSubmit,
|
|
38
|
+
onNext = _useMaterialQuizDispa.onNext,
|
|
39
|
+
refreshOrgMaterialQuiz = _useMaterialQuizDispa.refreshOrgMaterialQuiz,
|
|
40
|
+
onDirty = _useMaterialQuizDispa.onDirty;
|
|
41
|
+
var theme = useTheme();
|
|
42
42
|
// state
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
var intl = useRawEliceIntl();
|
|
44
|
+
var _React$useState = React.useState(),
|
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
46
|
+
materialQuizResponse = _React$useState2[0],
|
|
47
|
+
setMaterialQuizResponse = _React$useState2[1];
|
|
48
|
+
var _React$useState3 = React.useState('idle'),
|
|
49
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
50
|
+
submitStatus = _React$useState4[0],
|
|
51
|
+
setSubmitStatus = _React$useState4[1];
|
|
52
|
+
var _useCaculatePassage = useCaculatePassage(),
|
|
53
|
+
containerRef = _useCaculatePassage.containerRef,
|
|
54
|
+
questionRef = _useCaculatePassage.questionRef;
|
|
55
|
+
var _React$useState5 = React.useState(''),
|
|
56
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
57
|
+
answer = _React$useState6[0],
|
|
58
|
+
setAnswer = _React$useState6[1];
|
|
59
|
+
var _React$useState7 = React.useState(false),
|
|
60
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
61
|
+
hasSubmitted = _React$useState8[0],
|
|
62
|
+
setHasSubmitted = _React$useState8[1];
|
|
63
|
+
var isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
64
|
+
var isDisabled = answer.length === 0 || checkUserLectureTestEnded(lecture) || !!userId;
|
|
54
65
|
// quiz response fetcher
|
|
55
|
-
React.useEffect(()
|
|
66
|
+
React.useEffect(function () {
|
|
56
67
|
if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
signal
|
|
60
|
-
} = controller;
|
|
68
|
+
var controller = new AbortController();
|
|
69
|
+
var signal = controller.signal;
|
|
61
70
|
getOrgMaterialQuizResponseGet({
|
|
62
71
|
quizResponseId: materialQuiz.lastQuizResponseId
|
|
63
72
|
}, {
|
|
64
|
-
signal
|
|
65
|
-
}).then(response
|
|
73
|
+
signal: signal
|
|
74
|
+
}).then(function (response) {
|
|
66
75
|
setMaterialQuizResponse(response.quizResponse);
|
|
67
76
|
setAnswer(response.quizResponse.answer);
|
|
68
|
-
}).catch(error
|
|
77
|
+
}).catch(function (error) {
|
|
69
78
|
console.error(error);
|
|
70
79
|
});
|
|
71
|
-
return ()
|
|
80
|
+
return function () {
|
|
81
|
+
return controller.abort();
|
|
82
|
+
};
|
|
72
83
|
}
|
|
73
84
|
}, [materialQuiz, userId]);
|
|
74
85
|
// quiz response fetcher
|
|
75
|
-
React.useEffect(()
|
|
86
|
+
React.useEffect(function () {
|
|
76
87
|
if (userId && materialQuiz) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
signal
|
|
80
|
-
} = controller;
|
|
88
|
+
var controller = new AbortController();
|
|
89
|
+
var signal = controller.signal;
|
|
81
90
|
getOrgMaterialQuizResponseList({
|
|
82
91
|
materialQuizId: materialQuiz.id,
|
|
83
92
|
filterUserIds: [userId],
|
|
@@ -86,48 +95,74 @@ const MaterialQuizText = ({
|
|
|
86
95
|
offset: 0,
|
|
87
96
|
count: 1
|
|
88
97
|
}, {
|
|
89
|
-
signal
|
|
90
|
-
}).then(response
|
|
91
|
-
|
|
98
|
+
signal: signal
|
|
99
|
+
}).then(function (response) {
|
|
100
|
+
var quizResponse = response.quizResponses[0];
|
|
92
101
|
setMaterialQuizResponse(quizResponse);
|
|
93
102
|
setAnswer(typeof (quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer) === 'string' ? quizResponse.answer : '');
|
|
94
|
-
}).catch(error
|
|
103
|
+
}).catch(function (error) {
|
|
95
104
|
console.error(error);
|
|
96
105
|
});
|
|
97
|
-
return ()
|
|
106
|
+
return function () {
|
|
107
|
+
return controller.abort();
|
|
108
|
+
};
|
|
98
109
|
}
|
|
99
110
|
}, [materialQuiz, userId]);
|
|
100
111
|
// submit handler
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
112
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
113
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
114
|
+
var _yield$postOrgMateria, quizResponseId, _yield$getOrgMaterial, quizResponse;
|
|
115
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
116
|
+
while (1) switch (_context.prev = _context.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
if (materialQuiz) {
|
|
119
|
+
_context.next = 2;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return _context.abrupt("return");
|
|
123
|
+
case 2:
|
|
124
|
+
setSubmitStatus('pending');
|
|
125
|
+
_context.prev = 3;
|
|
126
|
+
_context.next = 6;
|
|
127
|
+
return postOrgMaterialQuizResponseAdd({
|
|
128
|
+
materialQuizId: materialQuiz.id,
|
|
129
|
+
answer: JSON.stringify(answer)
|
|
130
|
+
});
|
|
131
|
+
case 6:
|
|
132
|
+
_yield$postOrgMateria = _context.sent;
|
|
133
|
+
quizResponseId = _yield$postOrgMateria.quizResponseId;
|
|
134
|
+
_context.next = 10;
|
|
135
|
+
return getOrgMaterialQuizResponseGet({
|
|
136
|
+
quizResponseId: quizResponseId
|
|
137
|
+
});
|
|
138
|
+
case 10:
|
|
139
|
+
_yield$getOrgMaterial = _context.sent;
|
|
140
|
+
quizResponse = _yield$getOrgMaterial.quizResponse;
|
|
141
|
+
setHasSubmitted(true);
|
|
142
|
+
setMaterialQuizResponse(quizResponse);
|
|
143
|
+
void refreshOrgMaterialQuiz();
|
|
144
|
+
onSubmit(true, getQuizResult(quizResponse));
|
|
145
|
+
setSubmitStatus('resolved');
|
|
146
|
+
onDirty(false);
|
|
147
|
+
_context.next = 25;
|
|
148
|
+
break;
|
|
149
|
+
case 20:
|
|
150
|
+
_context.prev = 20;
|
|
151
|
+
_context.t0 = _context["catch"](3);
|
|
152
|
+
console.error(_context.t0);
|
|
153
|
+
onSubmit(false);
|
|
154
|
+
setSubmitStatus('rejected');
|
|
155
|
+
case 25:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context.stop();
|
|
158
|
+
}
|
|
159
|
+
}, _callee, null, [[3, 20]]);
|
|
160
|
+
}));
|
|
161
|
+
return function handleSubmit() {
|
|
162
|
+
return _ref3.apply(this, arguments);
|
|
163
|
+
};
|
|
164
|
+
}();
|
|
165
|
+
var commonProps = {
|
|
131
166
|
type: 'text',
|
|
132
167
|
autoFocus: answer.length === 0,
|
|
133
168
|
disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId,
|
|
@@ -135,20 +170,20 @@ const MaterialQuizText = ({
|
|
|
135
170
|
id: 'materialQuiz.text.placeholder'
|
|
136
171
|
}),
|
|
137
172
|
value: answer,
|
|
138
|
-
onChange: e
|
|
173
|
+
onChange: function onChange(e) {
|
|
139
174
|
setHasSubmitted(false);
|
|
140
175
|
setAnswer(e.target.value);
|
|
141
176
|
onDirty(true);
|
|
142
177
|
}
|
|
143
178
|
};
|
|
144
|
-
return
|
|
179
|
+
return jsx(QuestionBox, {
|
|
145
180
|
title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
|
|
146
181
|
titlePrefix: "Q.",
|
|
147
182
|
onNext: onNext,
|
|
148
|
-
submitResult:
|
|
183
|
+
submitResult: jsx(QuizResultBadge, {
|
|
149
184
|
materialQuizResponse: materialQuizResponse
|
|
150
185
|
}),
|
|
151
|
-
submitStatus:
|
|
186
|
+
submitStatus: jsx(QuizSubmitStatusText, {
|
|
152
187
|
status: submitStatus
|
|
153
188
|
}),
|
|
154
189
|
isNextActive: isNextActive,
|
|
@@ -167,37 +202,45 @@ const MaterialQuizText = ({
|
|
|
167
202
|
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
|
|
168
203
|
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
|
|
169
204
|
}
|
|
170
|
-
}]
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
205
|
+
}],
|
|
206
|
+
children: jsxs(Stack, {
|
|
207
|
+
height: "100%",
|
|
208
|
+
gap: "1rem",
|
|
209
|
+
children: [hasInlinePassage && jsx("div", {
|
|
210
|
+
id: MATERIAL_QUIZ_PASSIVE_ID,
|
|
211
|
+
ref: questionRef,
|
|
212
|
+
children: jsx(MaterialQuizInfo, {
|
|
213
|
+
renderWithBox: false
|
|
214
|
+
})
|
|
215
|
+
}), jsxs("div", {
|
|
216
|
+
id: MATERIAL_QUIZ_ANSWER_ID,
|
|
217
|
+
children: [jsxs(Flex, {
|
|
218
|
+
column: true,
|
|
219
|
+
children: [userId ? jsx(StyledLabel, {
|
|
220
|
+
htmlFor: "quiz-text-answer",
|
|
221
|
+
children: intl.formatMessage({
|
|
222
|
+
id: 'materialQuiz.submittedAnswer'
|
|
223
|
+
})
|
|
224
|
+
}) : null, jsx(StyledTextarea, Object.assign({
|
|
225
|
+
id: "quiz-text-answer"
|
|
226
|
+
}, commonProps))]
|
|
227
|
+
}), userId ? jsxs(Flex, {
|
|
228
|
+
column: true,
|
|
229
|
+
margintop: "1rem",
|
|
230
|
+
children: [jsx(StyledLabel, {
|
|
231
|
+
htmlFor: "quiz-text-submitted-answer",
|
|
232
|
+
children: intl.formatMessage({
|
|
233
|
+
id: 'materialQuiz.answer'
|
|
234
|
+
})
|
|
235
|
+
}), jsx(StyledTextarea, {
|
|
236
|
+
id: "quiz-text-submitted-answer",
|
|
237
|
+
disabled: true,
|
|
238
|
+
value: typeof (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo) === 'string' ? materialQuiz.answerInfo : ''
|
|
239
|
+
})]
|
|
240
|
+
}) : null]
|
|
241
|
+
}), jsx(MaterialQuizAnswerExplanation, {})]
|
|
242
|
+
})
|
|
243
|
+
});
|
|
201
244
|
};
|
|
202
245
|
|
|
203
246
|
export { MaterialQuizText as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { BadgeNext } from '@elice/blocks';
|
|
3
4
|
import { useRawEliceIntl } from '@elice/intl';
|
|
@@ -5,39 +6,43 @@ import styled from 'styled-components';
|
|
|
5
6
|
import { getQuizResultStatus, QuizResultStatus } from '../../helpers/index.js';
|
|
6
7
|
import { CORRECT_BACKGROUND_COLOR, CORRECT_TEXT_COLOR, WRONG_BACKGROUND_COLOR, WRONG_TEXT_COLOR } from './constants/color.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
var StyledGreenBadgeNext = styled(BadgeNext).withConfig({
|
|
9
10
|
componentId: "sc-1iksspv-0"
|
|
10
11
|
})(["background-color:", ";color:", ";"], CORRECT_BACKGROUND_COLOR, CORRECT_TEXT_COLOR);
|
|
11
|
-
|
|
12
|
+
var StyledRedBadgeNext = styled(BadgeNext).withConfig({
|
|
12
13
|
componentId: "sc-1iksspv-1"
|
|
13
14
|
})(["background-color:", ";color:", ";"], WRONG_BACKGROUND_COLOR, WRONG_TEXT_COLOR);
|
|
14
|
-
|
|
15
|
-
materialQuizResponse
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var QuizResultBadge = function QuizResultBadge(_ref) {
|
|
16
|
+
var materialQuizResponse = _ref.materialQuizResponse;
|
|
17
|
+
var intl = useRawEliceIntl();
|
|
18
|
+
var status = React.useMemo(function () {
|
|
19
|
+
return getQuizResultStatus(materialQuizResponse);
|
|
20
|
+
}, [materialQuizResponse]);
|
|
19
21
|
switch (status) {
|
|
20
22
|
case QuizResultStatus.Correct:
|
|
21
|
-
return
|
|
23
|
+
return jsx(StyledGreenBadgeNext, {
|
|
22
24
|
type: "quiet",
|
|
23
|
-
role: "green"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
role: "green",
|
|
26
|
+
children: intl.formatMessage({
|
|
27
|
+
id: 'materialQuiz.resultStatus.correct'
|
|
28
|
+
})
|
|
29
|
+
});
|
|
27
30
|
case QuizResultStatus.Wrong:
|
|
28
|
-
return
|
|
31
|
+
return jsx(StyledRedBadgeNext, {
|
|
29
32
|
type: "quiet",
|
|
30
|
-
role: "red"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
role: "red",
|
|
34
|
+
children: intl.formatMessage({
|
|
35
|
+
id: 'materialQuiz.resultStatus.wrong'
|
|
36
|
+
})
|
|
37
|
+
});
|
|
34
38
|
case QuizResultStatus.Submitted:
|
|
35
|
-
return
|
|
39
|
+
return jsx(BadgeNext, {
|
|
36
40
|
type: "quiet",
|
|
37
|
-
role: "primary"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
role: "primary",
|
|
42
|
+
children: intl.formatMessage({
|
|
43
|
+
id: 'materialQuiz.resultStatus.submitted'
|
|
44
|
+
})
|
|
45
|
+
});
|
|
41
46
|
default:
|
|
42
47
|
return null;
|
|
43
48
|
}
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { StatusText } from '@elice/blocks';
|
|
3
3
|
import { useRawEliceIntl } from '@elice/intl';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { SUCCESS_TEXT_COLOR } from './constants/color.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var StyledSuccessStatusText = styled(StatusText).withConfig({
|
|
8
8
|
componentId: "sc-1obyi4p-0"
|
|
9
9
|
})(["color:", ";"], SUCCESS_TEXT_COLOR);
|
|
10
|
-
|
|
11
|
-
status
|
|
12
|
-
|
|
13
|
-
const intl = useRawEliceIntl();
|
|
10
|
+
var QuizSubmitStatusText = function QuizSubmitStatusText(_ref) {
|
|
11
|
+
var status = _ref.status;
|
|
12
|
+
var intl = useRawEliceIntl();
|
|
14
13
|
switch (status) {
|
|
15
14
|
case 'resolved':
|
|
16
|
-
return
|
|
15
|
+
return jsx(StyledSuccessStatusText, {
|
|
17
16
|
role: "success",
|
|
18
|
-
size: "small"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
size: "small",
|
|
18
|
+
children: intl.formatMessage({
|
|
19
|
+
id: 'materialQuiz.submitStatus.success'
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
22
|
case 'rejected':
|
|
23
|
-
return
|
|
23
|
+
return jsx(StatusText, {
|
|
24
24
|
role: "danger",
|
|
25
|
-
size: "small"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
size: "small",
|
|
26
|
+
children: intl.formatMessage({
|
|
27
|
+
id: 'materialQuiz.submitStatus.failure'
|
|
28
|
+
})
|
|
29
|
+
});
|
|
29
30
|
default:
|
|
30
31
|
return null;
|
|
31
32
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { colors } from '@elice/mui-system';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
var CORRECT_TEXT_COLOR = colors.green[800];
|
|
4
|
+
var CORRECT_BACKGROUND_COLOR = colors.green[50];
|
|
5
|
+
var WRONG_TEXT_COLOR = colors.red[800];
|
|
6
|
+
var WRONG_BACKGROUND_COLOR = colors.red[50];
|
|
7
|
+
var SUCCESS_TEXT_COLOR = colors.green[400];
|
|
8
8
|
|
|
9
9
|
export { CORRECT_BACKGROUND_COLOR, CORRECT_TEXT_COLOR, SUCCESS_TEXT_COLOR, WRONG_BACKGROUND_COLOR, WRONG_TEXT_COLOR };
|
|
@@ -31,7 +31,7 @@ interface DispatchContextType {
|
|
|
31
31
|
setIsLongPassage: React.Dispatch<React.SetStateAction<boolean>>;
|
|
32
32
|
setIsInitialLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
|
33
33
|
}
|
|
34
|
-
declare function MaterialQuizProvider({ materialQuizId, userId, onSubmit, onDirty, onNext, children, }: MaterialQuizProviderProps):
|
|
34
|
+
declare function MaterialQuizProvider({ materialQuizId, userId, onSubmit, onDirty, onNext, children, }: MaterialQuizProviderProps): JSX.Element;
|
|
35
35
|
declare function useMaterialQuizState(): State;
|
|
36
36
|
declare function useMaterialQuizDispatch(): DispatchContextType;
|
|
37
37
|
export { MaterialQuizProvider, useMaterialQuizState, useMaterialQuizDispatch };
|