l-min-components 1.7.1421 → 1.7.1423

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.1421",
3
+ "version": "1.7.1423",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -1,3 +1,4 @@
1
+ import classNames from "classnames";
1
2
  import React from "react";
2
3
  import styled from "styled-components";
3
4
 
@@ -6,36 +7,71 @@ const ClarityItem = ({
6
7
  title = "",
7
8
  message = "",
8
9
  value = "",
10
+ alt,
9
11
  }) => {
10
12
  return (
11
13
  <Container>
12
- {type === "green" ? (
13
- <SpeedIcon />
14
- ) : type === "yellow" ? (
15
- <FluencyIcon />
16
- ) : type === "blue" ? (
17
- <UserIcon />
18
- ) : (
19
- <MicIcon />
14
+ {alt && (
15
+ <AltHeader>
16
+ {type === "pink" ? <PaperIcon /> : <BookIcon />} <h3>{title}</h3>
17
+ </AltHeader>
20
18
  )}
21
- <Content>
22
- <h3>{title}</h3>
23
- <p>{message}</p>
24
- </Content>
25
- <Value className={type} dangerouslySetInnerHTML={{ __html: value }} />
19
+ <Body className={classNames({ "alt-header": alt })}>
20
+ {!alt && (
21
+ <>
22
+ {type === "green" ? (
23
+ <SpeedIcon />
24
+ ) : type === "yellow" ? (
25
+ <FluencyIcon />
26
+ ) : type === "blue" ? (
27
+ <UserIcon />
28
+ ) : (
29
+ <MicIcon />
30
+ )}
31
+ </>
32
+ )}
33
+
34
+ <Content>
35
+ {!alt && <h3>{title}</h3>}
36
+ <p className={classNames({ "alt-header": alt })}>{message}</p>
37
+ </Content>
38
+ {!alt && (
39
+ <Value className={type} dangerouslySetInnerHTML={{ __html: value }} />
40
+ )}
41
+ </Body>
26
42
  </Container>
27
43
  );
28
44
  };
29
45
 
30
46
  const Container = styled.div`
31
- padding: 20px;
32
47
  border-radius: 20px;
33
48
  border: 1px solid #dfe5e5;
34
49
  background: #fff;
35
50
  width: 100%;
51
+ min-height: 120px;
52
+ `;
53
+ export const AltHeader = styled.div`
54
+ padding: 7px 10px;
55
+ display: flex;
56
+ align-items: center;
57
+ width: 100%;
58
+ gap: 10px;
59
+ border-bottom: 1px solid #dfe5e5;
60
+ h3 {
61
+ font-size: 16px;
62
+ font-weight: 600;
63
+ }
64
+ `;
65
+ const Body = styled.div`
36
66
  display: grid;
37
67
  grid-template-columns: 48px 1fr 60px;
38
68
  gap: 10px;
69
+ width: 100%;
70
+ padding: 20px;
71
+ &.alt-header {
72
+ grid-template-columns: 1fr;
73
+ padding-top: 12px;
74
+ }
39
75
  `;
40
76
 
41
77
  const Content = styled.div`
@@ -50,6 +86,12 @@ const Content = styled.div`
50
86
  font-size: 14px;
51
87
  line-height: 24px;
52
88
  max-width: 200px;
89
+ &::first-letter {
90
+ text-transform: capitalize;
91
+ }
92
+ &.alt-header {
93
+ max-width: none;
94
+ }
53
95
  }
54
96
  `;
55
97
 
@@ -84,6 +126,96 @@ const Value = styled.p`
84
126
 
85
127
  export default ClarityItem;
86
128
 
129
+ const BookIcon = () => (
130
+ <svg
131
+ width="31"
132
+ height="31"
133
+ viewBox="0 0 31 31"
134
+ fill="none"
135
+ xmlns="http://www.w3.org/2000/svg"
136
+ >
137
+ <rect
138
+ opacity="0.1"
139
+ y="0.318359"
140
+ width="30.3643"
141
+ height="30.3643"
142
+ rx="15.1822"
143
+ fill="#54B3F9"
144
+ />
145
+ <path
146
+ d="M22.6875 19.0582V10.0057C22.6875 9.10569 21.9525 8.43819 21.06 8.51319H21.015C19.44 8.64819 17.0475 9.45069 15.7125 10.2907L15.585 10.3732C15.3675 10.5082 15.0075 10.5082 14.79 10.3732L14.6025 10.2607C13.2675 9.42819 10.8825 8.63319 9.3075 8.50569C8.415 8.43069 7.6875 9.10569 7.6875 9.99819V19.0582C7.6875 19.7782 8.2725 20.4532 8.9925 20.5432L9.21 20.5732C10.8375 20.7907 13.35 21.6157 14.79 22.4032L14.82 22.4182C15.0225 22.5307 15.345 22.5307 15.54 22.4182C16.98 21.6232 19.5 20.7907 21.135 20.5732L21.3825 20.5432C22.1025 20.4532 22.6875 19.7782 22.6875 19.0582Z"
147
+ stroke="#54B3F9"
148
+ stroke-width="1.2"
149
+ stroke-linecap="round"
150
+ stroke-linejoin="round"
151
+ />
152
+ <path
153
+ d="M15.1875 10.6191V21.8691"
154
+ stroke="#54B3F9"
155
+ stroke-width="1.2"
156
+ stroke-linecap="round"
157
+ stroke-linejoin="round"
158
+ />
159
+ <path
160
+ d="M12 12.8691H10.3125"
161
+ stroke="#54B3F9"
162
+ stroke-width="1.2"
163
+ stroke-linecap="round"
164
+ stroke-linejoin="round"
165
+ />
166
+ <path
167
+ d="M12.5625 15.1191H10.3125"
168
+ stroke="#54B3F9"
169
+ stroke-width="1.2"
170
+ stroke-linecap="round"
171
+ stroke-linejoin="round"
172
+ />
173
+ </svg>
174
+ );
175
+
176
+ const PaperIcon = () => (
177
+ <svg
178
+ width="31"
179
+ height="31"
180
+ viewBox="0 0 31 31"
181
+ fill="none"
182
+ xmlns="http://www.w3.org/2000/svg"
183
+ >
184
+ <rect
185
+ opacity="0.1"
186
+ y="0.318359"
187
+ width="30.3643"
188
+ height="30.3643"
189
+ rx="15.1822"
190
+ fill="#F954D4"
191
+ />
192
+ <path
193
+ d="M22.4326 14.3309L21.6976 17.4659C21.0676 20.1734 19.8226 21.2684 17.4826 21.0434C17.1076 21.0134 16.7026 20.9459 16.2676 20.8409L15.0076 20.5409C11.8801 19.7984 10.9126 18.2534 11.6476 15.1184L12.3826 11.9759C12.5326 11.3384 12.7126 10.7834 12.9376 10.3259C13.8151 8.51086 15.3076 8.02336 17.8126 8.61586L19.0651 8.90836C22.2076 9.64336 23.1676 11.1959 22.4326 14.3309Z"
194
+ stroke="#F954D4"
195
+ stroke-linecap="round"
196
+ stroke-linejoin="round"
197
+ />
198
+ <path
199
+ d="M17.4852 21.0456C17.0202 21.3606 16.4352 21.6231 15.7227 21.8556L14.5377 22.2456C11.5602 23.2056 9.9927 22.4031 9.0252 19.4256L8.0652 16.4631C7.1052 13.4856 7.9002 11.9106 10.8777 10.9506L12.0627 10.5606C12.3702 10.4631 12.6627 10.3806 12.9402 10.3281C12.7152 10.7856 12.5352 11.3406 12.3852 11.9781L11.6502 15.1206C10.9152 18.2556 11.8827 19.8006 15.0102 20.5431L16.2702 20.8431C16.7052 20.9481 17.1102 21.0156 17.4852 21.0456Z"
200
+ stroke="#F954D4"
201
+ stroke-linecap="round"
202
+ stroke-linejoin="round"
203
+ />
204
+ <path
205
+ d="M15.6719 12.9004L19.3094 13.8229"
206
+ stroke="#F954D4"
207
+ stroke-linecap="round"
208
+ stroke-linejoin="round"
209
+ />
210
+ <path
211
+ d="M14.9375 15.8027L17.1125 16.3577"
212
+ stroke="#F954D4"
213
+ stroke-linecap="round"
214
+ stroke-linejoin="round"
215
+ />
216
+ </svg>
217
+ );
218
+
87
219
  const SpeedIcon = () => (
88
220
  <svg
89
221
  width="48"
@@ -26,12 +26,7 @@ const Grammar = ({ Aidata }) => {
26
26
  const originalText = data?.["Original Speech"] || "";
27
27
  const correctText = data?.["Grammatical Correct Version"] || "";
28
28
  const feedbacks = data?.["Feedback"];
29
- const {
30
- grammarFeekbackResult,
31
- grammerCorrectParagraph,
32
- grammarCorrectResult,
33
- renderCorrectedSentence,
34
- } = useReportUtils();
29
+ const { grammarFeekbackResult, renderCorrectedSentence } = useReportUtils();
35
30
 
36
31
  const wordsFeedback = grammarFeekbackResult(
37
32
  originalText,
@@ -40,10 +35,7 @@ const Grammar = ({ Aidata }) => {
40
35
  );
41
36
 
42
37
  const sentenceParts = renderCorrectedSentence(wordsFeedback);
43
- const correctWods = grammarCorrectResult(correctText, feedbackCorrection);
44
- const correctParagraph = correctWods
45
- ? grammerCorrectParagraph(correctWods)
46
- : "";
38
+
47
39
  useEffect(() => {
48
40
  if (wordsFeedback?.length) {
49
41
  const findWord = wordsFeedback?.find((word) => word?.operation);
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from "react";
1
+ import React, { useEffect, useMemo, useState } from "react";
2
2
  import {
3
3
  ClarityLevelSection,
4
4
  ModelComtainer,
@@ -38,6 +38,7 @@ const SpeechAnalysis = ({
38
38
  text: item?.wordText,
39
39
  value: item?.id,
40
40
  isCorrect: item?.isGood,
41
+ color: item?.color,
41
42
  }));
42
43
 
43
44
  const selectedWordValue = wordData?.find((item) => item?.id === selectedWord);
@@ -68,6 +69,28 @@ const SpeechAnalysis = ({
68
69
  (item) => item?.id === selectedSection
69
70
  );
70
71
 
72
+ const colors = useMemo(
73
+ () => ({
74
+ poor: "#F95454",
75
+ excellent: "#30D468",
76
+ fair: "#9747FF",
77
+ // fair2: "#0D5FDB",
78
+ good: "#0D7D96",
79
+ veryGood: "#1A9243",
80
+ pass: "#F39B33",
81
+ okay: "#FEBF10",
82
+ }),
83
+ []
84
+ );
85
+
86
+ const backgroundColors = useMemo(() => {
87
+ const bg = { ...colors };
88
+ for (let x of Object.keys(bg)) {
89
+ bg[x] = bg[x] + 10;
90
+ }
91
+ return bg;
92
+ }, []);
93
+
71
94
  return (
72
95
  <ModelComtainer>
73
96
  <ModelContent>
@@ -109,9 +132,10 @@ const SpeechAnalysis = ({
109
132
  <span>
110
133
  <span
111
134
  key={word?.value}
135
+ style={{ color: word?.color }}
112
136
  className={classNames({
113
137
  selected: selectedWord === word?.value,
114
- correct: word?.isCorrect,
138
+
115
139
  incorrect: !word?.isCorrect,
116
140
  capitalise: word?.value === 1,
117
141
  })}
@@ -141,7 +165,12 @@ const SpeechAnalysis = ({
141
165
  </ul>
142
166
  <SelectedWord>
143
167
  Showing breakdown for:{" "}
144
- <span className="capitalise">{selectedWordValue?.wordText}</span>
168
+ <span
169
+ className="capitalise"
170
+ style={{ color: selectedWordValue?.color }}
171
+ >
172
+ {selectedWordValue?.wordText}
173
+ </span>
145
174
  </SelectedWord>
146
175
  <SpeechAnalysisContent>
147
176
  {selectionSelectionValue?.id === "phoneme" && (
@@ -159,19 +188,33 @@ const SpeechAnalysis = ({
159
188
  </div>
160
189
  <div className="table_row">
161
190
  {selectionSelectionValue?.data?.map((item) => {
191
+ const colorName = item.Grade.toLowerCase()?.replace(
192
+ / ([a-z])/gi,
193
+ (match, p1) => p1.toUpperCase()
194
+ );
162
195
  const isExcellent = item?.Grade === "Excellent";
163
- const isPass = item?.Grade === "Pass";
196
+
164
197
  return (
165
198
  <div className="table_body" key={item?.id}>
166
199
  <p>/{item?.Phoneme}/</p>
167
200
  <p>{item?.Score || 0}%</p>
168
- {isExcellent ? (
169
- <p className="status">Excellent</p>
170
- ) : isPass ? (
171
- <p className="status warning">Pass</p>
172
- ) : (
173
- <p className="status failed">Fail</p>
174
- )}
201
+
202
+ <p
203
+ className="status"
204
+ style={{
205
+ textTransform: "capitalize",
206
+ background: backgroundColors?.[colorName],
207
+ color: colors?.[colorName],
208
+ }}
209
+ >
210
+ {colorName === "veryGood" ? (
211
+ <span style={{ textTransform: "none" }}>
212
+ Very good
213
+ </span>
214
+ ) : (
215
+ colorName
216
+ )}
217
+ </p>
175
218
 
176
219
  {isExcellent ? (
177
220
  <p className="good">
@@ -305,6 +348,18 @@ const SpeechAnalysis = ({
305
348
  type="blue"
306
349
  value={`<span>${selectionSelectionValue?.data?.intonation}%</span>`}
307
350
  />
351
+ <ClarityItem
352
+ title="What we heard"
353
+ message={Aidata?.data?.Hypothesis}
354
+ type="pink"
355
+ alt
356
+ />
357
+ <ClarityItem
358
+ title="Reference"
359
+ message={Aidata?.data?.Reference}
360
+ type="blue"
361
+ alt
362
+ />
308
363
  </ClarityLevelSection>
309
364
  )}
310
365
  {selectionSelectionValue?.id === "standard_assessment" && (