catchup-library-web 2.7.7 → 2.7.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.js +20 -9
- package/dist/index.mjs +22 -11
- package/package.json +1 -1
- package/src/components/activities/ActivityPreviewByData.tsx +5 -1
- package/src/components/activities/material-contents/DropdownActivityMaterialContent.tsx +3 -1
- package/src/components/activities/material-contents/MCMAActivityMaterialContent.tsx +4 -3
- package/src/components/activities/material-contents/OrderingActivityMaterialContent.tsx +3 -1
- package/src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx +12 -6
package/dist/index.js
CHANGED
|
@@ -4891,7 +4891,7 @@ var DropdownActivityMaterialContent = ({
|
|
|
4891
4891
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
|
|
4892
4892
|
(materialKey, index) => {
|
|
4893
4893
|
const answerKey = Object.keys(materialMap[materialKey])[0];
|
|
4894
|
-
const learnerAnswerState = !isPreview ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
|
|
4894
|
+
const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
|
|
4895
4895
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
4896
4896
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-xl", children: [
|
|
4897
4897
|
parseFloat(materialKey) + 1,
|
|
@@ -6393,7 +6393,8 @@ var MCMAActivityMaterialContent = ({
|
|
|
6393
6393
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DividerLine_default, {}) }),
|
|
6394
6394
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: checkCanAnswerQuestion() ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
|
|
6395
6395
|
(materialSubKey, index2) => {
|
|
6396
|
-
const
|
|
6396
|
+
const currentDisplayAnswerList = displayAnswerMap[materialKey] || [];
|
|
6397
|
+
const foundAnswer = currentDisplayAnswerList.find(
|
|
6397
6398
|
(learnerAnswer) => learnerAnswer === materialSubKey
|
|
6398
6399
|
);
|
|
6399
6400
|
const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== foundAnswer ? "EMPTY" : checkAnswerState(correctAnswerList, foundAnswer);
|
|
@@ -6411,7 +6412,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6411
6412
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6412
6413
|
BaseImage_default,
|
|
6413
6414
|
{
|
|
6414
|
-
src:
|
|
6415
|
+
src: currentDisplayAnswerList.includes(materialSubKey) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
|
|
6415
6416
|
alt: "checkbox",
|
|
6416
6417
|
size: "small",
|
|
6417
6418
|
onClick: () => {
|
|
@@ -6442,7 +6443,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6442
6443
|
);
|
|
6443
6444
|
}
|
|
6444
6445
|
) }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
6445
|
-
displayAnswerMap[materialKey]
|
|
6446
|
+
displayAnswerMap[materialKey] || ""
|
|
6446
6447
|
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6447
6448
|
"span",
|
|
6448
6449
|
{
|
|
@@ -7087,7 +7088,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
7087
7088
|
}
|
|
7088
7089
|
),
|
|
7089
7090
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
|
|
7090
|
-
const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
|
|
7091
|
+
const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
|
|
7091
7092
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7092
7093
|
"div",
|
|
7093
7094
|
{
|
|
@@ -7226,16 +7227,22 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
7226
7227
|
}) => {
|
|
7227
7228
|
const [shuffleOptionList, setShuffleOptionList] = (0, import_react26.useState)([]);
|
|
7228
7229
|
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react26.useState)(answerMap);
|
|
7230
|
+
const hasShuffledRef = (0, import_react26.useRef)(false);
|
|
7229
7231
|
(0, import_react26.useEffect)(() => {
|
|
7230
7232
|
const optionList = [];
|
|
7231
7233
|
optionList.push(...materialMap.trueList);
|
|
7232
7234
|
optionList.push(...materialMap.falseList);
|
|
7233
|
-
if (
|
|
7234
|
-
|
|
7235
|
+
if (!hasShuffledRef.current) {
|
|
7236
|
+
if (isPreview) {
|
|
7237
|
+
setShuffleOptionList(optionList);
|
|
7238
|
+
} else {
|
|
7239
|
+
setShuffleOptionList(shuffleArray(optionList));
|
|
7240
|
+
}
|
|
7241
|
+
hasShuffledRef.current = true;
|
|
7235
7242
|
} else {
|
|
7236
|
-
setShuffleOptionList(
|
|
7243
|
+
setShuffleOptionList(optionList);
|
|
7237
7244
|
}
|
|
7238
|
-
}, []);
|
|
7245
|
+
}, [materialMap]);
|
|
7239
7246
|
(0, import_react26.useEffect)(() => {
|
|
7240
7247
|
if (showCorrectAnswer) {
|
|
7241
7248
|
setDisplayAnswerMap(materialMap);
|
|
@@ -7639,8 +7646,12 @@ var ActivityPreviewByData = ({
|
|
|
7639
7646
|
if (optionList.length === 0) return;
|
|
7640
7647
|
setSelectedType(optionList[0].id);
|
|
7641
7648
|
}, [optionList]);
|
|
7649
|
+
const prevDataStringRef = (0, import_react27.useRef)("");
|
|
7642
7650
|
(0, import_react27.useEffect)(() => {
|
|
7643
7651
|
if (activityTemplateTypeList.length === 0) return;
|
|
7652
|
+
const dataString = JSON.stringify(data);
|
|
7653
|
+
if (dataString === prevDataStringRef.current) return;
|
|
7654
|
+
prevDataStringRef.current = dataString;
|
|
7644
7655
|
const currentAnswerMapMap = {};
|
|
7645
7656
|
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
7646
7657
|
if (answerType === activityTemplateMap.type) {
|
package/dist/index.mjs
CHANGED
|
@@ -4651,7 +4651,7 @@ var DropdownActivityMaterialContent = ({
|
|
|
4651
4651
|
/* @__PURE__ */ jsx28("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsx28("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
|
|
4652
4652
|
(materialKey, index) => {
|
|
4653
4653
|
const answerKey = Object.keys(materialMap[materialKey])[0];
|
|
4654
|
-
const learnerAnswerState = !isPreview ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
|
|
4654
|
+
const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
|
|
4655
4655
|
return /* @__PURE__ */ jsx28("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx28("div", { className: "mx-2", children: /* @__PURE__ */ jsxs18("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
4656
4656
|
/* @__PURE__ */ jsx28("div", { className: "my-auto", children: /* @__PURE__ */ jsxs18("p", { className: "text-xl", children: [
|
|
4657
4657
|
parseFloat(materialKey) + 1,
|
|
@@ -6153,7 +6153,8 @@ var MCMAActivityMaterialContent = ({
|
|
|
6153
6153
|
/* @__PURE__ */ jsx36("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ jsx36(DividerLine_default, {}) }),
|
|
6154
6154
|
/* @__PURE__ */ jsx36("div", { className: "flex-1 min-h-0 overflow-y-auto", children: checkCanAnswerQuestion() ? /* @__PURE__ */ jsx36("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
|
|
6155
6155
|
(materialSubKey, index2) => {
|
|
6156
|
-
const
|
|
6156
|
+
const currentDisplayAnswerList = displayAnswerMap[materialKey] || [];
|
|
6157
|
+
const foundAnswer = currentDisplayAnswerList.find(
|
|
6157
6158
|
(learnerAnswer) => learnerAnswer === materialSubKey
|
|
6158
6159
|
);
|
|
6159
6160
|
const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== foundAnswer ? "EMPTY" : checkAnswerState(correctAnswerList, foundAnswer);
|
|
@@ -6171,7 +6172,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6171
6172
|
/* @__PURE__ */ jsx36(
|
|
6172
6173
|
BaseImage_default,
|
|
6173
6174
|
{
|
|
6174
|
-
src:
|
|
6175
|
+
src: currentDisplayAnswerList.includes(materialSubKey) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
|
|
6175
6176
|
alt: "checkbox",
|
|
6176
6177
|
size: "small",
|
|
6177
6178
|
onClick: () => {
|
|
@@ -6202,7 +6203,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6202
6203
|
);
|
|
6203
6204
|
}
|
|
6204
6205
|
) }) : /* @__PURE__ */ jsx36("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
6205
|
-
displayAnswerMap[materialKey]
|
|
6206
|
+
displayAnswerMap[materialKey] || ""
|
|
6206
6207
|
).map((inputPart, index2) => /* @__PURE__ */ jsx36(
|
|
6207
6208
|
"span",
|
|
6208
6209
|
{
|
|
@@ -6847,7 +6848,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6847
6848
|
}
|
|
6848
6849
|
),
|
|
6849
6850
|
/* @__PURE__ */ jsx42("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
|
|
6850
|
-
const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
|
|
6851
|
+
const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
|
|
6851
6852
|
return /* @__PURE__ */ jsx42("div", { className: "w-full", children: /* @__PURE__ */ jsxs32(
|
|
6852
6853
|
"div",
|
|
6853
6854
|
{
|
|
@@ -6971,7 +6972,7 @@ var OrderingActivityContent = ({
|
|
|
6971
6972
|
var OrderingActivityContent_default = OrderingActivityContent;
|
|
6972
6973
|
|
|
6973
6974
|
// src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx
|
|
6974
|
-
import { useEffect as useEffect15, useState as useState25 } from "react";
|
|
6975
|
+
import { useEffect as useEffect15, useRef as useRef8, useState as useState25 } from "react";
|
|
6975
6976
|
import { InlineMath as InlineMath10 } from "react-katex";
|
|
6976
6977
|
import { Fragment as Fragment7, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6977
6978
|
var TrueFalseActivityMaterialContent = ({
|
|
@@ -6986,16 +6987,22 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
6986
6987
|
}) => {
|
|
6987
6988
|
const [shuffleOptionList, setShuffleOptionList] = useState25([]);
|
|
6988
6989
|
const [displayAnswerMap, setDisplayAnswerMap] = useState25(answerMap);
|
|
6990
|
+
const hasShuffledRef = useRef8(false);
|
|
6989
6991
|
useEffect15(() => {
|
|
6990
6992
|
const optionList = [];
|
|
6991
6993
|
optionList.push(...materialMap.trueList);
|
|
6992
6994
|
optionList.push(...materialMap.falseList);
|
|
6993
|
-
if (
|
|
6994
|
-
|
|
6995
|
+
if (!hasShuffledRef.current) {
|
|
6996
|
+
if (isPreview) {
|
|
6997
|
+
setShuffleOptionList(optionList);
|
|
6998
|
+
} else {
|
|
6999
|
+
setShuffleOptionList(shuffleArray(optionList));
|
|
7000
|
+
}
|
|
7001
|
+
hasShuffledRef.current = true;
|
|
6995
7002
|
} else {
|
|
6996
|
-
setShuffleOptionList(
|
|
7003
|
+
setShuffleOptionList(optionList);
|
|
6997
7004
|
}
|
|
6998
|
-
}, []);
|
|
7005
|
+
}, [materialMap]);
|
|
6999
7006
|
useEffect15(() => {
|
|
7000
7007
|
if (showCorrectAnswer) {
|
|
7001
7008
|
setDisplayAnswerMap(materialMap);
|
|
@@ -7282,7 +7289,7 @@ var ActivityEvaluationRubricContent = ({
|
|
|
7282
7289
|
var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
|
|
7283
7290
|
|
|
7284
7291
|
// src/components/activities/ActivityPreviewByData.tsx
|
|
7285
|
-
import { useEffect as useEffect16, useState as useState26 } from "react";
|
|
7292
|
+
import { useEffect as useEffect16, useRef as useRef9, useState as useState26 } from "react";
|
|
7286
7293
|
|
|
7287
7294
|
// src/components/boxes/SelectionBox.tsx
|
|
7288
7295
|
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -7399,8 +7406,12 @@ var ActivityPreviewByData = ({
|
|
|
7399
7406
|
if (optionList.length === 0) return;
|
|
7400
7407
|
setSelectedType(optionList[0].id);
|
|
7401
7408
|
}, [optionList]);
|
|
7409
|
+
const prevDataStringRef = useRef9("");
|
|
7402
7410
|
useEffect16(() => {
|
|
7403
7411
|
if (activityTemplateTypeList.length === 0) return;
|
|
7412
|
+
const dataString = JSON.stringify(data);
|
|
7413
|
+
if (dataString === prevDataStringRef.current) return;
|
|
7414
|
+
prevDataStringRef.current = dataString;
|
|
7404
7415
|
const currentAnswerMapMap = {};
|
|
7405
7416
|
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
7406
7417
|
if (answerType === activityTemplateMap.type) {
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import DropdownActivityContent from "./DropdownActivityContent";
|
|
3
3
|
import FillInTheBlanksActivityContent from "./FillInTheBlanksActivityContent";
|
|
4
4
|
import GroupingActivityContent from "./GroupingActivityContent";
|
|
@@ -102,8 +102,12 @@ const ActivityPreviewByData = ({
|
|
|
102
102
|
setSelectedType(optionList[0].id);
|
|
103
103
|
}, [optionList]);
|
|
104
104
|
|
|
105
|
+
const prevDataStringRef = useRef<string>("");
|
|
105
106
|
useEffect(() => {
|
|
106
107
|
if (activityTemplateTypeList.length === 0) return;
|
|
108
|
+
const dataString = JSON.stringify(data);
|
|
109
|
+
if (dataString === prevDataStringRef.current) return;
|
|
110
|
+
prevDataStringRef.current = dataString;
|
|
107
111
|
const currentAnswerMapMap: any = {};
|
|
108
112
|
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
109
113
|
if (answerType === activityTemplateMap.type) {
|
|
@@ -55,7 +55,9 @@ const DropdownActivityMaterialContent = ({
|
|
|
55
55
|
const answerKey = Object.keys(materialMap[materialKey])[0];
|
|
56
56
|
const learnerAnswerState = !isPreview
|
|
57
57
|
? null
|
|
58
|
-
:
|
|
58
|
+
: !showCorrectAnswer
|
|
59
|
+
? null
|
|
60
|
+
: checkAnswerState(answerKey, displayAnswerMap[materialKey]);
|
|
59
61
|
return (
|
|
60
62
|
<div key={index} className="w-full md:w-1/2">
|
|
61
63
|
<div className="mx-2">
|
|
@@ -56,7 +56,8 @@ const MCMAActivityMaterialContent = ({
|
|
|
56
56
|
<div className="flex flex-row w-full flex-wrap ">
|
|
57
57
|
{materialMap[materialKey].map(
|
|
58
58
|
(materialSubKey: string, index: number) => {
|
|
59
|
-
const
|
|
59
|
+
const currentDisplayAnswerList = displayAnswerMap[materialKey] || [];
|
|
60
|
+
const foundAnswer = currentDisplayAnswerList.find(
|
|
60
61
|
(learnerAnswer: string) => learnerAnswer === materialSubKey
|
|
61
62
|
);
|
|
62
63
|
const learnerAnswerState = !isPreview
|
|
@@ -84,7 +85,7 @@ const MCMAActivityMaterialContent = ({
|
|
|
84
85
|
>
|
|
85
86
|
<BaseImage
|
|
86
87
|
src={
|
|
87
|
-
|
|
88
|
+
currentDisplayAnswerList.includes(materialSubKey)
|
|
88
89
|
? "/icons/checkbox.webp"
|
|
89
90
|
: "/icons/checkbox-empty.webp"
|
|
90
91
|
}
|
|
@@ -131,7 +132,7 @@ const MCMAActivityMaterialContent = ({
|
|
|
131
132
|
) : (
|
|
132
133
|
<p key={materialKey} className="text-xl">
|
|
133
134
|
{constructInputWithSpecialExpressionList(
|
|
134
|
-
displayAnswerMap[materialKey]
|
|
135
|
+
displayAnswerMap[materialKey] || ""
|
|
135
136
|
).map((inputPart, index) => (
|
|
136
137
|
<span
|
|
137
138
|
key={index}
|
|
@@ -256,7 +256,9 @@ const OrderingActivityMaterialContent = ({
|
|
|
256
256
|
{Object.keys(displayAnswerMap).map((materialKey, index) => {
|
|
257
257
|
const learnerAnswerState = !isPreview
|
|
258
258
|
? null
|
|
259
|
-
:
|
|
259
|
+
: !showCorrectAnswer
|
|
260
|
+
? null
|
|
261
|
+
: checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
|
|
260
262
|
return (
|
|
261
263
|
<div className="w-full" key={index}>
|
|
262
264
|
<div
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import i18n from "../../../language/i18n";
|
|
3
3
|
import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
|
|
4
4
|
import { InlineMath } from "react-katex";
|
|
@@ -21,16 +21,22 @@ const TrueFalseActivityMaterialContent = ({
|
|
|
21
21
|
const [shuffleOptionList, setShuffleOptionList] = useState<any[]>([]);
|
|
22
22
|
const [displayAnswerMap, setDisplayAnswerMap] = useState<any>(answerMap);
|
|
23
23
|
|
|
24
|
+
const hasShuffledRef = useRef<boolean>(false);
|
|
24
25
|
useEffect(() => {
|
|
25
|
-
const optionList = [];
|
|
26
|
+
const optionList: any[] = [];
|
|
26
27
|
optionList.push(...materialMap.trueList);
|
|
27
28
|
optionList.push(...materialMap.falseList);
|
|
28
|
-
if (
|
|
29
|
-
|
|
29
|
+
if (!hasShuffledRef.current) {
|
|
30
|
+
if (isPreview) {
|
|
31
|
+
setShuffleOptionList(optionList);
|
|
32
|
+
} else {
|
|
33
|
+
setShuffleOptionList(shuffleArray(optionList));
|
|
34
|
+
}
|
|
35
|
+
hasShuffledRef.current = true;
|
|
30
36
|
} else {
|
|
31
|
-
setShuffleOptionList(
|
|
37
|
+
setShuffleOptionList(optionList);
|
|
32
38
|
}
|
|
33
|
-
}, []);
|
|
39
|
+
}, [materialMap]);
|
|
34
40
|
|
|
35
41
|
useEffect(() => {
|
|
36
42
|
if (showCorrectAnswer) {
|