l-min-components 1.7.1417 → 1.7.1418

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.1417",
3
+ "version": "1.7.1418",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- const WarningGrey = () => {
3
+ const WarningGrey = ({ color = "#949999" }) => {
4
4
  return (
5
5
  <svg
6
6
  width="20"
@@ -11,7 +11,7 @@ const WarningGrey = () => {
11
11
  >
12
12
  <path
13
13
  d="M9 5H11V7H9V5ZM9 9H11V15H9V9ZM10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM10 18C5.59 18 2 14.41 2 10C2 5.59 5.59 2 10 2C14.41 2 18 5.59 18 10C18 14.41 14.41 18 10 18Z"
14
- fill="#949999"
14
+ fill={color}
15
15
  />
16
16
  </svg>
17
17
  );
@@ -1,4 +1,4 @@
1
- import React, { useRef, useState } from "react";
1
+ import React, { useState } from "react";
2
2
  import styled from "styled-components";
3
3
  import { useSpeechSynthesis } from "react-speech-kit";
4
4
  import useAudioPlayer from "../useAudioPlayer";
@@ -14,7 +14,7 @@ const ResponsePlayer = ({ text, audio, small, Label = "You say" }) => {
14
14
  streamSrc: audio?.url,
15
15
  src: audio?.uploaded_media_url,
16
16
  });
17
- const audioRef = useRef(null);
17
+
18
18
  const { speak, cancel } = useSpeechSynthesis({
19
19
  onEnd: () => {
20
20
  setIsPlaying(false);
@@ -35,7 +35,7 @@ const Evaluation = ({ Aidata }) => {
35
35
  <p>{`This is the general feedback for the ${selectSection?.label?.toLowerCase()} analysis.`}</p>
36
36
  </EvaluationHeader>
37
37
  <ModelContent>
38
- <ul>
38
+ <ul className="ul_tabs">
39
39
  {optionList?.map((item) => (
40
40
  <li
41
41
  key={item?.value}
@@ -74,7 +74,7 @@ const Grammar = ({ Aidata }) => {
74
74
  </span>
75
75
  ))}
76
76
  </GrammarHeaderContent>
77
- <ul className="no-border">
77
+ <ul className="no-border ul_tabs">
78
78
  {tabs.map((tab) => (
79
79
  <li
80
80
  key={tab.value}
@@ -5,28 +5,53 @@ import classNames from "classnames";
5
5
  import { useState } from "react";
6
6
  import { useSpeechSynthesis } from "react-speech-kit";
7
7
  import useAudioPlayer from "../../../useAudioPlayer";
8
+ import AudioWaveComponent from "../../../useAudioPlayer/audioWave";
8
9
 
9
10
  const PlayButton = ({ type, refernceText, audio }) => {
10
- const { speak, cancel } = useSpeechSynthesis({});
11
+ const [isPlayingSpeak, setIsPlayingSpeak] = useState(false);
12
+ const { speak, cancel } = useSpeechSynthesis({
13
+ onEnd: () => {
14
+ setIsPlayingSpeak(false);
15
+ },
16
+ });
11
17
 
12
- const { play } = useAudioPlayer({
18
+ const { play, isPlaying, isReady } = useAudioPlayer({
13
19
  streamSrc: audio?.url,
14
20
  src: audio?.uploaded_media_url,
15
21
  });
16
22
 
23
+ const showWave = isPlaying || isPlayingSpeak;
24
+
25
+ const disabled = type !== "ai" && !isReady;
26
+
17
27
  return (
18
28
  <Container
29
+ disabled={disabled}
30
+ style={showWave ? { cursor: "not-allowed" } : undefined}
19
31
  className={classNames({ "ai-mode": type === "ai" })}
20
32
  onClick={() => {
21
- if (type === "ai" && refernceText) {
22
- speak({ text: refernceText });
23
- } else {
24
- audio && play();
25
- cancel();
33
+ if (!showWave) {
34
+ if (type === "ai" && refernceText) {
35
+ speak({ text: refernceText });
36
+ setIsPlayingSpeak(true);
37
+ } else {
38
+ audio && play();
39
+ cancel();
40
+ }
26
41
  }
27
42
  }}
28
43
  >
29
- <p>{type === "ai" ? "Correct response" : "You said"}</p>
44
+ {showWave ? (
45
+ <AudioWaveComponent
46
+ playState="play"
47
+ type="extra-small"
48
+ count={16}
49
+ color={type == "ai" ? "#00C2C2" : undefined}
50
+ />
51
+ ) : (
52
+ <p>{type === "ai" ? "Correct response" : "You said"}</p>
53
+ )}
54
+
30
55
  {type === "ai" ? <EarIcon /> : <SpeakerIcon />}
31
56
  </Container>
32
57
  );
@@ -45,6 +70,8 @@ const Container = styled.button`
45
70
  border: none;
46
71
  outline: none;
47
72
  cursor: pointer;
73
+ justify-content: space-between;
74
+
48
75
  p {
49
76
  flex: 1;
50
77
  text-align: left;
@@ -55,4 +82,8 @@ const Container = styled.button`
55
82
  &.ai-mode {
56
83
  background: #00c2c21a;
57
84
  }
85
+ &:disabled {
86
+ opacity: 0.5;
87
+ cursor: not-allowed;
88
+ }
58
89
  `;
@@ -98,7 +98,7 @@ const SpeechAnalysis = ({ Aidata, isPersonal }) => {
98
98
  </span>
99
99
  ))}
100
100
  </div>
101
- <ul className="no-border">
101
+ <ul className="no-border ul_tabs">
102
102
  {tabs?.map((tab) => (
103
103
  <li
104
104
  key={tab?.value}
@@ -4,7 +4,7 @@ import {
4
4
  Container,
5
5
  Content,
6
6
  MainSection,
7
- ProgressCircleSection,
7
+ // ProgressCircleSection,
8
8
  ProgressSidebar,
9
9
  Sidebar,
10
10
  SpeechSideSection,
@@ -18,6 +18,7 @@ import Evaluation from "./components/Evaluation";
18
18
  import SpeechAnalysis from "./components/SpeechAnalysis";
19
19
  import Grammar from "./components/Grammar";
20
20
  import classNames from "classnames";
21
+ import WarningGrey from "../../../assets/svg/warningGrey";
21
22
 
22
23
  const FullAnalysis = ({ data, onClose, accountType }) => {
23
24
  const { setRightLayout, setCenterLayoutStyle } = useContext(OutletContext);
@@ -53,11 +54,17 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
53
54
  };
54
55
  }, []);
55
56
 
56
- const sideModels = data && data?.models?.filter((item) => item?.sideProgress);
57
+ const sideModels =
58
+ data &&
59
+ data?.models?.slice().sort((a, b) => {
60
+ return (
61
+ (b?.sideProgress === true ? 1 : 0) - (a?.sideProgress === true ? 1 : 0)
62
+ );
63
+ });
57
64
 
58
- const firstModel = sideModels && sideModels?.[0];
59
- const secondModel = sideModels && sideModels?.[1];
60
- const thirdModel = sideModels && sideModels?.[2];
65
+ // const firstModel = sideModels && sideModels?.[0];
66
+ // const secondModel = sideModels && sideModels?.[1];
67
+ // const thirdModel = sideModels && sideModels?.[2];
61
68
 
62
69
  const selectedModel =
63
70
  data && data?.models?.find((item) => item?.id === selected);
@@ -80,7 +87,7 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
80
87
  {accountType !== "personal" && (
81
88
  <Sidebar>
82
89
  <ProgressSidebar>
83
- <ProgressCircleSection>
90
+ {/* <ProgressCircleSection>
84
91
  {thirdModel && (
85
92
  <Progress.Circle
86
93
  percent={thirdModel?.score}
@@ -129,27 +136,39 @@ const FullAnalysis = ({ data, onClose, accountType }) => {
129
136
  AI score <br />
130
137
  <span>{data?.AiScore || 0}%</span>
131
138
  </p>
132
- </ProgressCircleSection>
139
+ </ProgressCircleSection> */}
133
140
  <ul>
134
- {data?.models?.map((model) => {
135
- if (model?.id === "logic_evaluation") return null;
141
+ {sideModels?.map((model) => {
136
142
  return (
137
143
  <li key={model?.id}>
138
144
  <p>{`${model?.label} point`}</p>
139
- <div style={{ backgroundColor: model?.bgColor }}>
140
- <span style={{ color: model?.primaryColor }}>
141
- {model?.score || 0}%
142
- </span>
143
- <Progress.Line
144
- percent={model?.score || 0}
145
- strokeWidth={4}
146
- trailWidth={4}
147
- strokeColor={model?.primaryColor}
148
- trailColor={"#fff"}
149
- showInfo={false}
150
- style={{ width: "100%" }}
151
- />
152
- </div>
145
+
146
+ {model?.sideProgress ? (
147
+ <div
148
+ style={{ backgroundColor: model?.bgColor }}
149
+ className="progress-section"
150
+ >
151
+ <span style={{ color: model?.primaryColor }}>
152
+ {model?.score || 0}%
153
+ </span>
154
+ <Progress.Line
155
+ percent={model?.score || 0}
156
+ strokeWidth={8}
157
+ trailWidth={8}
158
+ strokeColor={model?.primaryColor}
159
+ trailColor={"#fff"}
160
+ showInfo={false}
161
+ style={{ width: "100%" }}
162
+ />
163
+ </div>
164
+ ) : (
165
+ <div className="no-score">
166
+ <WarningGrey color="#FEBF10" />
167
+ <p>
168
+ Note: This is currently not assigned a point value.
169
+ </p>
170
+ </div>
171
+ )}
153
172
  </li>
154
173
  );
155
174
  })}
@@ -24,8 +24,7 @@ export const ProgressSidebar = styled.div`
24
24
  width: 100%;
25
25
  border-radius: 25px;
26
26
  background: #fff;
27
- min-height: 150px;
28
- padding: 30px 20px 20px;
27
+ padding: 20px 20px;
29
28
  display: flex;
30
29
  flex-direction: column;
31
30
  width: 100%;
@@ -35,26 +34,60 @@ export const ProgressSidebar = styled.div`
35
34
  display: flex;
36
35
  flex-direction: column;
37
36
  width: 100%;
38
- gap: 20px;
39
37
  list-style: none;
40
38
  li {
39
+ padding-bottom: 15px;
40
+ border-bottom: 1px solid #f5f7f7;
41
+ margin-bottom: 15px;
42
+ &:last-child {
43
+ padding-bottom: 0px;
44
+ border-bottom: none;
45
+ margin-bottom: 0px;
46
+ }
41
47
  > p {
42
48
  color: #636666;
43
49
  font-size: 12px;
44
50
  }
45
- > div {
51
+
52
+ .no-score {
53
+ border-radius: 15px;
54
+ background: #fff9e8;
55
+ display: flex;
56
+ padding: 5px 10px;
57
+ gap: 5px;
58
+ width: 100%;
59
+ margin-top: 5px;
60
+ svg {
61
+ width: 16px;
62
+ height: 16px;
63
+ flex-shrink: 0;
64
+ }
65
+ p {
66
+ color: #636666;
67
+ font-size: 12px;
68
+ }
69
+ }
70
+ .progress-section {
46
71
  margin-top: 5px;
47
- padding: 0 10px;
48
- height: 24px;
72
+ padding: 0 14px;
73
+ height: 37px;
49
74
  border-radius: 100px;
50
75
  display: flex;
51
76
  align-items: center;
77
+ justify-content: space-between;
52
78
  width: 100%;
53
- gap: 16px;
79
+ gap: 12px;
54
80
  span {
55
- font-size: 14px;
81
+ font-size: 20px;
56
82
  font-weight: 700;
57
83
  }
84
+
85
+ .rs-progress-line-outer {
86
+ .rs-progress-line-bg {
87
+ border-radius: 6px;
88
+ overflow: hidden;
89
+ }
90
+ }
58
91
  }
59
92
  }
60
93
  }
@@ -129,7 +162,7 @@ export const ModelContent = styled.div`
129
162
  background: #fff;
130
163
  padding: 20px;
131
164
  min-height: 390px;
132
- ul {
165
+ .ul_tabs {
133
166
  padding-bottom: 20px;
134
167
  border-bottom: 1px solid #dfe5e5;
135
168
  list-style: none;
@@ -11,6 +11,7 @@ const GradingModal = ({
11
11
  noAi,
12
12
  defaultScore,
13
13
  suggestionValue,
14
+ showAIScore,
14
15
  }) => {
15
16
  const [selected, setSelected] = useState("manually");
16
17
  const [value, setValue] = useState(defaultScore || "");
@@ -44,32 +45,37 @@ const GradingModal = ({
44
45
  <TopSection>
45
46
  <h3>Instructor’s grading</h3>
46
47
  <ul className="check_wrapper">
47
- {!noAi && (
48
- <li
49
- onClick={() => {
50
- setSelected("ai");
51
- }}
52
- >
53
- <Radio
54
- checked={selected === "ai"}
55
- defaultBorderColor={"#C6CCCC"}
56
- />
57
- Use AI grade
58
- </li>
59
- )}
60
- {noAi && (
61
- <li
62
- onClick={() => {
63
- setSelected("suggest");
64
- }}
65
- >
66
- <Radio
67
- checked={selected === "suggest"}
68
- defaultBorderColor={"#C6CCCC"}
69
- />
70
- Use system grade
71
- </li>
48
+ {!noAi && !showAIScore ? null : (
49
+ <>
50
+ {!noAi && (
51
+ <li
52
+ onClick={() => {
53
+ setSelected("ai");
54
+ }}
55
+ >
56
+ <Radio
57
+ checked={selected === "ai"}
58
+ defaultBorderColor={"#C6CCCC"}
59
+ />
60
+ Use AI grade
61
+ </li>
62
+ )}
63
+ {noAi && (
64
+ <li
65
+ onClick={() => {
66
+ setSelected("suggest");
67
+ }}
68
+ >
69
+ <Radio
70
+ checked={selected === "suggest"}
71
+ defaultBorderColor={"#C6CCCC"}
72
+ />
73
+ Use system grade
74
+ </li>
75
+ )}
76
+ </>
72
77
  )}
78
+
73
79
  <li
74
80
  onClick={() => {
75
81
  setSelected("manually");
@@ -109,14 +109,14 @@ const ReportQuestions = ({
109
109
  />
110
110
  );
111
111
  }
112
+
113
+ const showAIScore = data?.ai_score_available;
112
114
  const noAi =
113
115
  questionType === "match-pair" ||
114
116
  questionType === "quiz-multiple-choice" ||
115
117
  questionType === "word-play-text" ||
116
118
  questionType === "word-play-multiple-choice";
117
119
 
118
- console.log(data);
119
-
120
120
  return (
121
121
  <Container>
122
122
  {gradeQuestionData?.loading && <FullPageLoader fixed hasBackground />}
@@ -127,6 +127,7 @@ const ReportQuestions = ({
127
127
  noAi={noAi}
128
128
  setScore={handleScore}
129
129
  defaultScore={intructorScore}
130
+ showAIScore={showAIScore}
130
131
  onClose={() => {
131
132
  setToggleGrade(false);
132
133
  }}
@@ -148,14 +149,16 @@ const ReportQuestions = ({
148
149
  </ScoreBadge>
149
150
  ) : (
150
151
  <>
151
- <ScoreBadge
152
- ai
153
- className={classNames({
154
- hidden: noAi,
155
- })}
156
- >
157
- AI score: <span>{parseInt(data?.ai_score || 0)}%</span>
158
- </ScoreBadge>
152
+ {showAIScore && (
153
+ <ScoreBadge
154
+ ai
155
+ className={classNames({
156
+ hidden: noAi,
157
+ })}
158
+ >
159
+ AI score: <span>{parseInt(data?.ai_score || 0)}%</span>
160
+ </ScoreBadge>
161
+ )}
159
162
  <ScoreRight>
160
163
  <></>
161
164
  <ScoreBadge
@@ -0,0 +1,13 @@
1
+ // audioManager.js
2
+ let currentStopFn = null;
3
+
4
+ const AudioManager = {
5
+ stopAll: () => {
6
+ if (currentStopFn) currentStopFn();
7
+ },
8
+ setStopFn: (fn) => {
9
+ currentStopFn = fn;
10
+ },
11
+ };
12
+
13
+ export default AudioManager;