catchup-library-web 2.0.7 → 2.0.9
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/dist/index.d.mts +26 -27
- package/dist/index.d.ts +26 -27
- package/dist/index.js +287 -527
- package/dist/index.mjs +287 -526
- package/package.json +1 -1
- package/src/components/activities/ActivityPreviewByAnswerData.tsx +118 -121
- package/src/components/activities/ActivityPreviewByData.tsx +10 -10
- package/src/components/activities/DropdownActivityContent.tsx +9 -35
- package/src/components/activities/FillInTheBlanksActivityContent.tsx +9 -34
- package/src/components/activities/GroupingActivityContent.tsx +4 -8
- package/src/components/activities/MCMAActivityContent.tsx +8 -8
- package/src/components/activities/MCSAActivityContent.tsx +8 -8
- package/src/components/activities/MatchingActivityContent.tsx +4 -8
- package/src/components/activities/OpenEndedActivityContent.tsx +4 -8
- package/src/components/activities/OrderingActivityContent.tsx +4 -8
- package/src/components/activities/TrueFalseActivityContent.tsx +4 -12
- package/src/components/activities/material-contents/DropdownActivityMaterialContent.tsx +9 -19
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx +9 -24
- package/src/components/activities/material-contents/GroupingActivityMaterialContent.tsx +7 -18
- package/src/components/activities/material-contents/MCMAActivityMaterialContent.tsx +2 -10
- package/src/components/activities/material-contents/MCSAActivityMaterialContent.tsx +2 -10
- package/src/components/activities/material-contents/MatchingActivityMaterialContent.tsx +7 -17
- package/src/components/activities/material-contents/OpenEndedActivityMaterialContent.tsx +2 -21
- package/src/components/activities/material-contents/OrderingActivityMaterialContent.tsx +4 -16
- package/src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx +4 -27
- package/src/properties/ActivityProperties.ts +21 -20
- package/src/utilization/CatchtivityUtilization.ts +55 -147
package/dist/index.js
CHANGED
|
@@ -132,7 +132,6 @@ __export(index_exports, {
|
|
|
132
132
|
calculateLevenshteinDistance: () => calculateLevenshteinDistance,
|
|
133
133
|
calculateStartDateOfWeek: () => calculateStartDateOfWeek,
|
|
134
134
|
checkActivityAnswerState: () => checkActivityAnswerState,
|
|
135
|
-
checkIfAnswerIsEmpty: () => checkIfAnswerIsEmpty,
|
|
136
135
|
constructActivityAnswerMap: () => constructActivityAnswerMap,
|
|
137
136
|
constructActivityAnswerStateList: () => constructActivityAnswerStateList,
|
|
138
137
|
constructActivityData: () => constructActivityData,
|
|
@@ -2350,45 +2349,29 @@ var retrieveDefaultOpenEndedMap = () => {
|
|
|
2350
2349
|
var retrieveDefaultTrueFalseMap = () => {
|
|
2351
2350
|
return { trueList: [], falseList: [] };
|
|
2352
2351
|
};
|
|
2353
|
-
var retrieveCurrentDefaultDataMap = (
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
if (
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
);
|
|
2362
|
-
} else if (
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
);
|
|
2366
|
-
} else if (
|
|
2367
|
-
|
|
2368
|
-
activityData.MCSAMaterialMap
|
|
2369
|
-
);
|
|
2370
|
-
} else if (activityTemplate.type === "MCMA") {
|
|
2371
|
-
defaultDataMap.answerMap = retrieveDefaultMCMAMap(
|
|
2372
|
-
activityData.MCMAMaterialMap
|
|
2373
|
-
);
|
|
2374
|
-
} else if (activityTemplate.type === "MATCHING") {
|
|
2375
|
-
defaultDataMap.answerMap = retrieveDefaultMatchingMap(
|
|
2376
|
-
activityData.matchingMaterialMap
|
|
2377
|
-
);
|
|
2378
|
-
} else if (activityTemplate.type === "GROUPING") {
|
|
2379
|
-
defaultDataMap.answerMap = retrieveDefaultGroupingMap(
|
|
2380
|
-
activityData.groupingMaterialMap
|
|
2381
|
-
);
|
|
2382
|
-
} else if (activityTemplate.type === "FILL_IN_THE_BLANKS") {
|
|
2383
|
-
defaultDataMap.answerMap = retrieveDefaultFillInTheBlanksMap(
|
|
2352
|
+
var retrieveCurrentDefaultDataMap = (activityTemplateType, activityData) => {
|
|
2353
|
+
if (activityTemplateType === "ORDERING") {
|
|
2354
|
+
return retrieveDefaultOrderingDataMap(activityData.orderingMaterialMap);
|
|
2355
|
+
} else if (activityTemplateType === "DROPDOWN") {
|
|
2356
|
+
return retrieveDefaultDropdownMap(activityData.dropdownMaterialMap);
|
|
2357
|
+
} else if (activityTemplateType === "MCSA") {
|
|
2358
|
+
return retrieveDefaultMCSAMap(activityData.MCSAMaterialMap);
|
|
2359
|
+
} else if (activityTemplateType === "MCMA") {
|
|
2360
|
+
return retrieveDefaultMCMAMap(activityData.MCMAMaterialMap);
|
|
2361
|
+
} else if (activityTemplateType === "MATCHING") {
|
|
2362
|
+
return retrieveDefaultMatchingMap(activityData.matchingMaterialMap);
|
|
2363
|
+
} else if (activityTemplateType === "GROUPING") {
|
|
2364
|
+
return retrieveDefaultGroupingMap(activityData.groupingMaterialMap);
|
|
2365
|
+
} else if (activityTemplateType === "FILL_IN_THE_BLANKS") {
|
|
2366
|
+
return retrieveDefaultFillInTheBlanksMap(
|
|
2384
2367
|
activityData.fillInTheBlanksMaterialMap
|
|
2385
2368
|
);
|
|
2386
|
-
} else if (
|
|
2387
|
-
|
|
2388
|
-
} else if (
|
|
2389
|
-
|
|
2369
|
+
} else if (activityTemplateType === "OPEN_ENDED") {
|
|
2370
|
+
return retrieveDefaultOpenEndedMap();
|
|
2371
|
+
} else if (activityTemplateType === "TRUE_FALSE") {
|
|
2372
|
+
return retrieveDefaultTrueFalseMap();
|
|
2390
2373
|
}
|
|
2391
|
-
return
|
|
2374
|
+
return {};
|
|
2392
2375
|
};
|
|
2393
2376
|
var constructActivityAnswerMap = (activityTemplate, activityData) => {
|
|
2394
2377
|
if (activityTemplate.type === "ORDERING") {
|
|
@@ -2420,63 +2403,11 @@ var constructActivityAnswerMap = (activityTemplate, activityData) => {
|
|
|
2420
2403
|
} else if (activityTemplate.type === "TRUE_FALSE") {
|
|
2421
2404
|
activityData.trueFalseMaterialMap = { trueList: [], falseList: [] };
|
|
2422
2405
|
}
|
|
2423
|
-
return retrieveCurrentDefaultDataMap(activityTemplate, activityData);
|
|
2406
|
+
return retrieveCurrentDefaultDataMap(activityTemplate.type, activityData);
|
|
2424
2407
|
};
|
|
2425
2408
|
var ignoreMathematicalExpression = (inputText) => {
|
|
2426
2409
|
return inputText.replaceAll("{", "").replaceAll("}", "").replaceAll("_", "").replaceAll("^", "").replaceAll("\\frac", "").replaceAll("\\text", "").replaceAll("\\sqrt", "");
|
|
2427
2410
|
};
|
|
2428
|
-
var checkIfAnswerIsEmpty = (answer) => {
|
|
2429
|
-
const { data } = answer;
|
|
2430
|
-
if (data && data.length > 0) {
|
|
2431
|
-
const foundAnswer = data[0];
|
|
2432
|
-
const { type, answerMap } = foundAnswer;
|
|
2433
|
-
if (type === "ORDERING") {
|
|
2434
|
-
return false;
|
|
2435
|
-
} else if (type === "DROPDOWN") {
|
|
2436
|
-
for (const key of Object.keys(answerMap)) {
|
|
2437
|
-
if (answerMap[key] !== "DEFAULT_OPTION") {
|
|
2438
|
-
return false;
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2441
|
-
} else if (type === "MCSA") {
|
|
2442
|
-
const key = Object.keys(answerMap)[0];
|
|
2443
|
-
if (answerMap[key] !== "ANSWER_KEY") {
|
|
2444
|
-
return false;
|
|
2445
|
-
}
|
|
2446
|
-
} else if (type === "MCMA") {
|
|
2447
|
-
const key = Object.keys(answerMap)[0];
|
|
2448
|
-
if (answerMap[key].length !== 0) {
|
|
2449
|
-
return false;
|
|
2450
|
-
}
|
|
2451
|
-
} else if (type === "MATCHING") {
|
|
2452
|
-
for (const key of Object.keys(answerMap)) {
|
|
2453
|
-
if (answerMap[key]) {
|
|
2454
|
-
return false;
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
} else if (type === "GROUPING") {
|
|
2458
|
-
for (const key of Object.keys(answerMap)) {
|
|
2459
|
-
if (answerMap[key].length !== 0) {
|
|
2460
|
-
return false;
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
|
-
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
2464
|
-
for (const key of Object.keys(answerMap)) {
|
|
2465
|
-
if (answerMap[key]) {
|
|
2466
|
-
return false;
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
} else if (type === "OPEN_ENDED") {
|
|
2470
|
-
const key = Object.keys(answerMap)[0];
|
|
2471
|
-
if (answerMap[key]) {
|
|
2472
|
-
return false;
|
|
2473
|
-
}
|
|
2474
|
-
} else if (type === "TRUE_FALSE") {
|
|
2475
|
-
return answerMap.trueList.length === 0 && answerMap.falseList.length === 0;
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
2478
|
-
return true;
|
|
2479
|
-
};
|
|
2480
2411
|
var constructActivityAnswerStateList = (answerList, activityList) => {
|
|
2481
2412
|
const stateList = [];
|
|
2482
2413
|
activityList.forEach((activity, index) => {
|
|
@@ -2490,7 +2421,7 @@ var constructActivityAnswerStateList = (answerList, activityList) => {
|
|
|
2490
2421
|
};
|
|
2491
2422
|
var retrieveActivityAnswerFromAnswerList = (answerList, activity) => {
|
|
2492
2423
|
return answerList.find(
|
|
2493
|
-
(answer) => parseFloat(answer.
|
|
2424
|
+
(answer) => parseFloat(answer.activityId) === parseFloat(activity.id)
|
|
2494
2425
|
);
|
|
2495
2426
|
};
|
|
2496
2427
|
var checkActivityAnswerState = (answerList, activity) => {
|
|
@@ -2672,7 +2603,7 @@ var retrieveClockTimeLeft = (type, value, durationType, durationInMinutes, activ
|
|
|
2672
2603
|
var retrieveEachTimeSpentInSeconds = (activityProgressList, activity) => {
|
|
2673
2604
|
if (!activityProgressList || !activity) return 0;
|
|
2674
2605
|
const foundActivityProgress = activityProgressList.find(
|
|
2675
|
-
(activityProgress) => parseFloat(activityProgress.
|
|
2606
|
+
(activityProgress) => parseFloat(activityProgress.activityId) === parseFloat(activity.id)
|
|
2676
2607
|
);
|
|
2677
2608
|
if (foundActivityProgress) {
|
|
2678
2609
|
return foundActivityProgress.timeSpent / 1e3;
|
|
@@ -3042,82 +2973,63 @@ var constructActivityData = (activityTemplateType, contentMap, bodyMap, material
|
|
|
3042
2973
|
return constructedData;
|
|
3043
2974
|
};
|
|
3044
2975
|
var constructAnswerBasedOnData = (data) => {
|
|
3045
|
-
const answer = { data: [] };
|
|
3046
2976
|
if (Object.keys(data).find((dataKey) => dataKey === "orderingMaterialMap")) {
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
JSON.parse(JSON.stringify(data))
|
|
3051
|
-
)
|
|
2977
|
+
return constructActivityAnswerMap(
|
|
2978
|
+
{ type: "ORDERING" },
|
|
2979
|
+
JSON.parse(JSON.stringify(data))
|
|
3052
2980
|
);
|
|
3053
2981
|
}
|
|
3054
2982
|
if (Object.keys(data).find((dataKey) => dataKey === "dropdownMaterialMap")) {
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
JSON.parse(JSON.stringify(data))
|
|
3059
|
-
)
|
|
2983
|
+
return constructActivityAnswerMap(
|
|
2984
|
+
{ type: "DROPDOWN" },
|
|
2985
|
+
JSON.parse(JSON.stringify(data))
|
|
3060
2986
|
);
|
|
3061
2987
|
}
|
|
3062
2988
|
if (Object.keys(data).find((dataKey) => dataKey === "MCSAMaterialMap")) {
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
JSON.parse(JSON.stringify(data))
|
|
3067
|
-
)
|
|
2989
|
+
return constructActivityAnswerMap(
|
|
2990
|
+
{ type: "MCSA" },
|
|
2991
|
+
JSON.parse(JSON.stringify(data))
|
|
3068
2992
|
);
|
|
3069
2993
|
}
|
|
3070
2994
|
if (Object.keys(data).find((dataKey) => dataKey === "MCMAMaterialMap")) {
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
JSON.parse(JSON.stringify(data))
|
|
3075
|
-
)
|
|
2995
|
+
return constructActivityAnswerMap(
|
|
2996
|
+
{ type: "MCMA" },
|
|
2997
|
+
JSON.parse(JSON.stringify(data))
|
|
3076
2998
|
);
|
|
3077
2999
|
}
|
|
3078
3000
|
if (Object.keys(data).find((dataKey) => dataKey === "matchingMaterialMap")) {
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
JSON.parse(JSON.stringify(data))
|
|
3083
|
-
)
|
|
3001
|
+
return constructActivityAnswerMap(
|
|
3002
|
+
{ type: "MATCHING" },
|
|
3003
|
+
JSON.parse(JSON.stringify(data))
|
|
3084
3004
|
);
|
|
3085
3005
|
}
|
|
3086
3006
|
if (Object.keys(data).find((dataKey) => dataKey === "groupingMaterialMap")) {
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
JSON.parse(JSON.stringify(data))
|
|
3091
|
-
)
|
|
3007
|
+
return constructActivityAnswerMap(
|
|
3008
|
+
{ type: "GROUPING" },
|
|
3009
|
+
JSON.parse(JSON.stringify(data))
|
|
3092
3010
|
);
|
|
3093
3011
|
}
|
|
3094
3012
|
if (Object.keys(data).find(
|
|
3095
3013
|
(dataKey) => dataKey === "fillInTheBlanksMaterialMap"
|
|
3096
3014
|
)) {
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
JSON.parse(JSON.stringify(data))
|
|
3101
|
-
)
|
|
3015
|
+
return constructActivityAnswerMap(
|
|
3016
|
+
{ type: "FILL_IN_THE_BLANKS" },
|
|
3017
|
+
JSON.parse(JSON.stringify(data))
|
|
3102
3018
|
);
|
|
3103
3019
|
}
|
|
3104
3020
|
if (Object.keys(data).find((dataKey) => dataKey === "openEndedMaterialMap")) {
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
JSON.parse(JSON.stringify(data))
|
|
3109
|
-
)
|
|
3021
|
+
return constructActivityAnswerMap(
|
|
3022
|
+
{ type: "OPEN_ENDED" },
|
|
3023
|
+
JSON.parse(JSON.stringify(data))
|
|
3110
3024
|
);
|
|
3111
3025
|
}
|
|
3112
3026
|
if (Object.keys(data).find((dataKey) => dataKey === "trueFalseMaterialMap")) {
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
JSON.parse(JSON.stringify(data))
|
|
3117
|
-
)
|
|
3027
|
+
return constructActivityAnswerMap(
|
|
3028
|
+
{ type: "TRUE_FALSE" },
|
|
3029
|
+
JSON.parse(JSON.stringify(data))
|
|
3118
3030
|
);
|
|
3119
3031
|
}
|
|
3120
|
-
return
|
|
3032
|
+
return {};
|
|
3121
3033
|
};
|
|
3122
3034
|
var constructActivityItemListBodyOnly = (bodyMap) => {
|
|
3123
3035
|
const itemList = [];
|
|
@@ -4668,7 +4580,7 @@ var ShowMaterialMediaByContentType_default = ShowMaterialMediaByContentType;
|
|
|
4668
4580
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4669
4581
|
var DropdownActivityMaterialContent = ({
|
|
4670
4582
|
uniqueValue,
|
|
4671
|
-
|
|
4583
|
+
answerMap,
|
|
4672
4584
|
materialMap,
|
|
4673
4585
|
contentMap,
|
|
4674
4586
|
checkCanAnswerQuestion,
|
|
@@ -4679,27 +4591,16 @@ var DropdownActivityMaterialContent = ({
|
|
|
4679
4591
|
const [updated, setUpdated] = (0, import_react16.useState)(false);
|
|
4680
4592
|
(0, import_react15.useEffect)(() => {
|
|
4681
4593
|
if (!showCorrectAnswer) return;
|
|
4682
|
-
|
|
4683
|
-
(answerData) => answerData.type === "DROPDOWN"
|
|
4684
|
-
);
|
|
4685
|
-
if (foundAnswer.answerMap.length === 0) return;
|
|
4686
|
-
if (Object.keys(materialMap).length === 0) return;
|
|
4687
|
-
foundAnswer.answerMap = Object.keys(materialMap).map(
|
|
4594
|
+
answerMap = Object.keys(materialMap).map(
|
|
4688
4595
|
(materialMapKey, index) => Object.keys(materialMap[materialMapKey])[0]
|
|
4689
4596
|
);
|
|
4690
|
-
onChange(
|
|
4597
|
+
onChange(answerMap, 0, Object.keys(materialMap[0])[0]);
|
|
4691
4598
|
setUpdated(true);
|
|
4692
4599
|
}, [showCorrectAnswer]);
|
|
4693
4600
|
(0, import_react15.useEffect)(() => {
|
|
4694
4601
|
if (!updated) return;
|
|
4695
4602
|
setUpdated(false);
|
|
4696
4603
|
}, [updated]);
|
|
4697
|
-
const retrieveAnswerMap = () => {
|
|
4698
|
-
const foundIndex = answer.data.findIndex(
|
|
4699
|
-
(answerData) => answerData.type === "DROPDOWN"
|
|
4700
|
-
);
|
|
4701
|
-
return answer.data[foundIndex].answerMap;
|
|
4702
|
-
};
|
|
4703
4604
|
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
4704
4605
|
if (!isPreview) return null;
|
|
4705
4606
|
if (correctAnswer === learnerAnswer) {
|
|
@@ -4707,7 +4608,6 @@ var DropdownActivityMaterialContent = ({
|
|
|
4707
4608
|
}
|
|
4708
4609
|
return "INCORRECT";
|
|
4709
4610
|
};
|
|
4710
|
-
const answerMap = retrieveAnswerMap();
|
|
4711
4611
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-row flex-wrap items-center", children: [
|
|
4712
4612
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_dropdown_text") }) }),
|
|
4713
4613
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DividerLine_default, {}) }),
|
|
@@ -4749,7 +4649,11 @@ var DropdownActivityMaterialContent = ({
|
|
|
4749
4649
|
value: materialOption
|
|
4750
4650
|
})),
|
|
4751
4651
|
onChange: (e) => {
|
|
4752
|
-
onChange(
|
|
4652
|
+
onChange(
|
|
4653
|
+
answerMap,
|
|
4654
|
+
materialKey,
|
|
4655
|
+
e.target.value
|
|
4656
|
+
);
|
|
4753
4657
|
}
|
|
4754
4658
|
}
|
|
4755
4659
|
) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -4779,7 +4683,7 @@ var DropdownActivityMaterialContent = ({
|
|
|
4779
4683
|
) }, index2),
|
|
4780
4684
|
onClick: (e) => {
|
|
4781
4685
|
onChange(
|
|
4782
|
-
|
|
4686
|
+
answerMap,
|
|
4783
4687
|
materialKey,
|
|
4784
4688
|
e.target.currentSrc
|
|
4785
4689
|
);
|
|
@@ -4823,7 +4727,7 @@ var DropdownActivityMaterialContent_default = DropdownActivityMaterialContent;
|
|
|
4823
4727
|
var import_react17 = require("react");
|
|
4824
4728
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4825
4729
|
var DropdownActivityContent = ({
|
|
4826
|
-
|
|
4730
|
+
answerMap,
|
|
4827
4731
|
data,
|
|
4828
4732
|
canAnswerQuestion,
|
|
4829
4733
|
changeAnswer,
|
|
@@ -4834,35 +4738,15 @@ var DropdownActivityContent = ({
|
|
|
4834
4738
|
const contentMap = parseContentMapFromData(data);
|
|
4835
4739
|
const dropdownBodyMap = parseBodyMapFromData(data, "DROPDOWN");
|
|
4836
4740
|
const dropdownMaterialMap = parseMaterialMapFromData(data, "DROPDOWN");
|
|
4837
|
-
const [currentAnswerMap, setCurrentAnswerMap] = (0, import_react17.useState)(
|
|
4838
|
-
return retrieveCurrentAnswerMap();
|
|
4839
|
-
});
|
|
4840
|
-
function retrieveCurrentAnswerMap() {
|
|
4841
|
-
let foundIndex = answer.data.findIndex(
|
|
4842
|
-
(answerData) => answerData.type === "DROPDOWN"
|
|
4843
|
-
);
|
|
4844
|
-
return answer.data[foundIndex].answerMap;
|
|
4845
|
-
}
|
|
4741
|
+
const [currentAnswerMap, setCurrentAnswerMap] = (0, import_react17.useState)(answerMap);
|
|
4846
4742
|
(0, import_react17.useEffect)(() => {
|
|
4847
|
-
setCurrentAnswerMap(
|
|
4848
|
-
}, [
|
|
4849
|
-
const handleDropdownAnswerOnChange = (
|
|
4743
|
+
setCurrentAnswerMap(answerMap);
|
|
4744
|
+
}, [answerMap]);
|
|
4745
|
+
const handleDropdownAnswerOnChange = (answerMap2, key, value) => {
|
|
4850
4746
|
if (isPreview) return;
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
4855
|
-
answerMap: __spreadProps(__spreadValues({}, item.answerMap), {
|
|
4856
|
-
[key]: value
|
|
4857
|
-
})
|
|
4858
|
-
});
|
|
4859
|
-
}
|
|
4860
|
-
return item;
|
|
4861
|
-
})
|
|
4862
|
-
});
|
|
4863
|
-
const newAnswerMap = __spreadProps(__spreadValues({}, currentAnswerMap), { [key]: value });
|
|
4864
|
-
setCurrentAnswerMap(newAnswerMap);
|
|
4865
|
-
changeAnswer(newAnswer);
|
|
4747
|
+
answerMap2 = __spreadProps(__spreadValues({}, currentAnswerMap), { [key]: value });
|
|
4748
|
+
setCurrentAnswerMap(answerMap2);
|
|
4749
|
+
changeAnswer(answerMap2);
|
|
4866
4750
|
};
|
|
4867
4751
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
|
|
4868
4752
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:w-[60%]"}`, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -4880,7 +4764,7 @@ var DropdownActivityContent = ({
|
|
|
4880
4764
|
DropdownActivityMaterialContent_default,
|
|
4881
4765
|
{
|
|
4882
4766
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
4883
|
-
|
|
4767
|
+
answerMap,
|
|
4884
4768
|
materialMap: dropdownMaterialMap,
|
|
4885
4769
|
contentMap,
|
|
4886
4770
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
@@ -4925,7 +4809,7 @@ var InputWithSpecialExpression_default = InputWithSpecialExpression;
|
|
|
4925
4809
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4926
4810
|
var FillInTheBlanksActivityMaterialContent = ({
|
|
4927
4811
|
uniqueValue,
|
|
4928
|
-
|
|
4812
|
+
answerMap,
|
|
4929
4813
|
optionList,
|
|
4930
4814
|
materialMap,
|
|
4931
4815
|
contentMap,
|
|
@@ -4955,22 +4839,11 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4955
4839
|
}, [optionList]);
|
|
4956
4840
|
(0, import_react18.useEffect)(() => {
|
|
4957
4841
|
if (!showCorrectAnswer) return;
|
|
4958
|
-
|
|
4959
|
-
(answerData) => answerData.type === "FILL_IN_THE_BLANKS"
|
|
4960
|
-
);
|
|
4961
|
-
if (!foundAnswer || foundAnswer.answerMap.length === 0) return;
|
|
4962
|
-
if (Object.keys(materialMap).length === 0) return;
|
|
4963
|
-
foundAnswer.answerMap = Object.keys(materialMap).map(
|
|
4842
|
+
answerMap = Object.keys(materialMap).map(
|
|
4964
4843
|
(materialMapKey) => JSON.parse(materialMap[materialMapKey])[0]
|
|
4965
4844
|
);
|
|
4966
|
-
onChange(
|
|
4967
|
-
}, [showCorrectAnswer
|
|
4968
|
-
const retrieveAnswerMap = () => {
|
|
4969
|
-
const foundIndex = answer.data.findIndex(
|
|
4970
|
-
(answerData) => answerData.type === "FILL_IN_THE_BLANKS"
|
|
4971
|
-
);
|
|
4972
|
-
return answer.data[foundIndex].answerMap;
|
|
4973
|
-
};
|
|
4845
|
+
onChange(answerMap, 0, JSON.parse(materialMap[0])[0]);
|
|
4846
|
+
}, [showCorrectAnswer]);
|
|
4974
4847
|
const checkAnswerState = (correctAnswerList, learnerAnswer) => {
|
|
4975
4848
|
if (!isPreview) return null;
|
|
4976
4849
|
const foundIndex = correctAnswerList.findIndex(
|
|
@@ -5004,7 +4877,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5004
4877
|
};
|
|
5005
4878
|
const handleMouseUp = () => {
|
|
5006
4879
|
if (dropTargetIndex !== null && draggedOption !== null) {
|
|
5007
|
-
onChange(
|
|
4880
|
+
onChange(answerMap, dropTargetIndex, draggedOption);
|
|
5008
4881
|
}
|
|
5009
4882
|
setDraggedOption(null);
|
|
5010
4883
|
setDropTargetIndex(null);
|
|
@@ -5035,7 +4908,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5035
4908
|
};
|
|
5036
4909
|
const handleTouchEnd = () => {
|
|
5037
4910
|
if (dropTargetIndex !== null && draggedOption !== null) {
|
|
5038
|
-
onChange(
|
|
4911
|
+
onChange(answerMap, dropTargetIndex, draggedOption);
|
|
5039
4912
|
}
|
|
5040
4913
|
setDraggedOption(null);
|
|
5041
4914
|
setDropTargetIndex(null);
|
|
@@ -5048,11 +4921,10 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5048
4921
|
};
|
|
5049
4922
|
const handleDropZoneClick = (index) => {
|
|
5050
4923
|
if (selectedOption !== null) {
|
|
5051
|
-
onChange(
|
|
4924
|
+
onChange(answerMap, index, selectedOption);
|
|
5052
4925
|
setSelectedOption(null);
|
|
5053
4926
|
}
|
|
5054
4927
|
};
|
|
5055
|
-
const answerMap = retrieveAnswerMap();
|
|
5056
4928
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5057
4929
|
"div",
|
|
5058
4930
|
{
|
|
@@ -5191,7 +5063,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5191
5063
|
onClick: (e) => {
|
|
5192
5064
|
if (answerMap[materialKey]) {
|
|
5193
5065
|
e.stopPropagation();
|
|
5194
|
-
onChange(
|
|
5066
|
+
onChange(answerMap, materialKey, "");
|
|
5195
5067
|
}
|
|
5196
5068
|
},
|
|
5197
5069
|
children: answerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -5230,7 +5102,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5230
5102
|
className: "flex-1 cursor-pointer",
|
|
5231
5103
|
onClick: (e) => {
|
|
5232
5104
|
e.stopPropagation();
|
|
5233
|
-
onChange(
|
|
5105
|
+
onChange(answerMap, materialKey, "");
|
|
5234
5106
|
},
|
|
5235
5107
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5236
5108
|
ShowMaterialMediaByContentType_default,
|
|
@@ -5266,7 +5138,7 @@ var FillInTheBlanksActivityMaterialContent_default = FillInTheBlanksActivityMate
|
|
|
5266
5138
|
var import_react19 = require("react");
|
|
5267
5139
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5268
5140
|
var FillInTheBlanksActivityContent = ({
|
|
5269
|
-
|
|
5141
|
+
answerMap,
|
|
5270
5142
|
data,
|
|
5271
5143
|
canAnswerQuestion,
|
|
5272
5144
|
changeAnswer,
|
|
@@ -5284,18 +5156,10 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5284
5156
|
"FILL_IN_THE_BLANKS"
|
|
5285
5157
|
);
|
|
5286
5158
|
const fillInTheBlanksIncorrectList = data.fillInTheBlanksIncorrectList ? JSON.parse(data.fillInTheBlanksIncorrectList) : [];
|
|
5287
|
-
const [currentAnswerMap, setCurrentAnswerMap] = (0, import_react19.useState)(
|
|
5288
|
-
return retrieveCurrentAnswerMap();
|
|
5289
|
-
});
|
|
5290
|
-
function retrieveCurrentAnswerMap() {
|
|
5291
|
-
let foundIndex = answer.data.findIndex(
|
|
5292
|
-
(answerData) => answerData.type === "FILL_IN_THE_BLANKS"
|
|
5293
|
-
);
|
|
5294
|
-
return answer.data[foundIndex].answerMap;
|
|
5295
|
-
}
|
|
5159
|
+
const [currentAnswerMap, setCurrentAnswerMap] = (0, import_react19.useState)(answerMap);
|
|
5296
5160
|
(0, import_react19.useEffect)(() => {
|
|
5297
|
-
setCurrentAnswerMap(
|
|
5298
|
-
}, [
|
|
5161
|
+
setCurrentAnswerMap(answerMap);
|
|
5162
|
+
}, [answerMap]);
|
|
5299
5163
|
const constructAnswerOptionList = () => {
|
|
5300
5164
|
const optionList = [];
|
|
5301
5165
|
Object.keys(fillInTheBlanksMaterialMap).forEach((key) => {
|
|
@@ -5314,23 +5178,11 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5314
5178
|
});
|
|
5315
5179
|
return optionList;
|
|
5316
5180
|
};
|
|
5317
|
-
const handleFillInTheBlanksAnswerOnChange = (
|
|
5181
|
+
const handleFillInTheBlanksAnswerOnChange = (answerMap2, key, value) => {
|
|
5318
5182
|
if (isPreview) return;
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
5323
|
-
answerMap: __spreadProps(__spreadValues({}, item.answerMap), {
|
|
5324
|
-
[key]: value
|
|
5325
|
-
})
|
|
5326
|
-
});
|
|
5327
|
-
}
|
|
5328
|
-
return item;
|
|
5329
|
-
})
|
|
5330
|
-
});
|
|
5331
|
-
const newAnswerMap = __spreadProps(__spreadValues({}, currentAnswerMap), { [key]: value });
|
|
5332
|
-
setCurrentAnswerMap(newAnswerMap);
|
|
5333
|
-
changeAnswer(newAnswer);
|
|
5183
|
+
answerMap2 = __spreadProps(__spreadValues({}, currentAnswerMap), { [key]: value });
|
|
5184
|
+
setCurrentAnswerMap(answerMap2);
|
|
5185
|
+
changeAnswer(answerMap2);
|
|
5334
5186
|
};
|
|
5335
5187
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
|
|
5336
5188
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:w-[60%]"}`, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -5348,7 +5200,7 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5348
5200
|
FillInTheBlanksActivityMaterialContent_default,
|
|
5349
5201
|
{
|
|
5350
5202
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
5351
|
-
|
|
5203
|
+
answerMap,
|
|
5352
5204
|
optionList: constructAnswerOptionList(),
|
|
5353
5205
|
materialMap: fillInTheBlanksMaterialMap,
|
|
5354
5206
|
contentMap,
|
|
@@ -5368,7 +5220,7 @@ var import_react_katex5 = require("react-katex");
|
|
|
5368
5220
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5369
5221
|
var GroupingActivityMaterialContent = ({
|
|
5370
5222
|
uniqueValue,
|
|
5371
|
-
|
|
5223
|
+
answerMap,
|
|
5372
5224
|
materialMap,
|
|
5373
5225
|
contentMap,
|
|
5374
5226
|
checkCanAnswerQuestion,
|
|
@@ -5418,10 +5270,8 @@ var GroupingActivityMaterialContent = ({
|
|
|
5418
5270
|
}, [materialMap, isShuffled]);
|
|
5419
5271
|
(0, import_react20.useEffect)(() => {
|
|
5420
5272
|
if (!showCorrectAnswer) return;
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
).answerMap = materialMap;
|
|
5424
|
-
}, [showCorrectAnswer, answer, materialMap]);
|
|
5273
|
+
answerMap = materialMap;
|
|
5274
|
+
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
5425
5275
|
(0, import_react20.useEffect)(() => {
|
|
5426
5276
|
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
5427
5277
|
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
@@ -5466,13 +5316,6 @@ var GroupingActivityMaterialContent = ({
|
|
|
5466
5316
|
};
|
|
5467
5317
|
requestAnimationFrame(animate);
|
|
5468
5318
|
}, [dropTargetKey]);
|
|
5469
|
-
const retrieveAnswerMap = () => {
|
|
5470
|
-
const foundIndex = answer.data.findIndex(
|
|
5471
|
-
(answerData) => answerData.type === "GROUPING"
|
|
5472
|
-
);
|
|
5473
|
-
const answerMap2 = answer.data[foundIndex].answerMap;
|
|
5474
|
-
return answerMap2;
|
|
5475
|
-
};
|
|
5476
5319
|
const retrieveFilteredMaterialList = (answerMap2) => {
|
|
5477
5320
|
const selectedValueList = [];
|
|
5478
5321
|
Object.keys(answerMap2).forEach((key) => {
|
|
@@ -5517,7 +5360,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5517
5360
|
};
|
|
5518
5361
|
const handleMouseUp = () => {
|
|
5519
5362
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
5520
|
-
onChange(
|
|
5363
|
+
onChange(answerMap, dropTargetKey, draggedValue, null);
|
|
5521
5364
|
}
|
|
5522
5365
|
setDraggedValue(null);
|
|
5523
5366
|
setDropTargetKey(null);
|
|
@@ -5549,7 +5392,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5549
5392
|
};
|
|
5550
5393
|
const handleTouchEnd = () => {
|
|
5551
5394
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
5552
|
-
onChange(
|
|
5395
|
+
onChange(answerMap, dropTargetKey, draggedValue, null);
|
|
5553
5396
|
}
|
|
5554
5397
|
setDraggedValue(null);
|
|
5555
5398
|
setDropTargetKey(null);
|
|
@@ -5563,11 +5406,10 @@ var GroupingActivityMaterialContent = ({
|
|
|
5563
5406
|
};
|
|
5564
5407
|
const handleDropZoneClick = (answerMapKey) => {
|
|
5565
5408
|
if (selectedValue !== null) {
|
|
5566
|
-
onChange(
|
|
5409
|
+
onChange(answerMap, answerMapKey, selectedValue, null);
|
|
5567
5410
|
setSelectedValue(null);
|
|
5568
5411
|
}
|
|
5569
5412
|
};
|
|
5570
|
-
const answerMap = retrieveAnswerMap();
|
|
5571
5413
|
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
5572
5414
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
5573
5415
|
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -5715,7 +5557,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5715
5557
|
e.stopPropagation();
|
|
5716
5558
|
if (checkCanAnswerQuestion()) {
|
|
5717
5559
|
onChange(
|
|
5718
|
-
|
|
5560
|
+
answerMap,
|
|
5719
5561
|
answerMapKey,
|
|
5720
5562
|
null,
|
|
5721
5563
|
answerMapIndex
|
|
@@ -5762,7 +5604,7 @@ var GroupingActivityMaterialContent_default = GroupingActivityMaterialContent;
|
|
|
5762
5604
|
// src/components/activities/GroupingActivityContent.tsx
|
|
5763
5605
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5764
5606
|
var GroupingActivityContent = ({
|
|
5765
|
-
|
|
5607
|
+
answerMap,
|
|
5766
5608
|
data,
|
|
5767
5609
|
canAnswerQuestion,
|
|
5768
5610
|
changeAnswer,
|
|
@@ -5772,18 +5614,14 @@ var GroupingActivityContent = ({
|
|
|
5772
5614
|
const contentMap = parseContentMapFromData(data);
|
|
5773
5615
|
const groupingBodyMap = parseBodyMapFromData(data, "GROUPING");
|
|
5774
5616
|
const groupingMaterialMap = parseMaterialMapFromData(data, "GROUPING");
|
|
5775
|
-
const handleGroupingAnswerOnChange = (
|
|
5617
|
+
const handleGroupingAnswerOnChange = (answerMap2, key, value, index) => {
|
|
5776
5618
|
if (isPreview) return;
|
|
5777
|
-
let foundIndex = answer2.data.findIndex(
|
|
5778
|
-
(answerData) => answerData.type === "GROUPING"
|
|
5779
|
-
);
|
|
5780
|
-
const answerMap = answer2.data[foundIndex].answerMap;
|
|
5781
5619
|
if (value) {
|
|
5782
|
-
|
|
5620
|
+
answerMap2[key].push(value);
|
|
5783
5621
|
} else {
|
|
5784
|
-
|
|
5622
|
+
answerMap2[key].splice(index, 1);
|
|
5785
5623
|
}
|
|
5786
|
-
changeAnswer(
|
|
5624
|
+
changeAnswer(answerMap2);
|
|
5787
5625
|
};
|
|
5788
5626
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
5789
5627
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -5798,7 +5636,7 @@ var GroupingActivityContent = ({
|
|
|
5798
5636
|
GroupingActivityMaterialContent_default,
|
|
5799
5637
|
{
|
|
5800
5638
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
5801
|
-
|
|
5639
|
+
answerMap,
|
|
5802
5640
|
materialMap: groupingMaterialMap,
|
|
5803
5641
|
contentMap,
|
|
5804
5642
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
@@ -5817,7 +5655,7 @@ var import_react_katex6 = require("react-katex");
|
|
|
5817
5655
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5818
5656
|
var MatchingActivityMaterialContent = ({
|
|
5819
5657
|
uniqueValue,
|
|
5820
|
-
|
|
5658
|
+
answerMap,
|
|
5821
5659
|
materialMap,
|
|
5822
5660
|
contentMap,
|
|
5823
5661
|
checkCanAnswerQuestion,
|
|
@@ -5865,10 +5703,8 @@ var MatchingActivityMaterialContent = ({
|
|
|
5865
5703
|
}, [materialMap, isShuffled]);
|
|
5866
5704
|
(0, import_react21.useEffect)(() => {
|
|
5867
5705
|
if (!showCorrectAnswer) return;
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
).answerMap = materialMap;
|
|
5871
|
-
}, [showCorrectAnswer, answer, materialMap]);
|
|
5706
|
+
answerMap = materialMap;
|
|
5707
|
+
}, [showCorrectAnswer]);
|
|
5872
5708
|
(0, import_react21.useEffect)(() => {
|
|
5873
5709
|
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
5874
5710
|
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
@@ -5913,12 +5749,6 @@ var MatchingActivityMaterialContent = ({
|
|
|
5913
5749
|
};
|
|
5914
5750
|
requestAnimationFrame(animate);
|
|
5915
5751
|
}, [dropTargetKey]);
|
|
5916
|
-
const retrieveAnswerMap = () => {
|
|
5917
|
-
const foundIndex = answer.data.findIndex(
|
|
5918
|
-
(answerData) => answerData.type === "MATCHING"
|
|
5919
|
-
);
|
|
5920
|
-
return answer.data[foundIndex].answerMap;
|
|
5921
|
-
};
|
|
5922
5752
|
const retrieveFilteredMaterialList = (answerMap2) => {
|
|
5923
5753
|
const selectedValueList = [];
|
|
5924
5754
|
Object.keys(answerMap2).forEach((key) => {
|
|
@@ -5957,7 +5787,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5957
5787
|
};
|
|
5958
5788
|
const handleMouseUp = () => {
|
|
5959
5789
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
5960
|
-
onChange(
|
|
5790
|
+
onChange(answerMap, dropTargetKey, draggedValue);
|
|
5961
5791
|
}
|
|
5962
5792
|
setDraggedValue(null);
|
|
5963
5793
|
setDropTargetKey(null);
|
|
@@ -5989,7 +5819,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5989
5819
|
};
|
|
5990
5820
|
const handleTouchEnd = () => {
|
|
5991
5821
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
5992
|
-
onChange(
|
|
5822
|
+
onChange(answerMap, dropTargetKey, draggedValue);
|
|
5993
5823
|
}
|
|
5994
5824
|
setDraggedValue(null);
|
|
5995
5825
|
setDropTargetKey(null);
|
|
@@ -6003,11 +5833,10 @@ var MatchingActivityMaterialContent = ({
|
|
|
6003
5833
|
};
|
|
6004
5834
|
const handleDropZoneClick = (answerMapKey) => {
|
|
6005
5835
|
if (selectedValue !== null) {
|
|
6006
|
-
onChange(
|
|
5836
|
+
onChange(answerMap, answerMapKey, selectedValue);
|
|
6007
5837
|
setSelectedValue(null);
|
|
6008
5838
|
}
|
|
6009
5839
|
};
|
|
6010
|
-
const answerMap = retrieveAnswerMap();
|
|
6011
5840
|
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
6012
5841
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
6013
5842
|
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -6154,7 +5983,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
6154
5983
|
onClick: (e) => {
|
|
6155
5984
|
e.stopPropagation();
|
|
6156
5985
|
if (checkCanAnswerQuestion() && answerMap[answerMapKey]) {
|
|
6157
|
-
onChange(
|
|
5986
|
+
onChange(answerMap, answerMapKey, null);
|
|
6158
5987
|
setSelectedValue(null);
|
|
6159
5988
|
}
|
|
6160
5989
|
},
|
|
@@ -6189,7 +6018,7 @@ var MatchingActivityMaterialContent_default = MatchingActivityMaterialContent;
|
|
|
6189
6018
|
// src/components/activities/MatchingActivityContent.tsx
|
|
6190
6019
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6191
6020
|
var MatchingActivityContent = ({
|
|
6192
|
-
|
|
6021
|
+
answerMap,
|
|
6193
6022
|
data,
|
|
6194
6023
|
canAnswerQuestion,
|
|
6195
6024
|
changeAnswer,
|
|
@@ -6199,14 +6028,10 @@ var MatchingActivityContent = ({
|
|
|
6199
6028
|
const contentMap = parseContentMapFromData(data);
|
|
6200
6029
|
const matchingBodyMap = parseBodyMapFromData(data, "MATCHING");
|
|
6201
6030
|
const matchingMaterialMap = parseMaterialMapFromData(data, "MATCHING");
|
|
6202
|
-
const handleMatchingAnswerOnChange = (
|
|
6031
|
+
const handleMatchingAnswerOnChange = (answerMap2, key, value) => {
|
|
6203
6032
|
if (isPreview) return;
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
);
|
|
6207
|
-
const answerMap = answer2.data[foundIndex].answerMap;
|
|
6208
|
-
answerMap[key] = value;
|
|
6209
|
-
changeAnswer(answer2);
|
|
6033
|
+
answerMap2[key] = value;
|
|
6034
|
+
changeAnswer(answerMap2);
|
|
6210
6035
|
};
|
|
6211
6036
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
6212
6037
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
@@ -6221,7 +6046,7 @@ var MatchingActivityContent = ({
|
|
|
6221
6046
|
MatchingActivityMaterialContent_default,
|
|
6222
6047
|
{
|
|
6223
6048
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
6224
|
-
|
|
6049
|
+
answerMap,
|
|
6225
6050
|
materialMap: matchingMaterialMap,
|
|
6226
6051
|
contentMap,
|
|
6227
6052
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
@@ -6239,19 +6064,13 @@ var import_react_katex7 = require("react-katex");
|
|
|
6239
6064
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6240
6065
|
var MCMAActivityMaterialContent = ({
|
|
6241
6066
|
uniqueValue,
|
|
6242
|
-
|
|
6067
|
+
answerMap,
|
|
6243
6068
|
materialMap,
|
|
6244
6069
|
contentMap,
|
|
6245
6070
|
checkCanAnswerQuestion,
|
|
6246
6071
|
onChange,
|
|
6247
6072
|
isPreview
|
|
6248
6073
|
}) => {
|
|
6249
|
-
const retrieveAnswerMap = () => {
|
|
6250
|
-
const foundIndex = answer.data.findIndex(
|
|
6251
|
-
(answerData) => answerData.type === "MCMA"
|
|
6252
|
-
);
|
|
6253
|
-
return answer.data[foundIndex].answerMap;
|
|
6254
|
-
};
|
|
6255
6074
|
const retrieveCorrectAnswerList = () => {
|
|
6256
6075
|
return JSON.parse(Object.keys(materialMap)[0]);
|
|
6257
6076
|
};
|
|
@@ -6266,7 +6085,6 @@ var MCMAActivityMaterialContent = ({
|
|
|
6266
6085
|
}
|
|
6267
6086
|
return "INCORRECT";
|
|
6268
6087
|
};
|
|
6269
|
-
const answerMap = retrieveAnswerMap();
|
|
6270
6088
|
const correctAnswerList = retrieveCorrectAnswerList();
|
|
6271
6089
|
return Object.keys(materialMap).map((materialKey, index) => {
|
|
6272
6090
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-row items-center my-1", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex-1 flex flex-col justify-center border-catchup-lighter-gray rounded-catchup-xlarge px-5 md:px-0", children: [
|
|
@@ -6290,7 +6108,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6290
6108
|
{
|
|
6291
6109
|
className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 gap-x-2 ${learnerAnswerState === "EMPTY" && foundIndex !== -1 || learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge p-2" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge p-2" : ""}`,
|
|
6292
6110
|
onClick: () => {
|
|
6293
|
-
onChange(
|
|
6111
|
+
onChange(answerMap, materialKey, materialSubKey);
|
|
6294
6112
|
},
|
|
6295
6113
|
children: [
|
|
6296
6114
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6344,7 +6162,7 @@ var MCMAActivityMaterialContent_default = MCMAActivityMaterialContent;
|
|
|
6344
6162
|
// src/components/activities/MCMAActivityContent.tsx
|
|
6345
6163
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6346
6164
|
var MCMAActivityContent = ({
|
|
6347
|
-
|
|
6165
|
+
answerMap,
|
|
6348
6166
|
data,
|
|
6349
6167
|
canAnswerQuestion,
|
|
6350
6168
|
changeAnswer,
|
|
@@ -6354,21 +6172,17 @@ var MCMAActivityContent = ({
|
|
|
6354
6172
|
const contentMap = parseContentMapFromData(data);
|
|
6355
6173
|
const MCMABodyMap = parseBodyMapFromData(data, "MCMA");
|
|
6356
6174
|
const MCMAMaterialMap = parseMaterialMapFromData(data, "MCMA");
|
|
6357
|
-
const handleMCMAAnswerOnChange = (
|
|
6175
|
+
const handleMCMAAnswerOnChange = (answerMap2, key, value) => {
|
|
6358
6176
|
if (isPreview) return;
|
|
6359
|
-
|
|
6360
|
-
(answerData) => answerData.type === "MCMA"
|
|
6361
|
-
);
|
|
6362
|
-
const answerMap = answer2.data[foundIndex].answerMap;
|
|
6363
|
-
const foundSubIndex = answerMap[key].findIndex(
|
|
6177
|
+
const foundSubIndex = answerMap2[key].findIndex(
|
|
6364
6178
|
(answerMaterialKey) => answerMaterialKey === value
|
|
6365
6179
|
);
|
|
6366
6180
|
if (foundSubIndex === -1) {
|
|
6367
|
-
|
|
6181
|
+
answerMap2[key].push(value);
|
|
6368
6182
|
} else {
|
|
6369
|
-
|
|
6183
|
+
answerMap2[key].splice(foundSubIndex, 1);
|
|
6370
6184
|
}
|
|
6371
|
-
changeAnswer(
|
|
6185
|
+
changeAnswer(answerMap2);
|
|
6372
6186
|
};
|
|
6373
6187
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
|
|
6374
6188
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:w-[60%]"}`, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ActivityBodyContent_default, { bodyMap: MCMABodyMap, templateType: "MCMA" }) }),
|
|
@@ -6378,7 +6192,7 @@ var MCMAActivityContent = ({
|
|
|
6378
6192
|
MCMAActivityMaterialContent_default,
|
|
6379
6193
|
{
|
|
6380
6194
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
6381
|
-
|
|
6195
|
+
answerMap,
|
|
6382
6196
|
materialMap: MCMAMaterialMap,
|
|
6383
6197
|
contentMap,
|
|
6384
6198
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
@@ -6395,19 +6209,13 @@ var import_react_katex8 = require("react-katex");
|
|
|
6395
6209
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6396
6210
|
var MCSAActivityMaterialContent = ({
|
|
6397
6211
|
uniqueValue,
|
|
6398
|
-
|
|
6212
|
+
answerMap,
|
|
6399
6213
|
materialMap,
|
|
6400
6214
|
contentMap,
|
|
6401
6215
|
checkCanAnswerQuestion,
|
|
6402
6216
|
onChange,
|
|
6403
6217
|
isPreview
|
|
6404
6218
|
}) => {
|
|
6405
|
-
const retrieveAnswerMap = () => {
|
|
6406
|
-
const foundIndex = answer.data.findIndex(
|
|
6407
|
-
(answerData) => answerData.type === "MCSA"
|
|
6408
|
-
);
|
|
6409
|
-
return answer.data[foundIndex].answerMap;
|
|
6410
|
-
};
|
|
6411
6219
|
const retrieveCorrectAnswer = () => {
|
|
6412
6220
|
return Object.keys(materialMap)[0];
|
|
6413
6221
|
};
|
|
@@ -6419,7 +6227,6 @@ var MCSAActivityMaterialContent = ({
|
|
|
6419
6227
|
}
|
|
6420
6228
|
return "INCORRECT";
|
|
6421
6229
|
};
|
|
6422
|
-
const answerMap = retrieveAnswerMap();
|
|
6423
6230
|
const correctAnswer = retrieveCorrectAnswer();
|
|
6424
6231
|
return Object.keys(materialMap).map((materialKey, index) => {
|
|
6425
6232
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-row items-center my-1", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex-1 flex flex-col justify-center border-catchup-lighter-gray rounded-catchup-xlarge px-5 md:px-0", children: [
|
|
@@ -6441,7 +6248,7 @@ var MCSAActivityMaterialContent = ({
|
|
|
6441
6248
|
{
|
|
6442
6249
|
className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 gap-x-2 ${learnerAnswerState === "EMPTY" && materialSubKey === correctAnswer || learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge p-2" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge p-2" : ""}`,
|
|
6443
6250
|
onClick: () => {
|
|
6444
|
-
onChange(
|
|
6251
|
+
onChange(answerMap, materialKey, materialSubKey);
|
|
6445
6252
|
},
|
|
6446
6253
|
children: [
|
|
6447
6254
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -6497,7 +6304,7 @@ var MCSAActivityMaterialContent_default = MCSAActivityMaterialContent;
|
|
|
6497
6304
|
// src/components/activities/MCSAActivityContent.tsx
|
|
6498
6305
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6499
6306
|
var MCSAActivityContent = ({
|
|
6500
|
-
|
|
6307
|
+
answerMap,
|
|
6501
6308
|
data,
|
|
6502
6309
|
canAnswerQuestion,
|
|
6503
6310
|
changeAnswer,
|
|
@@ -6507,14 +6314,10 @@ var MCSAActivityContent = ({
|
|
|
6507
6314
|
const contentMap = parseContentMapFromData(data);
|
|
6508
6315
|
const MCSABodyMap = parseBodyMapFromData(data, "MCSA");
|
|
6509
6316
|
const MCSAMaterialMap = parseMaterialMapFromData(data, "MCSA");
|
|
6510
|
-
const handleMCSAAnswerOnChange = (
|
|
6317
|
+
const handleMCSAAnswerOnChange = (answerMap2, key, value) => {
|
|
6511
6318
|
if (isPreview) return;
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
);
|
|
6515
|
-
const answerMap = answer2.data[foundIndex].answerMap;
|
|
6516
|
-
answerMap[key] = value;
|
|
6517
|
-
changeAnswer(answer2);
|
|
6319
|
+
answerMap2[key] = value;
|
|
6320
|
+
changeAnswer(answerMap2);
|
|
6518
6321
|
};
|
|
6519
6322
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
|
|
6520
6323
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:w-[60%]"}`, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ActivityBodyContent_default, { bodyMap: MCSABodyMap, templateType: "MCSA" }) }),
|
|
@@ -6524,7 +6327,7 @@ var MCSAActivityContent = ({
|
|
|
6524
6327
|
MCSAActivityMaterialContent_default,
|
|
6525
6328
|
{
|
|
6526
6329
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
6527
|
-
|
|
6330
|
+
answerMap,
|
|
6528
6331
|
materialMap: MCSAMaterialMap,
|
|
6529
6332
|
contentMap,
|
|
6530
6333
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
@@ -6567,26 +6370,11 @@ var retrieveDocumentTypeFromExtension = (format) => {
|
|
|
6567
6370
|
// src/components/activities/material-contents/OpenEndedActivityMaterialContent.tsx
|
|
6568
6371
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6569
6372
|
var OpenEndedActivityMaterialContent = ({
|
|
6570
|
-
|
|
6373
|
+
answerMap,
|
|
6571
6374
|
contentMap,
|
|
6572
6375
|
checkCanAnswerQuestion,
|
|
6573
6376
|
onChange
|
|
6574
6377
|
}) => {
|
|
6575
|
-
const retrieveAnswer = () => {
|
|
6576
|
-
if (!answer)
|
|
6577
|
-
return {
|
|
6578
|
-
answerMap: {
|
|
6579
|
-
ANSWER: ""
|
|
6580
|
-
}
|
|
6581
|
-
};
|
|
6582
|
-
return answer.data.find(
|
|
6583
|
-
(answerData) => answerData.type === "OPEN_ENDED"
|
|
6584
|
-
);
|
|
6585
|
-
};
|
|
6586
|
-
const retrieveAnswerMap = () => {
|
|
6587
|
-
const { answerMap: answerMap2 } = retrieveAnswer();
|
|
6588
|
-
return answerMap2;
|
|
6589
|
-
};
|
|
6590
6378
|
const RenderTextContent = (answerMap2) => {
|
|
6591
6379
|
const answerMapAnswer = answerMap2["ANSWER"];
|
|
6592
6380
|
let documentType = "TEXT";
|
|
@@ -6626,7 +6414,7 @@ var OpenEndedActivityMaterialContent = ({
|
|
|
6626
6414
|
useMinHeight: true,
|
|
6627
6415
|
onChange: (e) => {
|
|
6628
6416
|
if (checkCanAnswerQuestion()) {
|
|
6629
|
-
onChange(
|
|
6417
|
+
onChange(answerMap2, e.target.value);
|
|
6630
6418
|
}
|
|
6631
6419
|
}
|
|
6632
6420
|
}
|
|
@@ -6660,7 +6448,6 @@ var OpenEndedActivityMaterialContent = ({
|
|
|
6660
6448
|
}
|
|
6661
6449
|
) });
|
|
6662
6450
|
};
|
|
6663
|
-
const answerMap = retrieveAnswerMap();
|
|
6664
6451
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "", children: [
|
|
6665
6452
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_open_ended_text") }) }),
|
|
6666
6453
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DividerLine_default, {}) }),
|
|
@@ -6672,7 +6459,7 @@ var OpenEndedActivityMaterialContent_default = OpenEndedActivityMaterialContent;
|
|
|
6672
6459
|
// src/components/activities/OpenEndedActivityContent.tsx
|
|
6673
6460
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6674
6461
|
var OpenEndedActivityContent = ({
|
|
6675
|
-
|
|
6462
|
+
answerMap,
|
|
6676
6463
|
data,
|
|
6677
6464
|
changeAnswer,
|
|
6678
6465
|
canAnswerQuestion,
|
|
@@ -6682,14 +6469,10 @@ var OpenEndedActivityContent = ({
|
|
|
6682
6469
|
}) => {
|
|
6683
6470
|
const contentMap = parseContentMapFromData(data);
|
|
6684
6471
|
const openEndedBodyMap = parseBodyMapFromData(data, "OPEN_ENDED");
|
|
6685
|
-
const handleOpenEndedAnswerOnChange = (
|
|
6472
|
+
const handleOpenEndedAnswerOnChange = (answerMap2, value) => {
|
|
6686
6473
|
if (isPreview) return;
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
);
|
|
6690
|
-
const answerMap = answer2.data[foundIndex].answerMap;
|
|
6691
|
-
answerMap["ANSWER"] = value;
|
|
6692
|
-
changeAnswer(answer2);
|
|
6474
|
+
answerMap2["ANSWER"] = value;
|
|
6475
|
+
changeAnswer(answerMap2);
|
|
6693
6476
|
};
|
|
6694
6477
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
|
|
6695
6478
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -6717,7 +6500,7 @@ var OpenEndedActivityContent = ({
|
|
|
6717
6500
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:flex-1"}`, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6718
6501
|
OpenEndedActivityMaterialContent_default,
|
|
6719
6502
|
{
|
|
6720
|
-
|
|
6503
|
+
answerMap,
|
|
6721
6504
|
contentMap,
|
|
6722
6505
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
6723
6506
|
onChange: handleOpenEndedAnswerOnChange
|
|
@@ -6771,7 +6554,7 @@ var useScreenSize_default = useScreenSize;
|
|
|
6771
6554
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6772
6555
|
var OrderingActivityMaterialContent = ({
|
|
6773
6556
|
uniqueValue,
|
|
6774
|
-
|
|
6557
|
+
answerMap,
|
|
6775
6558
|
materialMap,
|
|
6776
6559
|
contentMap,
|
|
6777
6560
|
checkCanAnswerQuestion,
|
|
@@ -6806,19 +6589,10 @@ var OrderingActivityMaterialContent = ({
|
|
|
6806
6589
|
}, [screenSize]);
|
|
6807
6590
|
(0, import_react23.useEffect)(() => {
|
|
6808
6591
|
if (!showCorrectAnswer) return;
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
).answerMap;
|
|
6812
|
-
Object.keys(answerMap2).forEach((answerKey, index) => {
|
|
6813
|
-
answerMap2[answerKey] = index;
|
|
6592
|
+
Object.keys(answerMap).forEach((answerKey, index) => {
|
|
6593
|
+
answerMap[answerKey] = index;
|
|
6814
6594
|
});
|
|
6815
6595
|
}, [showCorrectAnswer]);
|
|
6816
|
-
const retrieveAnswerMap = () => {
|
|
6817
|
-
const foundIndex = answer.data.findIndex(
|
|
6818
|
-
(answerData) => answerData.type === "ORDERING"
|
|
6819
|
-
);
|
|
6820
|
-
return answer.data[foundIndex].answerMap;
|
|
6821
|
-
};
|
|
6822
6596
|
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
6823
6597
|
if (!isPreview) return null;
|
|
6824
6598
|
if (correctAnswer === learnerAnswer) {
|
|
@@ -6867,7 +6641,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6867
6641
|
};
|
|
6868
6642
|
const handleMouseUp = () => {
|
|
6869
6643
|
if (dropTargetKey !== null && draggedKey !== null && dropTargetKey !== draggedKey) {
|
|
6870
|
-
onChange(
|
|
6644
|
+
onChange(answerMap, draggedKey, dropTargetKey);
|
|
6871
6645
|
}
|
|
6872
6646
|
setDraggedKey(null);
|
|
6873
6647
|
setDropTargetKey(null);
|
|
@@ -6899,7 +6673,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6899
6673
|
};
|
|
6900
6674
|
const handleTouchEnd = () => {
|
|
6901
6675
|
if (dropTargetKey !== null && draggedKey !== null && dropTargetKey !== draggedKey) {
|
|
6902
|
-
onChange(
|
|
6676
|
+
onChange(answerMap, draggedKey, dropTargetKey);
|
|
6903
6677
|
}
|
|
6904
6678
|
setDraggedKey(null);
|
|
6905
6679
|
setDropTargetKey(null);
|
|
@@ -6913,12 +6687,11 @@ var OrderingActivityMaterialContent = ({
|
|
|
6913
6687
|
} else if (selectedKey === materialKey) {
|
|
6914
6688
|
setSelectedKey(null);
|
|
6915
6689
|
} else {
|
|
6916
|
-
onChange(
|
|
6690
|
+
onChange(answerMap, selectedKey, materialKey);
|
|
6917
6691
|
setSelectedKey(null);
|
|
6918
6692
|
}
|
|
6919
6693
|
setDraggedKey(null);
|
|
6920
6694
|
};
|
|
6921
|
-
const answerMap = retrieveAnswerMap();
|
|
6922
6695
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6923
6696
|
"div",
|
|
6924
6697
|
{
|
|
@@ -7056,7 +6829,7 @@ var OrderingActivityMaterialContent_default = OrderingActivityMaterialContent;
|
|
|
7056
6829
|
// src/components/activities/OrderingActivityContent.tsx
|
|
7057
6830
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7058
6831
|
var OrderingActivityContent = ({
|
|
7059
|
-
|
|
6832
|
+
answerMap,
|
|
7060
6833
|
data,
|
|
7061
6834
|
canAnswerQuestion,
|
|
7062
6835
|
changeAnswer,
|
|
@@ -7067,16 +6840,12 @@ var OrderingActivityContent = ({
|
|
|
7067
6840
|
const contentMap = parseContentMapFromData(data);
|
|
7068
6841
|
const orderingBodyMap = parseBodyMapFromData(data, "ORDERING");
|
|
7069
6842
|
const orderingMaterialMap = parseMaterialMapFromData(data, "ORDERING");
|
|
7070
|
-
const handleOrderingAnswerOnChange = (
|
|
6843
|
+
const handleOrderingAnswerOnChange = (answerMap2, primaryKey, secondaryKey) => {
|
|
7071
6844
|
if (isPreview) return;
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
const prevValue = answerMap[primaryKey];
|
|
7077
|
-
answerMap[primaryKey] = answerMap[secondaryKey];
|
|
7078
|
-
answerMap[secondaryKey] = prevValue;
|
|
7079
|
-
changeAnswer(answer2);
|
|
6845
|
+
const prevValue = answerMap2[primaryKey];
|
|
6846
|
+
answerMap2[primaryKey] = answerMap2[secondaryKey];
|
|
6847
|
+
answerMap2[secondaryKey] = prevValue;
|
|
6848
|
+
changeAnswer(answerMap2);
|
|
7080
6849
|
};
|
|
7081
6850
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
7082
6851
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
@@ -7091,7 +6860,7 @@ var OrderingActivityContent = ({
|
|
|
7091
6860
|
OrderingActivityMaterialContent_default,
|
|
7092
6861
|
{
|
|
7093
6862
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
7094
|
-
|
|
6863
|
+
answerMap,
|
|
7095
6864
|
materialMap: orderingMaterialMap,
|
|
7096
6865
|
contentMap,
|
|
7097
6866
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
@@ -7110,7 +6879,7 @@ var import_react_katex10 = require("react-katex");
|
|
|
7110
6879
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7111
6880
|
var TrueFalseActivityMaterialContent = ({
|
|
7112
6881
|
uniqueValue,
|
|
7113
|
-
|
|
6882
|
+
answerMap,
|
|
7114
6883
|
materialMap,
|
|
7115
6884
|
contentMap,
|
|
7116
6885
|
checkCanAnswerQuestion,
|
|
@@ -7118,7 +6887,6 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
7118
6887
|
isPreview,
|
|
7119
6888
|
showCorrectAnswer
|
|
7120
6889
|
}) => {
|
|
7121
|
-
const { screenSize } = useScreenSize_default();
|
|
7122
6890
|
const [shuffleOptionList, setShuffleOptionList] = (0, import_react24.useState)([]);
|
|
7123
6891
|
(0, import_react24.useEffect)(() => {
|
|
7124
6892
|
const optionList = [];
|
|
@@ -7132,26 +6900,8 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
7132
6900
|
}, []);
|
|
7133
6901
|
(0, import_react24.useEffect)(() => {
|
|
7134
6902
|
if (!showCorrectAnswer) return;
|
|
7135
|
-
|
|
7136
|
-
(answerData) => answerData.type === "TRUE_FALSE"
|
|
7137
|
-
).answerMap = materialMap;
|
|
6903
|
+
answerMap = materialMap;
|
|
7138
6904
|
}, [showCorrectAnswer]);
|
|
7139
|
-
const retrieveAnswer = () => {
|
|
7140
|
-
if (!answer)
|
|
7141
|
-
return {
|
|
7142
|
-
answerMap: {
|
|
7143
|
-
trueList: [],
|
|
7144
|
-
falseList: []
|
|
7145
|
-
}
|
|
7146
|
-
};
|
|
7147
|
-
return answer.data.find(
|
|
7148
|
-
(answerData) => answerData.type === "TRUE_FALSE"
|
|
7149
|
-
);
|
|
7150
|
-
};
|
|
7151
|
-
const retrieveAnswerMap = () => {
|
|
7152
|
-
const { answerMap: answerMap2 } = retrieveAnswer();
|
|
7153
|
-
return answerMap2;
|
|
7154
|
-
};
|
|
7155
6905
|
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
7156
6906
|
if (!isPreview) return null;
|
|
7157
6907
|
if (correctAnswer === learnerAnswer) {
|
|
@@ -7159,7 +6909,6 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
7159
6909
|
}
|
|
7160
6910
|
return "INCORRECT";
|
|
7161
6911
|
};
|
|
7162
|
-
const answerMap = retrieveAnswerMap();
|
|
7163
6912
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "", children: [
|
|
7164
6913
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_true_false_text") }) }),
|
|
7165
6914
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DividerLine_default, {}) }),
|
|
@@ -7209,7 +6958,7 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
7209
6958
|
alt: "checkbox",
|
|
7210
6959
|
size: "small",
|
|
7211
6960
|
onClick: () => {
|
|
7212
|
-
onChange(
|
|
6961
|
+
onChange(answerMap, "TRUE", shuffleOption);
|
|
7213
6962
|
}
|
|
7214
6963
|
}
|
|
7215
6964
|
) }) }),
|
|
@@ -7220,7 +6969,7 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
7220
6969
|
alt: "checkbox",
|
|
7221
6970
|
size: "small",
|
|
7222
6971
|
onClick: () => {
|
|
7223
|
-
onChange(
|
|
6972
|
+
onChange(answerMap, "FALSE", shuffleOption);
|
|
7224
6973
|
}
|
|
7225
6974
|
}
|
|
7226
6975
|
) }) })
|
|
@@ -7246,7 +6995,7 @@ var TrueFalseActivityMaterialContent_default = TrueFalseActivityMaterialContent;
|
|
|
7246
6995
|
// src/components/activities/TrueFalseActivityContent.tsx
|
|
7247
6996
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7248
6997
|
var TrueFalseActivityContent = ({
|
|
7249
|
-
|
|
6998
|
+
answerMap,
|
|
7250
6999
|
data,
|
|
7251
7000
|
canAnswerQuestion,
|
|
7252
7001
|
changeAnswer,
|
|
@@ -7257,43 +7006,36 @@ var TrueFalseActivityContent = ({
|
|
|
7257
7006
|
const contentMap = parseContentMapFromData(data);
|
|
7258
7007
|
const trueFalseBodyMap = parseBodyMapFromData(data, "TRUE_FALSE");
|
|
7259
7008
|
const trueFalseMaterialMap = parseMaterialMapFromData(data, "TRUE_FALSE");
|
|
7260
|
-
const
|
|
7261
|
-
let foundIndex = answer.data.findIndex(
|
|
7262
|
-
(answerData) => answerData.type === "TRUE_FALSE"
|
|
7263
|
-
);
|
|
7264
|
-
return answer.data[foundIndex].answerMap;
|
|
7265
|
-
};
|
|
7266
|
-
const handleTrueFalseAnswerOnChange = (answer2, key, value) => {
|
|
7009
|
+
const handleTrueFalseAnswerOnChange = (answerMap2, key, value) => {
|
|
7267
7010
|
if (isPreview) return;
|
|
7268
|
-
const answerMap = retrieveCurrentAnswerMap();
|
|
7269
7011
|
if (key === "TRUE") {
|
|
7270
|
-
const foundFalseIndex =
|
|
7012
|
+
const foundFalseIndex = answerMap2.falseList.findIndex(
|
|
7271
7013
|
(item) => item === value
|
|
7272
7014
|
);
|
|
7273
7015
|
if (foundFalseIndex !== -1) {
|
|
7274
|
-
|
|
7016
|
+
answerMap2.falseList.splice(foundFalseIndex, 1);
|
|
7275
7017
|
}
|
|
7276
|
-
const foundTrueIndex =
|
|
7018
|
+
const foundTrueIndex = answerMap2.falseList.findIndex(
|
|
7277
7019
|
(item) => item === value
|
|
7278
7020
|
);
|
|
7279
7021
|
if (foundTrueIndex === -1) {
|
|
7280
|
-
|
|
7022
|
+
answerMap2.trueList.push(value);
|
|
7281
7023
|
}
|
|
7282
7024
|
} else if (key === "FALSE") {
|
|
7283
|
-
const foundTrueIndex =
|
|
7025
|
+
const foundTrueIndex = answerMap2.trueList.findIndex(
|
|
7284
7026
|
(item) => item === value
|
|
7285
7027
|
);
|
|
7286
7028
|
if (foundTrueIndex !== -1) {
|
|
7287
|
-
|
|
7029
|
+
answerMap2.trueList.splice(foundTrueIndex, 1);
|
|
7288
7030
|
}
|
|
7289
|
-
const foundFalseIndex =
|
|
7031
|
+
const foundFalseIndex = answerMap2.falseList.findIndex(
|
|
7290
7032
|
(item) => item === value
|
|
7291
7033
|
);
|
|
7292
7034
|
if (foundFalseIndex === -1) {
|
|
7293
|
-
|
|
7035
|
+
answerMap2.falseList.push(value);
|
|
7294
7036
|
}
|
|
7295
7037
|
}
|
|
7296
|
-
changeAnswer(
|
|
7038
|
+
changeAnswer(answerMap2);
|
|
7297
7039
|
};
|
|
7298
7040
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
|
|
7299
7041
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:w-[40%]"}`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7309,7 +7051,7 @@ var TrueFalseActivityContent = ({
|
|
|
7309
7051
|
TrueFalseActivityMaterialContent_default,
|
|
7310
7052
|
{
|
|
7311
7053
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
7312
|
-
|
|
7054
|
+
answerMap,
|
|
7313
7055
|
materialMap: trueFalseMaterialMap,
|
|
7314
7056
|
contentMap,
|
|
7315
7057
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
@@ -7537,7 +7279,7 @@ var ActivityPreviewByData = ({
|
|
|
7537
7279
|
}
|
|
7538
7280
|
}, [data, lockedType, typeOptionList, showDifficulty]);
|
|
7539
7281
|
if (!data) return;
|
|
7540
|
-
const
|
|
7282
|
+
const answerMap = constructAnswerBasedOnData(data);
|
|
7541
7283
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
|
|
7542
7284
|
showType ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
7543
7285
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "mb-4", children: [
|
|
@@ -7558,7 +7300,7 @@ var ActivityPreviewByData = ({
|
|
|
7558
7300
|
selectedType ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "", children: selectedType === "ORDERING" && data["orderingBodyMap"] != null && data["orderingMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7559
7301
|
OrderingActivityContent_default,
|
|
7560
7302
|
{
|
|
7561
|
-
|
|
7303
|
+
answerMap,
|
|
7562
7304
|
changeAnswer: () => {
|
|
7563
7305
|
},
|
|
7564
7306
|
canAnswerQuestion: () => {
|
|
@@ -7572,7 +7314,7 @@ var ActivityPreviewByData = ({
|
|
|
7572
7314
|
) : selectedType === "DROPDOWN" && data["dropdownBodyMap"] != null && data["dropdownMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7573
7315
|
DropdownActivityContent_default,
|
|
7574
7316
|
{
|
|
7575
|
-
|
|
7317
|
+
answerMap,
|
|
7576
7318
|
changeAnswer: () => {
|
|
7577
7319
|
},
|
|
7578
7320
|
canAnswerQuestion: () => {
|
|
@@ -7586,7 +7328,7 @@ var ActivityPreviewByData = ({
|
|
|
7586
7328
|
) : selectedType === "MCSA" && data["MCSABodyMap"] != null && data["MCSAMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7587
7329
|
MCSAActivityContent_default,
|
|
7588
7330
|
{
|
|
7589
|
-
|
|
7331
|
+
answerMap,
|
|
7590
7332
|
changeAnswer: () => {
|
|
7591
7333
|
},
|
|
7592
7334
|
canAnswerQuestion: () => {
|
|
@@ -7600,7 +7342,7 @@ var ActivityPreviewByData = ({
|
|
|
7600
7342
|
) : selectedType === "MCMA" && data["MCMABodyMap"] != null && data["MCMAMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7601
7343
|
MCMAActivityContent_default,
|
|
7602
7344
|
{
|
|
7603
|
-
|
|
7345
|
+
answerMap,
|
|
7604
7346
|
changeAnswer: () => {
|
|
7605
7347
|
},
|
|
7606
7348
|
canAnswerQuestion: () => {
|
|
@@ -7614,7 +7356,7 @@ var ActivityPreviewByData = ({
|
|
|
7614
7356
|
) : selectedType === "MATCHING" && data["matchingBodyMap"] != null && data["matchingMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7615
7357
|
MatchingActivityContent_default,
|
|
7616
7358
|
{
|
|
7617
|
-
|
|
7359
|
+
answerMap,
|
|
7618
7360
|
changeAnswer: () => {
|
|
7619
7361
|
},
|
|
7620
7362
|
canAnswerQuestion: () => {
|
|
@@ -7627,7 +7369,7 @@ var ActivityPreviewByData = ({
|
|
|
7627
7369
|
) : selectedType === "GROUPING" && data["groupingBodyMap"] != null && data["groupingMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7628
7370
|
GroupingActivityContent_default,
|
|
7629
7371
|
{
|
|
7630
|
-
|
|
7372
|
+
answerMap,
|
|
7631
7373
|
changeAnswer: () => {
|
|
7632
7374
|
},
|
|
7633
7375
|
canAnswerQuestion: () => {
|
|
@@ -7640,7 +7382,7 @@ var ActivityPreviewByData = ({
|
|
|
7640
7382
|
) : selectedType === "FILL_IN_THE_BLANKS" && data["fillInTheBlanksBodyMap"] != null && data["fillInTheBlanksMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7641
7383
|
FillInTheBlanksActivityContent_default,
|
|
7642
7384
|
{
|
|
7643
|
-
|
|
7385
|
+
answerMap,
|
|
7644
7386
|
changeAnswer: () => {
|
|
7645
7387
|
},
|
|
7646
7388
|
canAnswerQuestion: () => {
|
|
@@ -7654,7 +7396,7 @@ var ActivityPreviewByData = ({
|
|
|
7654
7396
|
) : selectedType === "OPEN_ENDED" && data["openEndedBodyMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7655
7397
|
OpenEndedActivityContent_default,
|
|
7656
7398
|
{
|
|
7657
|
-
|
|
7399
|
+
answerMap,
|
|
7658
7400
|
canAnswerQuestion: () => false,
|
|
7659
7401
|
changeAnswer: () => {
|
|
7660
7402
|
},
|
|
@@ -7666,7 +7408,7 @@ var ActivityPreviewByData = ({
|
|
|
7666
7408
|
) : selectedType === "TRUE_FALSE" && data["trueFalseBodyMap"] != null && data["trueFalseMaterialMap"] != null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7667
7409
|
TrueFalseActivityContent_default,
|
|
7668
7410
|
{
|
|
7669
|
-
|
|
7411
|
+
answerMap,
|
|
7670
7412
|
changeAnswer: () => {
|
|
7671
7413
|
},
|
|
7672
7414
|
canAnswerQuestion: () => {
|
|
@@ -7699,135 +7441,157 @@ var ActivityPreviewByData_default = ActivityPreviewByData;
|
|
|
7699
7441
|
// src/components/activities/ActivityPreviewByAnswerData.tsx
|
|
7700
7442
|
var import_react26 = require("react");
|
|
7701
7443
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7444
|
+
var ACTIVITY_TEMPLATE_LIST = [
|
|
7445
|
+
{ type: "ORDERING", materialMap: "orderingMaterialMap" },
|
|
7446
|
+
{ type: "DROPDOWN", materialMap: "dropdownMaterialMap" },
|
|
7447
|
+
{ type: "MCSA", materialMap: "MCSAMaterialMap" },
|
|
7448
|
+
{ type: "MCMA", materialMap: "MCMAMaterialMap" },
|
|
7449
|
+
{ type: "MATCHING", materialMap: "matchingMaterialMap" },
|
|
7450
|
+
{ type: "GROUPING", materialMap: "groupingMaterialMap" },
|
|
7451
|
+
{
|
|
7452
|
+
type: "FILL_IN_THE_BLANKS",
|
|
7453
|
+
materialMap: "fillInTheBlanksMaterialMap"
|
|
7454
|
+
},
|
|
7455
|
+
{ type: "OPEN_ENDED", materialMap: "openEndedMaterialMap" },
|
|
7456
|
+
{ type: "TRUE_FALSE", materialMap: "trueFalseMaterialMap" }
|
|
7457
|
+
];
|
|
7702
7458
|
var ActivityPreviewByAnswerData = ({
|
|
7703
7459
|
data,
|
|
7460
|
+
answerType = null,
|
|
7704
7461
|
showType = true,
|
|
7705
7462
|
showDescription = true,
|
|
7706
|
-
|
|
7707
|
-
typeOptionList = [],
|
|
7463
|
+
lockedTypeList = [],
|
|
7708
7464
|
showSolution = false,
|
|
7709
7465
|
showEvaluationRubric = false,
|
|
7710
7466
|
showDifficulty = true,
|
|
7711
7467
|
isFullScreen = false,
|
|
7712
7468
|
showCorrectAnswer = false
|
|
7713
7469
|
}) => {
|
|
7714
|
-
var _a;
|
|
7715
|
-
const [key, setKey] = (0, import_react26.useState)((/* @__PURE__ */ new Date()).getTime());
|
|
7716
7470
|
const [selectedType, setSelectedType] = (0, import_react26.useState)(null);
|
|
7717
7471
|
const [optionList, setOptionList] = (0, import_react26.useState)([]);
|
|
7718
|
-
const [
|
|
7472
|
+
const [answerMapMap, setAnswerMapMap] = (0, import_react26.useState)({});
|
|
7473
|
+
const [activityTemplateTypeList, setActivityTemplateTypeList] = (0, import_react26.useState)([]);
|
|
7719
7474
|
(0, import_react26.useEffect)(() => {
|
|
7720
7475
|
if (!data) return;
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
if (
|
|
7725
|
-
|
|
7726
|
-
(
|
|
7476
|
+
let currentActivityTemplateMapList = JSON.parse(
|
|
7477
|
+
JSON.stringify(ACTIVITY_TEMPLATE_LIST)
|
|
7478
|
+
);
|
|
7479
|
+
if (lockedTypeList.length > 0) {
|
|
7480
|
+
currentActivityTemplateMapList = currentActivityTemplateMapList.filter(
|
|
7481
|
+
(activityTemplateMap) => lockedTypeList.includes(activityTemplateMap.type)
|
|
7727
7482
|
);
|
|
7728
|
-
return foundAnswer || null;
|
|
7729
7483
|
}
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
const constructAnswerBasedOnData2 = () => {
|
|
7735
|
-
const newAnswer = { data: [] };
|
|
7736
|
-
const activityTypes = [
|
|
7737
|
-
{ type: "ORDERING", materialMap: "orderingMaterialMap" },
|
|
7738
|
-
{ type: "DROPDOWN", materialMap: "dropdownMaterialMap" },
|
|
7739
|
-
{ type: "MCSA", materialMap: "MCSAMaterialMap" },
|
|
7740
|
-
{ type: "MCMA", materialMap: "MCMAMaterialMap" },
|
|
7741
|
-
{ type: "MATCHING", materialMap: "matchingMaterialMap" },
|
|
7742
|
-
{ type: "GROUPING", materialMap: "groupingMaterialMap" },
|
|
7743
|
-
{
|
|
7744
|
-
type: "FILL_IN_THE_BLANKS",
|
|
7745
|
-
materialMap: "fillInTheBlanksMaterialMap"
|
|
7746
|
-
},
|
|
7747
|
-
{ type: "OPEN_ENDED", materialMap: "openEndedMaterialMap" },
|
|
7748
|
-
{ type: "TRUE_FALSE", materialMap: "trueFalseMaterialMap" }
|
|
7749
|
-
];
|
|
7750
|
-
activityTypes.forEach(({ type, materialMap }) => {
|
|
7751
|
-
if (data[materialMap]) {
|
|
7752
|
-
const foundAnswer = checkAnswerMapExists(type);
|
|
7753
|
-
const answerItem = foundAnswer || constructActivityAnswerMap(
|
|
7754
|
-
{ type },
|
|
7755
|
-
JSON.parse(JSON.stringify(data))
|
|
7756
|
-
);
|
|
7757
|
-
newAnswer.data.push(answerItem);
|
|
7758
|
-
}
|
|
7759
|
-
});
|
|
7760
|
-
setAnswer(newAnswer);
|
|
7761
|
-
if (newAnswer.data.length > 0) {
|
|
7762
|
-
if (lockedType && newAnswer.data.find((item) => item.type === lockedType)) {
|
|
7763
|
-
setSelectedType(lockedType);
|
|
7764
|
-
} else {
|
|
7765
|
-
setSelectedType(newAnswer.data[0].type);
|
|
7766
|
-
}
|
|
7484
|
+
const currentActivityTemplateTypeList = [];
|
|
7485
|
+
for (const activityTemplateMap of currentActivityTemplateMapList) {
|
|
7486
|
+
if (data[activityTemplateMap.materialMap]) {
|
|
7487
|
+
currentActivityTemplateTypeList.push(activityTemplateMap);
|
|
7767
7488
|
}
|
|
7768
|
-
};
|
|
7769
|
-
constructAnswerBasedOnData2();
|
|
7770
|
-
}, [data, lockedType]);
|
|
7771
|
-
(0, import_react26.useEffect)(() => {
|
|
7772
|
-
if (!data || !answer.data.length) return;
|
|
7773
|
-
let currentTypeOptionList = typeOptionList || answer.data.map((item) => ({
|
|
7774
|
-
id: item.type,
|
|
7775
|
-
text: i18n_default.t(item.type)
|
|
7776
|
-
}));
|
|
7777
|
-
if (lockedType) {
|
|
7778
|
-
currentTypeOptionList = currentTypeOptionList.filter(
|
|
7779
|
-
(typeOption) => typeOption.id === lockedType
|
|
7780
|
-
);
|
|
7781
7489
|
}
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7490
|
+
setActivityTemplateTypeList(currentActivityTemplateMapList);
|
|
7491
|
+
}, [data, answerType, lockedTypeList]);
|
|
7492
|
+
(0, import_react26.useEffect)(() => {
|
|
7493
|
+
if (activityTemplateTypeList.length === 0) return;
|
|
7494
|
+
const currentOptionList = [];
|
|
7495
|
+
for (const activityTemplateType of activityTemplateTypeList) {
|
|
7496
|
+
const currentTypeOption = {
|
|
7497
|
+
id: activityTemplateType.type,
|
|
7498
|
+
value: i18n_default.t(activityTemplateType.type)
|
|
7499
|
+
};
|
|
7500
|
+
if (showDifficulty) {
|
|
7501
|
+
currentTypeOption.subText = i18n_default.t(
|
|
7502
|
+
retrieveDifficultyByActivityTypeFromData(
|
|
7503
|
+
activityTemplateType.type,
|
|
7504
|
+
data
|
|
7787
7505
|
)
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7506
|
+
);
|
|
7507
|
+
}
|
|
7508
|
+
currentOptionList.push(currentTypeOption);
|
|
7509
|
+
}
|
|
7510
|
+
setOptionList(currentOptionList);
|
|
7511
|
+
}, [activityTemplateTypeList, showDifficulty]);
|
|
7512
|
+
(0, import_react26.useEffect)(() => {
|
|
7513
|
+
if (optionList.length === 0) return;
|
|
7514
|
+
setSelectedType(optionList[0].id);
|
|
7515
|
+
}, [optionList]);
|
|
7516
|
+
(0, import_react26.useEffect)(() => {
|
|
7517
|
+
if (activityTemplateTypeList.length === 0) return;
|
|
7518
|
+
const currentAnswerMapMap = {};
|
|
7519
|
+
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
7520
|
+
if (answerType === activityTemplateMap.type) {
|
|
7521
|
+
currentAnswerMapMap[activityTemplateMap.type] = data.answerMap;
|
|
7522
|
+
} else {
|
|
7523
|
+
currentAnswerMapMap[activityTemplateMap.type] = constructActivityAnswerMap(
|
|
7524
|
+
{ type: activityTemplateMap.type },
|
|
7525
|
+
JSON.parse(JSON.stringify(data))
|
|
7526
|
+
);
|
|
7527
|
+
}
|
|
7792
7528
|
}
|
|
7793
|
-
|
|
7529
|
+
setAnswerMapMap(currentAnswerMapMap);
|
|
7530
|
+
}, [activityTemplateTypeList]);
|
|
7794
7531
|
const RenderSelectedActivityContent = () => {
|
|
7532
|
+
if (!selectedType) return null;
|
|
7795
7533
|
const commonProps = {
|
|
7796
|
-
|
|
7534
|
+
answerMap: answerMapMap[selectedType],
|
|
7797
7535
|
data,
|
|
7798
7536
|
canAnswerQuestion: () => true,
|
|
7799
|
-
// changeAnswer: (newAnswer: Answer) =>
|
|
7800
|
-
// setAnswer(JSON.parse(JSON.stringify(newAnswer))),
|
|
7801
7537
|
changeAnswer: () => {
|
|
7802
7538
|
},
|
|
7803
7539
|
isPreview: true,
|
|
7804
7540
|
showCorrectAnswer,
|
|
7805
7541
|
isFullScreen
|
|
7806
7542
|
};
|
|
7543
|
+
const isEmpty = answerMapMap[selectedType].isEmpty;
|
|
7807
7544
|
switch (selectedType) {
|
|
7808
7545
|
case "ORDERING":
|
|
7809
|
-
return data.orderingBodyMap && data.orderingMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7546
|
+
return data.orderingBodyMap && data.orderingMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7547
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7548
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OrderingActivityContent_default, __spreadValues({}, commonProps))
|
|
7549
|
+
] }) : null;
|
|
7810
7550
|
case "DROPDOWN":
|
|
7811
|
-
return data.dropdownBodyMap && data.dropdownMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7551
|
+
return data.dropdownBodyMap && data.dropdownMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7552
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7553
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DropdownActivityContent_default, __spreadValues({}, commonProps))
|
|
7554
|
+
] }) : null;
|
|
7812
7555
|
case "MCSA":
|
|
7813
|
-
return data.MCSABodyMap && data.MCSAMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7556
|
+
return data.MCSABodyMap && data.MCSAMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7557
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7558
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MCSAActivityContent_default, __spreadValues({}, commonProps))
|
|
7559
|
+
] }) : null;
|
|
7814
7560
|
case "MCMA":
|
|
7815
|
-
return data.MCMABodyMap && data.MCMAMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7561
|
+
return data.MCMABodyMap && data.MCMAMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7562
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7563
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MCMAActivityContent_default, __spreadValues({}, commonProps))
|
|
7564
|
+
] }) : null;
|
|
7816
7565
|
case "MATCHING":
|
|
7817
|
-
return data.matchingBodyMap && data.matchingMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7566
|
+
return data.matchingBodyMap && data.matchingMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7567
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7568
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MatchingActivityContent_default, __spreadValues({}, commonProps))
|
|
7569
|
+
] }) : null;
|
|
7818
7570
|
case "GROUPING":
|
|
7819
|
-
return data.groupingBodyMap && data.groupingMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7571
|
+
return data.groupingBodyMap && data.groupingMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7572
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7573
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(GroupingActivityContent_default, __spreadValues({}, commonProps))
|
|
7574
|
+
] }) : null;
|
|
7820
7575
|
case "FILL_IN_THE_BLANKS":
|
|
7821
|
-
return data.fillInTheBlanksBodyMap && data.fillInTheBlanksMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7576
|
+
return data.fillInTheBlanksBodyMap && data.fillInTheBlanksMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7577
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7578
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FillInTheBlanksActivityContent_default, __spreadValues({}, commonProps))
|
|
7579
|
+
] }) : null;
|
|
7822
7580
|
case "OPEN_ENDED":
|
|
7823
|
-
return data.openEndedBodyMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7581
|
+
return data.openEndedBodyMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7582
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7583
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7584
|
+
OpenEndedActivityContent_default,
|
|
7585
|
+
__spreadProps(__spreadValues({}, commonProps), {
|
|
7586
|
+
showMaterialContent: true
|
|
7587
|
+
})
|
|
7588
|
+
)
|
|
7589
|
+
] }) : null;
|
|
7829
7590
|
case "TRUE_FALSE":
|
|
7830
|
-
return data.trueFalseBodyMap && data.trueFalseMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7591
|
+
return data.trueFalseBodyMap && data.trueFalseMaterialMap ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7592
|
+
isEmpty && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}),
|
|
7593
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TrueFalseActivityContent_default, __spreadValues({}, commonProps))
|
|
7594
|
+
] }) : null;
|
|
7831
7595
|
default:
|
|
7832
7596
|
return null;
|
|
7833
7597
|
}
|
|
@@ -7850,10 +7614,7 @@ var ActivityPreviewByAnswerData = ({
|
|
|
7850
7614
|
] }),
|
|
7851
7615
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DividerLine_default, {})
|
|
7852
7616
|
] }) : null,
|
|
7853
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.
|
|
7854
|
-
((_a = answer == null ? void 0 : answer.data[0]) == null ? void 0 : _a.isEmpty) ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ActivityEmptyContent_default, {}) : null,
|
|
7855
|
-
selectedType ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: RenderSelectedActivityContent() }, selectedType) : null
|
|
7856
|
-
] }),
|
|
7617
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-col my-2 w-full p-5", children: RenderSelectedActivityContent() }),
|
|
7857
7618
|
selectedType && showSolution ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "my-4", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7858
7619
|
ActivitySolutionContent_default,
|
|
7859
7620
|
{
|
|
@@ -7868,7 +7629,7 @@ var ActivityPreviewByAnswerData = ({
|
|
|
7868
7629
|
data
|
|
7869
7630
|
}
|
|
7870
7631
|
) }) : null
|
|
7871
|
-
] }
|
|
7632
|
+
] });
|
|
7872
7633
|
};
|
|
7873
7634
|
var ActivityPreviewByAnswerData_default = ActivityPreviewByAnswerData;
|
|
7874
7635
|
|
|
@@ -11046,7 +10807,6 @@ var retrieveActivityMethodologyOptionList = () => {
|
|
|
11046
10807
|
calculateLevenshteinDistance,
|
|
11047
10808
|
calculateStartDateOfWeek,
|
|
11048
10809
|
checkActivityAnswerState,
|
|
11049
|
-
checkIfAnswerIsEmpty,
|
|
11050
10810
|
constructActivityAnswerMap,
|
|
11051
10811
|
constructActivityAnswerStateList,
|
|
11052
10812
|
constructActivityData,
|