l-min-components 1.7.1431 → 1.7.1433

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.1431",
3
+ "version": "1.7.1433",
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);
@@ -63,24 +60,38 @@ const Grammar = ({ Aidata }) => {
63
60
  <p>Click on the words to see detailed feedback</p>
64
61
  </div>
65
62
  <GrammarHeaderContent>
66
- {wordsFeedback?.map((word, idx) => (
67
- <span
68
- // This now correctly checks if the word has an operation (i.e., a correction)
69
- className={classNames({ "error-text": word?.operation })}
70
- key={idx}
71
- onClick={() => {
72
- if (!word?.operation) return;
73
- setSelectedWord(word);
74
- setSelectedSection(1);
75
- }}
76
- >
77
- {/* This will only be true for words with a correction (and a position) */}
78
- {word?.feedbackPosition && (
79
- <span>{word?.feedbackPosition}</span>
80
- )}
81
- {word?.text}
82
- </span>
83
- ))}
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
+ })}
84
95
  </GrammarHeaderContent>
85
96
  <ul className="no-border ul_tabs">
86
97
  {tabs.map((tab) => (
@@ -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;
@@ -28,6 +28,7 @@ const Response = ({
28
28
  goodFallback = false,
29
29
  }) => {
30
30
  const setupAiWordFlow = () => {
31
+ if (!response) return "";
31
32
  if (isAiWordFlow && typeof response !== "string") {
32
33
  const htmlString = response
33
34
  ?.map((item) => {
@@ -9,6 +9,7 @@ export const ErrorHeaderContainer = styled.div`
9
9
  justify-content: center;
10
10
  gap: 10px;
11
11
  padding: 10px;
12
+ margin-bottom: 15px;
12
13
  p {
13
14
  color: #f95454;
14
15
  text-align: center;
@@ -37,6 +37,7 @@ import useApi from "./api";
37
37
  import FullPageLoader from "../../fullPageLoader";
38
38
  import { 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]);
@@ -201,6 +203,7 @@ const ReportQuestions = ({
201
203
  </>
202
204
  )}
203
205
  </ScoreHeader>
206
+ {data && !hasAnswer && <ErrorHeader />}
204
207
  <QuestionContent>
205
208
  {(questionType === "quiz-scripted" ||
206
209
  questionType === "quiz-unscripted" ||
@@ -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 title="" response={transcript} isAiWordFlow />
74
+ <Response
75
+ title=""
76
+ response={
77
+ !selectedResponse?.recording?.url ? undefined : transcript
78
+ }
79
+ isAiWordFlow
80
+ />
75
81
  )}
76
82
  <QuestionSectionAction>
77
83
  <ResponseAudio
@@ -62,7 +62,7 @@ const MatchPair = ({ data }) => {
62
62
  <MatchPairItem
63
63
  className={classNames({
64
64
  "is-correct": item?.isCorrect && item?.answer,
65
- "is-incorrect": !item?.isCorrect && item?.answer,
65
+ "is-incorrect": !item?.isCorrect,
66
66
  })}
67
67
  >
68
68
  <p>{item?.answer}</p>