l-min-components 1.7.1567 → 1.7.1568

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.
@@ -24,7 +24,6 @@ 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";
28
27
  const FullAnalysis = ({ data, onClose, accountType }) => {
29
28
  const { findText } = useTranslation(wordStore);
30
29
  const { setRightLayout, setCenterLayoutStyle } = useContext(OutletContext);
@@ -37,7 +36,6 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
37
36
  label: item?.label,
38
37
  value: item?.id,
39
38
  }));
40
-
41
39
  const [selected, setSelected] = useState(tabs?.[0]?.value || "");
42
40
  useEffect(() => {
43
41
  if (tabs?.length) {
@@ -70,7 +68,6 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
70
68
 
71
69
  const selectedModel =
72
70
  data && data?.models?.find((item) => item?.id === selected);
73
-
74
71
  const handleClose = () => {
75
72
  setRightLayout(true);
76
73
  setCenterLayoutStyle({
@@ -244,9 +241,6 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
244
241
  setCheckingPlayingAudio={setCheckingPlayingAudio}
245
242
  />
246
243
  )}
247
- {selectedModel?.id === "comprehension" && (
248
- <Comprehension Aidata={selectedModel} />
249
- )}
250
244
  {selectedModel?.id === "grammar" && (
251
245
  <>
252
246
  {selectedModel?.version === 2 ? (
@@ -720,62 +720,3 @@ 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
- `;
@@ -54,13 +54,6 @@ 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,
61
- text: response,
62
- };
63
- }
64
57
  return {
65
58
  key: index + 1,
66
59
  text: response?.text,
@@ -144,8 +137,6 @@ const setupAnalysis = (data, audioData, score) => {
144
137
  let totalScore = 0;
145
138
  let modelCount = 0;
146
139
 
147
- // console.log(data, "///");
148
-
149
140
  if (
150
141
  data?.logic_evaluation &&
151
142
  data?.logic_evaluation?.length &&
@@ -401,27 +392,6 @@ const setupAnalysis = (data, audioData, score) => {
401
392
  }
402
393
  }
403
394
 
404
- if (
405
- data?.comprehension?.length &&
406
- data?.comprehension?.[0]?.attempt_data_batch?.length
407
- ) {
408
- const compreshension = data?.comprehension?.[0];
409
- const score = Math.floor(compreshension?.aggregatedConfidencePercent || 0);
410
-
411
- formatted.push({
412
- id: "comprehension",
413
- label: "Comprehension",
414
- data: compreshension,
415
- score,
416
- primaryColor: "#febf10",
417
- bgColor: "#febf1019",
418
- sideProgress: true,
419
- responseText: data?.speech_analysis?.[0]?.model_data?.["Reference"],
420
- });
421
- totalScore += score;
422
- modelCount++;
423
- }
424
-
425
395
  let AiScore = 0;
426
396
  if (modelCount > 0) {
427
397
  AiScore = totalScore / modelCount;
@@ -433,24 +403,7 @@ const setupAnalysis = (data, audioData, score) => {
433
403
  models: formatted,
434
404
  };
435
405
  };
436
- const quizWrittenSelectedModel = (response, aiData) => {
437
- if (!response || !aiData) return null;
438
- const index = response?.index || 0;
439
- const objectData = {};
440
406
 
441
- if (aiData?.grammar?.[index] && aiData?.grammar?.length) {
442
- const findData = aiData?.grammar?.[index];
443
- objectData["grammar"] = [findData];
444
- }
445
- if (
446
- aiData?.comprehension?.length &&
447
- aiData?.comprehension?.[0] &&
448
- index === 0
449
- ) {
450
- objectData["comprehension"] = aiData?.comprehension;
451
- }
452
- return objectData;
453
- };
454
407
  const quixSelectedModel = (response, aiData) => {
455
408
  if (!response || !aiData) return null;
456
409
 
@@ -474,14 +427,6 @@ const quixSelectedModel = (response, aiData) => {
474
427
  objectData["grammar"] = [findData];
475
428
  }
476
429
 
477
- if (aiData?.comprehension?.length && aiData?.comprehension) {
478
- const attemptResp = aiData?.comprehension?.[0]?.attempt_data_batch?.[0];
479
-
480
- if (attemptResp?.recording?.id === audioId || attemptResp?.id === audioId) {
481
- objectData["comprehension"] = aiData?.comprehension;
482
- }
483
- }
484
-
485
430
  return objectData;
486
431
  };
487
432
  const dialpgueSelectedModel = (response, aiData) => {
@@ -726,15 +671,10 @@ const getQuestionInfo = (question) => {
726
671
  type = "word-play-multiple-choice";
727
672
  else type = "word-play-text";
728
673
  } else if (question?.type === "QUIZ") {
729
- if (
730
- question?.question_data?.question_data?.type === "MultipleChoice" ||
731
- question?.question_data?.question_data?.type === "Multiple Choice"
732
- )
674
+ if (question?.question_data?.question_data?.type === "MultipleChoice")
733
675
  type = "quiz-multiple-choice";
734
676
  else if (question?.question_data?.question_data?.type === "UnScripted")
735
677
  type = "quiz-unscripted";
736
- else if (question?.question_data?.question_data?.type === "Written")
737
- type = "quiz-written";
738
678
  else type = "quiz-scripted";
739
679
  } else if (question?.type === "ESSAY") {
740
680
  if (question?.question_data?.config?.type === "Scripted")
@@ -768,7 +708,6 @@ const useReportUtils = () => {
768
708
  grammarFindOperation,
769
709
  toRGBA,
770
710
  getQuestionInfo,
771
- quizWrittenSelectedModel,
772
711
  };
773
712
  };
774
713
 
@@ -74,13 +74,6 @@ const data = {
74
74
  ai_score_available: false,
75
75
  system_score: true,
76
76
  },
77
- {
78
- label: "Q&A quiz",
79
- value: "quiz-written",
80
- type: "written",
81
- ai_score_available: false,
82
- system_score: false,
83
- },
84
77
  {
85
78
  label: "Q&A quiz",
86
79
  value: "quiz-scripted",
@@ -61,7 +61,6 @@ import { NavBack, NavForword } from "../fullAnalysis/icons/navArrow";
61
61
  */
62
62
  import useTranslation from "../../../hooks/useTranslation.jsx";
63
63
  import wordStore from "../../../mc/wordStore.json";
64
- import QuizWritten from "./questions/quizWritten.jsx";
65
64
  const ReportQuestions = ({
66
65
  accountType,
67
66
  AiData,
@@ -73,13 +72,6 @@ const ReportQuestions = ({
73
72
  onSwitchQuestion,
74
73
  loading,
75
74
  mainTitle,
76
- // navControl = {
77
- // on: false,
78
- // disablePrev: false,
79
- // disableNext: false,
80
- // onNext: () => {},
81
- // onPrev: () => {},
82
- // },
83
75
  }) => {
84
76
  const { findText } = useTranslation(wordStore);
85
77
  const [questionList, setQuestionList] = useState([]);
@@ -106,7 +98,6 @@ const ReportQuestions = ({
106
98
  const question = constants.questions.find(
107
99
  (question) => question.value === questionType
108
100
  );
109
-
110
101
  const commentData = answerData?.answer?.comments;
111
102
  const hasAnswer = answerData?.answer?.data;
112
103
  useEffect(() => {
@@ -260,36 +251,6 @@ const ReportQuestions = ({
260
251
  <InfoIcon2 />
261
252
  </ScoreHeader>
262
253
  <QuestionNav>
263
- {/* {navControl?.on ? (
264
- <>
265
- <button
266
- disabled={navControl.disablePrev}
267
- onClick={navControl.onPrev}
268
- >
269
- <NavBack disabled={navControl.disablePrev} />
270
- {findText("Previous question")}
271
- </button>
272
- <button
273
- disabled={navControl.disableNext}
274
- onClick={navControl.onNext}
275
- >
276
- {findText("Next question")}
277
- <NavForword disabled={navControl.disableNext} />
278
- </button>
279
- </>
280
- ) : (
281
- <>
282
- <button disabled={!prevId} onClick={handlePrev}>
283
- <NavBack disabled={!prevId} />
284
- {findText("Previous question")}
285
- </button>
286
- <button disabled={!nextId} onClick={handleNext}>
287
- {findText("Next question")}
288
- <NavForword disabled={!nextId} />
289
- </button>
290
- </>
291
- )} */}
292
-
293
254
  <button disabled={!prevId} onClick={handlePrev}>
294
255
  <NavBack disabled={!prevId} />
295
256
  {findText("Previous question")}
@@ -395,16 +356,6 @@ const ReportQuestions = ({
395
356
  defaultSelected={defaultSelected}
396
357
  />
397
358
  )}
398
- {questionType === "quiz-written" && (
399
- <QuizWritten
400
- data={findedQuestion}
401
- answerData={answerData}
402
- aiData={AiData}
403
- setToggle={setToggle}
404
- isPersonal={isPersonal}
405
- defaultSelected={defaultSelected}
406
- />
407
- )}
408
359
  {questionType === "quiz-multiple-choice" && (
409
360
  <QuizMultipleChoice
410
361
  data={findedQuestion}
@@ -37,7 +37,6 @@ const QuizScripted = ({
37
37
  }));
38
38
  const selectedResponse =
39
39
  quizList?.find((item) => item?.key === selected) || {};
40
-
41
40
  const selectedModel = quixSelectedModel(selectedResponse, aiData);
42
41
  useEffect(() => {
43
42
  if (selectedResponse) {
@@ -1,47 +0,0 @@
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;
@@ -1,97 +0,0 @@
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
- console.log(selectedModel, "/////");
43
-
44
- useEffect(() => {
45
- if (selectedResponse) {
46
- const models = setupAnalysis(
47
- selectedModel,
48
- selectedResponse?.recording,
49
- data?.ai_score
50
- );
51
- setAnalysis(models);
52
- }
53
- }, [selectedResponse?.key]);
54
- return (
55
- <QuestionSection>
56
- <Tabs
57
- options={selectionList}
58
- selected={selected}
59
- onChange={setSelected}
60
- />
61
- <QuestionDropdown>
62
- <>
63
- <li>
64
- <h3>{findText("Instruction")}</h3>
65
- <p>{data?.question_data?.instruction}</p>
66
- </li>
67
- <li>
68
- <QuizQuestion data={data} />
69
- </li>
70
- <li>
71
- <h3>{findText("Qyestion")}</h3>
72
- <p>{data?.question_data?.question_data?.question}</p>
73
- </li>
74
- </>
75
- </QuestionDropdown>
76
-
77
- <Response response={selectedResponse?.text} isPersonal={isPersonal} />
78
-
79
- <QuestionSectionWithAnalysis>
80
- <QuestionSectionAction>
81
- {analysis?.models?.length > 0 && (
82
- <AnalysisButton
83
- disabled={!(analysis?.models?.length > 0)}
84
- onClick={() => {
85
- setToggle({
86
- ...analysis,
87
- defaultSelected: selected,
88
- });
89
- }}
90
- />
91
- )}
92
- </QuestionSectionAction>
93
- </QuestionSectionWithAnalysis>
94
- </QuestionSection>
95
- );
96
- };
97
- export default QuizWritten;