l-min-components 1.7.1513 → 1.7.1515
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/package.json
CHANGED
|
@@ -655,6 +655,39 @@ function toRGBA(rgbaString, alpha = 1) {
|
|
|
655
655
|
const [r, g, b] = rgbaString.match(/\d+/g).map(Number);
|
|
656
656
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
657
657
|
}
|
|
658
|
+
|
|
659
|
+
const getQuestionInfo = (question) => {
|
|
660
|
+
let type = "";
|
|
661
|
+
if (question?.type === "SOUND_PLAY") type = "sound-play";
|
|
662
|
+
else if (question?.question_data?.type === "DIALOGUE") {
|
|
663
|
+
if (
|
|
664
|
+
Object.values(question?.question_data?.dialogues_data || {})?.[0]
|
|
665
|
+
?.type === "Scripted"
|
|
666
|
+
)
|
|
667
|
+
type = "dialogue-scripted";
|
|
668
|
+
else type = "dialogue-unscripted";
|
|
669
|
+
} else if (question?.question_data?.type === "WORD_PLAY") {
|
|
670
|
+
if (question?.question_data?.answer_format_data?.type === "Multiple Choice")
|
|
671
|
+
type = "word-play-multiple-choice";
|
|
672
|
+
else type = "word-play-text";
|
|
673
|
+
} else if (question?.type === "QUIZ") {
|
|
674
|
+
if (question?.question_data?.question_data?.type === "MultipleChoice")
|
|
675
|
+
type = "quiz-multiple-choice";
|
|
676
|
+
else if (question?.question_data?.question_data?.type === "UnScripted")
|
|
677
|
+
type = "quiz-unscripted";
|
|
678
|
+
else type = "quiz-scripted";
|
|
679
|
+
} else if (question?.type === "ESSAY") {
|
|
680
|
+
if (question?.question_data?.config?.type === "Scripted")
|
|
681
|
+
type = "essay-scripted";
|
|
682
|
+
else if (question?.question_data?.config?.type === "Written")
|
|
683
|
+
type = "essay-written";
|
|
684
|
+
else type = "essay-unscripted";
|
|
685
|
+
} else if (question?.question_data?.type === "READING") type = "reading";
|
|
686
|
+
else type = "match-pair";
|
|
687
|
+
|
|
688
|
+
return { type, data: question };
|
|
689
|
+
};
|
|
690
|
+
|
|
658
691
|
const useReportUtils = () => {
|
|
659
692
|
return {
|
|
660
693
|
renderCorrectedSentence,
|
|
@@ -673,6 +706,7 @@ const useReportUtils = () => {
|
|
|
673
706
|
getColor,
|
|
674
707
|
grammarFindOperation,
|
|
675
708
|
toRGBA,
|
|
709
|
+
getQuestionInfo,
|
|
676
710
|
};
|
|
677
711
|
};
|
|
678
712
|
|
|
@@ -44,38 +44,6 @@ import { InfoIcon } from "lucide-react";
|
|
|
44
44
|
import InfoIcon2 from "../fullAnalysis/icons/info";
|
|
45
45
|
import { NavBack, NavForword } from "../fullAnalysis/icons/navArrow";
|
|
46
46
|
|
|
47
|
-
const getQuestionInfo = (question) => {
|
|
48
|
-
let type = "";
|
|
49
|
-
if (question?.type === "SOUND_PLAY") type = "sound-play";
|
|
50
|
-
else if (question?.question_data?.type === "DIALOGUE") {
|
|
51
|
-
if (
|
|
52
|
-
Object.values(question?.question_data?.dialogues_data || {})?.[0]
|
|
53
|
-
?.type === "Scripted"
|
|
54
|
-
)
|
|
55
|
-
type = "dialogue-scripted";
|
|
56
|
-
else type = "dialogue-unscripted";
|
|
57
|
-
} else if (question?.question_data?.type === "WORD_PLAY") {
|
|
58
|
-
if (question?.question_data?.answer_format_data?.type === "Multiple Choice")
|
|
59
|
-
type = "word-play-multiple-choice";
|
|
60
|
-
else type = "word-play-text";
|
|
61
|
-
} else if (question?.type === "QUIZ") {
|
|
62
|
-
if (question?.question_data?.question_data?.type === "MultipleChoice")
|
|
63
|
-
type = "quiz-multiple-choice";
|
|
64
|
-
else if (question?.question_data?.question_data?.type === "UnScripted")
|
|
65
|
-
type = "quiz-unscripted";
|
|
66
|
-
else type = "quiz-scripted";
|
|
67
|
-
} else if (question?.type === "ESSAY") {
|
|
68
|
-
if (question?.question_data?.config?.type === "Scripted")
|
|
69
|
-
type = "essay-scripted";
|
|
70
|
-
else if (question?.question_data?.config?.type === "Written")
|
|
71
|
-
type = "essay-written";
|
|
72
|
-
else type = "essay-unscripted";
|
|
73
|
-
} else if (question?.question_data?.type === "READING") type = "reading";
|
|
74
|
-
else type = "match-pair";
|
|
75
|
-
|
|
76
|
-
return { type, data: question };
|
|
77
|
-
};
|
|
78
|
-
|
|
79
47
|
/**
|
|
80
48
|
* @param {Object} props
|
|
81
49
|
|
|
@@ -100,24 +68,20 @@ const ReportQuestions = ({
|
|
|
100
68
|
answerData,
|
|
101
69
|
onSwitchQuestion,
|
|
102
70
|
}) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
71
|
+
const [questionList, setQuestionList] = useState([]);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (questions?.length) {
|
|
75
|
+
setQuestionList(questions);
|
|
76
|
+
}
|
|
77
|
+
}, [questions]);
|
|
106
78
|
|
|
107
|
-
const findedQuestion =
|
|
79
|
+
const findedQuestion = questionList?.find(
|
|
108
80
|
(question) => question?.question_activity_id === questionActivityID
|
|
109
81
|
);
|
|
110
|
-
|
|
111
|
-
if (!findedQuestion) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
|
|
82
|
+
const { getQuestionInfo } = useReportUtils();
|
|
115
83
|
const questionType = getQuestionInfo(findedQuestion)?.type;
|
|
116
84
|
|
|
117
|
-
if (!questionType) {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
85
|
const [comment, setComment] = useState(null);
|
|
122
86
|
|
|
123
87
|
const [intructorScore, setInstructorScore] = useState(0);
|
|
@@ -190,11 +154,11 @@ const ReportQuestions = ({
|
|
|
190
154
|
const nextId = questions?.[currentQuestionIndex + 1]?.question_activity_id;
|
|
191
155
|
|
|
192
156
|
const handleNext = () => {
|
|
193
|
-
if (nextId) onSwitchQuestion(nextId);
|
|
157
|
+
if (nextId) onSwitchQuestion?.(nextId);
|
|
194
158
|
};
|
|
195
159
|
|
|
196
160
|
const handlePrev = () => {
|
|
197
|
-
if (prevId) onSwitchQuestion(prevId);
|
|
161
|
+
if (prevId) onSwitchQuestion?.(prevId);
|
|
198
162
|
};
|
|
199
163
|
|
|
200
164
|
return (
|