l-min-components 1.7.1432 → 1.7.1434
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 +1 -1
- package/src/assets/svg/yellow-pen.jsx +3 -3
- package/src/components/reportsComponents/fullAnalysis/components/Grammar.jsx +86 -40
- package/src/components/reportsComponents/fullAnalysis/components/SpeechAnalysis.jsx +19 -21
- package/src/components/reportsComponents/fullAnalysis/data.jsx +22 -46
- package/src/components/reportsComponents/fullAnalysis/style.jsx +26 -2
- package/src/components/reportsComponents/hooks/useRreportUtils.jsx +1 -0
- package/src/components/reportsComponents/reportQuestions/components/comment.jsx +9 -1
- package/src/components/reportsComponents/reportQuestions/components/response.jsx +1 -0
- package/src/components/reportsComponents/reportQuestions/components/style/comment.style.jsx +3 -0
- package/src/components/reportsComponents/reportQuestions/components/style/errorHeader.style.jsx +1 -0
- package/src/components/reportsComponents/reportQuestions/index.jsx +9 -2
- package/src/components/reportsComponents/reportQuestions/questions/dialogueUnscripted.jsx +7 -1
- package/src/components/reportsComponents/reportQuestions/questions/matchPair.jsx +1 -1
- package/src/components/reportsComponents/reportQuestions/style.jsx +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
const YellowPen = () => {
|
|
3
|
+
const YellowPen = ({ color = "#FEBF10" }) => {
|
|
4
4
|
return (
|
|
5
5
|
<svg
|
|
6
6
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -11,8 +11,8 @@ const YellowPen = () => {
|
|
|
11
11
|
>
|
|
12
12
|
<path
|
|
13
13
|
d="M13.4766 7.45508L5.62695 15.3047H3.44531V13.123L11.2949 5.27344L13.4766 7.45508ZM4.05469 13.375V14.6953H5.375L12.6152 7.45508L11.2949 6.13477L4.05469 13.375ZM13.9951 2.69531C14.082 2.69534 14.1527 2.72318 14.2119 2.78223L15.9678 4.53809C16.0857 4.65649 16.0859 4.84653 15.9678 4.96484L14.9102 6.02148L12.7275 3.83887L13.7852 2.78223C13.841 2.72652 13.9215 2.69531 13.9951 2.69531Z"
|
|
14
|
-
fill=
|
|
15
|
-
stroke=
|
|
14
|
+
fill={color}
|
|
15
|
+
stroke={color}
|
|
16
16
|
strokeWidth="0.891406"
|
|
17
17
|
/>
|
|
18
18
|
</svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from "react";
|
|
1
|
+
import React, { useCallback, useEffect } from "react";
|
|
2
2
|
import {
|
|
3
3
|
GrammarContent,
|
|
4
4
|
GrammarHeader,
|
|
@@ -14,16 +14,17 @@ 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 DOMPurify from "dompurify";
|
|
17
18
|
import useReportUtils from "../../hooks/useRreportUtils";
|
|
18
19
|
|
|
19
20
|
const Grammar = ({ Aidata }) => {
|
|
20
21
|
const [selectedSection, setSelectedSection] = useState(1);
|
|
21
22
|
const [selectedWord, setSelectedWord] = useState(null);
|
|
22
23
|
|
|
24
|
+
const [formattedCopy, setFormattedCopy] = useState("");
|
|
25
|
+
const [operationIndex, setOperationIndex] = useState(null);
|
|
26
|
+
|
|
23
27
|
const data = Aidata?.data;
|
|
24
|
-
const feedbackCorrection = (
|
|
25
|
-
data?.["Correction Operations (Optional)"] || []
|
|
26
|
-
)?.filter((item) => ["substituted", "formatting"].includes(item?.operation));
|
|
27
28
|
|
|
28
29
|
const originalText = data?.["Original Speech"] || "";
|
|
29
30
|
const correctText = data?.["Grammatical Correct Version"] || "";
|
|
@@ -31,6 +32,53 @@ const Grammar = ({ Aidata }) => {
|
|
|
31
32
|
|
|
32
33
|
const { grammarFeekbackResult } = useReportUtils();
|
|
33
34
|
|
|
35
|
+
const feedbackCorrection = (
|
|
36
|
+
data?.["Correction Operations (Optional)"] || []
|
|
37
|
+
)?.filter((item) => ["substituted", "formatting"].includes(item?.operation));
|
|
38
|
+
|
|
39
|
+
const findOperation = useCallback(() => {
|
|
40
|
+
const substitutedCorrections = feedbackCorrection.filter((correction) =>
|
|
41
|
+
["substituted", "formatting"].includes(correction.operation)
|
|
42
|
+
);
|
|
43
|
+
return substitutedCorrections[operationIndex ?? -1] || null;
|
|
44
|
+
}, [feedbackCorrection, operationIndex]);
|
|
45
|
+
|
|
46
|
+
const processSubstitutedCorrections = useCallback(
|
|
47
|
+
(corrections, originalSpeech) => {
|
|
48
|
+
if (!corrections.length) return originalSpeech;
|
|
49
|
+
|
|
50
|
+
let modifiedSpeech = originalSpeech;
|
|
51
|
+
let usedIndices = [];
|
|
52
|
+
|
|
53
|
+
corrections.forEach((correction, correctionIndex) => {
|
|
54
|
+
const escapedOriginalWord = correction.original_word.replace(
|
|
55
|
+
/[.*+?^${}()|[\]\\]/g,
|
|
56
|
+
"\\$&"
|
|
57
|
+
);
|
|
58
|
+
const regex = new RegExp(escapedOriginalWord, "g");
|
|
59
|
+
let match;
|
|
60
|
+
|
|
61
|
+
while ((match = regex.exec(modifiedSpeech)) !== null) {
|
|
62
|
+
const [start, end] = [match.index, match.index + match[0].length];
|
|
63
|
+
|
|
64
|
+
if (!usedIndices.some(([s, e]) => start < e && end > s)) {
|
|
65
|
+
usedIndices.push([start, end]);
|
|
66
|
+
modifiedSpeech =
|
|
67
|
+
modifiedSpeech.slice(0, start) +
|
|
68
|
+
`<span class="issue" data-index="${correctionIndex}"><span class="number" data-index="${correctionIndex}">${
|
|
69
|
+
correctionIndex + 1
|
|
70
|
+
}</span> ${match[0]}</span>` +
|
|
71
|
+
modifiedSpeech.slice(end);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return DOMPurify.sanitize(modifiedSpeech);
|
|
78
|
+
},
|
|
79
|
+
[]
|
|
80
|
+
);
|
|
81
|
+
|
|
34
82
|
const wordsFeedback = grammarFeekbackResult(
|
|
35
83
|
originalText,
|
|
36
84
|
feedbackCorrection,
|
|
@@ -45,12 +93,39 @@ const Grammar = ({ Aidata }) => {
|
|
|
45
93
|
}
|
|
46
94
|
}, [wordsFeedback?.length]);
|
|
47
95
|
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
const substitutedCorrections = feedbackCorrection?.filter((correction) =>
|
|
98
|
+
["substituted", "formatting"].includes(correction.operation)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const processedSpeech = processSubstitutedCorrections(
|
|
102
|
+
substitutedCorrections,
|
|
103
|
+
originalText
|
|
104
|
+
);
|
|
105
|
+
setFormattedCopy(processedSpeech);
|
|
106
|
+
}, [feedbackCorrection, processSubstitutedCorrections]);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const handleClick = (event) => {
|
|
110
|
+
const target = event.target;
|
|
111
|
+
const index = target.getAttribute("data-index");
|
|
112
|
+
if (index) setOperationIndex(Number(index));
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
document.addEventListener("click", handleClick);
|
|
116
|
+
return () => document.removeEventListener("click", handleClick);
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
48
119
|
const tabs = [
|
|
49
120
|
{ label: "Feedback", value: 1, icon: ChatIcon },
|
|
50
121
|
{ label: "View script", value: 2, icon: AIcon },
|
|
51
122
|
{ label: "Corrected version", value: 3, icon: MarsIcon },
|
|
52
123
|
].filter((item) => !(item?.value === 3 && Aidata?.score >= 100));
|
|
53
124
|
|
|
125
|
+
const operation = findOperation();
|
|
126
|
+
|
|
127
|
+
console.log(operation);
|
|
128
|
+
|
|
54
129
|
return (
|
|
55
130
|
<ModelComtainer>
|
|
56
131
|
<ModelContent>
|
|
@@ -60,38 +135,10 @@ const Grammar = ({ Aidata }) => {
|
|
|
60
135
|
<p>Click on the words to see detailed feedback</p>
|
|
61
136
|
</div>
|
|
62
137
|
<GrammarHeaderContent>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const nextIsWord = /^\w+$/.test(next?.text || "");
|
|
68
|
-
const isCorrected = !!word.operation;
|
|
69
|
-
const showFeedback = !!word.feedbackPosition;
|
|
70
|
-
|
|
71
|
-
const shouldAddSpace =
|
|
72
|
-
(isWord && nextIsWord) || // word → word
|
|
73
|
-
(isSymbol && nextIsWord); // symbol → word
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<span
|
|
77
|
-
className={classNames("inline", {
|
|
78
|
-
"error-text": isCorrected,
|
|
79
|
-
})}
|
|
80
|
-
key={idx}
|
|
81
|
-
style={{ whiteSpace: "pre" }}
|
|
82
|
-
onClick={() => {
|
|
83
|
-
if (!isCorrected) return;
|
|
84
|
-
setSelectedWord(word);
|
|
85
|
-
setSelectedSection(1);
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
{/* This will only be true for words with a correction (and a position) */}
|
|
89
|
-
{showFeedback && <sup>{word.feedbackPosition}</sup>}
|
|
90
|
-
{word.text}
|
|
91
|
-
{shouldAddSpace && " "}
|
|
92
|
-
</span>
|
|
93
|
-
);
|
|
94
|
-
})}
|
|
138
|
+
<div
|
|
139
|
+
className="grammar_analysis_container"
|
|
140
|
+
dangerouslySetInnerHTML={{ __html: formattedCopy }}
|
|
141
|
+
></div>
|
|
95
142
|
</GrammarHeaderContent>
|
|
96
143
|
<ul className="no-border ul_tabs">
|
|
97
144
|
{tabs.map((tab) => (
|
|
@@ -114,18 +161,17 @@ const Grammar = ({ Aidata }) => {
|
|
|
114
161
|
</ul>
|
|
115
162
|
</GrammarHeader>
|
|
116
163
|
<GrammarContent>
|
|
117
|
-
{selectedSection === 1 &&
|
|
164
|
+
{selectedSection === 1 && operation && (
|
|
118
165
|
<div className="feedback_section">
|
|
119
166
|
<div className="failed">
|
|
120
167
|
<RedX />
|
|
121
168
|
<span>
|
|
122
|
-
<span>{
|
|
123
|
-
{selectedWord?.text}
|
|
169
|
+
<span>{operationIndex + 1}</span> {operation?.original_word}
|
|
124
170
|
</span>
|
|
125
171
|
</div>
|
|
126
172
|
<div className="correct">
|
|
127
173
|
<GoodCheck />
|
|
128
|
-
<span>{
|
|
174
|
+
<span>{operation?.replacement_word}</span>
|
|
129
175
|
</div>
|
|
130
176
|
</div>
|
|
131
177
|
)}
|
|
@@ -23,6 +23,7 @@ import { Progress } from "rsuite";
|
|
|
23
23
|
import ClarityItem from "./ClarityItem";
|
|
24
24
|
import InlineClampedText from "./InlineClampedText";
|
|
25
25
|
import PlayButton from "./PlayButton";
|
|
26
|
+
import useReportUtils from "../../hooks/useRreportUtils";
|
|
26
27
|
|
|
27
28
|
const SpeechAnalysis = ({
|
|
28
29
|
Aidata,
|
|
@@ -33,6 +34,8 @@ const SpeechAnalysis = ({
|
|
|
33
34
|
const [selectedWord, setSelectedWord] = useState(1);
|
|
34
35
|
const [selectedSection, setSelectedSection] = useState(null);
|
|
35
36
|
|
|
37
|
+
const { getColor } = useReportUtils();
|
|
38
|
+
|
|
36
39
|
const wordData = Aidata?.words;
|
|
37
40
|
const words = wordData?.map((item) => ({
|
|
38
41
|
text: item?.wordText,
|
|
@@ -63,7 +66,7 @@ const SpeechAnalysis = ({
|
|
|
63
66
|
if (tabs?.length) {
|
|
64
67
|
setSelectedSection(tabs?.[0]?.value);
|
|
65
68
|
}
|
|
66
|
-
}, [tabs?.length
|
|
69
|
+
}, [tabs?.length]);
|
|
67
70
|
|
|
68
71
|
const selectionSelectionValue = sectionList?.find(
|
|
69
72
|
(item) => item?.id === selectedSection
|
|
@@ -91,6 +94,8 @@ const SpeechAnalysis = ({
|
|
|
91
94
|
return bg;
|
|
92
95
|
}, []);
|
|
93
96
|
|
|
97
|
+
console.log(selectionSelectionValue?.data);
|
|
98
|
+
|
|
94
99
|
return (
|
|
95
100
|
<ModelComtainer>
|
|
96
101
|
<ModelContent>
|
|
@@ -293,35 +298,28 @@ const SpeechAnalysis = ({
|
|
|
293
298
|
<div className="progress_section center">
|
|
294
299
|
<div className="progress_value">
|
|
295
300
|
<Progress.Circle
|
|
296
|
-
percent={
|
|
297
|
-
selectionSelectionValue?.data?.score
|
|
298
|
-
|
|
299
|
-
: selectionSelectionValue?.data?.score || 0
|
|
300
|
-
}
|
|
301
|
+
percent={Math.floor(
|
|
302
|
+
selectionSelectionValue?.data?.score || 0
|
|
303
|
+
)}
|
|
301
304
|
strokeWidth={10}
|
|
302
|
-
trailWidth={
|
|
303
|
-
strokeColor={
|
|
304
|
-
selectionSelectionValue?.data?.score
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
trailColor={
|
|
309
|
-
selectionSelectionValue?.data?.score > 45
|
|
310
|
-
? "#F95454"
|
|
311
|
-
: "#30D468"
|
|
312
|
-
}
|
|
305
|
+
trailWidth={4}
|
|
306
|
+
strokeColor={getColor(
|
|
307
|
+
selectionSelectionValue?.data?.score || 0
|
|
308
|
+
)}
|
|
309
|
+
trailColor="#F2F2F2"
|
|
313
310
|
showInfo={false}
|
|
314
311
|
className="progress-circle"
|
|
315
|
-
gapDegree={8}
|
|
316
312
|
gapPosition="bottom"
|
|
317
313
|
style={{
|
|
318
314
|
width: "80px",
|
|
319
315
|
}}
|
|
320
316
|
/>
|
|
321
317
|
<p
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
318
|
+
style={{
|
|
319
|
+
color: getColor(
|
|
320
|
+
selectionSelectionValue?.data?.score || 0
|
|
321
|
+
),
|
|
322
|
+
}}
|
|
325
323
|
>
|
|
326
324
|
{selectionSelectionValue?.data?.score || 0}%
|
|
327
325
|
</p>
|
|
@@ -7,38 +7,38 @@ export const sampleData1 = {
|
|
|
7
7
|
evidence: {
|
|
8
8
|
score: 80,
|
|
9
9
|
example:
|
|
10
|
-
"
|
|
10
|
+
"Have you heard about food? It is a fundamental aspect of human culture, with various cuisines around the world offering a diverse range of flavors and nutritional benefits <IMPROVEMENT>(for example, the Mediterranean diet is known for its health benefits, with a study by the American Journal of Medicine finding a significant reduction in heart disease among its adherents)</IMPROVEMENT>. Very delicious.. Robots can't relate <IMPROVEMENT>because they lack the sensory experiences that humans take for granted, such as taste and smell, which are crucial in appreciating the complexity of food</IMPROVEMENT>.",
|
|
11
11
|
feedback:
|
|
12
|
-
"The essay lacks any form of evidence to support its
|
|
12
|
+
"The essay lacks any form of evidence to support its claims. There are no specific examples, data, or references to credible sources. The statements made are vague and do not provide any convincing argument. To improve, the author should include relevant and convincing evidence, such as statistics or expert opinions, to substantiate their claims.",
|
|
13
13
|
},
|
|
14
14
|
coherence: {
|
|
15
15
|
score: 80,
|
|
16
16
|
example:
|
|
17
|
-
"
|
|
17
|
+
"Have you heard about food? <IMPROVEMENT>It is often described as</IMPROVEMENT> very delicious.. <IMPROVEMENT>This appreciation for taste is a characteristic that distinguishes humans from robots, as</IMPROVEMENT> robots can't relate.",
|
|
18
18
|
feedback:
|
|
19
|
-
"The essay lacks coherence and logical flow
|
|
19
|
+
"The essay lacks coherence and logical flow. It appears to be a collection of disconnected sentences. To improve coherence, a clear topic sentence and a logical connection between the ideas are needed. The transition between 'Have you heard about food?' and 'Very delicious..' is abrupt, and the sentence 'Robots can't relate.' seems unrelated to the preceding sentences.",
|
|
20
20
|
},
|
|
21
21
|
relevance: {
|
|
22
22
|
score: 15,
|
|
23
23
|
rating: "Not Relevant",
|
|
24
24
|
example:
|
|
25
|
-
"
|
|
25
|
+
"Have you heard about food? Very delicious.. Robots can't relate. <IMPROVEMENT>This lack of relation between robots and food highlights a significant aspect of technology, which is its limitation in replicating human experiences, such as savoring delicious food.</IMPROVEMENT>",
|
|
26
26
|
feedback:
|
|
27
|
-
"The essay does not directly address the topic 'Technology'. It
|
|
27
|
+
"The essay does not directly address the topic 'Technology'. It appears to be discussing food and its relation to robots, which is not relevant to the given topic. The essay lacks any mention or discussion about technology.",
|
|
28
28
|
},
|
|
29
29
|
critical_thinking: {
|
|
30
30
|
score: 80,
|
|
31
31
|
example:
|
|
32
|
-
"
|
|
32
|
+
"Have you heard about food? It's a universal language that humans understand, but <IMPROVEMENT>its significance extends beyond just taste, as it can evoke emotions and create cultural connections</IMPROVEMENT>. Very delicious.. <IMPROVEMENT>This subjective experience is uniquely human, as robots, lacking senses and emotions, can't truly relate to the culinary world in the way humans do</IMPROVEMENT>. Robots can't relate.",
|
|
33
33
|
feedback:
|
|
34
|
-
"The essay lacks depth
|
|
34
|
+
"The essay lacks depth of analysis and originality of thought. It does not explore different perspectives or go beyond a superficial statement. The connection between food and robots is not clearly established, and the essay does not demonstrate critical thinking.",
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
char_count:
|
|
38
|
-
word_count:
|
|
37
|
+
char_count: 64,
|
|
38
|
+
word_count: 10,
|
|
39
39
|
overall_score: 63,
|
|
40
40
|
overall_feedback:
|
|
41
|
-
"Evidence: The essay lacks any form of evidence to support its
|
|
41
|
+
"Evidence: The essay lacks any form of evidence to support its claims. There are no specific examples, data, or references to credible sources. The statements made are vague and do not provide any convincing argument. To improve, the author should include relevant and convincing evidence, such as statistics or expert opinions, to substantiate their claims.\n\nCoherence: The essay lacks coherence and logical flow. It appears to be a collection of disconnected sentences. To improve coherence, a clear topic sentence and a logical connection between the ideas are needed. The transition between 'Have you heard about food?' and 'Very delicious..' is abrupt, and the sentence 'Robots can't relate.' seems unrelated to the preceding sentences.\n\nRelevance: The essay does not directly address the topic 'Technology'. It appears to be discussing food and its relation to robots, which is not relevant to the given topic. The essay lacks any mention or discussion about technology.\n\nCritical Thinking: The essay lacks depth of analysis and originality of thought. It does not explore different perspectives or go beyond a superficial statement. The connection between food and robots is not clearly established, and the essay does not demonstrate critical thinking.",
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
],
|
|
@@ -46,49 +46,25 @@ export const sampleData1 = {
|
|
|
46
46
|
{
|
|
47
47
|
model_data: {
|
|
48
48
|
Feedback: [
|
|
49
|
-
"Inserted '
|
|
50
|
-
"Replaced '
|
|
51
|
-
"
|
|
52
|
-
"Inserted ','",
|
|
53
|
-
"Corrected formatting for ',' to '.'",
|
|
54
|
-
"Corrected formatting for 'thank' to 'Thank'",
|
|
49
|
+
"Inserted 'the '",
|
|
50
|
+
"Replaced 'Very' with 'It's very'",
|
|
51
|
+
"Deleted '.'",
|
|
55
52
|
],
|
|
56
53
|
"Grammar Score": 85,
|
|
57
54
|
"Original Speech":
|
|
58
|
-
"
|
|
55
|
+
"Have you heard about food? Very delicious.. Robots can't relate.",
|
|
59
56
|
"Grammatical Correct Version":
|
|
60
|
-
|
|
57
|
+
"Have you heard about the food? It's very delicious. Robots can't relate.",
|
|
61
58
|
"Correction Operations (Optional)": [
|
|
62
|
-
{ word:
|
|
59
|
+
{ word: "the ", length: 4, position: 22, operation: "inserted" },
|
|
63
60
|
{
|
|
64
|
-
length:
|
|
65
|
-
position:
|
|
61
|
+
length: 4,
|
|
62
|
+
position: 28,
|
|
66
63
|
operation: "substituted",
|
|
67
|
-
original_word: "
|
|
68
|
-
replacement_word: '
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
length: 5,
|
|
72
|
-
position: 41,
|
|
73
|
-
operation: "formatting",
|
|
74
|
-
original_word: "argue",
|
|
75
|
-
replacement_word: "Argue",
|
|
76
|
-
},
|
|
77
|
-
{ word: ",", length: 1, position: 65, operation: "inserted" },
|
|
78
|
-
{
|
|
79
|
-
length: 1,
|
|
80
|
-
position: 69,
|
|
81
|
-
operation: "formatting",
|
|
82
|
-
original_word: ",",
|
|
83
|
-
replacement_word: ".",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
length: 5,
|
|
87
|
-
position: 71,
|
|
88
|
-
operation: "formatting",
|
|
89
|
-
original_word: "thank",
|
|
90
|
-
replacement_word: "Thank",
|
|
64
|
+
original_word: "Very",
|
|
65
|
+
replacement_word: "It's very",
|
|
91
66
|
},
|
|
67
|
+
{ word: ".", length: 1, position: 42, operation: "deleted" },
|
|
92
68
|
],
|
|
93
69
|
},
|
|
94
70
|
},
|
|
@@ -435,7 +435,31 @@ export const GrammarHeaderContent = styled.div`
|
|
|
435
435
|
background: #f5f7f7;
|
|
436
436
|
width: 100%;
|
|
437
437
|
margin-bottom: 20px;
|
|
438
|
-
|
|
438
|
+
.grammar_analysis_container {
|
|
439
|
+
line-height: 22px;
|
|
440
|
+
font-size: 16px;
|
|
441
|
+
.issue {
|
|
442
|
+
display: inline-flex;
|
|
443
|
+
padding-right: 4px;
|
|
444
|
+
color: #f95454;
|
|
445
|
+
align-items: center;
|
|
446
|
+
gap: 2px;
|
|
447
|
+
cursor: pointer;
|
|
448
|
+
.number {
|
|
449
|
+
display: inline-flex;
|
|
450
|
+
justify-content: center;
|
|
451
|
+
align-items: center;
|
|
452
|
+
height: 20px;
|
|
453
|
+
border-radius: 100px;
|
|
454
|
+
padding: 0 6px;
|
|
455
|
+
border: 1px solid #f95454;
|
|
456
|
+
background: rgba(249, 84, 84, 0.2);
|
|
457
|
+
font-size: 12px;
|
|
458
|
+
font-weight: 700;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
/* span {
|
|
439
463
|
line-height: 22px;
|
|
440
464
|
font-size: 16px;
|
|
441
465
|
|
|
@@ -459,7 +483,7 @@ export const GrammarHeaderContent = styled.div`
|
|
|
459
483
|
font-weight: 700;
|
|
460
484
|
}
|
|
461
485
|
}
|
|
462
|
-
}
|
|
486
|
+
} */
|
|
463
487
|
`;
|
|
464
488
|
|
|
465
489
|
export const GrammarContent = styled.div`
|
|
@@ -34,7 +34,14 @@ import useApi from "../api";
|
|
|
34
34
|
* @param {boolean} props.editMode
|
|
35
35
|
* @returns {React.ReactNode}
|
|
36
36
|
*/
|
|
37
|
-
const Comment = ({
|
|
37
|
+
const Comment = ({
|
|
38
|
+
editMode = false,
|
|
39
|
+
data,
|
|
40
|
+
testId,
|
|
41
|
+
questionData,
|
|
42
|
+
setData,
|
|
43
|
+
disabledAdd,
|
|
44
|
+
}) => {
|
|
38
45
|
const { affiliateAccount } = useContext(OutletContext);
|
|
39
46
|
const [toggleDelete, setToggleDelete] = useState(false);
|
|
40
47
|
const [showForm, setShowForm] = useState(null);
|
|
@@ -197,6 +204,7 @@ const Comment = ({ editMode = false, data, testId, questionData, setData }) => {
|
|
|
197
204
|
{!showForm && (
|
|
198
205
|
<button
|
|
199
206
|
className="sm-btn"
|
|
207
|
+
disabled={disabledAdd}
|
|
200
208
|
onClick={() => {
|
|
201
209
|
setShowForm("Text");
|
|
202
210
|
}}
|
|
@@ -32,6 +32,8 @@ export const CommentContainer = styled.div`
|
|
|
32
32
|
cursor: pointer;
|
|
33
33
|
&:disabled {
|
|
34
34
|
background: #c6cccc;
|
|
35
|
+
|
|
36
|
+
cursor: not-allowed;
|
|
35
37
|
box-shadow: none;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -125,6 +127,7 @@ export const CommentContentEmpty = styled.div``;
|
|
|
125
127
|
|
|
126
128
|
export const CommentContentForm = styled.div`
|
|
127
129
|
margin-bottom: 10px;
|
|
130
|
+
|
|
128
131
|
> textarea {
|
|
129
132
|
border-radius: 10px;
|
|
130
133
|
border: 1px solid #dfe5e5;
|
|
@@ -35,8 +35,9 @@ import classNames from "classnames";
|
|
|
35
35
|
import FullAnalysis from "../fullAnalysis";
|
|
36
36
|
import useApi from "./api";
|
|
37
37
|
import FullPageLoader from "../../fullPageLoader";
|
|
38
|
-
import { OutletContext } from "../..";
|
|
38
|
+
import { ButtonComponent, OutletContext } from "../..";
|
|
39
39
|
import useReportUtils from "../hooks/useRreportUtils";
|
|
40
|
+
import ErrorHeader from "./components/errorHeader";
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* @param {Object} props
|
|
@@ -67,6 +68,7 @@ const ReportQuestions = ({
|
|
|
67
68
|
(question) => question.value === questionType
|
|
68
69
|
);
|
|
69
70
|
const commentData = data?.answer?.comments;
|
|
71
|
+
const hasAnswer = data?.answer?.data;
|
|
70
72
|
|
|
71
73
|
useEffect(() => {
|
|
72
74
|
if (commentData?.length) setComment(commentData?.[0]);
|
|
@@ -189,11 +191,14 @@ const ReportQuestions = ({
|
|
|
189
191
|
{(accountType === "instructor-personal" ||
|
|
190
192
|
accountType === "instructor-affiliate") && (
|
|
191
193
|
<button
|
|
194
|
+
disabled={!hasAnswer && data}
|
|
192
195
|
onClick={() => {
|
|
193
196
|
setToggleGrade(true);
|
|
194
197
|
}}
|
|
195
198
|
>
|
|
196
|
-
<YellowPen
|
|
199
|
+
<YellowPen
|
|
200
|
+
color={!hasAnswer && data ? "#fff" : undefined}
|
|
201
|
+
/>
|
|
197
202
|
Edit score
|
|
198
203
|
</button>
|
|
199
204
|
)}
|
|
@@ -201,6 +206,7 @@ const ReportQuestions = ({
|
|
|
201
206
|
</>
|
|
202
207
|
)}
|
|
203
208
|
</ScoreHeader>
|
|
209
|
+
{data && !hasAnswer && <ErrorHeader />}
|
|
204
210
|
<QuestionContent>
|
|
205
211
|
{(questionType === "quiz-scripted" ||
|
|
206
212
|
questionType === "quiz-unscripted" ||
|
|
@@ -287,6 +293,7 @@ const ReportQuestions = ({
|
|
|
287
293
|
testId={testId}
|
|
288
294
|
questionData={data}
|
|
289
295
|
setData={setComment}
|
|
296
|
+
disabledAdd={true}
|
|
290
297
|
editMode={
|
|
291
298
|
accountType === "instructor-personal" ||
|
|
292
299
|
accountType === "instructor-affiliate"
|
|
@@ -71,7 +71,13 @@ const DialogueUnscripted = ({ data, aiData, setToggle }) => {
|
|
|
71
71
|
|
|
72
72
|
<QuestionSectionWithAnalysis>
|
|
73
73
|
{analysis?.models?.length > 0 && transcript?.length > 0 && (
|
|
74
|
-
<Response
|
|
74
|
+
<Response
|
|
75
|
+
title=""
|
|
76
|
+
response={
|
|
77
|
+
!selectedResponse?.recording?.url ? undefined : transcript
|
|
78
|
+
}
|
|
79
|
+
isAiWordFlow
|
|
80
|
+
/>
|
|
75
81
|
)}
|
|
76
82
|
<QuestionSectionAction>
|
|
77
83
|
<ResponseAudio
|
|
@@ -38,6 +38,13 @@ export const ScoreHeader = styled.div`
|
|
|
38
38
|
padding-bottom: 15px;
|
|
39
39
|
border-bottom: 1px solid #f5f7f7;
|
|
40
40
|
margin-bottom: 15px;
|
|
41
|
+
button {
|
|
42
|
+
&:disabled {
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
background: #c6cccc;
|
|
45
|
+
color: white;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
41
48
|
`;
|
|
42
49
|
|
|
43
50
|
export const ScoreRight = styled.div`
|