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