@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 designTokens = require('@elice/design-tokens');
|
|
@@ -26,54 +24,39 @@ var MaterialQuizInfo = require('./MaterialQuizInfo.js');
|
|
|
26
24
|
var QuizResultBadge = require('./QuizResultBadge.js');
|
|
27
25
|
var QuizSubmitStatusText = require('./QuizSubmitStatusText.js');
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
|
|
34
|
-
var hasInlinePassage = _ref.hasInlinePassage;
|
|
27
|
+
const MaterialQuizSelectOne = ({
|
|
28
|
+
hasInlinePassage
|
|
29
|
+
}) => {
|
|
35
30
|
// context
|
|
36
|
-
|
|
37
|
-
course
|
|
38
|
-
lecture
|
|
39
|
-
materialQuiz
|
|
40
|
-
userId
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
const {
|
|
32
|
+
course,
|
|
33
|
+
lecture,
|
|
34
|
+
materialQuiz,
|
|
35
|
+
userId
|
|
36
|
+
} = MaterialQuizContext.useMaterialQuizState();
|
|
37
|
+
const {
|
|
38
|
+
onSubmit,
|
|
39
|
+
onNext,
|
|
40
|
+
refreshOrgMaterialQuiz,
|
|
41
|
+
onDirty
|
|
42
|
+
} = MaterialQuizContext.useMaterialQuizDispatch();
|
|
43
|
+
const theme = material.useTheme();
|
|
47
44
|
// state
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setMaterialQuizResponse = _React$useState4[1];
|
|
57
|
-
var _React$useState5 = React__default.default.useState('idle'),
|
|
58
|
-
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
59
|
-
submitStatus = _React$useState6[0],
|
|
60
|
-
setSubmitStatus = _React$useState6[1];
|
|
61
|
-
var _useCaculatePassage = useCaculatePassage.useCaculatePassage(),
|
|
62
|
-
containerRef = _useCaculatePassage.containerRef,
|
|
63
|
-
questionRef = _useCaculatePassage.questionRef;
|
|
45
|
+
const intl$1 = intl.useRawEliceIntl();
|
|
46
|
+
const [selectedAnswer, setSelectedAnswer] = React.useState();
|
|
47
|
+
const [materialQuizResponse, setMaterialQuizResponse] = React.useState();
|
|
48
|
+
const [submitStatus, setSubmitStatus] = React.useState('idle');
|
|
49
|
+
const {
|
|
50
|
+
containerRef,
|
|
51
|
+
questionRef
|
|
52
|
+
} = useCaculatePassage.useCaculatePassage();
|
|
64
53
|
// Whether user has clicked any options
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _React$useState9 = React__default.default.useState(false),
|
|
70
|
-
_React$useState10 = _rollupPluginBabelHelpers.slicedToArray(_React$useState9, 2),
|
|
71
|
-
hasSubmitted = _React$useState10[0],
|
|
72
|
-
setHasSubmitted = _React$useState10[1];
|
|
73
|
-
var isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
74
|
-
var isDisabled = selectedAnswer === undefined || index.checkUserLectureTestEnded(lecture) || !!userId;
|
|
54
|
+
const [isActive, setIsActive] = React.useState(false);
|
|
55
|
+
const [hasSubmitted, setHasSubmitted] = React.useState(false);
|
|
56
|
+
const isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
57
|
+
const isDisabled = selectedAnswer === undefined || index.checkUserLectureTestEnded(lecture) || !!userId;
|
|
75
58
|
// answer select handler
|
|
76
|
-
|
|
59
|
+
const handleAnswerSelect = index$1 => {
|
|
77
60
|
if (index.checkUserLectureTestEnded(lecture) || !!userId) {
|
|
78
61
|
return;
|
|
79
62
|
}
|
|
@@ -83,31 +66,33 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
|
|
|
83
66
|
onDirty(true);
|
|
84
67
|
};
|
|
85
68
|
// quiz response fetcher
|
|
86
|
-
|
|
69
|
+
React.useEffect(() => {
|
|
87
70
|
if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
|
|
88
|
-
|
|
89
|
-
|
|
71
|
+
const controller = new AbortController();
|
|
72
|
+
const {
|
|
73
|
+
signal
|
|
74
|
+
} = controller;
|
|
90
75
|
apiClient.getOrgMaterialQuizResponseGet({
|
|
91
76
|
quizResponseId: materialQuiz.lastQuizResponseId
|
|
92
77
|
}, {
|
|
93
|
-
signal
|
|
94
|
-
}).then(
|
|
95
|
-
|
|
78
|
+
signal
|
|
79
|
+
}).then(response => {
|
|
80
|
+
const quizResponseAnswer = response.quizResponse.answer;
|
|
96
81
|
setMaterialQuizResponse(response.quizResponse);
|
|
97
82
|
setSelectedAnswer(typeof response.quizResponse.answer === 'string' ? undefined : quizResponseAnswer[0]);
|
|
98
|
-
}).catch(
|
|
83
|
+
}).catch(error => {
|
|
99
84
|
console.error(error);
|
|
100
85
|
});
|
|
101
|
-
return
|
|
102
|
-
return controller.abort();
|
|
103
|
-
};
|
|
86
|
+
return () => controller.abort();
|
|
104
87
|
}
|
|
105
88
|
}, [materialQuiz, userId]);
|
|
106
89
|
// quiz response fetcher
|
|
107
|
-
|
|
90
|
+
React.useEffect(() => {
|
|
108
91
|
if (userId && materialQuiz) {
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
const controller = new AbortController();
|
|
93
|
+
const {
|
|
94
|
+
signal
|
|
95
|
+
} = controller;
|
|
111
96
|
apiClient.getOrgMaterialQuizResponseList({
|
|
112
97
|
materialQuizId: materialQuiz.id,
|
|
113
98
|
filterUserIds: [userId],
|
|
@@ -116,84 +101,58 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
|
|
|
116
101
|
offset: 0,
|
|
117
102
|
count: 1
|
|
118
103
|
}, {
|
|
119
|
-
signal
|
|
120
|
-
}).then(
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
signal
|
|
105
|
+
}).then(response => {
|
|
106
|
+
const quizResponse = response.quizResponses[0];
|
|
107
|
+
const quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
|
|
123
108
|
setMaterialQuizResponse(quizResponse);
|
|
124
109
|
setSelectedAnswer(quizResponseAnswer === null || quizResponseAnswer === void 0 ? void 0 : quizResponseAnswer[0]);
|
|
125
|
-
}).catch(
|
|
110
|
+
}).catch(error => {
|
|
126
111
|
console.error(error);
|
|
127
112
|
});
|
|
128
|
-
return
|
|
129
|
-
return controller.abort();
|
|
130
|
-
};
|
|
113
|
+
return () => controller.abort();
|
|
131
114
|
}
|
|
132
115
|
}, [materialQuiz, userId]);
|
|
133
116
|
// submit handler
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
void refreshOrgMaterialQuiz();
|
|
166
|
-
onSubmit(true, index.getQuizResult(quizResponse));
|
|
167
|
-
setSubmitStatus('resolved');
|
|
168
|
-
setHasSubmitted(true);
|
|
169
|
-
onDirty(false);
|
|
170
|
-
_context.next = 26;
|
|
171
|
-
break;
|
|
172
|
-
case 21:
|
|
173
|
-
_context.prev = 21;
|
|
174
|
-
_context.t0 = _context["catch"](3);
|
|
175
|
-
console.error(_context.t0);
|
|
176
|
-
onSubmit(false);
|
|
177
|
-
setSubmitStatus('rejected');
|
|
178
|
-
case 26:
|
|
179
|
-
case "end":
|
|
180
|
-
return _context.stop();
|
|
181
|
-
}
|
|
182
|
-
}, _callee, null, [[3, 21]]);
|
|
183
|
-
}));
|
|
184
|
-
return function handleSubmit() {
|
|
185
|
-
return _ref2.apply(this, arguments);
|
|
186
|
-
};
|
|
187
|
-
}();
|
|
188
|
-
return jsxRuntime.jsx(QuestionBox.default, {
|
|
117
|
+
const handleSubmit = async () => {
|
|
118
|
+
if (!materialQuiz || selectedAnswer === undefined) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
setSubmitStatus('pending');
|
|
122
|
+
try {
|
|
123
|
+
const {
|
|
124
|
+
quizResponseId
|
|
125
|
+
} = await apiClient.postOrgMaterialQuizResponseAdd({
|
|
126
|
+
materialQuizId: materialQuiz.id,
|
|
127
|
+
answer: [selectedAnswer]
|
|
128
|
+
});
|
|
129
|
+
const {
|
|
130
|
+
quizResponse
|
|
131
|
+
} = await apiClient.getOrgMaterialQuizResponseGet({
|
|
132
|
+
quizResponseId
|
|
133
|
+
});
|
|
134
|
+
setIsActive(false);
|
|
135
|
+
setMaterialQuizResponse(quizResponse);
|
|
136
|
+
void refreshOrgMaterialQuiz();
|
|
137
|
+
onSubmit(true, index.getQuizResult(quizResponse));
|
|
138
|
+
setSubmitStatus('resolved');
|
|
139
|
+
setHasSubmitted(true);
|
|
140
|
+
onDirty(false);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.error(error);
|
|
143
|
+
onSubmit(false);
|
|
144
|
+
setSubmitStatus('rejected');
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
return React.createElement(QuestionBox.default, {
|
|
189
148
|
title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
|
|
190
149
|
titlePrefix: "Q.",
|
|
191
150
|
onNext: onNext,
|
|
192
151
|
isNextActive: isNextActive,
|
|
193
|
-
submitStatus:
|
|
152
|
+
submitStatus: React.createElement(QuizSubmitStatusText.default, {
|
|
194
153
|
status: submitStatus
|
|
195
154
|
}),
|
|
196
|
-
submitResult:
|
|
155
|
+
submitResult: React.createElement(QuizResultBadge.default, {
|
|
197
156
|
materialQuizResponse: materialQuizResponse
|
|
198
157
|
}),
|
|
199
158
|
bodyContainerRef: containerRef,
|
|
@@ -211,54 +170,49 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
|
|
|
211
170
|
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? designTokens.base.color.gray6 : theme.palette.primary.main,
|
|
212
171
|
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? designTokens.base.color.gray3 : theme.palette.primary.contrastText
|
|
213
172
|
}
|
|
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
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}) : null
|
|
258
|
-
}), jsxRuntime.jsx(MaterialQuizAnswerExplanation.default, {})]
|
|
259
|
-
}) : null]
|
|
260
|
-
})
|
|
261
|
-
});
|
|
173
|
+
}]
|
|
174
|
+
}, React.createElement(material.Stack, {
|
|
175
|
+
height: "100%",
|
|
176
|
+
gap: "1rem"
|
|
177
|
+
}, hasInlinePassage && React.createElement("div", {
|
|
178
|
+
id: element.MATERIAL_QUIZ_PASSIVE_ID,
|
|
179
|
+
ref: questionRef
|
|
180
|
+
}, React.createElement(MaterialQuizInfo.default, {
|
|
181
|
+
renderWithBox: false
|
|
182
|
+
})), materialQuiz ? React.createElement("div", {
|
|
183
|
+
id: element.MATERIAL_QUIZ_ANSWER_ID
|
|
184
|
+
}, React.createElement(QuestionRadio.default, {
|
|
185
|
+
selectedValue: selectedAnswer,
|
|
186
|
+
onSelect: handleAnswerSelect,
|
|
187
|
+
disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId
|
|
188
|
+
}, materialQuiz.options && course ? materialQuiz.options.map((option, index$1) => {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
const getIsSelected = (index, materialQuizResponse) => {
|
|
191
|
+
var _a;
|
|
192
|
+
if (!materialQuizResponse) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
const materialQuizResponseAnswer = materialQuizResponse.answer;
|
|
196
|
+
return (_a = materialQuizResponseAnswer === null || materialQuizResponseAnswer === void 0 ? void 0 : materialQuizResponseAnswer.includes(index)) !== null && _a !== void 0 ? _a : false;
|
|
197
|
+
};
|
|
198
|
+
const status = index.getOptionStatus({
|
|
199
|
+
materialQuizResponse,
|
|
200
|
+
isSelected: getIsSelected(index$1, materialQuizResponse),
|
|
201
|
+
isActive
|
|
202
|
+
});
|
|
203
|
+
const materialQuizAnswerInfo = materialQuiz.answerInfo;
|
|
204
|
+
return React.createElement(QuestionRadioOption.default, {
|
|
205
|
+
key: index$1,
|
|
206
|
+
value: index$1,
|
|
207
|
+
status: status,
|
|
208
|
+
isAnswer: (_a = !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index$1)) !== null && _a !== void 0 ? _a : false
|
|
209
|
+
}, course.preference.renderMarkdownInQuizOptions ? React.createElement(StyledMarkdown.default, {
|
|
210
|
+
children: (_b = option === null || option === void 0 ? void 0 : option.content) !== null && _b !== void 0 ? _b : '',
|
|
211
|
+
paddingx: 0,
|
|
212
|
+
paddingy: 0,
|
|
213
|
+
dark: true
|
|
214
|
+
}) : option === null || option === void 0 ? void 0 : option.content);
|
|
215
|
+
}) : null), React.createElement(MaterialQuizAnswerExplanation.default, null)) : null));
|
|
262
216
|
};
|
|
263
217
|
|
|
264
218
|
exports.default = MaterialQuizSelectOne;
|
|
@@ -2,60 +2,53 @@
|
|
|
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 designTokens = require('@elice/design-tokens');
|
|
8
8
|
var styled = require('styled-components');
|
|
9
9
|
var MaterialQuizContext = require('./context/MaterialQuizContext.js');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
14
|
-
|
|
15
|
-
var StyledShimmer = styled__default.default.div.withConfig({
|
|
11
|
+
const StyledShimmer = styled.div.withConfig({
|
|
16
12
|
componentId: "sc-10uz5tw-0"
|
|
17
|
-
})(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var StyledShimmerBody = styled__default.default.div.withConfig({
|
|
13
|
+
})(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"], ({
|
|
14
|
+
vertical
|
|
15
|
+
}) => vertical ? '0' : '8px');
|
|
16
|
+
const StyledShimmerBody = styled.div.withConfig({
|
|
22
17
|
componentId: "sc-10uz5tw-1"
|
|
23
18
|
})(["padding:1.5rem;background-color:", ";overflow-y:auto;height:100%;"], designTokens.base.color.navy8);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
vertical
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
})
|
|
58
|
-
});
|
|
19
|
+
const MaterialQuizShimmer = () => {
|
|
20
|
+
const {
|
|
21
|
+
vertical
|
|
22
|
+
} = MaterialQuizContext.useMaterialQuizState();
|
|
23
|
+
return React.createElement(StyledShimmer, {
|
|
24
|
+
vertical: vertical
|
|
25
|
+
}, React.createElement(StyledShimmerBody, null, React.createElement(blocks.Shimmer, {
|
|
26
|
+
dark: true,
|
|
27
|
+
borderRadius: '4px',
|
|
28
|
+
width: "80%",
|
|
29
|
+
height: '40px'
|
|
30
|
+
}), React.createElement(blocks.Vspace, {
|
|
31
|
+
height: 1
|
|
32
|
+
}), React.createElement(blocks.Shimmer, {
|
|
33
|
+
dark: true,
|
|
34
|
+
borderRadius: '4px',
|
|
35
|
+
width: "100%",
|
|
36
|
+
height: '40px'
|
|
37
|
+
}), React.createElement(blocks.Vspace, {
|
|
38
|
+
height: 1
|
|
39
|
+
}), React.createElement(blocks.Shimmer, {
|
|
40
|
+
dark: true,
|
|
41
|
+
borderRadius: '4px',
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: '40px'
|
|
44
|
+
}), React.createElement(blocks.Vspace, {
|
|
45
|
+
height: 1
|
|
46
|
+
}), React.createElement(blocks.Shimmer, {
|
|
47
|
+
dark: true,
|
|
48
|
+
borderRadius: '4px',
|
|
49
|
+
width: "100%",
|
|
50
|
+
height: '40px'
|
|
51
|
+
})));
|
|
59
52
|
};
|
|
60
53
|
|
|
61
54
|
exports.default = MaterialQuizShimmer;
|