l-min-components 1.7.1430 → 1.7.1432
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/components/reportsComponents/fullAnalysis/components/Grammar.jsx +34 -22
- package/src/components/reportsComponents/fullAnalysis/index.jsx +1 -1
- package/src/components/reportsComponents/fullAnalysis/style.jsx +2 -4
- package/src/components/reportsComponents/reportQuestions/components/modals/gradingModal.jsx +1 -2
- package/src/components/reportsComponents/reportQuestions/index.jsx +1 -1
package/package.json
CHANGED
|
@@ -15,9 +15,6 @@ import { useState } from "react";
|
|
|
15
15
|
import GoodCheck from "../../../../assets/svg/goodCheck";
|
|
16
16
|
import RedX from "../../../../assets/svg/redX";
|
|
17
17
|
import useReportUtils from "../../hooks/useRreportUtils";
|
|
18
|
-
// import WarningGrey from "../../../../assets/svg/warningGrey";
|
|
19
|
-
|
|
20
|
-
// import DOMPurify from "dompurify";
|
|
21
18
|
|
|
22
19
|
const Grammar = ({ Aidata }) => {
|
|
23
20
|
const [selectedSection, setSelectedSection] = useState(1);
|
|
@@ -27,6 +24,7 @@ const Grammar = ({ Aidata }) => {
|
|
|
27
24
|
const feedbackCorrection = (
|
|
28
25
|
data?.["Correction Operations (Optional)"] || []
|
|
29
26
|
)?.filter((item) => ["substituted", "formatting"].includes(item?.operation));
|
|
27
|
+
|
|
30
28
|
const originalText = data?.["Original Speech"] || "";
|
|
31
29
|
const correctText = data?.["Grammatical Correct Version"] || "";
|
|
32
30
|
const feedbacks = data?.["Feedback"];
|
|
@@ -51,7 +49,7 @@ const Grammar = ({ Aidata }) => {
|
|
|
51
49
|
{ label: "Feedback", value: 1, icon: ChatIcon },
|
|
52
50
|
{ label: "View script", value: 2, icon: AIcon },
|
|
53
51
|
{ label: "Corrected version", value: 3, icon: MarsIcon },
|
|
54
|
-
];
|
|
52
|
+
].filter((item) => !(item?.value === 3 && Aidata?.score >= 100));
|
|
55
53
|
|
|
56
54
|
return (
|
|
57
55
|
<ModelComtainer>
|
|
@@ -62,24 +60,38 @@ const Grammar = ({ Aidata }) => {
|
|
|
62
60
|
<p>Click on the words to see detailed feedback</p>
|
|
63
61
|
</div>
|
|
64
62
|
<GrammarHeaderContent>
|
|
65
|
-
{wordsFeedback?.map((word, idx) =>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
63
|
+
{wordsFeedback?.map((word, idx) => {
|
|
64
|
+
const isWord = /^\w+$/.test(word.text);
|
|
65
|
+
const isSymbol = /^[^\w\s]+$/.test(word.text);
|
|
66
|
+
const next = wordsFeedback[idx + 1];
|
|
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
|
+
})}
|
|
83
95
|
</GrammarHeaderContent>
|
|
84
96
|
<ul className="no-border ul_tabs">
|
|
85
97
|
{tabs.map((tab) => (
|
|
@@ -153,7 +153,7 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
|
|
|
153
153
|
className="progress-section"
|
|
154
154
|
>
|
|
155
155
|
<span style={{ color: model?.primaryColor }}>
|
|
156
|
-
{model?.score || 0}%
|
|
156
|
+
{Math.floor(model?.score) || 0}%
|
|
157
157
|
</span>
|
|
158
158
|
<Progress.Line
|
|
159
159
|
percent={model?.score || 0}
|
|
@@ -438,9 +438,7 @@ export const GrammarHeaderContent = styled.div`
|
|
|
438
438
|
span {
|
|
439
439
|
line-height: 22px;
|
|
440
440
|
font-size: 16px;
|
|
441
|
-
|
|
442
|
-
content: " ";
|
|
443
|
-
}
|
|
441
|
+
|
|
444
442
|
&.error-text {
|
|
445
443
|
display: inline-flex;
|
|
446
444
|
padding-right: 4px;
|
|
@@ -448,7 +446,7 @@ export const GrammarHeaderContent = styled.div`
|
|
|
448
446
|
align-items: center;
|
|
449
447
|
gap: 2px;
|
|
450
448
|
cursor: pointer;
|
|
451
|
-
>
|
|
449
|
+
> sup {
|
|
452
450
|
display: inline-flex;
|
|
453
451
|
justify-content: center;
|
|
454
452
|
align-items: center;
|
|
@@ -17,7 +17,6 @@ const GradingModal = ({
|
|
|
17
17
|
const [value, setValue] = useState(defaultScore || "");
|
|
18
18
|
|
|
19
19
|
const numberValue = parseFloat(value || 0);
|
|
20
|
-
const disable = selected === "manually" && (numberValue > 100 || !value);
|
|
21
20
|
|
|
22
21
|
const isNumbter = parseFloat(aiValue) || 0;
|
|
23
22
|
const isSuggestionNumber = parseFloat(suggestionValue) || 0;
|
|
@@ -111,7 +110,7 @@ const GradingModal = ({
|
|
|
111
110
|
</TopSection>
|
|
112
111
|
<ButtonComponent
|
|
113
112
|
text="Save score"
|
|
114
|
-
disabled={disable}
|
|
113
|
+
// disabled={disable}
|
|
115
114
|
onClick={handleSetValue}
|
|
116
115
|
/>
|
|
117
116
|
</Content>
|
|
@@ -128,7 +128,7 @@ const ReportQuestions = ({
|
|
|
128
128
|
{toggleGrade && (
|
|
129
129
|
<GradingModal
|
|
130
130
|
aiValue={formatNumber(data?.ai_score)}
|
|
131
|
-
suggestionValue={formatNumber(
|
|
131
|
+
suggestionValue={formatNumber(data?.suggested_score)}
|
|
132
132
|
noAi={noAi}
|
|
133
133
|
setScore={handleScore}
|
|
134
134
|
defaultScore={formatNumber(intructorScore)}
|