l-min-components 1.7.1413 → 1.7.1415

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.1413",
3
+ "version": "1.7.1415",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+
3
+ const WarningGrey = () => {
4
+ return (
5
+ <svg
6
+ width="20"
7
+ height="20"
8
+ viewBox="0 0 20 20"
9
+ fill="none"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ >
12
+ <path
13
+ d="M9 5H11V7H9V5ZM9 9H11V15H9V9ZM10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM10 18C5.59 18 2 14.41 2 10C2 5.59 5.59 2 10 2C14.41 2 18 5.59 18 10C18 14.41 14.41 18 10 18Z"
14
+ fill="#949999"
15
+ />
16
+ </svg>
17
+ );
18
+ };
19
+
20
+ export default WarningGrey;
@@ -32,7 +32,7 @@ const Evaluation = ({ Aidata }) => {
32
32
  return (
33
33
  <ModelComtainer>
34
34
  <EvaluationHeader>
35
- <p>{Aidata?.data?.overall_feedback}</p>
35
+ <p>{`This is the general feedback for the ${selectSection?.label?.toLowerCase()} analysis.`}</p>
36
36
  </EvaluationHeader>
37
37
  <ModelContent>
38
38
  <ul>
@@ -16,7 +16,7 @@ const EvalutionFeedback = ({
16
16
  {!hideWarning && (
17
17
  <div>
18
18
  <WarningIcon />
19
- <p>Introduced words are highlighted in blue</p>
19
+ <p>Introduced words are highlighted in green</p>
20
20
  </div>
21
21
  )}
22
22
  </Header>
@@ -62,6 +62,6 @@ const Header = styled.div`
62
62
  export const HighlightedText = styled.p`
63
63
  font-size: 14px;
64
64
  span {
65
- color: #00c2c2;
65
+ color: #30d468;
66
66
  }
67
67
  `;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
2
  import {
3
3
  GrammarContent,
4
4
  GrammarHeader,
@@ -14,35 +14,36 @@ import { MarsIcon } from "lucide-react";
14
14
  import { useState } from "react";
15
15
  import GoodCheck from "../../../../assets/svg/goodCheck";
16
16
  import RedX from "../../../../assets/svg/redX";
17
+ import useReportUtils from "../../hooks/useRreportUtils";
18
+ import WarningGrey from "../../../../assets/svg/warningGrey";
17
19
 
18
- const Grammar = () => {
20
+ const Grammar = ({ Aidata }) => {
19
21
  const [selectedSection, setSelectedSection] = useState(1);
20
- const sampleText =
21
- "Text <span><span>1</span>setup</span> Lorem, ipsum dolor sit amet consectetur adipisicing elit. Veritatis odio laboriosam adipisci ab inventore velit pariatur, alias quas hic libero.";
22
+ const [selectedWord, setSelectedWord] = useState(null);
22
23
 
23
- const texts = [
24
- { text: "Hello" },
25
- { text: "world,", position: 1 },
26
- { text: "James", position: 2 },
27
- { text: "back" },
28
- { text: "How" },
29
- { text: "are", position: 3 },
30
- { text: "you" },
31
- { text: "doing", position: 4 },
32
- { text: "today?" },
33
- { text: "It's", position: 5 },
34
- { text: "been" },
35
- { text: "a" },
36
- { text: "while", position: 6 },
37
- { text: "since" },
38
- { text: "we", position: 7 },
39
- { text: "last" },
40
- { text: "met.", position: 8 },
41
- { text: "Hope" },
42
- { text: "everything", position: 9 },
43
- { text: "is" },
44
- { text: "great!" },
45
- ];
24
+ const data = Aidata?.data;
25
+ const feedbackCorrection = data?.["Correction Operations (Optional)"] || [];
26
+ const originalText = data?.["Original Speech"] || "";
27
+ const correctText = data?.["Grammatical Correct Version"] || "";
28
+ const feedbacks = data?.["Feedback"];
29
+ const {
30
+ grammarFeekbackResult,
31
+ grammerCorrectParagraph,
32
+ grammarCorrectResult,
33
+ } = useReportUtils();
34
+
35
+ const wordsFeedback = grammarFeekbackResult(
36
+ originalText,
37
+ feedbackCorrection,
38
+ feedbacks
39
+ );
40
+ const correctWods = grammarCorrectResult(correctText, feedbackCorrection);
41
+ const correctParagraph = correctWods
42
+ ? grammerCorrectParagraph(correctWods)
43
+ : "";
44
+ useEffect(() => {
45
+ if (wordsFeedback?.length) setSelectedWord(wordsFeedback?.[0]);
46
+ }, [wordsFeedback?.length]);
46
47
 
47
48
  const tabs = [
48
49
  { label: "Feedback", value: 1, icon: ChatIcon },
@@ -58,13 +59,18 @@ const Grammar = () => {
58
59
  <p>Click on the words to see detailed feedback</p>
59
60
  </div>
60
61
  <GrammarHeaderContent>
61
- {texts?.map((item, idx) => (
62
+ {wordsFeedback?.map((word, idx) => (
62
63
  <span
63
- className={classNames({ "error-text": item?.position })}
64
+ className={classNames({ "error-text": word?.position })}
64
65
  key={idx}
66
+ onClick={() => {
67
+ setSelectedWord(word);
68
+
69
+ setSelectedSection(1);
70
+ }}
65
71
  >
66
- {item?.position && <span>{item.position}</span>}
67
- {item.text}
72
+ {word?.position && <span>{word?.position}</span>}
73
+ {word?.text}
68
74
  </span>
69
75
  ))}
70
76
  </GrammarHeaderContent>
@@ -76,7 +82,9 @@ const Grammar = () => {
76
82
  className={classNames({
77
83
  active: selectedSection === tab.value,
78
84
  })}
79
- onClick={() => setSelectedSection(tab.value)}
85
+ onClick={() => {
86
+ setSelectedSection(tab.value);
87
+ }}
80
88
  >
81
89
  <tab.icon
82
90
  color={selectedSection === tab.value ? "#f5f7f7" : "#949999"}
@@ -87,26 +95,30 @@ const Grammar = () => {
87
95
  </ul>
88
96
  </GrammarHeader>
89
97
  <GrammarContent>
90
- {selectedSection === 1 && (
98
+ {selectedSection === 1 && selectedWord && (
91
99
  <div className="feedback_section">
92
100
  <div className="failed">
93
101
  <RedX />
94
102
  <span>
95
- <span>1</span> Makes
103
+ <span>{selectedWord?.position}</span> {selectedWord?.text}
96
104
  </span>
97
105
  </div>
98
106
  <div className="correct">
99
107
  <GoodCheck />
100
- <span>Makes</span>
108
+ <span>{selectedWord?.correct}</span>
101
109
  </div>
102
- <p>
103
- The verbs should be in the same tense within the a sentence or
104
- paragraph
105
- </p>
110
+ <p>{selectedWord?.feedback}</p>
106
111
  </div>
107
112
  )}
108
- {selectedSection === 2 && (
109
- <p>Technology make more convenient life and means easier.</p>
113
+ {selectedSection === 2 && originalText && <p>{originalText}</p>}
114
+ {selectedSection === 3 && (
115
+ <div className="correct_section">
116
+ <div className="warning">
117
+ <WarningGrey />
118
+ <p>Introduced words are highlighted in green</p>
119
+ </div>
120
+ <p dangerouslySetInnerHTML={{ __html: correctParagraph }}></p>
121
+ </div>
110
122
  )}
111
123
  </GrammarContent>
112
124
  </ModelContent>
@@ -72,7 +72,7 @@ const SpeechAnalysis = ({ Aidata, isPersonal }) => {
72
72
  <HandIcon />
73
73
  <p>Click on the words to see detailed feedback</p>
74
74
  </div>
75
- {true && (
75
+ {isPersonal && (
76
76
  <div className="">
77
77
  <PlayButton audio={Aidata?.audioData} />
78
78
  <PlayButton type="ai" refernceText={Aidata?.data?.Reference} />