@nualang/nualang-ui-components 0.1.1297 → 0.1.1298
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.
|
@@ -1064,7 +1064,13 @@ function Exercises(props) {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
|
-
const [roleplaysArray, setRoleplaysArray] = useState(
|
|
1067
|
+
const [roleplaysArray, setRoleplaysArray] = useState([]);
|
|
1068
|
+
useEffect(() => {
|
|
1069
|
+
if (roleplays && Array.isArray(roleplays)) {
|
|
1070
|
+
const sortedRoleplays = [...roleplays].sort((a, b) => a.idx - b.idx);
|
|
1071
|
+
setRoleplaysArray(sortedRoleplays);
|
|
1072
|
+
}
|
|
1073
|
+
}, [JSON.stringify(roleplays)]);
|
|
1068
1074
|
const onDropRoleplay = () => {
|
|
1069
1075
|
updateRoleplays(roleplaysArray);
|
|
1070
1076
|
};
|
|
@@ -1078,12 +1084,16 @@ function Exercises(props) {
|
|
|
1078
1084
|
});
|
|
1079
1085
|
setRoleplaysArray(newRoleplays);
|
|
1080
1086
|
}, [roleplaysArray]);
|
|
1081
|
-
const [botsArray, setBotsArray] = useState(
|
|
1082
|
-
|
|
1083
|
-
|
|
1087
|
+
const [botsArray, setBotsArray] = useState([]);
|
|
1088
|
+
useEffect(() => {
|
|
1089
|
+
if (bots && Array.isArray(bots)) {
|
|
1090
|
+
let sortedBots = [...bots].sort((a, b) => a.idx - b.idx);
|
|
1091
|
+
if (!isChallengeModeStudent && !isCreator && !parentClassroom?.isCreator) {
|
|
1092
|
+
sortedBots = sortedBots.filter(bot => !bot.isChallengeBot || bot.isChallengeBot === false);
|
|
1093
|
+
}
|
|
1094
|
+
setBotsArray(sortedBots);
|
|
1084
1095
|
}
|
|
1085
|
-
|
|
1086
|
-
});
|
|
1096
|
+
}, [JSON.stringify(bots), isChallengeModeStudent, isCreator, parentClassroom?.isCreator]);
|
|
1087
1097
|
const onDropBot = () => {
|
|
1088
1098
|
updateBots(botsArray);
|
|
1089
1099
|
};
|
|
@@ -1338,7 +1348,7 @@ function Exercises(props) {
|
|
|
1338
1348
|
})
|
|
1339
1349
|
})]
|
|
1340
1350
|
});
|
|
1341
|
-
if (isMember && hiddenExercisesState.includes("pronunciation")) {
|
|
1351
|
+
if (!parentClassroom?.isCreator && isMember && hiddenExercisesState.includes("pronunciation")) {
|
|
1342
1352
|
return null;
|
|
1343
1353
|
} else if (isLoading) {
|
|
1344
1354
|
return PronunciationExercise;
|
|
@@ -1448,7 +1458,7 @@ function Exercises(props) {
|
|
|
1448
1458
|
})
|
|
1449
1459
|
})]
|
|
1450
1460
|
});
|
|
1451
|
-
if (isMember && hiddenExercisesState.includes("translation")) {
|
|
1461
|
+
if (!parentClassroom?.isCreator && isMember && hiddenExercisesState.includes("translation")) {
|
|
1452
1462
|
return null;
|
|
1453
1463
|
} else if (isLoading) {
|
|
1454
1464
|
return TranslationExercise;
|
|
@@ -1561,7 +1571,7 @@ function Exercises(props) {
|
|
|
1561
1571
|
})
|
|
1562
1572
|
})]
|
|
1563
1573
|
});
|
|
1564
|
-
if (isMember && hiddenExercisesState.includes("listening")) {
|
|
1574
|
+
if (!parentClassroom?.isCreator && isMember && hiddenExercisesState.includes("listening")) {
|
|
1565
1575
|
return null;
|
|
1566
1576
|
} else if (isLoading) {
|
|
1567
1577
|
return ListeningExercise;
|
|
@@ -1577,7 +1587,7 @@ function Exercises(props) {
|
|
|
1577
1587
|
return ListeningExercise;
|
|
1578
1588
|
};
|
|
1579
1589
|
const renderRoleplaysExerciseItem = () => {
|
|
1580
|
-
if (isMember && hiddenExercisesState.includes("roleplays")) return null;
|
|
1590
|
+
if (!parentClassroom?.isCreator && isMember && hiddenExercisesState.includes("roleplays")) return null;
|
|
1581
1591
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
1582
1592
|
children: [/*#__PURE__*/_jsx(ListItem, {
|
|
1583
1593
|
disablePadding: true,
|
|
@@ -1663,6 +1673,7 @@ function Exercises(props) {
|
|
|
1663
1673
|
handleUpdateRoleplay: handleUpdateRoleplay,
|
|
1664
1674
|
classroomId: classroomId,
|
|
1665
1675
|
assignment: assignmentId,
|
|
1676
|
+
parentClassroom: parentClassroom,
|
|
1666
1677
|
...props
|
|
1667
1678
|
}, roleplay.roleplayId)), isCreator ? /*#__PURE__*/_jsxs(ListItemButton, {
|
|
1668
1679
|
"data-cy": "add-roleplay-exercise",
|
|
@@ -1684,7 +1695,7 @@ function Exercises(props) {
|
|
|
1684
1695
|
});
|
|
1685
1696
|
};
|
|
1686
1697
|
const renderChatbotsExerciseItem = () => {
|
|
1687
|
-
if (isMember && hiddenExercisesState.includes("chatbots")) return null;
|
|
1698
|
+
if (!parentClassroom?.isCreator && isMember && hiddenExercisesState.includes("chatbots")) return null;
|
|
1688
1699
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
1689
1700
|
children: [/*#__PURE__*/_jsx(ListItem, {
|
|
1690
1701
|
disablePadding: true,
|