l-min-components 1.7.1315 → 1.7.1316
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 +2 -1
- package/src/components/AIAnalysis/assets/arrowDown.jsx +15 -0
- package/src/components/AIAnalysis/assets/arrowLeft.jsx +28 -0
- package/src/components/AIAnalysis/assets/cursorClick.jsx +20 -0
- package/src/components/AIAnalysis/dropdownResult.jsx +60 -0
- package/src/components/AIAnalysis/grammer.jsx +432 -0
- package/src/components/AIAnalysis/index.jsx +78 -0
- package/src/components/AIAnalysis/relevant.jsx +125 -0
- package/src/components/AIAnalysis/responsePlayer.jsx +197 -0
- package/src/components/AIAnalysis/sectionSwitch.jsx +61 -0
- package/src/components/AIAnalysis/speech.jsx +786 -0
- package/src/components/AIAnalysis/wordWheel.jsx +235 -0
- package/src/components/header/getHeaderDetails.js +7 -3
- package/src/components/index.js +1 -0
- package/src/components/instructorAccountSwitcher/index.jsx +30 -23
- package/src/components/useAudioPlayer/index.jsx +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "l-min-components",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1316",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src/assets",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"react-responsive-carousel": "^3.2.23",
|
|
64
64
|
"react-router-dom": "^6.8.2",
|
|
65
65
|
"react-slick": "0.30.2",
|
|
66
|
+
"react-speech-kit": "^3.0.1",
|
|
66
67
|
"react-toastify": "^9.1.3",
|
|
67
68
|
"react-tooltip": "^5.10.1",
|
|
68
69
|
"react-use-websocket": "^4.13.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const ArrowDown = () => (
|
|
2
|
+
<svg
|
|
3
|
+
width="30"
|
|
4
|
+
height="30"
|
|
5
|
+
viewBox="0 0 30 30"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<path
|
|
9
|
+
d="M25.6094 10.5813L15.0031 21.1875L4.39688 10.5813L6.16438 8.8125L15.0031 17.6525L23.8419 8.8125L25.6094 10.5813Z"
|
|
10
|
+
fill="#F5F7F7"
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export default ArrowDown;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const ArrowLeft = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="24"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
9
|
+
<path
|
|
10
|
+
d="M9.57 5.92969L3.5 11.9997L9.57 18.0697"
|
|
11
|
+
stroke="#313333"
|
|
12
|
+
strokeWidth="1.5"
|
|
13
|
+
strokeMiterlimit="10"
|
|
14
|
+
strokeLinecap="round"
|
|
15
|
+
strokeLinejoin="round"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M20.5019 12H3.67188"
|
|
19
|
+
stroke="#313333"
|
|
20
|
+
strokeWidth="1.5"
|
|
21
|
+
strokeMiterlimit="10"
|
|
22
|
+
strokeLinecap="round"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export default ArrowLeft;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const CursorClickIcon = () => {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
width="18"
|
|
7
|
+
height="22"
|
|
8
|
+
viewBox="0 0 18 22"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
d="M15.1295 7.48271C14.676 7.48065 14.2311 7.6056 13.8451 7.84339C13.5649 7.2509 13.061 6.7939 12.444 6.57285C11.8271 6.35179 11.1476 6.38479 10.5549 6.66457V3.26008C10.5549 2.60679 10.2954 1.98027 9.83348 1.51833C9.37154 1.05639 8.74502 0.796875 8.09173 0.796875C7.43845 0.796875 6.81193 1.05639 6.34999 1.51833C5.88805 1.98027 5.62853 2.60679 5.62853 3.26008L5.62853 11.3007L5.01273 10.2362C4.68959 9.66809 4.154 9.25161 3.52378 9.07838C2.89356 8.90515 2.22034 8.98937 1.65222 9.31251C1.0841 9.63565 0.667615 10.1712 0.494388 10.8015C0.32116 11.4317 0.405381 12.1049 0.728522 12.673C3.58759 18.6903 5.48778 21.2063 9.85116 21.2063C11.9036 21.2039 13.8713 20.3876 15.3227 18.9363C16.774 17.4849 17.5903 15.5172 17.5927 13.4648V9.94591C17.5903 9.29334 17.3301 8.66816 16.8686 8.20672C16.4072 7.74528 15.782 7.48502 15.1295 7.48271ZM16.1851 13.4648C16.1828 15.1439 15.5147 16.7536 14.3274 17.941C13.14 19.1283 11.5303 19.7964 9.85116 19.7987C8.07414 19.7987 6.84254 19.3149 5.7165 18.1976C4.59047 17.0804 3.54361 15.3122 1.99531 12.0484L1.96892 11.9956C1.89779 11.8764 1.85174 11.7439 1.83359 11.6063C1.81544 11.4686 1.82557 11.3287 1.86335 11.1951C1.89828 11.0605 1.95988 10.9343 2.04451 10.824C2.12913 10.7137 2.23506 10.6215 2.35599 10.5529C2.59831 10.413 2.88624 10.3751 3.15653 10.4473C3.28992 10.4824 3.41482 10.5441 3.52369 10.6288C3.63255 10.7135 3.72312 10.8193 3.78993 10.94L5.7253 14.2829C5.8042 14.4156 5.92406 14.5191 6.06685 14.5778C6.20964 14.6365 6.36763 14.6472 6.51704 14.6084C6.66656 14.5693 6.79877 14.4814 6.89277 14.3587C6.98677 14.2361 7.0372 14.0856 7.03608 13.931L7.03608 3.26008C7.03608 2.9801 7.1473 2.71159 7.34527 2.51361C7.54325 2.31564 7.81176 2.20442 8.09173 2.20442C8.37171 2.20442 8.64022 2.31564 8.8382 2.51361C9.03617 2.71159 9.14739 2.9801 9.14739 3.26008V9.24214C9.14739 9.42879 9.22154 9.60779 9.35352 9.73978C9.4855 9.87176 9.66451 9.94591 9.85116 9.94591C10.0378 9.94591 10.2168 9.87176 10.3488 9.73978C10.4808 9.60779 10.5549 9.42879 10.5549 9.24214V8.89025C10.5549 8.61027 10.6662 8.34176 10.8641 8.14379C11.0621 7.94581 11.3306 7.83459 11.6106 7.83459C11.8906 7.83459 12.1591 7.94581 12.3571 8.14379C12.555 8.34176 12.6663 8.61027 12.6663 8.89025V9.94591C12.6663 10.1326 12.7404 10.3116 12.8724 10.4435C13.0044 10.5755 13.1834 10.6497 13.37 10.6497C13.5567 10.6497 13.7357 10.5755 13.8677 10.4435C13.9996 10.3116 14.0738 10.1326 14.0738 9.94591C14.0738 9.66593 14.185 9.39742 14.383 9.19944C14.581 9.00147 14.8495 8.89025 15.1295 8.89025C15.4094 8.89025 15.6779 9.00147 15.8759 9.19944C16.0739 9.39742 16.1851 9.66593 16.1851 9.94591V13.4648Z"
|
|
14
|
+
fill="#009999"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default CursorClickIcon;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
|
|
4
|
+
const DropdownResult = ({ label, element }) => {
|
|
5
|
+
const [toggle, setToggle] = useState(false);
|
|
6
|
+
return (
|
|
7
|
+
<Container>
|
|
8
|
+
<Action
|
|
9
|
+
onClick={() => {
|
|
10
|
+
setToggle(!toggle);
|
|
11
|
+
}}
|
|
12
|
+
>
|
|
13
|
+
<p>{label}</p>
|
|
14
|
+
<Icon />
|
|
15
|
+
</Action>
|
|
16
|
+
{toggle && element && <Content>{element}</Content>}
|
|
17
|
+
</Container>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const Container = styled.div`
|
|
22
|
+
border-radius: 10px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
background: #f5f7f7;
|
|
25
|
+
`;
|
|
26
|
+
const Action = styled.div`
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
height: 44px;
|
|
32
|
+
width: 100%;
|
|
33
|
+
background: #e8fafa;
|
|
34
|
+
padding: 0 20px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
p {
|
|
37
|
+
color: #00c2c2;
|
|
38
|
+
font-size: 16px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
const Content = styled.div`
|
|
43
|
+
padding: 20px;
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const Icon = () => (
|
|
47
|
+
<svg
|
|
48
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
49
|
+
width="25"
|
|
50
|
+
height="25"
|
|
51
|
+
viewBox="0 0 25 25"
|
|
52
|
+
fill="none"
|
|
53
|
+
>
|
|
54
|
+
<path
|
|
55
|
+
d="M3.54297 8.58922L12.028 17.0742L20.513 8.58922L19.099 7.17422L12.028 14.2462L4.95697 7.17422L3.54297 8.58922Z"
|
|
56
|
+
fill="#4A4D4D"
|
|
57
|
+
/>
|
|
58
|
+
</svg>
|
|
59
|
+
);
|
|
60
|
+
export default DropdownResult;
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import CursorClickIcon from "./assets/cursorClick";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { IoCloseOutline } from "react-icons/io5";
|
|
5
|
+
import { FaCheck } from "react-icons/fa6";
|
|
6
|
+
import ButtonComponent from "../button";
|
|
7
|
+
|
|
8
|
+
const Grammer = ({ data }) => {
|
|
9
|
+
const [selected, setSelected] = useState(null);
|
|
10
|
+
const [showVersion, setShowVersion] = useState(null);
|
|
11
|
+
|
|
12
|
+
const feedbackCorrection = data["Correction Operations (Optional)"] || [];
|
|
13
|
+
const originalText = data["Original Speech"] || "";
|
|
14
|
+
const correctText = data["Grammatical Correct Version"] || "";
|
|
15
|
+
|
|
16
|
+
const getFeekbackResult = () => {
|
|
17
|
+
const result = [];
|
|
18
|
+
let positionCounter = 1; // Tracks the word position in the text
|
|
19
|
+
let correctionIndex = 0; // Tracks the current correction
|
|
20
|
+
let words = originalText?.split(/\s+/) || []; // Split text into words
|
|
21
|
+
let wordIndex = 0; // Tracks the current word being processed
|
|
22
|
+
|
|
23
|
+
while (wordIndex <= words?.length) {
|
|
24
|
+
const word = words[wordIndex];
|
|
25
|
+
const correction = feedbackCorrection[correctionIndex];
|
|
26
|
+
|
|
27
|
+
if (
|
|
28
|
+
correction &&
|
|
29
|
+
correction?.operation === "substituted" && // Handle substitution
|
|
30
|
+
words
|
|
31
|
+
.slice(
|
|
32
|
+
wordIndex,
|
|
33
|
+
wordIndex + correction?.original_word.split(" ").length
|
|
34
|
+
)
|
|
35
|
+
.join(" ") === correction?.original_word
|
|
36
|
+
) {
|
|
37
|
+
result.push({
|
|
38
|
+
text: correction?.original_word,
|
|
39
|
+
correct: correction?.replacement_word,
|
|
40
|
+
position: positionCounter,
|
|
41
|
+
operation: correction?.operation,
|
|
42
|
+
});
|
|
43
|
+
wordIndex += correction?.original_word.split(" ").length || 0;
|
|
44
|
+
correctionIndex++;
|
|
45
|
+
positionCounter++;
|
|
46
|
+
} else if (correction && correction?.operation === "inserted") {
|
|
47
|
+
result.push({
|
|
48
|
+
text: correction?.word,
|
|
49
|
+
correct: correction?.word, // Insert the new word
|
|
50
|
+
position: positionCounter,
|
|
51
|
+
operation: correction?.operation,
|
|
52
|
+
});
|
|
53
|
+
correctionIndex++;
|
|
54
|
+
positionCounter++;
|
|
55
|
+
} else {
|
|
56
|
+
if (word !== undefined) {
|
|
57
|
+
result.push({ text: word });
|
|
58
|
+
}
|
|
59
|
+
wordIndex++;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return result;
|
|
64
|
+
};
|
|
65
|
+
const getCorrectResult = () => {
|
|
66
|
+
const result = [];
|
|
67
|
+
let correctionIndex = 0;
|
|
68
|
+
let words = correctText.split(/\s+/);
|
|
69
|
+
let wordIndex = 0;
|
|
70
|
+
|
|
71
|
+
while (wordIndex < words.length) {
|
|
72
|
+
const word = words[wordIndex];
|
|
73
|
+
const correction = feedbackCorrection[correctionIndex];
|
|
74
|
+
if (
|
|
75
|
+
correction &&
|
|
76
|
+
correction?.operation === "substituted" &&
|
|
77
|
+
words
|
|
78
|
+
.slice(
|
|
79
|
+
wordIndex,
|
|
80
|
+
wordIndex + correction?.replacement_word.split(" ").length
|
|
81
|
+
)
|
|
82
|
+
.join(" ") === correction?.replacement_word
|
|
83
|
+
) {
|
|
84
|
+
result.push({
|
|
85
|
+
text: correction?.replacement_word,
|
|
86
|
+
highlight: true,
|
|
87
|
+
});
|
|
88
|
+
wordIndex += correction?.replacement_word.split(" ").length;
|
|
89
|
+
correctionIndex++;
|
|
90
|
+
} else if (correction && correction?.operation === "inserted") {
|
|
91
|
+
result.push({
|
|
92
|
+
text: correction?.word,
|
|
93
|
+
highlight: true,
|
|
94
|
+
});
|
|
95
|
+
correctionIndex++;
|
|
96
|
+
} else {
|
|
97
|
+
result.push({ text: word });
|
|
98
|
+
wordIndex++;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return result;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const generateParagraph = (data) => {
|
|
106
|
+
let paragraph = "<p>";
|
|
107
|
+
|
|
108
|
+
data?.forEach((item) => {
|
|
109
|
+
if (item?.highlight) {
|
|
110
|
+
paragraph += `<span>${item?.text}</span> `;
|
|
111
|
+
} else {
|
|
112
|
+
paragraph += `${item?.text} `;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
paragraph = paragraph?.trim() + "</p>";
|
|
117
|
+
|
|
118
|
+
return paragraph;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<Container>
|
|
123
|
+
{showVersion && (
|
|
124
|
+
<WordsModal
|
|
125
|
+
value={showVersion?.value}
|
|
126
|
+
isCorrect={showVersion?.isCorrect}
|
|
127
|
+
onClose={() => {
|
|
128
|
+
setShowVersion(null);
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
)}
|
|
132
|
+
<Header>
|
|
133
|
+
<div className="info">
|
|
134
|
+
<CursorClickIcon />
|
|
135
|
+
<p>Click on the words/sentences highlighted in red to see feedback</p>
|
|
136
|
+
</div>
|
|
137
|
+
<p>
|
|
138
|
+
Points: <span>{data?.["Grammar Score"] || 0}</span>
|
|
139
|
+
</p>
|
|
140
|
+
</Header>
|
|
141
|
+
<Content>
|
|
142
|
+
<div className="text_content">
|
|
143
|
+
{getFeekbackResult()?.map((value, idx) => (
|
|
144
|
+
<span
|
|
145
|
+
key={idx}
|
|
146
|
+
onClick={() => {
|
|
147
|
+
if (value?.position) setSelected(value);
|
|
148
|
+
}}
|
|
149
|
+
className={`${value?.position ? "error" : ""}`}
|
|
150
|
+
>
|
|
151
|
+
{" "}
|
|
152
|
+
{value?.position && <span>{value?.position}</span>} {value?.text}
|
|
153
|
+
</span>
|
|
154
|
+
))}
|
|
155
|
+
</div>
|
|
156
|
+
{selected && (
|
|
157
|
+
<div className="feedback_content">
|
|
158
|
+
<h3>Feedback:</h3>
|
|
159
|
+
<div className="reply">
|
|
160
|
+
{selected?.operation !== "inserted" && (
|
|
161
|
+
<div className="row red">
|
|
162
|
+
<IoCloseOutline color="#F95454" />
|
|
163
|
+
<p className="red">
|
|
164
|
+
<span>{selected?.position}</span>
|
|
165
|
+
{selected?.text}
|
|
166
|
+
</p>
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
|
|
170
|
+
<div className="row">
|
|
171
|
+
<FaCheck color="#29D1D1" />
|
|
172
|
+
<p>{selected?.correct}</p>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
)}
|
|
177
|
+
</Content>
|
|
178
|
+
<ButtonWrapper>
|
|
179
|
+
<span
|
|
180
|
+
onClick={() => {
|
|
181
|
+
setShowVersion({
|
|
182
|
+
value: `<p>${originalText}</p>`,
|
|
183
|
+
});
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<ButtonComponent text="View script" type="secondary" />
|
|
187
|
+
</span>
|
|
188
|
+
<span
|
|
189
|
+
onClick={() => {
|
|
190
|
+
const correctResults = getCorrectResult();
|
|
191
|
+
const value = generateParagraph(correctResults);
|
|
192
|
+
setShowVersion({
|
|
193
|
+
value,
|
|
194
|
+
isCorrect: true,
|
|
195
|
+
});
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
<ButtonComponent text="View corrected version" type="secondary" />
|
|
199
|
+
</span>
|
|
200
|
+
</ButtonWrapper>
|
|
201
|
+
</Container>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default Grammer;
|
|
206
|
+
|
|
207
|
+
const WordsModal = ({ onClose, isCorrect, value }) => {
|
|
208
|
+
return (
|
|
209
|
+
<ModalWrapper isOpen>
|
|
210
|
+
<ModalComntainer>
|
|
211
|
+
<span className="close_btn" onClick={onClose}>
|
|
212
|
+
<IoCloseOutline color="#000" size={24} />
|
|
213
|
+
</span>
|
|
214
|
+
<div className="word_wrapper">
|
|
215
|
+
{isCorrect && (
|
|
216
|
+
<div className="header">
|
|
217
|
+
<h4>Corrected version</h4>
|
|
218
|
+
<p>Introduced words are highlighted in green</p>
|
|
219
|
+
</div>
|
|
220
|
+
)}
|
|
221
|
+
<div
|
|
222
|
+
className="content"
|
|
223
|
+
dangerouslySetInnerHTML={{ __html: value }}
|
|
224
|
+
></div>
|
|
225
|
+
</div>
|
|
226
|
+
</ModalComntainer>
|
|
227
|
+
</ModalWrapper>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const ModalComntainer = styled.div`
|
|
232
|
+
width: 610px;
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
align-items: flex-end;
|
|
236
|
+
gap: 10px;
|
|
237
|
+
.close_btn {
|
|
238
|
+
width: 40px;
|
|
239
|
+
height: 40px;
|
|
240
|
+
display: grid;
|
|
241
|
+
place-items: center;
|
|
242
|
+
background-color: #fff;
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
border-radius: 50%;
|
|
245
|
+
}
|
|
246
|
+
.word_wrapper {
|
|
247
|
+
border-radius: 30px;
|
|
248
|
+
background: #fff;
|
|
249
|
+
width: 100%;
|
|
250
|
+
padding: 48px;
|
|
251
|
+
min-height: 520px;
|
|
252
|
+
display: flex;
|
|
253
|
+
flex-direction: column;
|
|
254
|
+
gap: 20px;
|
|
255
|
+
.header {
|
|
256
|
+
h4 {
|
|
257
|
+
border-radius: 10px 10px 0px 0px;
|
|
258
|
+
background: #00c2c2;
|
|
259
|
+
height: 32px;
|
|
260
|
+
padding: 0 15px;
|
|
261
|
+
display: flex;
|
|
262
|
+
align-items: center;
|
|
263
|
+
color: #fff;
|
|
264
|
+
font-size: 16px;
|
|
265
|
+
font-weight: 400;
|
|
266
|
+
}
|
|
267
|
+
p {
|
|
268
|
+
border-radius: 0px 0px 10px 10px;
|
|
269
|
+
background: #f5f7f7;
|
|
270
|
+
height: 32px;
|
|
271
|
+
padding: 0 15px;
|
|
272
|
+
display: flex;
|
|
273
|
+
align-items: center;
|
|
274
|
+
color: #919494;
|
|
275
|
+
|
|
276
|
+
font-size: 14px;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
.content {
|
|
280
|
+
> p {
|
|
281
|
+
color: #797979;
|
|
282
|
+
font-size: 16px;
|
|
283
|
+
line-height: 34px;
|
|
284
|
+
span {
|
|
285
|
+
color: #00c2c2;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
`;
|
|
291
|
+
|
|
292
|
+
const Container = styled.div`
|
|
293
|
+
width: 100%;
|
|
294
|
+
display: flex;
|
|
295
|
+
flex-direction: column;
|
|
296
|
+
gap: 20px;
|
|
297
|
+
`;
|
|
298
|
+
|
|
299
|
+
const Header = styled.div`
|
|
300
|
+
display: flex;
|
|
301
|
+
align-items: center;
|
|
302
|
+
justify-content: space-between;
|
|
303
|
+
.info {
|
|
304
|
+
display: flex;
|
|
305
|
+
align-items: center;
|
|
306
|
+
gap: 10px;
|
|
307
|
+
p {
|
|
308
|
+
color: #636666;
|
|
309
|
+
font-size: 16px;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
> p {
|
|
313
|
+
border-radius: 10px;
|
|
314
|
+
height: 40px;
|
|
315
|
+
width: 140px;
|
|
316
|
+
background: #e5f9f9;
|
|
317
|
+
display: flex;
|
|
318
|
+
align-items: center;
|
|
319
|
+
gap: 4px;
|
|
320
|
+
justify-content: center;
|
|
321
|
+
color: #636666;
|
|
322
|
+
font-size: 16px;
|
|
323
|
+
span {
|
|
324
|
+
color: #00c2c2;
|
|
325
|
+
font-size: 20px;
|
|
326
|
+
font-weight: 700;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
`;
|
|
330
|
+
|
|
331
|
+
const Content = styled.div`
|
|
332
|
+
border-radius: 20px;
|
|
333
|
+
background: #f9f9f9;
|
|
334
|
+
padding: 20px;
|
|
335
|
+
min-height: 400px;
|
|
336
|
+
display: flex;
|
|
337
|
+
flex-direction: column;
|
|
338
|
+
width: 100%;
|
|
339
|
+
gap: 32px;
|
|
340
|
+
.text_content {
|
|
341
|
+
flex: 1;
|
|
342
|
+
span {
|
|
343
|
+
color: #797979;
|
|
344
|
+
font-size: 16px;
|
|
345
|
+
line-height: 34px;
|
|
346
|
+
&.error {
|
|
347
|
+
display: inline-flex;
|
|
348
|
+
align-items: center;
|
|
349
|
+
color: #f95454;
|
|
350
|
+
cursor: pointer;
|
|
351
|
+
span {
|
|
352
|
+
display: inline-flex;
|
|
353
|
+
border-radius: 22.667px;
|
|
354
|
+
align-items: center;
|
|
355
|
+
background: rgba(249, 84, 84, 0.1);
|
|
356
|
+
height: 16px;
|
|
357
|
+
font-size: 14px;
|
|
358
|
+
line-height: 14px;
|
|
359
|
+
padding: 0 4px;
|
|
360
|
+
color: #f95454;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
.feedback_content {
|
|
366
|
+
width: 100%;
|
|
367
|
+
padding: 15px;
|
|
368
|
+
border-radius: 20px;
|
|
369
|
+
background: #fff;
|
|
370
|
+
h3 {
|
|
371
|
+
color: #00c2c2;
|
|
372
|
+
font-size: 16px;
|
|
373
|
+
margin-bottom: 10px;
|
|
374
|
+
line-height: 11px;
|
|
375
|
+
padding-bottom: 10px;
|
|
376
|
+
border-bottom: 1px solid #dfe5e5;
|
|
377
|
+
}
|
|
378
|
+
.reply {
|
|
379
|
+
.row {
|
|
380
|
+
display: flex;
|
|
381
|
+
align-items: center;
|
|
382
|
+
width: 100%;
|
|
383
|
+
gap: 10px;
|
|
384
|
+
p {
|
|
385
|
+
font-size: 16px;
|
|
386
|
+
color: #0d7d96;
|
|
387
|
+
line-height: 34px;
|
|
388
|
+
&.red {
|
|
389
|
+
display: inline-flex;
|
|
390
|
+
align-items: center;
|
|
391
|
+
color: #f95454;
|
|
392
|
+
cursor: pointer;
|
|
393
|
+
span {
|
|
394
|
+
display: inline-flex;
|
|
395
|
+
border-radius: 22.667px;
|
|
396
|
+
align-items: center;
|
|
397
|
+
background: rgba(249, 84, 84, 0.1);
|
|
398
|
+
height: 16px;
|
|
399
|
+
font-size: 14px;
|
|
400
|
+
line-height: 14px;
|
|
401
|
+
padding: 0 4px;
|
|
402
|
+
color: #f95454;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
`;
|
|
410
|
+
|
|
411
|
+
const ButtonWrapper = styled.div`
|
|
412
|
+
display: flex;
|
|
413
|
+
align-items: center;
|
|
414
|
+
gap: 20px;
|
|
415
|
+
button {
|
|
416
|
+
width: 233px;
|
|
417
|
+
padding: 0;
|
|
418
|
+
height: 44px;
|
|
419
|
+
}
|
|
420
|
+
`;
|
|
421
|
+
const ModalWrapper = styled.div`
|
|
422
|
+
position: fixed;
|
|
423
|
+
top: 0;
|
|
424
|
+
left: 0;
|
|
425
|
+
bottom: 0;
|
|
426
|
+
right: 0;
|
|
427
|
+
display: ${({ isOpen }) => (isOpen ? "flex" : "none")};
|
|
428
|
+
align-items: center;
|
|
429
|
+
justify-content: center;
|
|
430
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
431
|
+
z-index: 9999;
|
|
432
|
+
`;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
|
|
4
|
+
import ArrowLeft from "./assets/arrowLeft";
|
|
5
|
+
import SectionSwitch from "./sectionSwitch";
|
|
6
|
+
import Relevant from "./relevant";
|
|
7
|
+
import Grammer from "./grammer";
|
|
8
|
+
import Speech from "./speech";
|
|
9
|
+
|
|
10
|
+
const AIAnalysis = ({
|
|
11
|
+
title = "Full analysis",
|
|
12
|
+
options = [],
|
|
13
|
+
data,
|
|
14
|
+
onClose,
|
|
15
|
+
}) => {
|
|
16
|
+
const [selected, setSelectied] = useState(options[0]?.value);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Container>
|
|
20
|
+
<h1 onClick={onClose}>
|
|
21
|
+
<ArrowLeft />
|
|
22
|
+
{title}
|
|
23
|
+
</h1>
|
|
24
|
+
<Wrapper>
|
|
25
|
+
<SectionSwitch
|
|
26
|
+
options={options}
|
|
27
|
+
valueSelect={selected}
|
|
28
|
+
onChange={setSelectied}
|
|
29
|
+
/>
|
|
30
|
+
{selected === "relevance" && (
|
|
31
|
+
<Relevant
|
|
32
|
+
data={data?.relevance[0]?.model_data}
|
|
33
|
+
student_text={data?.student_text}
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
{selected === "grammar" && (
|
|
37
|
+
<Grammer data={data?.grammar[0]?.model_data} />
|
|
38
|
+
)}
|
|
39
|
+
{selected === "speech" &&
|
|
40
|
+
data?.speech_analysis[0]?.model_data?.Reference && (
|
|
41
|
+
<Speech
|
|
42
|
+
data={data?.speech_analysis[0]?.model_data}
|
|
43
|
+
audio={data?.audio}
|
|
44
|
+
/>
|
|
45
|
+
)}
|
|
46
|
+
</Wrapper>
|
|
47
|
+
</Container>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const Container = styled.div`
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: 5px;
|
|
55
|
+
width: 100%;
|
|
56
|
+
h1 {
|
|
57
|
+
display: flex;
|
|
58
|
+
gap: 12px;
|
|
59
|
+
align-items: center;
|
|
60
|
+
font-size: 22px;
|
|
61
|
+
width: fit-content;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
font-weight: 700;
|
|
64
|
+
line-height: 40px;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
const Wrapper = styled.div`
|
|
69
|
+
border-radius: 30.913px;
|
|
70
|
+
background: #fff;
|
|
71
|
+
padding: 20px;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 24px;
|
|
75
|
+
width: 100%;
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
export default AIAnalysis;
|