catchup-library-web 2.2.2 → 2.2.4
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +235 -184
- package/dist/index.mjs +234 -183
- package/package.json +1 -1
- package/src/components/activities/ActivityPreviewByData.tsx +2 -0
- package/src/components/activities/MCMAActivityContent.tsx +2 -0
- package/src/components/activities/MCSAActivityContent.tsx +2 -0
- package/src/components/activities/material-contents/DropdownActivityMaterialContent.tsx +146 -142
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx +28 -19
- package/src/components/activities/material-contents/GroupingActivityMaterialContent.tsx +12 -8
- package/src/components/activities/material-contents/MCMAActivityMaterialContent.tsx +21 -3
- package/src/components/activities/material-contents/MCSAActivityMaterialContent.tsx +20 -3
- package/src/components/activities/material-contents/MatchingActivityMaterialContent.tsx +20 -13
- package/src/properties/ActivityProperties.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -4571,19 +4571,20 @@ var DropdownActivityMaterialContent = ({
|
|
|
4571
4571
|
isPreview,
|
|
4572
4572
|
showCorrectAnswer
|
|
4573
4573
|
}) => {
|
|
4574
|
-
const [
|
|
4574
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react16.useState)(answerMap);
|
|
4575
4575
|
(0, import_react15.useEffect)(() => {
|
|
4576
|
-
if (
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4576
|
+
if (showCorrectAnswer) {
|
|
4577
|
+
const correctAnswerMap = {};
|
|
4578
|
+
Object.keys(materialMap).forEach((materialMapKey) => {
|
|
4579
|
+
correctAnswerMap[materialMapKey] = Object.keys(
|
|
4580
|
+
materialMap[materialMapKey]
|
|
4581
|
+
)[0];
|
|
4582
|
+
});
|
|
4583
|
+
setDisplayAnswerMap(correctAnswerMap);
|
|
4584
|
+
} else {
|
|
4585
|
+
setDisplayAnswerMap(answerMap);
|
|
4586
|
+
}
|
|
4587
|
+
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
4587
4588
|
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
4588
4589
|
if (!isPreview) return null;
|
|
4589
4590
|
if (correctAnswer === learnerAnswer) {
|
|
@@ -4594,66 +4595,66 @@ var DropdownActivityMaterialContent = ({
|
|
|
4594
4595
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-row flex-wrap items-center", children: [
|
|
4595
4596
|
/* @__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") }) }),
|
|
4596
4597
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DividerLine_default, {}) }),
|
|
4597
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
|
|
4599
|
+
(materialKey, index) => {
|
|
4600
|
+
const answerKey = Object.keys(materialMap[materialKey])[0];
|
|
4601
|
+
const learnerAnswerState = checkAnswerState(
|
|
4602
|
+
answerKey,
|
|
4603
|
+
displayAnswerMap[materialKey]
|
|
4604
|
+
);
|
|
4605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
4606
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-xl", children: [
|
|
4607
|
+
parseFloat(materialKey) + 1,
|
|
4608
|
+
"."
|
|
4609
|
+
] }) }),
|
|
4610
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full relative", children: [
|
|
4611
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4612
|
+
InputGroup_default,
|
|
4613
|
+
{
|
|
4614
|
+
type: "select",
|
|
4615
|
+
value: displayAnswerMap[materialKey],
|
|
4616
|
+
optionList: shuffleArray(
|
|
4617
|
+
materialMap[materialKey][answerKey]
|
|
4618
|
+
).map((materialOption) => ({
|
|
4619
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4620
|
+
materialOption
|
|
4621
|
+
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4622
|
+
"span",
|
|
4623
|
+
{
|
|
4624
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4625
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4626
|
+
import_react_katex2.InlineMath,
|
|
4627
|
+
{
|
|
4628
|
+
math: inputPart.value
|
|
4629
|
+
}
|
|
4630
|
+
) }) : inputPart.value
|
|
4631
|
+
},
|
|
4632
|
+
index2
|
|
4633
|
+
)) }),
|
|
4634
|
+
value: materialOption
|
|
4635
|
+
})),
|
|
4636
|
+
onChange: (e) => {
|
|
4637
|
+
onChange(
|
|
4638
|
+
answerMap,
|
|
4639
|
+
materialKey,
|
|
4640
|
+
e.target.value
|
|
4641
|
+
);
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4645
|
+
MediaDropdown_default,
|
|
4646
|
+
{
|
|
4647
|
+
id: materialKey,
|
|
4648
|
+
answer: displayAnswerMap[materialKey] === "DEFAULT_OPTION" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-catchup-activity-media-box-item h-catchup-activity-media-box-item border rounded-catchup-xlarge border-dashed border-catchup-blue", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "italic", children: i18n_default.t("please_select") }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4649
|
+
ShowMaterialMediaByContentType_default,
|
|
4621
4650
|
{
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
{
|
|
4626
|
-
math: inputPart.value
|
|
4627
|
-
}
|
|
4628
|
-
) }) : inputPart.value
|
|
4651
|
+
contentType: contentMap.type,
|
|
4652
|
+
src: displayAnswerMap[materialKey],
|
|
4653
|
+
canFullScreen: false
|
|
4629
4654
|
},
|
|
4630
|
-
|
|
4631
|
-
)
|
|
4632
|
-
|
|
4633
|
-
})),
|
|
4634
|
-
onChange: (e) => {
|
|
4635
|
-
onChange(
|
|
4636
|
-
answerMap,
|
|
4637
|
-
materialKey,
|
|
4638
|
-
e.target.value
|
|
4639
|
-
);
|
|
4640
|
-
}
|
|
4641
|
-
}
|
|
4642
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4643
|
-
MediaDropdown_default,
|
|
4644
|
-
{
|
|
4645
|
-
id: materialKey,
|
|
4646
|
-
answer: answerMap[materialKey] === "DEFAULT_OPTION" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-catchup-activity-media-box-item h-catchup-activity-media-box-item border rounded-catchup-xlarge border-dashed border-catchup-blue", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "italic", children: i18n_default.t("please_select") }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4647
|
-
ShowMaterialMediaByContentType_default,
|
|
4648
|
-
{
|
|
4649
|
-
contentType: contentMap.type,
|
|
4650
|
-
src: answerMap[materialKey],
|
|
4651
|
-
canFullScreen: false
|
|
4652
|
-
},
|
|
4653
|
-
`${uniqueValue}-${index}`
|
|
4654
|
-
),
|
|
4655
|
-
optionList: materialMap[materialKey][answerKey].map(
|
|
4656
|
-
(materialOption, index2) => ({
|
|
4655
|
+
`${uniqueValue}-${index}`
|
|
4656
|
+
),
|
|
4657
|
+
optionList: materialMap[materialKey][answerKey].map((materialOption, index2) => ({
|
|
4657
4658
|
id: index2,
|
|
4658
4659
|
media: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4659
4660
|
ShowMaterialMediaByContentType_default,
|
|
@@ -4671,37 +4672,37 @@ var DropdownActivityMaterialContent = ({
|
|
|
4671
4672
|
e.target.currentSrc
|
|
4672
4673
|
);
|
|
4673
4674
|
}
|
|
4674
|
-
})
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
}
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
}
|
|
4701
|
-
|
|
4702
|
-
] })
|
|
4703
|
-
|
|
4704
|
-
|
|
4675
|
+
}))
|
|
4676
|
+
}
|
|
4677
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4678
|
+
displayAnswerMap[materialKey]
|
|
4679
|
+
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4680
|
+
"span",
|
|
4681
|
+
{
|
|
4682
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4683
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_katex2.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
4684
|
+
},
|
|
4685
|
+
index2
|
|
4686
|
+
)) }) }),
|
|
4687
|
+
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute -top-2 right-3 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4688
|
+
BaseImage_default,
|
|
4689
|
+
{
|
|
4690
|
+
src: "/icons/checkbox.webp",
|
|
4691
|
+
alt: "chekbbox",
|
|
4692
|
+
size: "small"
|
|
4693
|
+
}
|
|
4694
|
+
) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute -top-2 right-3 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4695
|
+
BaseImage_default,
|
|
4696
|
+
{
|
|
4697
|
+
src: "/icons/cross-red.webp",
|
|
4698
|
+
alt: "cross-red",
|
|
4699
|
+
size: "small"
|
|
4700
|
+
}
|
|
4701
|
+
) }) : null
|
|
4702
|
+
] })
|
|
4703
|
+
] }) }) }, index);
|
|
4704
|
+
}
|
|
4705
|
+
) })
|
|
4705
4706
|
] });
|
|
4706
4707
|
};
|
|
4707
4708
|
var DropdownActivityMaterialContent_default = DropdownActivityMaterialContent;
|
|
@@ -4808,6 +4809,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4808
4809
|
const [draggedElement, setDraggedElement] = (0, import_react18.useState)(
|
|
4809
4810
|
null
|
|
4810
4811
|
);
|
|
4812
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react18.useState)(answerMap);
|
|
4811
4813
|
const dragElementRef = (0, import_react18.useRef)(null);
|
|
4812
4814
|
const [mousePosition, setMousePosition] = (0, import_react18.useState)({
|
|
4813
4815
|
x: 0,
|
|
@@ -4821,12 +4823,18 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4821
4823
|
setShuffleOptionList(shuffleArray(optionList));
|
|
4822
4824
|
}, [optionList]);
|
|
4823
4825
|
(0, import_react18.useEffect)(() => {
|
|
4824
|
-
if (
|
|
4825
|
-
|
|
4826
|
-
(materialMapKey) =>
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4826
|
+
if (showCorrectAnswer) {
|
|
4827
|
+
const correctAnswerMap = {};
|
|
4828
|
+
Object.keys(materialMap).forEach((materialMapKey) => {
|
|
4829
|
+
correctAnswerMap[materialMapKey] = JSON.parse(
|
|
4830
|
+
materialMap[materialMapKey]
|
|
4831
|
+
)[0];
|
|
4832
|
+
});
|
|
4833
|
+
setDisplayAnswerMap(correctAnswerMap);
|
|
4834
|
+
} else {
|
|
4835
|
+
setDisplayAnswerMap(answerMap);
|
|
4836
|
+
}
|
|
4837
|
+
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
4830
4838
|
const checkAnswerState = (correctAnswerList, learnerAnswer) => {
|
|
4831
4839
|
if (!isPreview) return null;
|
|
4832
4840
|
const foundIndex = correctAnswerList.findIndex(
|
|
@@ -4837,8 +4845,10 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4837
4845
|
}
|
|
4838
4846
|
return "INCORRECT";
|
|
4839
4847
|
};
|
|
4840
|
-
const checkAnswerProvided = (
|
|
4841
|
-
return Object.keys(
|
|
4848
|
+
const checkAnswerProvided = (currentAnswerMap, option) => {
|
|
4849
|
+
return Object.keys(currentAnswerMap).findIndex(
|
|
4850
|
+
(key) => currentAnswerMap[key] === option
|
|
4851
|
+
) !== -1;
|
|
4842
4852
|
};
|
|
4843
4853
|
const handleMouseDown = (e, option) => {
|
|
4844
4854
|
e.preventDefault();
|
|
@@ -4970,7 +4980,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4970
4980
|
}
|
|
4971
4981
|
),
|
|
4972
4982
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap gap-x-2 gap-y-2 my-2", children: shuffleOptionList.map(
|
|
4973
|
-
(option, index) => checkAnswerProvided(
|
|
4983
|
+
(option, index) => checkAnswerProvided(displayAnswerMap, option) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4974
4984
|
ShowMaterialMediaByContentType_default,
|
|
4975
4985
|
{
|
|
4976
4986
|
contentType: contentMap.type,
|
|
@@ -5020,10 +5030,10 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5020
5030
|
index
|
|
5021
5031
|
)
|
|
5022
5032
|
) }),
|
|
5023
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
|
|
5024
5034
|
const learnerAnswerState = checkAnswerState(
|
|
5025
5035
|
JSON.parse(materialMap[materialKey]),
|
|
5026
|
-
|
|
5036
|
+
displayAnswerMap[materialKey]
|
|
5027
5037
|
);
|
|
5028
5038
|
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.jsx)(
|
|
5029
5039
|
"div",
|
|
@@ -5042,17 +5052,17 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5042
5052
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5043
5053
|
"div",
|
|
5044
5054
|
{
|
|
5045
|
-
className: `w-full min-h-[44px] border rounded-lg ${
|
|
5055
|
+
className: `w-full min-h-[44px] border rounded-lg ${displayAnswerMap[materialKey] ? "border-catchup-blue-400 px-2 cursor-pointer" : "bg-catchup-gray-50 border-catchup-gray-200 border-dashed py-2 px-4"}`,
|
|
5046
5056
|
onClick: (e) => {
|
|
5047
|
-
if (
|
|
5057
|
+
if (displayAnswerMap[materialKey]) {
|
|
5048
5058
|
e.stopPropagation();
|
|
5049
5059
|
onChange(answerMap, materialKey, "");
|
|
5050
5060
|
}
|
|
5051
5061
|
},
|
|
5052
|
-
children:
|
|
5062
|
+
children: displayAnswerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5053
5063
|
InputWithSpecialExpression_default,
|
|
5054
5064
|
{
|
|
5055
|
-
value:
|
|
5065
|
+
value: displayAnswerMap[materialKey],
|
|
5056
5066
|
showSpecialOnly: false
|
|
5057
5067
|
}
|
|
5058
5068
|
) : null
|
|
@@ -5073,7 +5083,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5073
5083
|
size: "small"
|
|
5074
5084
|
}
|
|
5075
5085
|
) }) : null
|
|
5076
|
-
] }) :
|
|
5086
|
+
] }) : displayAnswerMap[materialKey] === "" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5077
5087
|
"div",
|
|
5078
5088
|
{
|
|
5079
5089
|
className: `w-catchup-activity-media-box-item h-catchup-activity-media-box-item border rounded-catchup-xlarge border-dashed ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
|
|
@@ -5091,14 +5101,14 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5091
5101
|
ShowMaterialMediaByContentType_default,
|
|
5092
5102
|
{
|
|
5093
5103
|
contentType: contentMap.type,
|
|
5094
|
-
src:
|
|
5104
|
+
src: displayAnswerMap[materialKey],
|
|
5095
5105
|
canFullScreen: true
|
|
5096
5106
|
},
|
|
5097
5107
|
`${uniqueValue}-${index}`
|
|
5098
5108
|
)
|
|
5099
5109
|
}
|
|
5100
5110
|
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
5101
|
-
|
|
5111
|
+
displayAnswerMap[materialKey]
|
|
5102
5112
|
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5103
5113
|
"span",
|
|
5104
5114
|
{
|
|
@@ -5218,6 +5228,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5218
5228
|
null
|
|
5219
5229
|
);
|
|
5220
5230
|
const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react20.useState)([]);
|
|
5231
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react20.useState)(answerMap);
|
|
5221
5232
|
const dragElementRef = (0, import_react20.useRef)(null);
|
|
5222
5233
|
const [mousePosition, setMousePosition] = (0, import_react20.useState)({
|
|
5223
5234
|
x: 0,
|
|
@@ -5250,8 +5261,11 @@ var GroupingActivityMaterialContent = ({
|
|
|
5250
5261
|
hasShuffledRef.current = true;
|
|
5251
5262
|
}, [materialMap]);
|
|
5252
5263
|
(0, import_react20.useEffect)(() => {
|
|
5253
|
-
if (
|
|
5254
|
-
|
|
5264
|
+
if (showCorrectAnswer) {
|
|
5265
|
+
setDisplayAnswerMap(materialMap);
|
|
5266
|
+
} else {
|
|
5267
|
+
setDisplayAnswerMap(answerMap);
|
|
5268
|
+
}
|
|
5255
5269
|
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
5256
5270
|
(0, import_react20.useEffect)(() => {
|
|
5257
5271
|
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
@@ -5297,10 +5311,10 @@ var GroupingActivityMaterialContent = ({
|
|
|
5297
5311
|
};
|
|
5298
5312
|
requestAnimationFrame(animate);
|
|
5299
5313
|
}, [dropTargetKey]);
|
|
5300
|
-
const retrieveFilteredMaterialList = (
|
|
5314
|
+
const retrieveFilteredMaterialList = (currentAnswerMap) => {
|
|
5301
5315
|
const selectedValueList = [];
|
|
5302
|
-
Object.keys(
|
|
5303
|
-
|
|
5316
|
+
Object.keys(currentAnswerMap).forEach((key) => {
|
|
5317
|
+
currentAnswerMap[key].forEach((value) => {
|
|
5304
5318
|
selectedValueList.push(value);
|
|
5305
5319
|
});
|
|
5306
5320
|
});
|
|
@@ -5391,7 +5405,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5391
5405
|
setSelectedValue(null);
|
|
5392
5406
|
}
|
|
5393
5407
|
};
|
|
5394
|
-
const filteredMaterialList = retrieveFilteredMaterialList(
|
|
5408
|
+
const filteredMaterialList = retrieveFilteredMaterialList(displayAnswerMap);
|
|
5395
5409
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
5396
5410
|
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5397
5411
|
"div",
|
|
@@ -5493,7 +5507,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5493
5507
|
}) }),
|
|
5494
5508
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DividerLine_default, {})
|
|
5495
5509
|
] }) : null,
|
|
5496
|
-
Object.keys(
|
|
5510
|
+
Object.keys(displayAnswerMap).map((answerMapKey, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-row w-full", children: [
|
|
5497
5511
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5498
5512
|
"div",
|
|
5499
5513
|
{
|
|
@@ -5520,7 +5534,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5520
5534
|
onMouseLeave: () => setDropTargetKey(null),
|
|
5521
5535
|
onClick: () => handleDropZoneClick(answerMapKey),
|
|
5522
5536
|
className: `${dropTargetKey === answerMapKey ? "bg-catchup-light-blue ring-2 ring-blue-400" : ""} flex-1 border-catchup-blue rounded-catchup-xlarge border-2 h-full p-1 transition-all duration-200`,
|
|
5523
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-full w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-row items-center gap-2 w-max h-full", children:
|
|
5537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-full w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-row items-center gap-2 w-max h-full", children: displayAnswerMap[answerMapKey].map(
|
|
5524
5538
|
(answerMapValue, answerMapIndex) => {
|
|
5525
5539
|
const learnerAnswerState = checkAnswerState(
|
|
5526
5540
|
materialMap[answerMapKey],
|
|
@@ -5651,6 +5665,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5651
5665
|
null
|
|
5652
5666
|
);
|
|
5653
5667
|
const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react21.useState)([]);
|
|
5668
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react21.useState)(answerMap);
|
|
5654
5669
|
const dragElementRef = (0, import_react21.useRef)(null);
|
|
5655
5670
|
const [mousePosition, setMousePosition] = (0, import_react21.useState)({
|
|
5656
5671
|
x: 0,
|
|
@@ -5681,9 +5696,12 @@ var MatchingActivityMaterialContent = ({
|
|
|
5681
5696
|
hasShuffledRef.current = true;
|
|
5682
5697
|
}, [materialMap]);
|
|
5683
5698
|
(0, import_react21.useEffect)(() => {
|
|
5684
|
-
if (
|
|
5685
|
-
|
|
5686
|
-
|
|
5699
|
+
if (showCorrectAnswer) {
|
|
5700
|
+
setDisplayAnswerMap(materialMap);
|
|
5701
|
+
} else {
|
|
5702
|
+
setDisplayAnswerMap(answerMap);
|
|
5703
|
+
}
|
|
5704
|
+
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
5687
5705
|
(0, import_react21.useEffect)(() => {
|
|
5688
5706
|
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
5689
5707
|
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
@@ -5728,10 +5746,10 @@ var MatchingActivityMaterialContent = ({
|
|
|
5728
5746
|
};
|
|
5729
5747
|
requestAnimationFrame(animate);
|
|
5730
5748
|
}, [dropTargetKey]);
|
|
5731
|
-
const retrieveFilteredMaterialList = (
|
|
5749
|
+
const retrieveFilteredMaterialList = (currentAnswerMap) => {
|
|
5732
5750
|
const selectedValueList = [];
|
|
5733
|
-
Object.keys(
|
|
5734
|
-
selectedValueList.push(
|
|
5751
|
+
Object.keys(currentAnswerMap).forEach((key) => {
|
|
5752
|
+
selectedValueList.push(currentAnswerMap[key]);
|
|
5735
5753
|
});
|
|
5736
5754
|
return shuffledMaterialList.filter(
|
|
5737
5755
|
(material) => selectedValueList.findIndex((value) => material === value) === -1
|
|
@@ -5816,7 +5834,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5816
5834
|
setSelectedValue(null);
|
|
5817
5835
|
}
|
|
5818
5836
|
};
|
|
5819
|
-
const filteredMaterialList = retrieveFilteredMaterialList(
|
|
5837
|
+
const filteredMaterialList = retrieveFilteredMaterialList(displayAnswerMap);
|
|
5820
5838
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
5821
5839
|
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5822
5840
|
"div",
|
|
@@ -5923,10 +5941,10 @@ var MatchingActivityMaterialContent = ({
|
|
|
5923
5941
|
),
|
|
5924
5942
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DividerLine_default, {}) })
|
|
5925
5943
|
] }) : null,
|
|
5926
|
-
Object.keys(
|
|
5944
|
+
Object.keys(displayAnswerMap).map((answerMapKey, index) => {
|
|
5927
5945
|
const learnerAnswerState = checkAnswerState(
|
|
5928
5946
|
materialMap[answerMapKey],
|
|
5929
|
-
|
|
5947
|
+
displayAnswerMap[answerMapKey]
|
|
5930
5948
|
);
|
|
5931
5949
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-row w-full", children: [
|
|
5932
5950
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -5961,13 +5979,13 @@ var MatchingActivityMaterialContent = ({
|
|
|
5961
5979
|
className: "h-full flex-1 flex flex-row items-center justify-center px-4",
|
|
5962
5980
|
onClick: (e) => {
|
|
5963
5981
|
e.stopPropagation();
|
|
5964
|
-
if (checkCanAnswerQuestion() &&
|
|
5982
|
+
if (checkCanAnswerQuestion() && displayAnswerMap[answerMapKey]) {
|
|
5965
5983
|
onChange(answerMap, answerMapKey, null);
|
|
5966
5984
|
setSelectedValue(null);
|
|
5967
5985
|
}
|
|
5968
5986
|
},
|
|
5969
|
-
children:
|
|
5970
|
-
|
|
5987
|
+
children: displayAnswerMap[answerMapKey] ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
5988
|
+
displayAnswerMap[answerMapKey]
|
|
5971
5989
|
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5972
5990
|
"span",
|
|
5973
5991
|
{
|
|
@@ -5979,7 +5997,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5979
5997
|
ShowMaterialMediaByContentType_default,
|
|
5980
5998
|
{
|
|
5981
5999
|
contentType: contentMap.type,
|
|
5982
|
-
src:
|
|
6000
|
+
src: displayAnswerMap[answerMapKey],
|
|
5983
6001
|
canFullScreen: false
|
|
5984
6002
|
},
|
|
5985
6003
|
`${uniqueValue}-${index}`
|
|
@@ -6039,6 +6057,7 @@ var MatchingActivityContent = ({
|
|
|
6039
6057
|
var MatchingActivityContent_default = MatchingActivityContent;
|
|
6040
6058
|
|
|
6041
6059
|
// src/components/activities/material-contents/MCMAActivityMaterialContent.tsx
|
|
6060
|
+
var import_react22 = require("react");
|
|
6042
6061
|
var import_react_katex7 = require("react-katex");
|
|
6043
6062
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6044
6063
|
var MCMAActivityMaterialContent = ({
|
|
@@ -6048,8 +6067,21 @@ var MCMAActivityMaterialContent = ({
|
|
|
6048
6067
|
contentMap,
|
|
6049
6068
|
checkCanAnswerQuestion,
|
|
6050
6069
|
onChange,
|
|
6051
|
-
isPreview
|
|
6070
|
+
isPreview,
|
|
6071
|
+
showCorrectAnswer
|
|
6052
6072
|
}) => {
|
|
6073
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react22.useState)(answerMap);
|
|
6074
|
+
(0, import_react22.useEffect)(() => {
|
|
6075
|
+
if (showCorrectAnswer) {
|
|
6076
|
+
const correctAnswerMap = {};
|
|
6077
|
+
Object.keys(materialMap).forEach((materialKey) => {
|
|
6078
|
+
correctAnswerMap[materialKey] = JSON.parse(materialKey);
|
|
6079
|
+
});
|
|
6080
|
+
setDisplayAnswerMap(correctAnswerMap);
|
|
6081
|
+
} else {
|
|
6082
|
+
setDisplayAnswerMap(answerMap);
|
|
6083
|
+
}
|
|
6084
|
+
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
6053
6085
|
const retrieveCorrectAnswerList = () => {
|
|
6054
6086
|
return JSON.parse(Object.keys(materialMap)[0]);
|
|
6055
6087
|
};
|
|
@@ -6071,7 +6103,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6071
6103
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DividerLine_default, {}) }),
|
|
6072
6104
|
checkCanAnswerQuestion() ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
|
|
6073
6105
|
(materialSubKey, index2) => {
|
|
6074
|
-
const foundAnswer =
|
|
6106
|
+
const foundAnswer = displayAnswerMap[materialKey].find(
|
|
6075
6107
|
(learnerAnswer) => learnerAnswer === materialSubKey
|
|
6076
6108
|
);
|
|
6077
6109
|
const learnerAnswerState = checkAnswerState(
|
|
@@ -6093,7 +6125,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6093
6125
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6094
6126
|
BaseImage_default,
|
|
6095
6127
|
{
|
|
6096
|
-
src:
|
|
6128
|
+
src: displayAnswerMap[materialKey].includes(materialSubKey) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
|
|
6097
6129
|
alt: "checkbox",
|
|
6098
6130
|
size: "small",
|
|
6099
6131
|
onClick: () => {
|
|
@@ -6124,7 +6156,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6124
6156
|
);
|
|
6125
6157
|
}
|
|
6126
6158
|
) }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
6127
|
-
|
|
6159
|
+
displayAnswerMap[materialKey]
|
|
6128
6160
|
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6129
6161
|
"span",
|
|
6130
6162
|
{
|
|
@@ -6146,6 +6178,7 @@ var MCMAActivityContent = ({
|
|
|
6146
6178
|
canAnswerQuestion,
|
|
6147
6179
|
changeAnswer,
|
|
6148
6180
|
isPreview,
|
|
6181
|
+
showCorrectAnswer,
|
|
6149
6182
|
isFullScreen
|
|
6150
6183
|
}) => {
|
|
6151
6184
|
const contentMap = parseContentMapFromData(data);
|
|
@@ -6176,7 +6209,8 @@ var MCMAActivityContent = ({
|
|
|
6176
6209
|
contentMap,
|
|
6177
6210
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
6178
6211
|
onChange: handleMCMAAnswerOnChange,
|
|
6179
|
-
isPreview
|
|
6212
|
+
isPreview,
|
|
6213
|
+
showCorrectAnswer
|
|
6180
6214
|
}
|
|
6181
6215
|
) })
|
|
6182
6216
|
] });
|
|
@@ -6184,6 +6218,7 @@ var MCMAActivityContent = ({
|
|
|
6184
6218
|
var MCMAActivityContent_default = MCMAActivityContent;
|
|
6185
6219
|
|
|
6186
6220
|
// src/components/activities/material-contents/MCSAActivityMaterialContent.tsx
|
|
6221
|
+
var import_react23 = require("react");
|
|
6187
6222
|
var import_react_katex8 = require("react-katex");
|
|
6188
6223
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6189
6224
|
var MCSAActivityMaterialContent = ({
|
|
@@ -6193,8 +6228,21 @@ var MCSAActivityMaterialContent = ({
|
|
|
6193
6228
|
contentMap,
|
|
6194
6229
|
checkCanAnswerQuestion,
|
|
6195
6230
|
onChange,
|
|
6196
|
-
isPreview
|
|
6231
|
+
isPreview,
|
|
6232
|
+
showCorrectAnswer
|
|
6197
6233
|
}) => {
|
|
6234
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react23.useState)(answerMap);
|
|
6235
|
+
(0, import_react23.useEffect)(() => {
|
|
6236
|
+
if (showCorrectAnswer) {
|
|
6237
|
+
const correctAnswerMap = {};
|
|
6238
|
+
Object.keys(materialMap).forEach((materialKey) => {
|
|
6239
|
+
correctAnswerMap[materialKey] = materialMap[materialKey][0];
|
|
6240
|
+
});
|
|
6241
|
+
setDisplayAnswerMap(correctAnswerMap);
|
|
6242
|
+
} else {
|
|
6243
|
+
setDisplayAnswerMap(answerMap);
|
|
6244
|
+
}
|
|
6245
|
+
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
6198
6246
|
const retrieveCorrectAnswer = () => {
|
|
6199
6247
|
return Object.keys(materialMap)[0];
|
|
6200
6248
|
};
|
|
@@ -6220,7 +6268,7 @@ var MCSAActivityMaterialContent = ({
|
|
|
6220
6268
|
const learnerAnswerState = checkAnswerState(
|
|
6221
6269
|
correctAnswer,
|
|
6222
6270
|
materialSubKey,
|
|
6223
|
-
|
|
6271
|
+
displayAnswerMap[materialKey]
|
|
6224
6272
|
);
|
|
6225
6273
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6226
6274
|
"div",
|
|
@@ -6233,7 +6281,7 @@ var MCSAActivityMaterialContent = ({
|
|
|
6233
6281
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6234
6282
|
BaseImage_default,
|
|
6235
6283
|
{
|
|
6236
|
-
src:
|
|
6284
|
+
src: displayAnswerMap[materialKey] === materialSubKey ? "/icons/item-element.webp" : "/icons/not-selected-item-element.webp",
|
|
6237
6285
|
alt: "circle",
|
|
6238
6286
|
size: "small",
|
|
6239
6287
|
onClick: () => {
|
|
@@ -6266,7 +6314,7 @@ var MCSAActivityMaterialContent = ({
|
|
|
6266
6314
|
)
|
|
6267
6315
|
}
|
|
6268
6316
|
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6269
|
-
|
|
6317
|
+
displayAnswerMap[materialKey]
|
|
6270
6318
|
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6271
6319
|
"span",
|
|
6272
6320
|
{
|
|
@@ -6288,6 +6336,7 @@ var MCSAActivityContent = ({
|
|
|
6288
6336
|
canAnswerQuestion,
|
|
6289
6337
|
changeAnswer,
|
|
6290
6338
|
isPreview,
|
|
6339
|
+
showCorrectAnswer,
|
|
6291
6340
|
isFullScreen
|
|
6292
6341
|
}) => {
|
|
6293
6342
|
const contentMap = parseContentMapFromData(data);
|
|
@@ -6311,6 +6360,7 @@ var MCSAActivityContent = ({
|
|
|
6311
6360
|
contentMap,
|
|
6312
6361
|
checkCanAnswerQuestion: canAnswerQuestion,
|
|
6313
6362
|
onChange: handleMCSAAnswerOnChange,
|
|
6363
|
+
showCorrectAnswer,
|
|
6314
6364
|
isPreview
|
|
6315
6365
|
}
|
|
6316
6366
|
) })
|
|
@@ -6491,21 +6541,21 @@ var OpenEndedActivityContent = ({
|
|
|
6491
6541
|
var OpenEndedActivityContent_default = OpenEndedActivityContent;
|
|
6492
6542
|
|
|
6493
6543
|
// src/components/activities/material-contents/OrderingActivityMaterialContent.tsx
|
|
6494
|
-
var
|
|
6544
|
+
var import_react25 = require("react");
|
|
6495
6545
|
var import_react_katex9 = require("react-katex");
|
|
6496
6546
|
|
|
6497
6547
|
// src/hooks/useScreenSize.ts
|
|
6498
|
-
var
|
|
6548
|
+
var import_react24 = require("react");
|
|
6499
6549
|
var useScreenSize = () => {
|
|
6500
|
-
const [containerSize, setContainerSize] = (0,
|
|
6550
|
+
const [containerSize, setContainerSize] = (0, import_react24.useState)({
|
|
6501
6551
|
width: 0,
|
|
6502
6552
|
height: 0
|
|
6503
6553
|
});
|
|
6504
|
-
const [screenSize, setScreenSize] = (0,
|
|
6554
|
+
const [screenSize, setScreenSize] = (0, import_react24.useState)({
|
|
6505
6555
|
width: window.innerWidth,
|
|
6506
6556
|
height: window.innerHeight
|
|
6507
6557
|
});
|
|
6508
|
-
(0,
|
|
6558
|
+
(0, import_react24.useEffect)(() => {
|
|
6509
6559
|
const handleResize = () => {
|
|
6510
6560
|
setScreenSize({
|
|
6511
6561
|
width: window.innerWidth,
|
|
@@ -6541,25 +6591,25 @@ var OrderingActivityMaterialContent = ({
|
|
|
6541
6591
|
isPreview,
|
|
6542
6592
|
showCorrectAnswer
|
|
6543
6593
|
}) => {
|
|
6544
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
6545
|
-
const [draggedKey, setDraggedKey] = (0,
|
|
6546
|
-
const [dropTargetKey, setDropTargetKey] = (0,
|
|
6547
|
-
const [draggedElement, setDraggedElement] = (0,
|
|
6594
|
+
const [selectedKey, setSelectedKey] = (0, import_react25.useState)(null);
|
|
6595
|
+
const [draggedKey, setDraggedKey] = (0, import_react25.useState)(null);
|
|
6596
|
+
const [dropTargetKey, setDropTargetKey] = (0, import_react25.useState)(null);
|
|
6597
|
+
const [draggedElement, setDraggedElement] = (0, import_react25.useState)(
|
|
6548
6598
|
null
|
|
6549
6599
|
);
|
|
6550
|
-
const dragElementRef = (0,
|
|
6551
|
-
const [mousePosition, setMousePosition] = (0,
|
|
6600
|
+
const dragElementRef = (0, import_react25.useRef)(null);
|
|
6601
|
+
const [mousePosition, setMousePosition] = (0, import_react25.useState)({
|
|
6552
6602
|
x: 0,
|
|
6553
6603
|
y: 0
|
|
6554
6604
|
});
|
|
6555
|
-
const [touchPosition, setTouchPosition] = (0,
|
|
6605
|
+
const [touchPosition, setTouchPosition] = (0, import_react25.useState)({
|
|
6556
6606
|
x: 0,
|
|
6557
6607
|
y: 0
|
|
6558
6608
|
});
|
|
6559
6609
|
const { screenSize } = useScreenSize_default();
|
|
6560
|
-
const [view, setView] = (0,
|
|
6561
|
-
const [displayAnswerMap, setDisplayAnswerMap] = (0,
|
|
6562
|
-
(0,
|
|
6610
|
+
const [view, setView] = (0, import_react25.useState)("PC");
|
|
6611
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react25.useState)(answerMap);
|
|
6612
|
+
(0, import_react25.useEffect)(() => {
|
|
6563
6613
|
if (!screenSize) return;
|
|
6564
6614
|
if (screenSize.width <= 1024) {
|
|
6565
6615
|
setView("TABLET");
|
|
@@ -6567,7 +6617,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6567
6617
|
setView("PC");
|
|
6568
6618
|
}
|
|
6569
6619
|
}, [screenSize]);
|
|
6570
|
-
(0,
|
|
6620
|
+
(0, import_react25.useEffect)(() => {
|
|
6571
6621
|
if (showCorrectAnswer) {
|
|
6572
6622
|
const correctAnswerMap = {};
|
|
6573
6623
|
Object.keys(answerMap).forEach((answerKey, index) => {
|
|
@@ -6858,7 +6908,7 @@ var OrderingActivityContent = ({
|
|
|
6858
6908
|
var OrderingActivityContent_default = OrderingActivityContent;
|
|
6859
6909
|
|
|
6860
6910
|
// src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx
|
|
6861
|
-
var
|
|
6911
|
+
var import_react26 = require("react");
|
|
6862
6912
|
var import_react_katex10 = require("react-katex");
|
|
6863
6913
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6864
6914
|
var TrueFalseActivityMaterialContent = ({
|
|
@@ -6871,9 +6921,9 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
6871
6921
|
isPreview,
|
|
6872
6922
|
showCorrectAnswer
|
|
6873
6923
|
}) => {
|
|
6874
|
-
const [shuffleOptionList, setShuffleOptionList] = (0,
|
|
6875
|
-
const [displayAnswerMap, setDisplayAnswerMap] = (0,
|
|
6876
|
-
(0,
|
|
6924
|
+
const [shuffleOptionList, setShuffleOptionList] = (0, import_react26.useState)([]);
|
|
6925
|
+
const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react26.useState)(answerMap);
|
|
6926
|
+
(0, import_react26.useEffect)(() => {
|
|
6877
6927
|
const optionList = [];
|
|
6878
6928
|
optionList.push(...materialMap.trueList);
|
|
6879
6929
|
optionList.push(...materialMap.falseList);
|
|
@@ -6883,7 +6933,7 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
6883
6933
|
setShuffleOptionList(shuffleArray(optionList));
|
|
6884
6934
|
}
|
|
6885
6935
|
}, []);
|
|
6886
|
-
(0,
|
|
6936
|
+
(0, import_react26.useEffect)(() => {
|
|
6887
6937
|
if (showCorrectAnswer) {
|
|
6888
6938
|
setDisplayAnswerMap(materialMap);
|
|
6889
6939
|
} else {
|
|
@@ -7172,7 +7222,7 @@ var ActivityEvaluationRubricContent = ({
|
|
|
7172
7222
|
var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
|
|
7173
7223
|
|
|
7174
7224
|
// src/components/activities/ActivityPreviewByData.tsx
|
|
7175
|
-
var
|
|
7225
|
+
var import_react27 = require("react");
|
|
7176
7226
|
|
|
7177
7227
|
// src/components/boxes/SelectionBox.tsx
|
|
7178
7228
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
@@ -7239,11 +7289,11 @@ var ActivityPreviewByData = ({
|
|
|
7239
7289
|
isFullScreen = false,
|
|
7240
7290
|
showCorrectAnswer = false
|
|
7241
7291
|
}) => {
|
|
7242
|
-
const [selectedType, setSelectedType] = (0,
|
|
7243
|
-
const [optionList, setOptionList] = (0,
|
|
7244
|
-
const [answerMapMap, setAnswerMapMap] = (0,
|
|
7245
|
-
const [activityTemplateTypeList, setActivityTemplateTypeList] = (0,
|
|
7246
|
-
(0,
|
|
7292
|
+
const [selectedType, setSelectedType] = (0, import_react27.useState)(null);
|
|
7293
|
+
const [optionList, setOptionList] = (0, import_react27.useState)([]);
|
|
7294
|
+
const [answerMapMap, setAnswerMapMap] = (0, import_react27.useState)({});
|
|
7295
|
+
const [activityTemplateTypeList, setActivityTemplateTypeList] = (0, import_react27.useState)([]);
|
|
7296
|
+
(0, import_react27.useEffect)(() => {
|
|
7247
7297
|
if (!data) return;
|
|
7248
7298
|
let currentActivityTemplateMapList = JSON.parse(
|
|
7249
7299
|
JSON.stringify(ACTIVITY_TEMPLATE_LIST)
|
|
@@ -7261,7 +7311,7 @@ var ActivityPreviewByData = ({
|
|
|
7261
7311
|
}
|
|
7262
7312
|
setActivityTemplateTypeList(currentActivityTemplateMapList);
|
|
7263
7313
|
}, [data, answerType, typeList]);
|
|
7264
|
-
(0,
|
|
7314
|
+
(0, import_react27.useEffect)(() => {
|
|
7265
7315
|
if (activityTemplateTypeList.length === 0) return;
|
|
7266
7316
|
const currentOptionList = [];
|
|
7267
7317
|
for (const activityTemplateType of activityTemplateTypeList) {
|
|
@@ -7281,11 +7331,11 @@ var ActivityPreviewByData = ({
|
|
|
7281
7331
|
}
|
|
7282
7332
|
setOptionList(currentOptionList);
|
|
7283
7333
|
}, [activityTemplateTypeList, showDifficulty]);
|
|
7284
|
-
(0,
|
|
7334
|
+
(0, import_react27.useEffect)(() => {
|
|
7285
7335
|
if (optionList.length === 0) return;
|
|
7286
7336
|
setSelectedType(optionList[0].id);
|
|
7287
7337
|
}, [optionList]);
|
|
7288
|
-
(0,
|
|
7338
|
+
(0, import_react27.useEffect)(() => {
|
|
7289
7339
|
if (activityTemplateTypeList.length === 0) return;
|
|
7290
7340
|
const currentAnswerMapMap = {};
|
|
7291
7341
|
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
@@ -7369,6 +7419,7 @@ var ActivityPreviewByData = ({
|
|
|
7369
7419
|
}
|
|
7370
7420
|
};
|
|
7371
7421
|
if (!data) return null;
|
|
7422
|
+
console.log(optionList);
|
|
7372
7423
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
|
|
7373
7424
|
showType && optionList.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
7374
7425
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "mb-4", children: [
|
|
@@ -7468,7 +7519,7 @@ var LeftTextRightInputGroup = ({
|
|
|
7468
7519
|
var LeftTextRightInputGroup_default = LeftTextRightInputGroup;
|
|
7469
7520
|
|
|
7470
7521
|
// src/components/groups/PageTravelGroup.tsx
|
|
7471
|
-
var
|
|
7522
|
+
var import_react28 = require("react");
|
|
7472
7523
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
7473
7524
|
var PageTravelGroup = ({
|
|
7474
7525
|
isImageProcessing,
|
|
@@ -7478,13 +7529,13 @@ var PageTravelGroup = ({
|
|
|
7478
7529
|
setPageNumber,
|
|
7479
7530
|
setImageReady
|
|
7480
7531
|
}) => {
|
|
7481
|
-
const [totalPageNumber, setTotalPageNumber] = (0,
|
|
7482
|
-
const [newPageNumber, setNewPageNumber] = (0,
|
|
7483
|
-
(0,
|
|
7532
|
+
const [totalPageNumber, setTotalPageNumber] = (0, import_react28.useState)(0);
|
|
7533
|
+
const [newPageNumber, setNewPageNumber] = (0, import_react28.useState)(0);
|
|
7534
|
+
(0, import_react28.useEffect)(() => {
|
|
7484
7535
|
if (!initialTotalPageNumber) return;
|
|
7485
7536
|
setTotalPageNumber(initialTotalPageNumber);
|
|
7486
7537
|
}, [initialTotalPageNumber]);
|
|
7487
|
-
(0,
|
|
7538
|
+
(0, import_react28.useEffect)(() => {
|
|
7488
7539
|
setNewPageNumber(pageNumber + 1);
|
|
7489
7540
|
}, [pageNumber]);
|
|
7490
7541
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex-1 flex flex-row justify-center items-center flex-wrap", children: [
|