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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.7.1430",
3
+ "version": "1.7.1432",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -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
- <span
67
- // This now correctly checks if the word has an operation (i.e., a correction)
68
- className={classNames({ "error-text": word?.operation })}
69
- key={idx}
70
- onClick={() => {
71
- if (!word?.operation) return;
72
- setSelectedWord(word);
73
- setSelectedSection(1);
74
- }}
75
- >
76
- {/* This will only be true for words with a correction (and a position) */}
77
- {word?.feedbackPosition && (
78
- <span>{word?.feedbackPosition}</span>
79
- )}
80
- {word?.text}
81
- </span>
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
- &::after {
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
- > span {
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(100)}
131
+ suggestionValue={formatNumber(data?.suggested_score)}
132
132
  noAi={noAi}
133
133
  setScore={handleScore}
134
134
  defaultScore={formatNumber(intructorScore)}