l-min-components 1.7.1576 → 1.7.1578

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.7.1576",
3
+ "version": "1.7.1578",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -54,6 +54,13 @@ const quizResponses = ({ responses = [], type = "scripted" }) => {
54
54
  recording: response,
55
55
  };
56
56
  }
57
+ if (type === "written") {
58
+ return {
59
+ key: index + 1,
60
+ index: index,
61
+ text: response,
62
+ };
63
+ }
57
64
  return {
58
65
  key: index + 1,
59
66
  text: response?.text,
@@ -692,10 +699,15 @@ const getQuestionInfo = (question) => {
692
699
  type = "word-play-multiple-choice";
693
700
  else type = "word-play-text";
694
701
  } else if (question?.type === "QUIZ") {
695
- if (question?.question_data?.question_data?.type === "MultipleChoice")
702
+ if (
703
+ question?.question_data?.question_data?.type === "MultipleChoice" ||
704
+ question?.question_data?.question_data?.type === "Multiple Choice"
705
+ )
696
706
  type = "quiz-multiple-choice";
697
707
  else if (question?.question_data?.question_data?.type === "UnScripted")
698
708
  type = "quiz-unscripted";
709
+ else if (question?.question_data?.question_data?.type === "Written")
710
+ type = "quiz-written";
699
711
  else type = "quiz-scripted";
700
712
  } else if (question?.type === "ESSAY") {
701
713
  if (question?.question_data?.config?.type === "Scripted")
@@ -0,0 +1,91 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import {
3
+ QuestionSection,
4
+ QuestionSectionAction,
5
+ QuestionSectionWithAnalysis,
6
+ } from "../style.jsx";
7
+ import Tabs from "../components/tabs.jsx";
8
+ import useReportUtils from "../../hooks/useRreportUtils.jsx";
9
+ import Response from "../components/response.jsx";
10
+ import AnalysisButton from "../components/analysisButton.jsx";
11
+ import QuestionDropdown from "../components/questionDropdown.jsx";
12
+ import QuizQuestion from "../components/quizQuestion.jsx";
13
+
14
+ import useTranslation from "../../../../hooks/useTranslation.jsx";
15
+ import wordStore from "../../../../mc/wordStore.json";
16
+ const QuizWritten = ({
17
+ data,
18
+ aiData,
19
+ setToggle,
20
+ answerData,
21
+ isPersonal,
22
+ defaultSelected = 1,
23
+ }) => {
24
+ const { findText } = useTranslation(wordStore);
25
+ const [selected, setSelected] = useState(defaultSelected);
26
+ const [analysis, setAnalysis] = useState(null);
27
+ const { quizResponses, setupAnalysis } = useReportUtils();
28
+ const quizList = quizResponses({
29
+ responses: answerData?.answer?.data?.data?.responses,
30
+ type: "written",
31
+ });
32
+
33
+ const selectionList = quizList?.map((item) => ({
34
+ value: item?.key,
35
+ label: `Reponses ${item?.key}`,
36
+ }));
37
+ const selectedResponse =
38
+ quizList?.find((item) => item?.key === selected) || {};
39
+
40
+ // const selectedModel = quizWrittenSelectedModel(selectedResponse, aiData);
41
+
42
+ useEffect(() => {
43
+ if (selectedResponse) {
44
+ // const models = setupAnalysis(selectedModel, null, data?.ai_score);
45
+ // setAnalysis(models);
46
+ }
47
+ }, [selectedResponse?.key]);
48
+ return (
49
+ <QuestionSection>
50
+ <Tabs
51
+ options={selectionList}
52
+ selected={selected}
53
+ onChange={setSelected}
54
+ />
55
+ <QuestionDropdown>
56
+ <>
57
+ <li>
58
+ <h3>{findText("Instruction")}</h3>
59
+ <p>{data?.question_data?.instruction}</p>
60
+ </li>
61
+ <li>
62
+ <QuizQuestion data={data} />
63
+ </li>
64
+ <li>
65
+ <h3>{findText("Qyestion")}</h3>
66
+ <p>{data?.question_data?.question_data?.question}</p>
67
+ </li>
68
+ </>
69
+ </QuestionDropdown>
70
+
71
+ <Response response={selectedResponse?.text} isPersonal={isPersonal} />
72
+
73
+ <QuestionSectionWithAnalysis>
74
+ <QuestionSectionAction>
75
+ {analysis?.models?.length > 0 && (
76
+ <AnalysisButton
77
+ disabled={!(analysis?.models?.length > 0)}
78
+ onClick={() => {
79
+ setToggle({
80
+ ...analysis,
81
+ defaultSelected: selected,
82
+ });
83
+ }}
84
+ />
85
+ )}
86
+ </QuestionSectionAction>
87
+ </QuestionSectionWithAnalysis>
88
+ </QuestionSection>
89
+ );
90
+ };
91
+ export default QuizWritten;