@nualang/nualang-ui-components 0.1.1285 → 0.1.1287
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.
|
@@ -761,7 +761,7 @@ function BotListItem({
|
|
|
761
761
|
display: "flex",
|
|
762
762
|
alignItems: "center",
|
|
763
763
|
gap: "8px",
|
|
764
|
-
children: [bot.botName || "", /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeBotHtmlTooltip, {
|
|
764
|
+
children: [bot.botName || "", isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeBotHtmlTooltip, {
|
|
765
765
|
placement: "right",
|
|
766
766
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
767
767
|
label: t("challenge_mode"),
|
|
@@ -769,6 +769,11 @@ function BotListItem({
|
|
|
769
769
|
variant: "outlined",
|
|
770
770
|
color: "primary"
|
|
771
771
|
})
|
|
772
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
773
|
+
label: t("challenge_mode"),
|
|
774
|
+
size: "small",
|
|
775
|
+
variant: "outlined",
|
|
776
|
+
color: "primary"
|
|
772
777
|
})]
|
|
773
778
|
}) : !isBotChallenge ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
774
779
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
@@ -791,7 +796,7 @@ function BotListItem({
|
|
|
791
796
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
792
797
|
variant: "body1",
|
|
793
798
|
children: bot.botName || ""
|
|
794
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeBotHtmlTooltip, {
|
|
799
|
+
}), isCreator ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ChallengeBotHtmlTooltip, {
|
|
795
800
|
placement: "right",
|
|
796
801
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
797
802
|
label: t("challenge_mode"),
|
|
@@ -799,6 +804,11 @@ function BotListItem({
|
|
|
799
804
|
variant: "outlined",
|
|
800
805
|
color: "primary"
|
|
801
806
|
})
|
|
807
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
808
|
+
label: t("challenge_mode"),
|
|
809
|
+
size: "small",
|
|
810
|
+
variant: "outlined",
|
|
811
|
+
color: "primary"
|
|
802
812
|
})]
|
|
803
813
|
}),
|
|
804
814
|
secondary: isLargeScreen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
@@ -1140,7 +1150,7 @@ function Exercises(props) {
|
|
|
1140
1150
|
}
|
|
1141
1151
|
}, [bots, botsStringified]);
|
|
1142
1152
|
(0, _react.useEffect)(() => {
|
|
1143
|
-
if (!isChallengeModeStudent && !isCreator) {
|
|
1153
|
+
if (!isChallengeModeStudent && !isCreator && !parentClassroom?.isCreator) {
|
|
1144
1154
|
setBotsArray(bots.filter(bot => !bot.isChallengeBot || bot.isChallengeBot === false));
|
|
1145
1155
|
}
|
|
1146
1156
|
}, [bots, isChallengeModeStudent, isCreator]);
|
|
@@ -488,27 +488,19 @@ function ExerciseCellData({
|
|
|
488
488
|
let type = null;
|
|
489
489
|
let color;
|
|
490
490
|
if (exercise === "roleplays" && roleplayId && completions?.length > 0) {
|
|
491
|
-
const
|
|
491
|
+
const roleplayCompletionData = data?.percentComplete["roleplays"].completedCounts.find(c => c.roleplayId === roleplayId);
|
|
492
492
|
icon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
493
|
-
children: `${
|
|
493
|
+
children: `${roleplayCompletionData?.completedCount} / ${roleplayCompletionData?.total}`
|
|
494
494
|
});
|
|
495
|
-
type =
|
|
496
|
-
switch (
|
|
497
|
-
case
|
|
495
|
+
type = roleplayCompletionData?.completedCount > 0 ? roleplayCompletionData?.completedCount === roleplayCompletionData?.total ? "completed" : "partial" : "incompleted";
|
|
496
|
+
switch (type) {
|
|
497
|
+
case "incompleted":
|
|
498
498
|
color = _colors.red[400];
|
|
499
499
|
break;
|
|
500
|
-
case
|
|
501
|
-
case 2:
|
|
502
|
-
color = _colors.orange[400];
|
|
503
|
-
break;
|
|
504
|
-
case 3:
|
|
500
|
+
case "partial":
|
|
505
501
|
color = _colors.yellow[400];
|
|
506
502
|
break;
|
|
507
|
-
case
|
|
508
|
-
case 5:
|
|
509
|
-
color = _colors.lightGreen[400];
|
|
510
|
-
break;
|
|
511
|
-
case 6:
|
|
503
|
+
case "completed":
|
|
512
504
|
color = _colors.green[400];
|
|
513
505
|
break;
|
|
514
506
|
default:
|
package/dist/utils/index.js
CHANGED
|
@@ -229,21 +229,6 @@ const calcTopicCompletions = (topic, completions = [], isSectionHidden, assignme
|
|
|
229
229
|
let totalNumberOfGames = 0;
|
|
230
230
|
let completedBots = 0;
|
|
231
231
|
const roleplays = topic.roleplays.map(roleplay => {
|
|
232
|
-
const {
|
|
233
|
-
isFillInTheBlanksHidden = "false",
|
|
234
|
-
isActItOutHidden = "false",
|
|
235
|
-
isActItOutListeningHidden = "false",
|
|
236
|
-
isActItOutListeningSpeakingHidden = "false",
|
|
237
|
-
isActItOutSpeakingHidden = "false"
|
|
238
|
-
} = roleplay;
|
|
239
|
-
const trueCount = Object.values({
|
|
240
|
-
isFillInTheBlanksHidden,
|
|
241
|
-
isActItOutHidden,
|
|
242
|
-
isActItOutListeningHidden,
|
|
243
|
-
isActItOutListeningSpeakingHidden,
|
|
244
|
-
isActItOutSpeakingHidden
|
|
245
|
-
}).filter(value => value === "true").length;
|
|
246
|
-
const numberOfUnhiddenGames = 6 - trueCount;
|
|
247
232
|
const isUnassignedRoleplay = assignmentExercises ? assignmentExercises && !assignmentExercises.some(e => e.roleplayId === roleplay.roleplayId) : false;
|
|
248
233
|
if (isRoleplaysHidden || roleplay.isRoleplayHidden || isSectionHidden || topic.isTopicHidden || isUnassignedRoleplay) {
|
|
249
234
|
return {
|
|
@@ -251,22 +236,66 @@ const calcTopicCompletions = (topic, completions = [], isSectionHidden, assignme
|
|
|
251
236
|
completedCount: 0
|
|
252
237
|
};
|
|
253
238
|
}
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
239
|
+
const roleplayCompletions = Array.isArray(completions) ? completions.filter(completion => completion.gameId && completion.roleplayId === roleplay.roleplayId) : [];
|
|
240
|
+
let numberOfRoleplayExercises = 0;
|
|
241
|
+
let numberOfCompletedRoleplayExercises = 0;
|
|
242
|
+
|
|
243
|
+
// Define all possible roleplay exercises and their config
|
|
244
|
+
const roleplayExercises = [{
|
|
245
|
+
name: "roleplay-story",
|
|
246
|
+
hiddenKey: null
|
|
247
|
+
}, {
|
|
248
|
+
name: "roleplay-fill-in-the-blanks",
|
|
249
|
+
hiddenKey: "isFillInTheBlanksHidden"
|
|
250
|
+
}, {
|
|
251
|
+
name: "roleplay-act-it-out",
|
|
252
|
+
hiddenKey: "isActItOutHidden"
|
|
253
|
+
}, {
|
|
254
|
+
name: "roleplay-act-it-out-listening",
|
|
255
|
+
hiddenKey: "isActItOutListeningHidden"
|
|
256
|
+
}, {
|
|
257
|
+
name: "roleplay-act-it-out-speaking",
|
|
258
|
+
hiddenKey: "isActItOutSpeakingHidden"
|
|
259
|
+
}, {
|
|
260
|
+
name: "roleplay-act-it-out-listening-speaking",
|
|
261
|
+
hiddenKey: "isActItOutListeningSpeakingHidden"
|
|
262
|
+
}];
|
|
263
|
+
roleplayExercises.forEach(({
|
|
264
|
+
name,
|
|
265
|
+
hiddenKey
|
|
266
|
+
}) => {
|
|
267
|
+
// Check if the exercise is hidden
|
|
268
|
+
if (hiddenKey && roleplay?.[hiddenKey] === "true") {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const isAssigned = !assignmentExercises || assignmentExercises.some(e => e.name === name && e.roleplayId === roleplay.roleplayId);
|
|
272
|
+
if (!isAssigned) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
numberOfRoleplayExercises++;
|
|
276
|
+
totalNumberOfGames++;
|
|
277
|
+
totalExercises++;
|
|
278
|
+
const completedCount = Array.isArray(roleplayCompletions) ? roleplayCompletions.filter(c => c.exercise === name).length : 0;
|
|
279
|
+
if (completedCount > 0) {
|
|
280
|
+
numberOfCompletedRoleplayExercises++;
|
|
281
|
+
completedGames++;
|
|
282
|
+
completedExerciseCount++;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
if (numberOfCompletedRoleplayExercises === numberOfRoleplayExercises) {
|
|
258
286
|
completedRoleplays++;
|
|
259
287
|
}
|
|
260
|
-
completedExerciseCount += uniqueCompletions.length;
|
|
261
|
-
totalExercises += numberOfUnhiddenGames;
|
|
262
288
|
return {
|
|
263
289
|
...roleplay,
|
|
264
|
-
completedCount:
|
|
290
|
+
completedCount: numberOfCompletedRoleplayExercises,
|
|
291
|
+
total: numberOfRoleplayExercises
|
|
265
292
|
};
|
|
266
293
|
});
|
|
267
294
|
const bots = topic.bots.map(bot => {
|
|
268
295
|
const isUnassignedBot = assignmentExercises ? assignmentExercises && !assignmentExercises.some(e => e.botId === bot.botId) : false;
|
|
269
|
-
if (isBotsHidden || bot.isBotHidden ||
|
|
296
|
+
if (isBotsHidden || bot.isBotHidden || bot.isChallengeBot ||
|
|
297
|
+
// Don't count challenge bots until we can identify if they're visible for the particular student
|
|
298
|
+
isSectionHidden || topic.isTopicHidden || isUnassignedBot) {
|
|
270
299
|
return {
|
|
271
300
|
...bot,
|
|
272
301
|
completedCount: 0
|
|
@@ -308,7 +337,11 @@ const calcTopicCompletions = (topic, completions = [], isSectionHidden, assignme
|
|
|
308
337
|
},
|
|
309
338
|
roleplays: {
|
|
310
339
|
completed: completedRoleplays,
|
|
311
|
-
|
|
340
|
+
completedCounts: roleplays.map(roleplay => ({
|
|
341
|
+
roleplayId: roleplay.roleplayId,
|
|
342
|
+
completedCount: roleplay.completedCount,
|
|
343
|
+
total: roleplay.total
|
|
344
|
+
})),
|
|
312
345
|
total: roleplays.length,
|
|
313
346
|
percentage: Math.floor(completedGames / totalNumberOfGames * 100)
|
|
314
347
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nualang/nualang-ui-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1287",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@hookform/resolvers": "^3.6.0",
|
|
21
21
|
"@json2csv/plainjs": "^7.0.1",
|
|
22
22
|
"@nualang/avatars": "2.0.3",
|
|
23
|
-
"@nualang/nualang-api-and-queries": "^1.1.
|
|
23
|
+
"@nualang/nualang-api-and-queries": "^1.1.20",
|
|
24
24
|
"@storybook/theming": "^8.6.12",
|
|
25
25
|
"@stripe/react-stripe-js": "^2.1.1",
|
|
26
26
|
"@stripe/stripe-js": "^1.54.2",
|