@elice/material-quiz 1.240709.0 → 1.240710.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/material-quiz/MaterialQuiz.js +32 -12
- package/cjs/components/material-quiz/MaterialQuizInfo.js +57 -12
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +12 -5
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +11 -5
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +12 -5
- package/cjs/components/material-quiz/MaterialQuizText.js +9 -4
- package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +2 -0
- package/cjs/components/material-quiz/context/MaterialQuizContext.js +14 -2
- package/cjs/components/material-quiz/locales/en.json.js +1 -1
- package/cjs/components/material-quiz/locales/ja.json.js +1 -1
- package/cjs/components/material-quiz/locales/ko.json.js +1 -1
- package/cjs/components/material-quiz/locales/th.json.js +1 -1
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +23 -30
- package/cjs/components/shared/QuestionBox.js +57 -37
- package/cjs/components/shared/utils/mergeRefs.d.ts +2 -0
- package/cjs/components/shared/utils/mergeRefs.js +11 -0
- package/cjs/hooks/useCaculatePassage.js +11 -3
- package/es/components/material-quiz/MaterialQuiz.js +32 -12
- package/es/components/material-quiz/MaterialQuizInfo.js +58 -13
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +14 -7
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +12 -6
- package/es/components/material-quiz/MaterialQuizSelectOne.js +13 -6
- package/es/components/material-quiz/MaterialQuizText.js +10 -5
- package/es/components/material-quiz/context/MaterialQuizContext.d.ts +2 -0
- package/es/components/material-quiz/context/MaterialQuizContext.js +15 -3
- package/es/components/material-quiz/locales/en.json.js +1 -1
- package/es/components/material-quiz/locales/ja.json.js +1 -1
- package/es/components/material-quiz/locales/ko.json.js +1 -1
- package/es/components/material-quiz/locales/th.json.js +1 -1
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +24 -31
- package/es/components/shared/QuestionBox.js +57 -37
- package/es/components/shared/utils/mergeRefs.d.ts +2 -0
- package/es/components/shared/utils/mergeRefs.js +9 -0
- package/es/hooks/useCaculatePassage.js +12 -4
- package/package.json +5 -4
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { getOrgMaterialQuizResponseGet, getOrgMaterialQuizResponseList, postOrgMaterialQuizResponseAdd } from '@elice/api-client';
|
|
3
|
+
import { base } from '@elice/design-tokens';
|
|
3
4
|
import { useRawEliceIntl } from '@elice/intl';
|
|
4
|
-
import { Stack } from '@mui/material';
|
|
5
|
+
import { useTheme, Stack } from '@mui/material';
|
|
5
6
|
import { MATERIAL_QUIZ_PASSIVE_ID, MATERIAL_QUIZ_ANSWER_ID } from '../../constant/element.js';
|
|
6
|
-
import {
|
|
7
|
+
import { checkUserLectureTestEnded, shouldResetOptions, getOptionStatus, getQuizResult } from '../../helpers/index.js';
|
|
7
8
|
import { useCaculatePassage } from '../../hooks/useCaculatePassage.js';
|
|
8
9
|
import '../shared/QuizDraggbleOption.js';
|
|
9
10
|
import '../shared/QuizDraggbleDummyOption.js';
|
|
@@ -14,6 +15,7 @@ import QuestionCheckboxOption from '../shared/question-checkbox/QuestionCheckbox
|
|
|
14
15
|
import QuestionBox from '../shared/QuestionBox.js';
|
|
15
16
|
import StyledMarkdown from '../shared/StyledMarkdown.js';
|
|
16
17
|
import { useMaterialQuizState, useMaterialQuizDispatch } from './context/MaterialQuizContext.js';
|
|
18
|
+
import MaterialQuizAnswerExplanation from './MaterialQuizAnswerExplanation.js';
|
|
17
19
|
import MaterialQuizInfo from './MaterialQuizInfo.js';
|
|
18
20
|
import QuizResultBadge from './QuizResultBadge.js';
|
|
19
21
|
import QuizSubmitStatusText from './QuizSubmitStatusText.js';
|
|
@@ -34,6 +36,7 @@ const MaterialQuizSelectMultiple = ({
|
|
|
34
36
|
refreshOrgMaterialQuiz,
|
|
35
37
|
onDirty
|
|
36
38
|
} = useMaterialQuizDispatch();
|
|
39
|
+
const theme = useTheme();
|
|
37
40
|
// state
|
|
38
41
|
const intl = useRawEliceIntl();
|
|
39
42
|
const [selectedAnswer, setSelectedAnswer] = React.useState([]);
|
|
@@ -47,6 +50,7 @@ const MaterialQuizSelectMultiple = ({
|
|
|
47
50
|
const [isActive, setIsActive] = React.useState(false);
|
|
48
51
|
const [hasSubmitted, setHasSubmitted] = React.useState(false);
|
|
49
52
|
const isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
53
|
+
const isDisabled = selectedAnswer.length === 0 || checkUserLectureTestEnded(lecture) || !!userId;
|
|
50
54
|
// answer select handler
|
|
51
55
|
const handleAnswerSelect = index => {
|
|
52
56
|
if (checkUserLectureTestEnded(lecture) || !!userId) {
|
|
@@ -158,16 +162,19 @@ const MaterialQuizSelectMultiple = ({
|
|
|
158
162
|
}),
|
|
159
163
|
bodyContainerRef: containerRef,
|
|
160
164
|
footerActions: [{
|
|
161
|
-
border:
|
|
162
|
-
disabled:
|
|
165
|
+
border: false,
|
|
166
|
+
disabled: isDisabled,
|
|
163
167
|
loading: submitStatus === 'pending',
|
|
164
168
|
tabIndex: 0,
|
|
165
169
|
transparent: false,
|
|
166
|
-
role: isNextActive ? 'secondary' : 'lightpurple',
|
|
167
170
|
onClick: handleSubmit,
|
|
168
171
|
children: intl.formatMessage({
|
|
169
172
|
id: isNextActive ? 'materialQuiz.resubmit' : 'materialQuiz.submit'
|
|
170
|
-
})
|
|
173
|
+
}),
|
|
174
|
+
customStyles: {
|
|
175
|
+
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
|
|
176
|
+
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
|
|
177
|
+
}
|
|
171
178
|
}]
|
|
172
179
|
}, React.createElement(Stack, {
|
|
173
180
|
height: "100%",
|
|
@@ -210,7 +217,7 @@ const MaterialQuizSelectMultiple = ({
|
|
|
210
217
|
paddingy: 0,
|
|
211
218
|
dark: true
|
|
212
219
|
}) : option === null || option === void 0 ? void 0 : option.content);
|
|
213
|
-
}) : null))));
|
|
220
|
+
}) : null), React.createElement(MaterialQuizAnswerExplanation, null))));
|
|
214
221
|
};
|
|
215
222
|
|
|
216
223
|
export { MaterialQuizSelectMultiple as default };
|
|
@@ -4,7 +4,7 @@ import { Icon, Flex, Text } from '@elice/blocks';
|
|
|
4
4
|
import { base } from '@elice/design-tokens';
|
|
5
5
|
import { eilSortItem } from '@elice/icons';
|
|
6
6
|
import { useRawEliceIntl } from '@elice/intl';
|
|
7
|
-
import { Stack } from '@mui/material';
|
|
7
|
+
import { useTheme, Stack } from '@mui/material';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
9
|
import { MATERIAL_QUIZ_PASSIVE_ID, MATERIAL_QUIZ_ANSWER_ID } from '../../constant/element.js';
|
|
10
10
|
import { getQuizResult, checkUserLectureTestEnded, getQuizResultStatus, QuizResultStatus } from '../../helpers/index.js';
|
|
@@ -15,6 +15,7 @@ import QuizDraggbleDroppedOption from '../shared/QuizDraggbleDroppedOption.js';
|
|
|
15
15
|
import QuizDraggbleDummyOption from '../shared/QuizDraggbleDummyOption.js';
|
|
16
16
|
import QuizDraggbleOption from '../shared/QuizDraggbleOption.js';
|
|
17
17
|
import { useMaterialQuizState, useMaterialQuizDispatch } from './context/MaterialQuizContext.js';
|
|
18
|
+
import MaterialQuizAnswerExplanation from './MaterialQuizAnswerExplanation.js';
|
|
18
19
|
import MaterialQuizInfo from './MaterialQuizInfo.js';
|
|
19
20
|
import QuizResultBadge from './QuizResultBadge.js';
|
|
20
21
|
import QuizSubmitStatusText from './QuizSubmitStatusText.js';
|
|
@@ -72,6 +73,7 @@ const MaterialQuizSelectMultipleOrder = ({
|
|
|
72
73
|
refreshOrgMaterialQuiz,
|
|
73
74
|
onDirty
|
|
74
75
|
} = useMaterialQuizDispatch();
|
|
76
|
+
const theme = useTheme();
|
|
75
77
|
// state
|
|
76
78
|
const intl = useRawEliceIntl();
|
|
77
79
|
const [materialQuizResponse, setMaterialQuizResponse] = React.useState();
|
|
@@ -86,6 +88,7 @@ const MaterialQuizSelectMultipleOrder = ({
|
|
|
86
88
|
const [correctAnswerList, setCorrectAnswerList] = React.useState([]);
|
|
87
89
|
const [hasSubmitted, setHasSubmitted] = React.useState(false);
|
|
88
90
|
const isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
91
|
+
const isDisabled = (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.correctOptionCount) !== answerList.filter(answer => answer.order !== null).length || !!userId;
|
|
89
92
|
// ref
|
|
90
93
|
const optionBoxRef = React.useRef(null);
|
|
91
94
|
// to make jquery touchable
|
|
@@ -414,16 +417,19 @@ const MaterialQuizSelectMultipleOrder = ({
|
|
|
414
417
|
}),
|
|
415
418
|
bodyContainerRef: containerRef,
|
|
416
419
|
footerActions: [{
|
|
417
|
-
border:
|
|
418
|
-
disabled:
|
|
420
|
+
border: false,
|
|
421
|
+
disabled: isDisabled,
|
|
419
422
|
loading: submitStatus === 'pending',
|
|
420
423
|
tabIndex: 0,
|
|
421
424
|
transparent: false,
|
|
422
|
-
role: isNextActive ? 'secondary' : 'lightpurple',
|
|
423
425
|
onClick: handleSubmit,
|
|
424
426
|
children: intl.formatMessage({
|
|
425
427
|
id: isNextActive ? 'materialQuiz.resubmit' : 'materialQuiz.submit'
|
|
426
|
-
})
|
|
428
|
+
}),
|
|
429
|
+
customStyles: {
|
|
430
|
+
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
|
|
431
|
+
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
|
|
432
|
+
}
|
|
427
433
|
}]
|
|
428
434
|
}, React.createElement(Stack, {
|
|
429
435
|
height: "100%",
|
|
@@ -468,7 +474,7 @@ const MaterialQuizSelectMultipleOrder = ({
|
|
|
468
474
|
indexOrder: index + 1,
|
|
469
475
|
isMarkdown: !!(course === null || course === void 0 ? void 0 : course.preference.renderMarkdownInQuizOptions)
|
|
470
476
|
});
|
|
471
|
-
}))) : null)));
|
|
477
|
+
}))) : null, React.createElement(MaterialQuizAnswerExplanation, null))));
|
|
472
478
|
};
|
|
473
479
|
|
|
474
480
|
export { MaterialQuizSelectMultipleOrder as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { getOrgMaterialQuizResponseGet, getOrgMaterialQuizResponseList, postOrgMaterialQuizResponseAdd } from '@elice/api-client';
|
|
3
|
+
import { base } from '@elice/design-tokens';
|
|
3
4
|
import { useRawEliceIntl } from '@elice/intl';
|
|
4
|
-
import { Stack } from '@mui/material';
|
|
5
|
+
import { useTheme, Stack } from '@mui/material';
|
|
5
6
|
import { MATERIAL_QUIZ_PASSIVE_ID, MATERIAL_QUIZ_ANSWER_ID } from '../../constant/element.js';
|
|
6
7
|
import { checkUserLectureTestEnded, getOptionStatus, getQuizResult } from '../../helpers/index.js';
|
|
7
8
|
import { useCaculatePassage } from '../../hooks/useCaculatePassage.js';
|
|
@@ -14,6 +15,7 @@ import '../shared/question-checkbox/QuestionCheckboxOption.js';
|
|
|
14
15
|
import QuestionBox from '../shared/QuestionBox.js';
|
|
15
16
|
import StyledMarkdown from '../shared/StyledMarkdown.js';
|
|
16
17
|
import { useMaterialQuizState, useMaterialQuizDispatch } from './context/MaterialQuizContext.js';
|
|
18
|
+
import MaterialQuizAnswerExplanation from './MaterialQuizAnswerExplanation.js';
|
|
17
19
|
import MaterialQuizInfo from './MaterialQuizInfo.js';
|
|
18
20
|
import QuizResultBadge from './QuizResultBadge.js';
|
|
19
21
|
import QuizSubmitStatusText from './QuizSubmitStatusText.js';
|
|
@@ -34,6 +36,7 @@ const MaterialQuizSelectOne = ({
|
|
|
34
36
|
refreshOrgMaterialQuiz,
|
|
35
37
|
onDirty
|
|
36
38
|
} = useMaterialQuizDispatch();
|
|
39
|
+
const theme = useTheme();
|
|
37
40
|
// state
|
|
38
41
|
const intl = useRawEliceIntl();
|
|
39
42
|
const [selectedAnswer, setSelectedAnswer] = React.useState();
|
|
@@ -47,6 +50,7 @@ const MaterialQuizSelectOne = ({
|
|
|
47
50
|
const [isActive, setIsActive] = React.useState(false);
|
|
48
51
|
const [hasSubmitted, setHasSubmitted] = React.useState(false);
|
|
49
52
|
const isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
53
|
+
const isDisabled = selectedAnswer === undefined || checkUserLectureTestEnded(lecture) || !!userId;
|
|
50
54
|
// answer select handler
|
|
51
55
|
const handleAnswerSelect = index => {
|
|
52
56
|
if (checkUserLectureTestEnded(lecture) || !!userId) {
|
|
@@ -149,16 +153,19 @@ const MaterialQuizSelectOne = ({
|
|
|
149
153
|
}),
|
|
150
154
|
bodyContainerRef: containerRef,
|
|
151
155
|
footerActions: [{
|
|
152
|
-
border:
|
|
153
|
-
disabled:
|
|
156
|
+
border: false,
|
|
157
|
+
disabled: isDisabled,
|
|
154
158
|
loading: submitStatus === 'pending',
|
|
155
159
|
tabIndex: 0,
|
|
156
160
|
transparent: false,
|
|
157
|
-
role: isNextActive ? 'secondary' : 'lightpurple',
|
|
158
161
|
onClick: handleSubmit,
|
|
159
162
|
children: intl.formatMessage({
|
|
160
163
|
id: isNextActive ? 'materialQuiz.resubmit' : 'materialQuiz.submit'
|
|
161
|
-
})
|
|
164
|
+
}),
|
|
165
|
+
customStyles: {
|
|
166
|
+
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
|
|
167
|
+
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
|
|
168
|
+
}
|
|
162
169
|
}]
|
|
163
170
|
}, React.createElement(Stack, {
|
|
164
171
|
height: "100%",
|
|
@@ -201,7 +208,7 @@ const MaterialQuizSelectOne = ({
|
|
|
201
208
|
paddingy: 0,
|
|
202
209
|
dark: true
|
|
203
210
|
}) : option === null || option === void 0 ? void 0 : option.content);
|
|
204
|
-
}) : null)) : null));
|
|
211
|
+
}) : null), React.createElement(MaterialQuizAnswerExplanation, null)) : null));
|
|
205
212
|
};
|
|
206
213
|
|
|
207
214
|
export { MaterialQuizSelectOne as default };
|
|
@@ -3,7 +3,7 @@ import { getOrgMaterialQuizResponseGet, getOrgMaterialQuizResponseList, postOrgM
|
|
|
3
3
|
import { Flex } from '@elice/blocks';
|
|
4
4
|
import { base } from '@elice/design-tokens';
|
|
5
5
|
import { useRawEliceIntl } from '@elice/intl';
|
|
6
|
-
import { Stack } from '@mui/material';
|
|
6
|
+
import { useTheme, Stack } from '@mui/material';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { MATERIAL_QUIZ_PASSIVE_ID, MATERIAL_QUIZ_ANSWER_ID } from '../../constant/element.js';
|
|
9
9
|
import { checkUserLectureTestEnded, getQuizResult } from '../../helpers/index.js';
|
|
@@ -37,6 +37,7 @@ const MaterialQuizText = ({
|
|
|
37
37
|
refreshOrgMaterialQuiz,
|
|
38
38
|
onDirty
|
|
39
39
|
} = useMaterialQuizDispatch();
|
|
40
|
+
const theme = useTheme();
|
|
40
41
|
// state
|
|
41
42
|
const intl = useRawEliceIntl();
|
|
42
43
|
const [materialQuizResponse, setMaterialQuizResponse] = React.useState();
|
|
@@ -48,6 +49,7 @@ const MaterialQuizText = ({
|
|
|
48
49
|
const [answer, setAnswer] = React.useState('');
|
|
49
50
|
const [hasSubmitted, setHasSubmitted] = React.useState(false);
|
|
50
51
|
const isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
52
|
+
const isDisabled = answer.length === 0 || checkUserLectureTestEnded(lecture) || !!userId;
|
|
51
53
|
// quiz response fetcher
|
|
52
54
|
React.useEffect(() => {
|
|
53
55
|
if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
|
|
@@ -151,16 +153,19 @@ const MaterialQuizText = ({
|
|
|
151
153
|
isNextActive: isNextActive,
|
|
152
154
|
bodyContainerRef: containerRef,
|
|
153
155
|
footerActions: [{
|
|
154
|
-
border:
|
|
156
|
+
border: false,
|
|
155
157
|
children: intl.formatMessage({
|
|
156
158
|
id: isNextActive ? 'materialQuiz.resubmit' : 'materialQuiz.submit'
|
|
157
159
|
}),
|
|
158
|
-
disabled:
|
|
160
|
+
disabled: isDisabled,
|
|
159
161
|
loading: submitStatus === 'pending',
|
|
160
162
|
tabIndex: 0,
|
|
161
163
|
transparent: false,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
onClick: handleSubmit,
|
|
165
|
+
customStyles: {
|
|
166
|
+
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
|
|
167
|
+
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
|
|
168
|
+
}
|
|
164
169
|
}]
|
|
165
170
|
}, React.createElement(Stack, {
|
|
166
171
|
height: "100%",
|
|
@@ -9,6 +9,7 @@ export interface State {
|
|
|
9
9
|
userId?: number;
|
|
10
10
|
initStatus: APIStatus;
|
|
11
11
|
isLongPassage: boolean;
|
|
12
|
+
isInitialLoading: boolean;
|
|
12
13
|
}
|
|
13
14
|
export type MaterialQuizProps = {
|
|
14
15
|
materialQuizId: number;
|
|
@@ -28,6 +29,7 @@ interface DispatchContextType {
|
|
|
28
29
|
setVertical: React.Dispatch<React.SetStateAction<boolean>>;
|
|
29
30
|
onNext?: () => void;
|
|
30
31
|
setIsLongPassage: React.Dispatch<React.SetStateAction<boolean>>;
|
|
32
|
+
setIsInitialLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
|
31
33
|
}
|
|
32
34
|
declare function MaterialQuizProvider({ materialQuizId, userId, onSubmit, onDirty, onNext, children, }: MaterialQuizProviderProps): React.JSX.Element;
|
|
33
35
|
declare function useMaterialQuizState(): State;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { config, postOrgMaterialQuizOptionsSetSelect, getOrgMaterialQuizGet, getOrgCourseGet, getOrgLectureGet } from '@elice/api-client';
|
|
3
3
|
import { useMaterialConfigApiClientUpdate, useMaterialFetchRaw } from '@elice/material-shared-utils';
|
|
4
4
|
import { enums } from '@elice/types';
|
|
@@ -20,7 +20,12 @@ function MaterialQuizProvider({
|
|
|
20
20
|
const [initStatus, setInitStatus] = React.useState('idle');
|
|
21
21
|
const [vertical, setVertical] = React.useState(false);
|
|
22
22
|
const [isLongPassage, setIsLongPassage] = React.useState(false);
|
|
23
|
+
const [isInitialLoading, setIsInitialLoading] = React.useState(true);
|
|
23
24
|
const canInit = useMaterialConfigApiClientUpdate(config.init);
|
|
25
|
+
const resetLayout = () => {
|
|
26
|
+
setIsInitialLoading(true);
|
|
27
|
+
setIsLongPassage(false);
|
|
28
|
+
};
|
|
24
29
|
const {
|
|
25
30
|
materialQuiz,
|
|
26
31
|
materialLecturePage,
|
|
@@ -73,6 +78,11 @@ function MaterialQuizProvider({
|
|
|
73
78
|
}
|
|
74
79
|
return () => controller.abort();
|
|
75
80
|
}, [materialLecturePage]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (materialQuizId) {
|
|
83
|
+
resetLayout();
|
|
84
|
+
}
|
|
85
|
+
}, [materialQuizId]);
|
|
76
86
|
React.useEffect(() => {
|
|
77
87
|
if (canInit && materialLecturePage) {
|
|
78
88
|
void init();
|
|
@@ -86,7 +96,8 @@ function MaterialQuizProvider({
|
|
|
86
96
|
userId,
|
|
87
97
|
vertical,
|
|
88
98
|
initStatus,
|
|
89
|
-
isLongPassage
|
|
99
|
+
isLongPassage,
|
|
100
|
+
isInitialLoading
|
|
90
101
|
}
|
|
91
102
|
}, React.createElement(DispatchContext.Provider, {
|
|
92
103
|
value: {
|
|
@@ -95,7 +106,8 @@ function MaterialQuizProvider({
|
|
|
95
106
|
onNext,
|
|
96
107
|
refreshOrgMaterialQuiz,
|
|
97
108
|
setVertical,
|
|
98
|
-
setIsLongPassage
|
|
109
|
+
setIsLongPassage,
|
|
110
|
+
setIsInitialLoading
|
|
99
111
|
}
|
|
100
112
|
}, children));
|
|
101
113
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var messageEn = {"materialQuiz.anchorLabel.question":"
|
|
1
|
+
var messageEn = {"materialQuiz.anchorLabel.question":"Passage","materialQuiz.anchorLabel.answer":"Answer","materialQuiz.error":"Failed to fetch quiz","materialQuiz.submit":"Submit","materialQuiz.resubmit":"Resubmit","materialQuiz.submittedAnswer":"Submitted Answer","materialQuiz.answer":"Answer","materialQuiz.next":"Next question >","materialQuiz.selectOne.answer.title":"Choose from the views below.","materialQuiz.selectMultiple.answer.title":"Choose from the views below. (Redundant selections available)","materialQuiz.selectMultipleOrder.answer.title":"Drag and drop your answers.","materialQuiz.text.answer.title":"Please fill out the answer.","materialQuiz.empty.title":"Quiz is now preparing.","materialQuiz.empty.description":"Please check again after quiz posting!","materialQuiz.survey.empty.title":"Survey is now preparing.","materialQuiz.survey.empty.description":"Please check again after survey posting!","materialQuiz.submitStatus.success":"Submitted","materialQuiz.submitStatus.failure":"Failed to submit","materialQuiz.resultStatus.correct":"Correct","materialQuiz.resultStatus.wrong":"Wrong","materialQuiz.resultStatus.submitted":"Submitted","materialQuiz.explanation.close":"close quiz explanations","materialQuiz.explanation.show":"show quiz explanations","materialQuiz.explanation.empty":"no explanations","materialQuiz.text.placeholder":"please fill the answer","materialQuiz.text.correct":"that's correct!","materialQuiz.text.wrong":"that's wrong. try it again!","materialQuiz.order.answerEmpty":"You could move the options back here","materialQuiz.bottomSheet.title":"Options","materialQuiz.bottomSheet.optionEmpty":"All views have been placed in the group.","materialQuiz.dropzone.desktop.answerEmpty":"Drag the view into the area.","materialQuiz.dropzone.mobile.answerEmpty":"Click here to add a view.","materialQuiz.dropzone.optionEmpty":"Option","materialQuiz.dropzone.optionReset":"Answer Reset"};
|
|
2
2
|
|
|
3
3
|
export { messageEn as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var ja = {"materialQuiz.anchorLabel.question":"
|
|
1
|
+
var ja = {"materialQuiz.anchorLabel.question":"文章","materialQuiz.anchorLabel.answer":"回答","materialQuiz.error":"クイズの取得に失敗しました。","materialQuiz.submit":"提出","materialQuiz.resubmit":"再送信","materialQuiz.submittedAnswer":"提出された回答","materialQuiz.answer":"回答","materialQuiz.next":"次の質問 >","materialQuiz.selectOne.answer.title":"以下から選択してください。","materialQuiz.selectMultiple.answer.title":"以下から選択してください。 (冗長な選択肢も利用可能)","materialQuiz.selectMultipleOrder.answer.title":"ドラッグして回答をドロップしてください。","materialQuiz.text.answer.title":"回答を記入してください。","materialQuiz.empty.title":"クイズは今準備中です。","materialQuiz.empty.description":"クイズの投稿後にもう一度確認してください!","materialQuiz.survey.empty.title":"調査は現在準備中です。","materialQuiz.survey.empty.description":"調査投稿後にもう一度ご確認ください!","materialQuiz.submitStatus.success":"提出済","materialQuiz.submitStatus.failure":"提出に失敗しました。","materialQuiz.resultStatus.correct":"正しい","materialQuiz.resultStatus.wrong":"間違った","materialQuiz.resultStatus.submitted":"提出済","materialQuiz.explanation.close":"クイズの説明を閉じる","materialQuiz.explanation.show":"クイズの説明を表示します","materialQuiz.explanation.empty":"いいです。","materialQuiz.text.placeholder":"回答を入力してください","materialQuiz.text.correct":"その通りです!","materialQuiz.text.wrong":"それは間違っています。もう一度やってみてください!","materialQuiz.order.answerEmpty":"オプションをここに戻すことができます。","materialQuiz.bottomSheet.title":"オプション","materialQuiz.bottomSheet.optionEmpty":"すべてのビューがグループに配置されました。","materialQuiz.dropzone.desktop.answerEmpty":"ビューをエリアにドラッグしてください。","materialQuiz.dropzone.mobile.answerEmpty":"ここをクリックしてビューを追加してください。","materialQuiz.dropzone.optionEmpty":"オプション","materialQuiz.dropzone.optionReset":"回答をリセットします"};
|
|
2
2
|
|
|
3
3
|
export { ja as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var messageKo = {"materialQuiz.anchorLabel.question":"지문","materialQuiz.anchorLabel.answer":"
|
|
1
|
+
var messageKo = {"materialQuiz.anchorLabel.question":"지문","materialQuiz.anchorLabel.answer":"답안","materialQuiz.error":"퀴즈를 불러오는데 실패했습니다.\n잠시 후 다시 시도해주세요.","materialQuiz.submit":"제출","materialQuiz.resubmit":"다시 제출","materialQuiz.submittedAnswer":"제출한 답","materialQuiz.answer":"정답","materialQuiz.next":"다음 문제로 이동 >","materialQuiz.selectOne.answer.title":"아래 보기에서 골라주세요.","materialQuiz.selectMultiple.answer.title":"아래 보기에서 골라주세요. (중복 선택 가능)","materialQuiz.selectMultipleOrder.answer.title":"답안을 드래그 앤 드롭하세요.","materialQuiz.text.answer.title":"답안을 작성해 주세요.","materialQuiz.empty.title":"퀴즈가 준비 중 입니다.","materialQuiz.empty.description":"퀴즈 게시 후 다시 확인해주세요!","materialQuiz.survey.empty.title":"설문조사 준비 중 입니다.","materialQuiz.survey.empty.description":"설문지 게시 후 다시 확인해주세요!","materialQuiz.submitStatus.success":"제출되었습니다.","materialQuiz.submitStatus.failure":"제출에 실패하였습니다.","materialQuiz.resultStatus.correct":"정답","materialQuiz.resultStatus.wrong":"오답","materialQuiz.resultStatus.submitted":"제출완료","materialQuiz.explanation.close":"퀴즈해설 닫기","materialQuiz.explanation.show":"퀴즈 해설 보기","materialQuiz.explanation.empty":"작성된 해설이 없습니다.","materialQuiz.text.placeholder":"답안을 작성해 주세요.","materialQuiz.text.correct":"정답입니다.","materialQuiz.text.wrong":"오답입니다. 다시 답안을 제출해보세요.","materialQuiz.order.answerEmpty":"항목을 다시 이곳으로 옮길 수 있습니다.","materialQuiz.bottomSheet.title":"보기","materialQuiz.bottomSheet.optionEmpty":"모든 보기를 그룹에 배치하였습니다.","materialQuiz.dropzone.desktop.answerEmpty":"보기를 영역에 끌어 넣어주세요.","materialQuiz.dropzone.mobile.answerEmpty":"이곳을 클릭하여 보기를 넣어주세요.","materialQuiz.dropzone.optionEmpty":"보기","materialQuiz.dropzone.optionReset":"답안 초기화"};
|
|
2
2
|
|
|
3
3
|
export { messageKo as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var th = {"materialQuiz.anchorLabel.question":"
|
|
1
|
+
var th = {"materialQuiz.anchorLabel.question":"ทางเดิน","materialQuiz.anchorLabel.answer":"ดคำตอบ","materialQuiz.error":"ไม่สามารถดึงควิซได้","materialQuiz.submit":"ส่งใบสมัคร","materialQuiz.resubmit":"ส่งอีกครั้ง","materialQuiz.submittedAnswer":"ฉันสามารถตอบคำถามเช่นนี้ได้","materialQuiz.answer":"ตอบ","materialQuiz.next":"คำถามถัดไป >","materialQuiz.selectOne.answer.title":"เลือกจากมุมมองด้านล่างนี้","materialQuiz.selectMultiple.answer.title":"เลือกจากรายการด้านล่าง (มีการเลือกที่ซ้ำซ้อน)","materialQuiz.selectMultipleOrder.answer.title":"ลากและวางคำตอบของคุณ","materialQuiz.text.answer.title":"กรุณากรอกคำตอบ","materialQuiz.empty.title":"ควิซกำลังเตรียมอยู่ตอนนี้","materialQuiz.empty.description":"โปรดตรวจสอบอีกครั้งหลังจากโพสต์ควิซ!","materialQuiz.survey.empty.title":"การสำรวจกำลังเตรียมการอยู่ค่ะ","materialQuiz.survey.empty.description":"โปรดตรวจสอบอีกครั้งหลังจากโพสต์แบบสำรวจ!","materialQuiz.submitStatus.success":"เสนอ","materialQuiz.submitStatus.failure":"การส่งล้มเหลว","materialQuiz.resultStatus.correct":"ถูกต้อง","materialQuiz.resultStatus.wrong":"ผิด","materialQuiz.resultStatus.submitted":"เสนอ","materialQuiz.explanation.close":"ปิดคำอธิบายควิซ","materialQuiz.explanation.show":"แสดงคำอธิบายของควิซ","materialQuiz.explanation.empty":"ไม่ให้อธิบาย","materialQuiz.text.placeholder":"กรุณากรอกคำตอบ","materialQuiz.text.correct":"ถูกต้อง!","materialQuiz.text.wrong":"นั่นผิด ลองอีกครั้ง!","materialQuiz.order.answerEmpty":"คุณสามารถย้ายตัวเลือกกลับมาที่นี่ได้","materialQuiz.bottomSheet.title":"ตัวเลือก","materialQuiz.bottomSheet.optionEmpty":"ทุกมุมมองได้ถูกวางไว้ในกลุ่มแล้ว","materialQuiz.dropzone.desktop.answerEmpty":"ลากมุมมองเข้าสู่พื้นที่","materialQuiz.dropzone.mobile.answerEmpty":"คลิกที่นี่เพื่อเพิ่มมุมมอง","materialQuiz.dropzone.optionEmpty":"ตัวเลือก","materialQuiz.dropzone.optionReset":"รีเซ็ตคำตอบ"};
|
|
2
2
|
|
|
3
3
|
export { th as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { getOrgMaterialQuizResponseGet, getOrgMaterialQuizResponseList, postOrgMaterialQuizResponseAdd } from '@elice/api-client';
|
|
3
|
-
import { Flex
|
|
3
|
+
import { Flex } from '@elice/blocks';
|
|
4
4
|
import { base } from '@elice/design-tokens';
|
|
5
5
|
import { useRawEliceIntl } from '@elice/intl';
|
|
6
|
-
import {
|
|
6
|
+
import { useTheme } from '@mui/material';
|
|
7
7
|
import cloneDeep from 'lodash-es/cloneDeep';
|
|
8
8
|
import flattenDeep from 'lodash-es/flattenDeep';
|
|
9
9
|
import { MATERIAL_QUIZ_ANSWER_ID, MATERIAL_QUIZ_PASSIVE_ID } from '../../../constant/element.js';
|
|
@@ -12,6 +12,7 @@ import { useCaculatePassage } from '../../../hooks/useCaculatePassage.js';
|
|
|
12
12
|
import QuestionBox from '../../shared/QuestionBox.js';
|
|
13
13
|
import { useMaterialQuizState, useMaterialQuizDispatch } from '../context/MaterialQuizContext.js';
|
|
14
14
|
import MaterialQuizAnswerExplanation from '../MaterialQuizAnswerExplanation.js';
|
|
15
|
+
import MaterialQuizInfo from '../MaterialQuizInfo.js';
|
|
15
16
|
import QuizResultBadge from '../QuizResultBadge.js';
|
|
16
17
|
import QuizSubmitStatusText from '../QuizSubmitStatusText.js';
|
|
17
18
|
import QuizGroupContext from './context/context.js';
|
|
@@ -27,7 +28,8 @@ const MaterialQuizGroup = () => {
|
|
|
27
28
|
const {
|
|
28
29
|
materialQuiz,
|
|
29
30
|
userId,
|
|
30
|
-
vertical
|
|
31
|
+
vertical,
|
|
32
|
+
isLongPassage
|
|
31
33
|
} = useMaterialQuizState();
|
|
32
34
|
const {
|
|
33
35
|
onSubmit,
|
|
@@ -35,6 +37,7 @@ const MaterialQuizGroup = () => {
|
|
|
35
37
|
refreshOrgMaterialQuiz,
|
|
36
38
|
onDirty
|
|
37
39
|
} = useMaterialQuizDispatch();
|
|
40
|
+
const theme = useTheme();
|
|
38
41
|
const [groupList, setGroupList] = React.useState([]);
|
|
39
42
|
const [optionList, setOptionList] = React.useState([]);
|
|
40
43
|
const [currentAnswerList, setCurrentAnswerList] = React.useState([]);
|
|
@@ -43,9 +46,12 @@ const MaterialQuizGroup = () => {
|
|
|
43
46
|
const [submitStatus, setSubmitStatus] = React.useState('idle');
|
|
44
47
|
const [hasSubmitted, setHasSubmitted] = React.useState(false);
|
|
45
48
|
const isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
49
|
+
const isDisabled = !flattenDeep(currentAnswerList).length || !!userId;
|
|
46
50
|
const {
|
|
47
|
-
questionRef
|
|
51
|
+
questionRef,
|
|
52
|
+
containerRef
|
|
48
53
|
} = useCaculatePassage();
|
|
54
|
+
const isVisibleSideBySide = !vertical && isLongPassage;
|
|
49
55
|
/**
|
|
50
56
|
*
|
|
51
57
|
*/
|
|
@@ -227,7 +233,7 @@ const MaterialQuizGroup = () => {
|
|
|
227
233
|
*
|
|
228
234
|
*/
|
|
229
235
|
const renderQuizInfo = () => {
|
|
230
|
-
if (!materialQuiz) {
|
|
236
|
+
if (!materialQuiz || isVisibleSideBySide) {
|
|
231
237
|
return null;
|
|
232
238
|
}
|
|
233
239
|
return React.createElement(Flex, {
|
|
@@ -235,26 +241,9 @@ const MaterialQuizGroup = () => {
|
|
|
235
241
|
id: MATERIAL_QUIZ_PASSIVE_ID,
|
|
236
242
|
column: true,
|
|
237
243
|
ref: questionRef
|
|
238
|
-
}, React.createElement(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
customStyles: {
|
|
242
|
-
color: base.color.primary3,
|
|
243
|
-
marginRight: '0.5rem'
|
|
244
|
-
}
|
|
245
|
-
}, 'Q.'), React.createElement(Text, {
|
|
246
|
-
bold: true,
|
|
247
|
-
role: "white",
|
|
248
|
-
size: "large",
|
|
249
|
-
wordBreak: "break-word"
|
|
250
|
-
}, materialQuiz.questionTitle)), materialQuiz.questionDescription ? React.createElement(React.Fragment, null, React.createElement(Vspace, {
|
|
251
|
-
height: 1
|
|
252
|
-
}), React.createElement(MarkdownSSR, {
|
|
253
|
-
children: materialQuiz.questionDescription,
|
|
254
|
-
dark: true,
|
|
255
|
-
paddingx: 0,
|
|
256
|
-
paddingy: 0
|
|
257
|
-
})) : null, React.createElement(MaterialQuizAnswerExplanation, null));
|
|
244
|
+
}, React.createElement(MaterialQuizInfo, {
|
|
245
|
+
renderWithBox: false
|
|
246
|
+
}));
|
|
258
247
|
};
|
|
259
248
|
//
|
|
260
249
|
//
|
|
@@ -283,21 +272,25 @@ const MaterialQuizGroup = () => {
|
|
|
283
272
|
submitResult: React.createElement(QuizResultBadge, {
|
|
284
273
|
materialQuizResponse: materialQuizResponse
|
|
285
274
|
}),
|
|
275
|
+
bodyContainerRef: containerRef,
|
|
286
276
|
footerActions: [{
|
|
287
|
-
border:
|
|
288
|
-
disabled:
|
|
277
|
+
border: false,
|
|
278
|
+
disabled: isDisabled,
|
|
289
279
|
loading: submitStatus === 'pending',
|
|
290
280
|
tabIndex: 0,
|
|
291
281
|
transparent: false,
|
|
292
|
-
role: isNextActive ? 'secondary' : 'lightpurple',
|
|
293
282
|
onClick: handleSubmit,
|
|
294
283
|
children: intl.formatMessage({
|
|
295
284
|
id: isNextActive ? 'materialQuiz.resubmit' : 'materialQuiz.submit'
|
|
296
|
-
})
|
|
285
|
+
}),
|
|
286
|
+
customStyles: {
|
|
287
|
+
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
|
|
288
|
+
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
|
|
289
|
+
}
|
|
297
290
|
}]
|
|
298
|
-
}, renderQuizInfo(), vertical ? React.createElement("div", {
|
|
291
|
+
}, renderQuizInfo(), vertical || isVisibleSideBySide ? React.createElement("div", {
|
|
299
292
|
id: MATERIAL_QUIZ_ANSWER_ID
|
|
300
|
-
}, React.createElement(MaterialQuizGroupMobile, null)) : React.createElement(MaterialQuizGroupDesktop, null)));
|
|
293
|
+
}, React.createElement(MaterialQuizGroupMobile, null)) : React.createElement(React.Fragment, null, React.createElement(MaterialQuizGroupDesktop, null)), React.createElement(MaterialQuizAnswerExplanation, null)));
|
|
301
294
|
};
|
|
302
295
|
var MaterialQuizGroup$1 = MaterialQuizGroup;
|
|
303
296
|
|