@nualang/nualang-ui-components 0.1.1205 → 0.1.1207

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.
@@ -46,7 +46,9 @@ function CreateAssignment({
46
46
  classrooms,
47
47
  handleInputChange,
48
48
  selectedClassroom,
49
- isClassroomView
49
+ isClassroomView,
50
+ handleSelectExercises,
51
+ handleSelectDiscuss
50
52
  }) {
51
53
  const {
52
54
  classes
@@ -98,7 +100,7 @@ function CreateAssignment({
98
100
  md: 6,
99
101
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
100
102
  className: classes.div,
101
- onClick: () => {},
103
+ onClick: handleSelectExercises,
102
104
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
103
105
  style: {
104
106
  marginBottom: theme.spacing(2)
@@ -128,7 +130,7 @@ function CreateAssignment({
128
130
  md: 6,
129
131
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
130
132
  className: classes.div,
131
- onClick: () => {},
133
+ onClick: handleSelectDiscuss,
132
134
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
133
135
  style: {
134
136
  marginBottom: theme.spacing(2)
@@ -17,7 +17,8 @@ const AssignmentCardsList = ({
17
17
  t = text => text,
18
18
  assignments = [],
19
19
  isCreator,
20
- onRefresh
20
+ onRefresh,
21
+ handleCreateAssignment
21
22
  }) => {
22
23
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
23
24
  mt: 3,
@@ -58,6 +59,7 @@ const AssignmentCardsList = ({
58
59
  textAlign: "center"
59
60
  },
60
61
  startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {}),
62
+ onClick: handleCreateAssignment,
61
63
  children: t("create_assignment")
62
64
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
63
65
  sx: {
@@ -248,24 +248,23 @@ function AnswerResult({
248
248
  };
249
249
  }) : [];
250
250
  const correctWordsArray = exercise === "roleplay" ? nextScriptLine?.text?.split(" ") : currentPhrase && currentPhrase.phrase ? (0, _utils.removeExtraWhiteSpaces)(currentPhrase.phrase).split(" ") : [];
251
+ const handlePronunciationCheck = (word, phraseWordListIndex) => {
252
+ if (exercise === "pronunciation") {
253
+ return checkIsPronunciationCorrect(word.trim(), {
254
+ phrase: phraseWordList[phraseWordListIndex].trim(),
255
+ alternativeVersions: currentPhrase.alternativeVersions ? currentPhrase.alternativeVersions.map(altAns => {
256
+ return altAns ? (0, _utils.removeExtraWhiteSpaces)(altAns).split(" ")[phraseWordListIndex] : "";
257
+ }) : []
258
+ });
259
+ } else {
260
+ return checkIsPronunciationCorrect(word.trim(), phraseWordList[phraseWordListIndex].trim());
261
+ }
262
+ };
251
263
  const transcriptArray = transcript.split(" ").map((word, i) => {
252
- const isWordCorrect = phraseWordList[i] && (exercise === "pronunciation" ? checkIsPronunciationCorrect(word.trim(), {
253
- phrase: phraseWordList[i].trim(),
254
- alternativeVersions: currentPhrase.alternativeVersions ? currentPhrase.alternativeVersions.map(altAns => {
255
- return altAns ? (0, _utils.removeExtraWhiteSpaces)(altAns).split(" ")[i] : "";
256
- }) : []
257
- }) : checkIsPronunciationCorrect(word.trim(), phraseWordList[i].trim()));
258
- const isWordNearCorrect = !isWordCorrect && (phraseWordList[i - 1] && checkIsPronunciationCorrect(word.trim(), {
259
- phrase: phraseWordList[i - 1].trim(),
260
- alternativeVersions: currentPhrase.alternativeVersions ? currentPhrase.alternativeVersions.map(altAns => {
261
- return altAns ? (0, _utils.removeExtraWhiteSpaces)(altAns).split(" ")[i - 1] : "";
262
- }) : []
263
- }) || phraseWordList[i + 1] && checkIsPronunciationCorrect(word.trim(), {
264
- phrase: phraseWordList[i + 1].trim(),
265
- alternativeVersions: currentPhrase.alternativeVersions ? currentPhrase.alternativeVersions.map(altAns => {
266
- return altAns ? (0, _utils.removeExtraWhiteSpaces)(altAns).split(" ")[i + 1] : "";
267
- }) : []
268
- }));
264
+ const isWordCorrect = phraseWordList[i] && handlePronunciationCheck(word, i);
265
+ const isPreviousWordCorrect = !isWordCorrect && phraseWordList[i - 1] && handlePronunciationCheck(word, i - 1);
266
+ const isNextWordCorrect = !isWordCorrect && phraseWordList[i + 1] && handlePronunciationCheck(word, i + 1);
267
+ const isWordNearCorrect = !isWordCorrect && (isPreviousWordCorrect || isNextWordCorrect);
269
268
  const wordIndex = (transcriptWords || []).findIndex(w => w.word === word.trim());
270
269
  let wordPronunciationScore = null;
271
270
  let wordPronunciationScorePercentage = null;
@@ -919,7 +919,8 @@ function Classroom({
919
919
  classroomId: classroomId,
920
920
  memberId: !isCreator && username,
921
921
  username: username,
922
- getCourseSections: getCourseSections
922
+ getCourseSections: getCourseSections,
923
+ handleCreateAssignment: handleCreateAssignment
923
924
  })
924
925
  }, `tab-content-assignments`)
925
926
  }] : []), ...(isVideoChatEnabled && isNualangLiveEnabled && (isMember && isVideoChatEnabledInSettings || isCreator) ? [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1205",
3
+ "version": "0.1.1207",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",