l-min-components 1.7.1570 → 1.7.1572

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.1570",
3
+ "version": "1.7.1572",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import {
3
+ ComprehensionContainer,
4
+ ComprehensionContainerResponse,
5
+ ComprehensionFeekback,
6
+ } from "../style";
7
+
8
+ const FeekbackResponsive = ({ title, content, color = "#00C2C2" }) => {
9
+ return (
10
+ <ComprehensionFeekback>
11
+ <h3 style={{ color }}>{title}</h3>
12
+ <p>{content}</p>
13
+ </ComprehensionFeekback>
14
+ );
15
+ };
16
+
17
+ const Comprehension = ({ Aidata }) => {
18
+ const model = Aidata?.data;
19
+
20
+ return (
21
+ <ComprehensionContainer>
22
+ <li>
23
+ <ComprehensionContainerResponse>
24
+ <p>Student response</p>
25
+ <div>
26
+ <p>{model?.studentTextAnswers?.[0] || Aidata?.responseText}</p>
27
+ </div>
28
+ </ComprehensionContainerResponse>
29
+ </li>
30
+ <li>
31
+ <FeekbackResponsive
32
+ title="Correct answer"
33
+ content={model?.model_data?.generate?.answers?.[0]?.answer}
34
+ />
35
+ </li>
36
+ <li>
37
+ <FeekbackResponsive
38
+ title="Feekback"
39
+ color="#30D468"
40
+ content={model?.model_data?.evaluate?.results?.[0]?.feedback}
41
+ />
42
+ </li>
43
+ </ComprehensionContainer>
44
+ );
45
+ };
46
+
47
+ export default Comprehension;
@@ -24,6 +24,7 @@ import useReportUtils from "../hooks/useRreportUtils";
24
24
  import GrammarV2 from "./components/Grammar.v2";
25
25
  import useTranslation from "../../../hooks/useTranslation.jsx";
26
26
  import wordStore from "../../../mc/wordStore.json";
27
+ import Comprehension from "./components/Comprehension.jsx";
27
28
  const FullAnalysis = ({ data, onClose, accountType }) => {
28
29
  const { findText } = useTranslation(wordStore);
29
30
  const { setRightLayout, setCenterLayoutStyle } = useContext(OutletContext);
@@ -241,6 +242,9 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
241
242
  setCheckingPlayingAudio={setCheckingPlayingAudio}
242
243
  />
243
244
  )}
245
+ {selectedModel?.id === "comprehension" && (
246
+ <Comprehension Aidata={selectedModel} />
247
+ )}
244
248
  {selectedModel?.id === "grammar" && (
245
249
  <>
246
250
  {selectedModel?.version === 2 ? (
@@ -720,3 +720,62 @@ export const GrammarV2FeedbackList = styled.ul`
720
720
  }
721
721
  }
722
722
  `;
723
+
724
+ export const ComprehensionContainer = styled.ul`
725
+ border-radius: 32px;
726
+ background: #fff;
727
+ padding: 20px;
728
+ list-style: none;
729
+ display: flex;
730
+ flex-direction: column;
731
+ width: 100%;
732
+ gap: 15px;
733
+ li {
734
+ border-bottom: 1px solid #dfe5e5;
735
+
736
+ padding-bottom: 15px;
737
+ &:last-child {
738
+ border-bottom: transparent;
739
+ }
740
+ }
741
+ `;
742
+
743
+ export const ComprehensionContainerResponse = styled.div`
744
+ display: flex;
745
+ flex-direction: column;
746
+ width: 100%;
747
+ gap: 10px;
748
+ padding-bottom: 5px;
749
+ > p {
750
+ color: #636666;
751
+ font-size: 14px;
752
+ line-height: 24px;
753
+ }
754
+ > div {
755
+ border-radius: 24px;
756
+ background: #f5f7f7;
757
+ min-height: 150px;
758
+ padding: 10px;
759
+ > p {
760
+ color: #4a4d4d;
761
+
762
+ font-size: 16px;
763
+ line-height: 25px;
764
+ &::first-letter {
765
+ text-transform: capitalize;
766
+ }
767
+ }
768
+ }
769
+ `;
770
+
771
+ export const ComprehensionFeekback = styled.div`
772
+ h3 {
773
+ font-size: 16px;
774
+ font-weight: 600;
775
+ margin-bottom: 10px;
776
+ }
777
+ p {
778
+ color: #4a4d4d;
779
+ font-size: 14px;
780
+ }
781
+ `;
@@ -425,6 +425,25 @@ const setupAnalysis = (data, audioData, score) => {
425
425
  };
426
426
  };
427
427
 
428
+ const quizWrittenSelectedModel = (response, aiData) => {
429
+ if (!response || !aiData) return null;
430
+ const index = response?.index || 0;
431
+ const objectData = {};
432
+
433
+ if (aiData?.grammar?.[index] && aiData?.grammar?.length) {
434
+ const findData = aiData?.grammar?.[index];
435
+ objectData["grammar"] = [findData];
436
+ }
437
+ if (
438
+ aiData?.comprehension?.length &&
439
+ aiData?.comprehension?.[0] &&
440
+ index === 0
441
+ ) {
442
+ objectData["comprehension"] = aiData?.comprehension;
443
+ }
444
+ return objectData;
445
+ };
446
+
428
447
  const quixSelectedModel = (response, aiData) => {
429
448
  if (!response || !aiData) return null;
430
449
 
@@ -447,6 +466,13 @@ const quixSelectedModel = (response, aiData) => {
447
466
  );
448
467
  objectData["grammar"] = [findData];
449
468
  }
469
+ if (aiData?.comprehension?.length && aiData?.comprehension) {
470
+ const attemptResp = aiData?.comprehension?.[0]?.attempt_data_batch?.[0];
471
+
472
+ if (attemptResp?.recording?.id === audioId || attemptResp?.id === audioId) {
473
+ objectData["comprehension"] = aiData?.comprehension;
474
+ }
475
+ }
450
476
 
451
477
  return objectData;
452
478
  };
@@ -692,10 +718,15 @@ const getQuestionInfo = (question) => {
692
718
  type = "word-play-multiple-choice";
693
719
  else type = "word-play-text";
694
720
  } else if (question?.type === "QUIZ") {
695
- if (question?.question_data?.question_data?.type === "MultipleChoice")
721
+ if (
722
+ question?.question_data?.question_data?.type === "MultipleChoice" ||
723
+ question?.question_data?.question_data?.type === "Multiple Choice"
724
+ )
696
725
  type = "quiz-multiple-choice";
697
726
  else if (question?.question_data?.question_data?.type === "UnScripted")
698
727
  type = "quiz-unscripted";
728
+ else if (question?.question_data?.question_data?.type === "Written")
729
+ type = "quiz-written";
699
730
  else type = "quiz-scripted";
700
731
  } else if (question?.type === "ESSAY") {
701
732
  if (question?.question_data?.config?.type === "Scripted")
@@ -729,6 +760,7 @@ const useReportUtils = () => {
729
760
  grammarFindOperation,
730
761
  toRGBA,
731
762
  getQuestionInfo,
763
+ quizWrittenSelectedModel,
732
764
  };
733
765
  };
734
766
 
@@ -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,17 @@ const ReportQuestions = ({
385
386
  defaultSelected={defaultSelected}
386
387
  />
387
388
  )}
389
+
390
+ {questionType === "quiz-written" && (
391
+ <QuizWritten
392
+ data={findedQuestion}
393
+ answerData={answerData}
394
+ aiData={AiData}
395
+ setToggle={setToggle}
396
+ isPersonal={isPersonal}
397
+ defaultSelected={defaultSelected}
398
+ />
399
+ )}
388
400
  {questionType === "quiz-multiple-choice" && (
389
401
  <QuizMultipleChoice
390
402
  data={findedQuestion}
@@ -0,0 +1,96 @@
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, quizWrittenSelectedModel } =
28
+ useReportUtils();
29
+ const quizList = quizResponses({
30
+ responses: answerData?.answer?.data?.data?.responses,
31
+ type: "written",
32
+ });
33
+
34
+ const selectionList = quizList?.map((item) => ({
35
+ value: item?.key,
36
+ label: `Reponses ${item?.key}`,
37
+ }));
38
+ const selectedResponse =
39
+ quizList?.find((item) => item?.key === selected) || {};
40
+
41
+ const selectedModel = quizWrittenSelectedModel(selectedResponse, aiData);
42
+
43
+ useEffect(() => {
44
+ if (selectedResponse) {
45
+ const models = setupAnalysis(
46
+ selectedModel,
47
+ selectedResponse?.recording,
48
+ data?.ai_score
49
+ );
50
+ setAnalysis(models);
51
+ }
52
+ }, [selectedResponse?.key]);
53
+ return (
54
+ <QuestionSection>
55
+ <Tabs
56
+ options={selectionList}
57
+ selected={selected}
58
+ onChange={setSelected}
59
+ />
60
+ <QuestionDropdown>
61
+ <>
62
+ <li>
63
+ <h3>{findText("Instruction")}</h3>
64
+ <p>{data?.question_data?.instruction}</p>
65
+ </li>
66
+ <li>
67
+ <QuizQuestion data={data} />
68
+ </li>
69
+ <li>
70
+ <h3>{findText("Qyestion")}</h3>
71
+ <p>{data?.question_data?.question_data?.question}</p>
72
+ </li>
73
+ </>
74
+ </QuestionDropdown>
75
+
76
+ <Response response={selectedResponse?.text} isPersonal={isPersonal} />
77
+
78
+ <QuestionSectionWithAnalysis>
79
+ <QuestionSectionAction>
80
+ {analysis?.models?.length > 0 && (
81
+ <AnalysisButton
82
+ disabled={!(analysis?.models?.length > 0)}
83
+ onClick={() => {
84
+ setToggle({
85
+ ...analysis,
86
+ defaultSelected: selected,
87
+ });
88
+ }}
89
+ />
90
+ )}
91
+ </QuestionSectionAction>
92
+ </QuestionSectionWithAnalysis>
93
+ </QuestionSection>
94
+ );
95
+ };
96
+ export default QuizWritten;