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