l-min-components 1.7.1577 → 1.7.1579

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.1577",
3
+ "version": "1.7.1579",
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,
@@ -62,6 +62,7 @@ import { NavBack, NavForword } from "../fullAnalysis/icons/navArrow";
62
62
  */
63
63
  import useTranslation from "../../../hooks/useTranslation.jsx";
64
64
  import wordStore from "../../../mc/wordStore.json";
65
+ import QuizWritten from "./questions/quizWritten.jsx";
65
66
  const ReportQuestions = ({
66
67
  accountType,
67
68
  AiData,
@@ -385,6 +386,16 @@ const ReportQuestions = ({
385
386
  defaultSelected={defaultSelected}
386
387
  />
387
388
  )}
389
+ {questionType === "quiz-written" && (
390
+ <QuizWritten
391
+ data={findedQuestion}
392
+ answerData={answerData}
393
+ aiData={AiData}
394
+ setToggle={setToggle}
395
+ isPersonal={isPersonal}
396
+ defaultSelected={defaultSelected}
397
+ />
398
+ )}
388
399
  {questionType === "quiz-multiple-choice" && (
389
400
  <QuizMultipleChoice
390
401
  data={findedQuestion}
@@ -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 } = 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;