catchup-library-web 1.20.36 → 1.21.1
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 +498 -264
- package/dist/index.mjs +498 -264
- package/package.json +2 -6
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx +68 -10
- package/src/components/activities/material-contents/GroupingActivityMaterialContent.tsx +74 -2
- package/src/components/activities/material-contents/MatchingActivityMaterialContent.tsx +255 -144
- package/src/components/activities/material-contents/OrderingActivityMaterialContent.tsx +76 -2
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent2.tsx +0 -306
- package/src/components/activities/material-contents/GroupingActivityMaterialContent2.tsx +0 -362
- package/src/components/activities/material-contents/MatchingActivityMaterialContent2.tsx +0 -350
- package/src/components/activities/material-contents/OrderingActivityMaterialContent2.tsx +0 -231
- package/src/components/dnds/DraggableDroppableItem.tsx +0 -60
- package/src/components/dnds/DraggableItem.tsx +0 -39
- package/src/components/dnds/DroppableItem.tsx +0 -33
package/dist/index.mjs
CHANGED
|
@@ -4691,6 +4691,10 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4691
4691
|
null
|
|
4692
4692
|
);
|
|
4693
4693
|
const dragElementRef = useRef4(null);
|
|
4694
|
+
const [mousePosition, setMousePosition] = useState17({
|
|
4695
|
+
x: 0,
|
|
4696
|
+
y: 0
|
|
4697
|
+
});
|
|
4694
4698
|
const [touchPosition, setTouchPosition] = useState17({
|
|
4695
4699
|
x: 0,
|
|
4696
4700
|
y: 0
|
|
@@ -4733,6 +4737,19 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4733
4737
|
e.preventDefault();
|
|
4734
4738
|
setDraggedOption(option);
|
|
4735
4739
|
setSelectedOption(null);
|
|
4740
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
4741
|
+
};
|
|
4742
|
+
const handleMouseMove = (e) => {
|
|
4743
|
+
if (!draggedOption) return;
|
|
4744
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
4745
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
4746
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-drop-zone]");
|
|
4747
|
+
if (dropZone) {
|
|
4748
|
+
const dropIndex = dropZone.getAttribute("data-drop-zone");
|
|
4749
|
+
setDropTargetIndex(dropIndex);
|
|
4750
|
+
} else {
|
|
4751
|
+
setDropTargetIndex(null);
|
|
4752
|
+
}
|
|
4736
4753
|
};
|
|
4737
4754
|
const handleMouseUp = () => {
|
|
4738
4755
|
if (dropTargetIndex !== null && draggedOption !== null) {
|
|
@@ -4740,6 +4757,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4740
4757
|
}
|
|
4741
4758
|
setDraggedOption(null);
|
|
4742
4759
|
setDropTargetIndex(null);
|
|
4760
|
+
setMousePosition({ x: 0, y: 0 });
|
|
4743
4761
|
};
|
|
4744
4762
|
const handleTouchStart = (e, option, element) => {
|
|
4745
4763
|
const touch = e.touches[0];
|
|
@@ -4771,6 +4789,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4771
4789
|
setDraggedOption(null);
|
|
4772
4790
|
setDropTargetIndex(null);
|
|
4773
4791
|
setDraggedElement(null);
|
|
4792
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
4774
4793
|
};
|
|
4775
4794
|
const handleSelectOption = (option) => {
|
|
4776
4795
|
setSelectedOption(option);
|
|
@@ -4783,178 +4802,212 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4783
4802
|
}
|
|
4784
4803
|
};
|
|
4785
4804
|
const answerMap = retrieveAnswerMap();
|
|
4786
|
-
return /* @__PURE__ */ jsxs17(
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
},
|
|
4798
|
-
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx28("div", { className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx28("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ jsx28(
|
|
4799
|
-
InputWithSpecialExpression_default,
|
|
4805
|
+
return /* @__PURE__ */ jsxs17(
|
|
4806
|
+
"div",
|
|
4807
|
+
{
|
|
4808
|
+
className: "flex flex-row flex-wrap items-center",
|
|
4809
|
+
onMouseMove: handleMouseMove,
|
|
4810
|
+
onMouseUp: handleMouseUp,
|
|
4811
|
+
children: [
|
|
4812
|
+
/* @__PURE__ */ jsx28("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx28("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_fill_in_the_blanks_text") }) }),
|
|
4813
|
+
/* @__PURE__ */ jsx28("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx28(DividerLine_default, {}) }),
|
|
4814
|
+
draggedOption && mousePosition.x > 0 && /* @__PURE__ */ jsx28(
|
|
4815
|
+
"div",
|
|
4800
4816
|
{
|
|
4801
|
-
|
|
4802
|
-
|
|
4817
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
4818
|
+
style: {
|
|
4819
|
+
left: `${mousePosition.x}px`,
|
|
4820
|
+
top: `${mousePosition.y}px`,
|
|
4821
|
+
transform: "translate(-50%, -50%)"
|
|
4822
|
+
},
|
|
4823
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx28("div", { className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx28("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ jsx28(
|
|
4824
|
+
InputWithSpecialExpression_default,
|
|
4825
|
+
{
|
|
4826
|
+
value: draggedOption,
|
|
4827
|
+
showSpecialOnly: false
|
|
4828
|
+
}
|
|
4829
|
+
) }) }) : /* @__PURE__ */ jsx28("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx28(
|
|
4830
|
+
ShowMaterialMediaByContentType_default,
|
|
4831
|
+
{
|
|
4832
|
+
contentType: contentMap.type,
|
|
4833
|
+
src: draggedOption,
|
|
4834
|
+
canFullScreen: false
|
|
4835
|
+
},
|
|
4836
|
+
uniqueValue
|
|
4837
|
+
) })
|
|
4803
4838
|
}
|
|
4804
|
-
)
|
|
4805
|
-
|
|
4839
|
+
),
|
|
4840
|
+
draggedOption && touchPosition.x > 0 && /* @__PURE__ */ jsx28(
|
|
4841
|
+
"div",
|
|
4806
4842
|
{
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx28(
|
|
4834
|
-
"div",
|
|
4843
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
4844
|
+
style: {
|
|
4845
|
+
left: `${touchPosition.x}px`,
|
|
4846
|
+
top: `${touchPosition.y}px`,
|
|
4847
|
+
transform: "translate(-50%, -50%)"
|
|
4848
|
+
},
|
|
4849
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx28("div", { className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx28("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ jsx28(
|
|
4850
|
+
InputWithSpecialExpression_default,
|
|
4851
|
+
{
|
|
4852
|
+
value: draggedOption,
|
|
4853
|
+
showSpecialOnly: false
|
|
4854
|
+
}
|
|
4855
|
+
) }) }) : /* @__PURE__ */ jsx28("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx28(
|
|
4856
|
+
ShowMaterialMediaByContentType_default,
|
|
4857
|
+
{
|
|
4858
|
+
contentType: contentMap.type,
|
|
4859
|
+
src: draggedOption,
|
|
4860
|
+
canFullScreen: false
|
|
4861
|
+
},
|
|
4862
|
+
uniqueValue
|
|
4863
|
+
) })
|
|
4864
|
+
}
|
|
4865
|
+
),
|
|
4866
|
+
/* @__PURE__ */ jsx28("div", { className: "w-full flex flex-row flex-wrap gap-x-2 gap-y-2 my-2", children: shuffleOptionList.map(
|
|
4867
|
+
(option, index) => checkAnswerProvided(answerMap, option) ? /* @__PURE__ */ jsx28(
|
|
4868
|
+
ShowMaterialMediaByContentType_default,
|
|
4835
4869
|
{
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
value: option,
|
|
4842
|
-
showSpecialOnly: false
|
|
4843
|
-
}
|
|
4844
|
-
) })
|
|
4845
|
-
}
|
|
4870
|
+
contentType: contentMap.type,
|
|
4871
|
+
src: option,
|
|
4872
|
+
canFullScreen: true
|
|
4873
|
+
},
|
|
4874
|
+
`${uniqueValue}-${index}`
|
|
4846
4875
|
) : /* @__PURE__ */ jsx28(
|
|
4847
4876
|
"div",
|
|
4848
4877
|
{
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
canFullScreen: true
|
|
4857
|
-
},
|
|
4858
|
-
`${uniqueValue}-${index}`
|
|
4859
|
-
)
|
|
4860
|
-
}
|
|
4861
|
-
)
|
|
4862
|
-
},
|
|
4863
|
-
index
|
|
4864
|
-
)
|
|
4865
|
-
) }),
|
|
4866
|
-
/* @__PURE__ */ jsx28("div", { className: "w-full flex flex-row flex-wrap", onMouseUp: handleMouseUp, children: Object.keys(answerMap).map((materialKey, index) => {
|
|
4867
|
-
const learnerAnswerState = checkAnswerState(
|
|
4868
|
-
JSON.parse(materialMap[materialKey]),
|
|
4869
|
-
answerMap[materialKey]
|
|
4870
|
-
);
|
|
4871
|
-
return /* @__PURE__ */ jsx28("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx28("div", { className: "mx-2", children: /* @__PURE__ */ jsx28(
|
|
4872
|
-
"div",
|
|
4873
|
-
{
|
|
4874
|
-
"data-drop-zone": materialKey,
|
|
4875
|
-
onMouseEnter: () => draggedOption && setDropTargetIndex(materialKey),
|
|
4876
|
-
onMouseLeave: () => setDropTargetIndex(null),
|
|
4877
|
-
onClick: () => handleDropZoneClick(materialKey),
|
|
4878
|
-
className: `${dropTargetIndex === materialKey ? "ring-2 ring-blue-400 bg-blue-50" : ""} transition-all duration-200 rounded-lg`,
|
|
4879
|
-
children: /* @__PURE__ */ jsxs17("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
4880
|
-
/* @__PURE__ */ jsx28("div", { className: "my-auto", children: /* @__PURE__ */ jsxs17("p", { className: "text-xl", children: [
|
|
4881
|
-
parseFloat(materialKey) + 1,
|
|
4882
|
-
"."
|
|
4883
|
-
] }) }),
|
|
4884
|
-
/* @__PURE__ */ jsx28("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ jsxs17("div", { className: "relative", children: [
|
|
4885
|
-
/* @__PURE__ */ jsx28("div", { className: "flex-1", children: /* @__PURE__ */ jsx28(
|
|
4878
|
+
ref: draggedOption === option ? dragElementRef : null,
|
|
4879
|
+
className: `${draggedOption === option ? "opacity-40" : selectedOption === option ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
|
|
4880
|
+
onMouseDown: (e) => handleMouseDown(e, option),
|
|
4881
|
+
onTouchStart: (e) => handleTouchStart(e, option, e.currentTarget),
|
|
4882
|
+
onTouchMove: handleTouchMove,
|
|
4883
|
+
onTouchEnd: handleTouchEnd,
|
|
4884
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx28(
|
|
4886
4885
|
"div",
|
|
4887
4886
|
{
|
|
4888
|
-
className:
|
|
4889
|
-
onClick: (
|
|
4890
|
-
|
|
4891
|
-
e.stopPropagation();
|
|
4892
|
-
onChange(answer, materialKey, "");
|
|
4893
|
-
}
|
|
4894
|
-
},
|
|
4895
|
-
children: answerMap[materialKey] ? /* @__PURE__ */ jsx28(
|
|
4887
|
+
className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge cursor-pointer select-none",
|
|
4888
|
+
onClick: () => handleSelectOption(option),
|
|
4889
|
+
children: /* @__PURE__ */ jsx28("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ jsx28(
|
|
4896
4890
|
InputWithSpecialExpression_default,
|
|
4897
4891
|
{
|
|
4898
|
-
value:
|
|
4892
|
+
value: option,
|
|
4899
4893
|
showSpecialOnly: false
|
|
4900
4894
|
}
|
|
4901
|
-
)
|
|
4902
|
-
}
|
|
4903
|
-
) }),
|
|
4904
|
-
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ jsx28("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ jsx28(
|
|
4905
|
-
BaseImage_default,
|
|
4906
|
-
{
|
|
4907
|
-
src: "/icons/checkbox.webp",
|
|
4908
|
-
alt: "checkbox",
|
|
4909
|
-
size: "small"
|
|
4895
|
+
) })
|
|
4910
4896
|
}
|
|
4911
|
-
)
|
|
4912
|
-
|
|
4897
|
+
) : /* @__PURE__ */ jsx28(
|
|
4898
|
+
"div",
|
|
4913
4899
|
{
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4900
|
+
className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge cursor-pointer select-none",
|
|
4901
|
+
onClick: () => handleSelectOption(option),
|
|
4902
|
+
children: /* @__PURE__ */ jsx28(
|
|
4903
|
+
ShowMaterialMediaByContentType_default,
|
|
4904
|
+
{
|
|
4905
|
+
contentType: contentMap.type,
|
|
4906
|
+
src: option,
|
|
4907
|
+
canFullScreen: true
|
|
4908
|
+
},
|
|
4909
|
+
`${uniqueValue}-${index}`
|
|
4910
|
+
)
|
|
4917
4911
|
}
|
|
4918
|
-
)
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
)
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4912
|
+
)
|
|
4913
|
+
},
|
|
4914
|
+
index
|
|
4915
|
+
)
|
|
4916
|
+
) }),
|
|
4917
|
+
/* @__PURE__ */ jsx28("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
|
|
4918
|
+
const learnerAnswerState = checkAnswerState(
|
|
4919
|
+
JSON.parse(materialMap[materialKey]),
|
|
4920
|
+
answerMap[materialKey]
|
|
4921
|
+
);
|
|
4922
|
+
return /* @__PURE__ */ jsx28("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx28("div", { className: "mx-2", children: /* @__PURE__ */ jsx28(
|
|
4923
|
+
"div",
|
|
4924
|
+
{
|
|
4925
|
+
"data-drop-zone": materialKey,
|
|
4926
|
+
onMouseEnter: () => draggedOption && setDropTargetIndex(materialKey),
|
|
4927
|
+
onMouseLeave: () => setDropTargetIndex(null),
|
|
4928
|
+
onClick: () => handleDropZoneClick(materialKey),
|
|
4929
|
+
className: `${dropTargetIndex === materialKey ? "ring-2 ring-blue-400 bg-blue-50" : ""} transition-all duration-200 rounded-lg`,
|
|
4930
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
4931
|
+
/* @__PURE__ */ jsx28("div", { className: "my-auto", children: /* @__PURE__ */ jsxs17("p", { className: "text-xl", children: [
|
|
4932
|
+
parseFloat(materialKey) + 1,
|
|
4933
|
+
"."
|
|
4934
|
+
] }) }),
|
|
4935
|
+
/* @__PURE__ */ jsx28("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ jsxs17("div", { className: "relative", children: [
|
|
4936
|
+
/* @__PURE__ */ jsx28("div", { className: "flex-1", children: /* @__PURE__ */ jsx28(
|
|
4937
|
+
"div",
|
|
4938
|
+
{
|
|
4939
|
+
className: `w-full min-h-[44px] border rounded-lg ${answerMap[materialKey] ? "border-catchup-blue-400 px-2 cursor-pointer" : "bg-catchup-gray-50 border-catchup-gray-200 border-dashed py-2 px-4"}`,
|
|
4940
|
+
onClick: (e) => {
|
|
4941
|
+
if (answerMap[materialKey]) {
|
|
4942
|
+
e.stopPropagation();
|
|
4943
|
+
onChange(answer, materialKey, "");
|
|
4944
|
+
}
|
|
4945
|
+
},
|
|
4946
|
+
children: answerMap[materialKey] ? /* @__PURE__ */ jsx28(
|
|
4947
|
+
InputWithSpecialExpression_default,
|
|
4948
|
+
{
|
|
4949
|
+
value: answerMap[materialKey],
|
|
4950
|
+
showSpecialOnly: false
|
|
4951
|
+
}
|
|
4952
|
+
) : null
|
|
4953
|
+
}
|
|
4954
|
+
) }),
|
|
4955
|
+
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ jsx28("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ jsx28(
|
|
4956
|
+
BaseImage_default,
|
|
4957
|
+
{
|
|
4958
|
+
src: "/icons/checkbox.webp",
|
|
4959
|
+
alt: "checkbox",
|
|
4960
|
+
size: "small"
|
|
4961
|
+
}
|
|
4962
|
+
) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ jsx28("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ jsx28(
|
|
4963
|
+
BaseImage_default,
|
|
4964
|
+
{
|
|
4965
|
+
src: "/icons/cross-red.webp",
|
|
4966
|
+
alt: "cross-red",
|
|
4967
|
+
size: "small"
|
|
4968
|
+
}
|
|
4969
|
+
) }) : null
|
|
4970
|
+
] }) : answerMap[materialKey] === "" ? /* @__PURE__ */ jsx28(
|
|
4971
|
+
"div",
|
|
4935
4972
|
{
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4973
|
+
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"}`,
|
|
4974
|
+
children: /* @__PURE__ */ jsx28("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ jsx28("span", { className: "italic", children: i18n_default.t("please_drop_here") }) })
|
|
4975
|
+
}
|
|
4976
|
+
) : /* @__PURE__ */ jsx28(
|
|
4977
|
+
"div",
|
|
4978
|
+
{
|
|
4979
|
+
className: "flex-1 cursor-pointer",
|
|
4980
|
+
onClick: (e) => {
|
|
4981
|
+
e.stopPropagation();
|
|
4982
|
+
onChange(answer, materialKey, "");
|
|
4983
|
+
},
|
|
4984
|
+
children: /* @__PURE__ */ jsx28(
|
|
4985
|
+
ShowMaterialMediaByContentType_default,
|
|
4986
|
+
{
|
|
4987
|
+
contentType: contentMap.type,
|
|
4988
|
+
src: answerMap[materialKey],
|
|
4989
|
+
canFullScreen: true
|
|
4990
|
+
},
|
|
4991
|
+
`${uniqueValue}-${index}`
|
|
4992
|
+
)
|
|
4993
|
+
}
|
|
4994
|
+
) : /* @__PURE__ */ jsx28("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
4995
|
+
answerMap[materialKey]
|
|
4996
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx28(
|
|
4997
|
+
"span",
|
|
4998
|
+
{
|
|
4999
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5000
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx28("span", { className: "text-xl", children: /* @__PURE__ */ jsx28(InlineMath4, { math: inputPart.value }) }) : inputPart.value
|
|
4939
5001
|
},
|
|
4940
|
-
|
|
4941
|
-
)
|
|
4942
|
-
}
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
children: inputPart.isEquation ? /* @__PURE__ */ jsx28("span", { className: "text-xl", children: /* @__PURE__ */ jsx28(InlineMath4, { math: inputPart.value }) }) : inputPart.value
|
|
4950
|
-
},
|
|
4951
|
-
index2
|
|
4952
|
-
)) }, materialKey) })
|
|
4953
|
-
] })
|
|
4954
|
-
}
|
|
4955
|
-
) }) }, index);
|
|
4956
|
-
}) })
|
|
4957
|
-
] });
|
|
5002
|
+
index2
|
|
5003
|
+
)) }, materialKey) })
|
|
5004
|
+
] })
|
|
5005
|
+
}
|
|
5006
|
+
) }) }, index);
|
|
5007
|
+
}) })
|
|
5008
|
+
]
|
|
5009
|
+
}
|
|
5010
|
+
);
|
|
4958
5011
|
};
|
|
4959
5012
|
var FillInTheBlanksActivityMaterialContent_default = FillInTheBlanksActivityMaterialContent;
|
|
4960
5013
|
|
|
@@ -5081,6 +5134,10 @@ var GroupingActivityMaterialContent = ({
|
|
|
5081
5134
|
const [isShuffled, setIsShuffled] = useState19(false);
|
|
5082
5135
|
const [shuffledMaterialList, setShuffledMaterialList] = useState19([]);
|
|
5083
5136
|
const dragElementRef = useRef5(null);
|
|
5137
|
+
const [mousePosition, setMousePosition] = useState19({
|
|
5138
|
+
x: 0,
|
|
5139
|
+
y: 0
|
|
5140
|
+
});
|
|
5084
5141
|
const [touchPosition, setTouchPosition] = useState19({
|
|
5085
5142
|
x: 0,
|
|
5086
5143
|
y: 0
|
|
@@ -5148,6 +5205,19 @@ var GroupingActivityMaterialContent = ({
|
|
|
5148
5205
|
e.preventDefault();
|
|
5149
5206
|
setDraggedValue(materialValue);
|
|
5150
5207
|
setSelectedValue(null);
|
|
5208
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5209
|
+
};
|
|
5210
|
+
const handleMouseMove = (e) => {
|
|
5211
|
+
if (!draggedValue) return;
|
|
5212
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5213
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
5214
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-grouping-drop-zone]");
|
|
5215
|
+
if (dropZone) {
|
|
5216
|
+
const dropKey = dropZone.getAttribute("data-grouping-drop-zone");
|
|
5217
|
+
setDropTargetKey(dropKey);
|
|
5218
|
+
} else {
|
|
5219
|
+
setDropTargetKey(null);
|
|
5220
|
+
}
|
|
5151
5221
|
};
|
|
5152
5222
|
const handleMouseUp = () => {
|
|
5153
5223
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
@@ -5155,6 +5225,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5155
5225
|
}
|
|
5156
5226
|
setDraggedValue(null);
|
|
5157
5227
|
setDropTargetKey(null);
|
|
5228
|
+
setMousePosition({ x: 0, y: 0 });
|
|
5158
5229
|
};
|
|
5159
5230
|
const handleTouchStart = (e, materialValue, element) => {
|
|
5160
5231
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5187,6 +5258,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5187
5258
|
setDraggedValue(null);
|
|
5188
5259
|
setDropTargetKey(null);
|
|
5189
5260
|
setDraggedElement(null);
|
|
5261
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
5190
5262
|
};
|
|
5191
5263
|
const handleSelectItem = (materialValue) => {
|
|
5192
5264
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5201,7 +5273,36 @@ var GroupingActivityMaterialContent = ({
|
|
|
5201
5273
|
};
|
|
5202
5274
|
const answerMap = retrieveAnswerMap();
|
|
5203
5275
|
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
5204
|
-
return /* @__PURE__ */ jsxs19("div", { onMouseUp: handleMouseUp, children: [
|
|
5276
|
+
return /* @__PURE__ */ jsxs19("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
5277
|
+
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ jsx30(
|
|
5278
|
+
"div",
|
|
5279
|
+
{
|
|
5280
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
5281
|
+
style: {
|
|
5282
|
+
left: `${mousePosition.x}px`,
|
|
5283
|
+
top: `${mousePosition.y}px`,
|
|
5284
|
+
transform: "translate(-50%, -50%)"
|
|
5285
|
+
},
|
|
5286
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx30("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx30("div", { className: "flex flex-col items-center justify-center m-2 min-w-[200px]", children: /* @__PURE__ */ jsx30("p", { className: "text-xl text-center whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(draggedValue).map(
|
|
5287
|
+
(inputPart, index) => /* @__PURE__ */ jsx30(
|
|
5288
|
+
"span",
|
|
5289
|
+
{
|
|
5290
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5291
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx30("span", { className: "text-2xl", children: /* @__PURE__ */ jsx30(InlineMath5, { math: inputPart.value }) }) : inputPart.value
|
|
5292
|
+
},
|
|
5293
|
+
index
|
|
5294
|
+
)
|
|
5295
|
+
) }) }) }) : /* @__PURE__ */ jsx30("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx30(
|
|
5296
|
+
ShowMaterialMediaByContentType_default,
|
|
5297
|
+
{
|
|
5298
|
+
contentType: contentMap.type,
|
|
5299
|
+
src: draggedValue,
|
|
5300
|
+
canFullScreen: false
|
|
5301
|
+
},
|
|
5302
|
+
`${uniqueValue}-drag-mouse`
|
|
5303
|
+
) })
|
|
5304
|
+
}
|
|
5305
|
+
),
|
|
5205
5306
|
draggedValue && touchPosition.x > 0 && /* @__PURE__ */ jsx30(
|
|
5206
5307
|
"div",
|
|
5207
5308
|
{
|
|
@@ -5227,7 +5328,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5227
5328
|
src: draggedValue,
|
|
5228
5329
|
canFullScreen: false
|
|
5229
5330
|
},
|
|
5230
|
-
`${uniqueValue}-drag`
|
|
5331
|
+
`${uniqueValue}-drag-touch`
|
|
5231
5332
|
) })
|
|
5232
5333
|
}
|
|
5233
5334
|
),
|
|
@@ -5430,17 +5531,16 @@ var MatchingActivityMaterialContent = ({
|
|
|
5430
5531
|
const [selectedValue, setSelectedValue] = useState20(null);
|
|
5431
5532
|
const [draggedValue, setDraggedValue] = useState20(null);
|
|
5432
5533
|
const [dropTargetKey, setDropTargetKey] = useState20(null);
|
|
5433
|
-
const [draggedElement, setDraggedElement] = useState20(
|
|
5434
|
-
null
|
|
5435
|
-
);
|
|
5534
|
+
const [draggedElement, setDraggedElement] = useState20(null);
|
|
5436
5535
|
const [isShuffled, setIsShuffled] = useState20(false);
|
|
5437
5536
|
const [shuffledMaterialList, setShuffledMaterialList] = useState20([]);
|
|
5438
5537
|
const dragElementRef = useRef6(null);
|
|
5439
|
-
const [
|
|
5440
|
-
|
|
5441
|
-
y: 0
|
|
5442
|
-
});
|
|
5538
|
+
const [mousePosition, setMousePosition] = useState20({ x: 0, y: 0 });
|
|
5539
|
+
const [touchPosition, setTouchPosition] = useState20({ x: 0, y: 0 });
|
|
5443
5540
|
const itemsRef = useRef6(null);
|
|
5541
|
+
const scrollIntervalRef = useRef6(null);
|
|
5542
|
+
const SCROLL_THRESHOLD = 100;
|
|
5543
|
+
const SCROLL_SPEED = 10;
|
|
5444
5544
|
useEffect11(() => {
|
|
5445
5545
|
const shuffleArray2 = (array) => {
|
|
5446
5546
|
if (!isShuffled) {
|
|
@@ -5462,10 +5562,44 @@ var MatchingActivityMaterialContent = ({
|
|
|
5462
5562
|
}, [materialMap, isShuffled]);
|
|
5463
5563
|
useEffect11(() => {
|
|
5464
5564
|
if (!showCorrectAnswer) return;
|
|
5465
|
-
answer.data.find(
|
|
5466
|
-
(answerData) => answerData.type === "MATCHING"
|
|
5467
|
-
).answerMap = materialMap;
|
|
5565
|
+
answer.data.find((answerData) => answerData.type === "MATCHING").answerMap = materialMap;
|
|
5468
5566
|
}, [showCorrectAnswer, answer, materialMap]);
|
|
5567
|
+
useEffect11(() => {
|
|
5568
|
+
if (!draggedValue || mousePosition.y === 0) return;
|
|
5569
|
+
const handleAutoScroll = () => {
|
|
5570
|
+
const viewportHeight = window.innerHeight;
|
|
5571
|
+
const scrollY = window.scrollY;
|
|
5572
|
+
if (mousePosition.y < SCROLL_THRESHOLD + scrollY) {
|
|
5573
|
+
window.scrollBy(0, -SCROLL_SPEED);
|
|
5574
|
+
} else if (mousePosition.y > viewportHeight + scrollY - SCROLL_THRESHOLD) {
|
|
5575
|
+
window.scrollBy(0, SCROLL_SPEED);
|
|
5576
|
+
}
|
|
5577
|
+
};
|
|
5578
|
+
scrollIntervalRef.current = setInterval(handleAutoScroll, 16);
|
|
5579
|
+
return () => {
|
|
5580
|
+
if (scrollIntervalRef.current) {
|
|
5581
|
+
clearInterval(scrollIntervalRef.current);
|
|
5582
|
+
}
|
|
5583
|
+
};
|
|
5584
|
+
}, [draggedValue, mousePosition.y]);
|
|
5585
|
+
useEffect11(() => {
|
|
5586
|
+
if (!draggedValue || touchPosition.y === 0) return;
|
|
5587
|
+
const handleAutoScroll = () => {
|
|
5588
|
+
const viewportHeight = window.innerHeight;
|
|
5589
|
+
const scrollY = window.scrollY;
|
|
5590
|
+
if (touchPosition.y < SCROLL_THRESHOLD + scrollY) {
|
|
5591
|
+
window.scrollBy(0, -SCROLL_SPEED);
|
|
5592
|
+
} else if (touchPosition.y > viewportHeight + scrollY - SCROLL_THRESHOLD) {
|
|
5593
|
+
window.scrollBy(0, SCROLL_SPEED);
|
|
5594
|
+
}
|
|
5595
|
+
};
|
|
5596
|
+
scrollIntervalRef.current = setInterval(handleAutoScroll, 16);
|
|
5597
|
+
return () => {
|
|
5598
|
+
if (scrollIntervalRef.current) {
|
|
5599
|
+
clearInterval(scrollIntervalRef.current);
|
|
5600
|
+
}
|
|
5601
|
+
};
|
|
5602
|
+
}, [draggedValue, touchPosition.y]);
|
|
5469
5603
|
const retrieveAnswerMap = () => {
|
|
5470
5604
|
const foundIndex = answer.data.findIndex(
|
|
5471
5605
|
(answerData) => answerData.type === "MATCHING"
|
|
@@ -5494,6 +5628,19 @@ var MatchingActivityMaterialContent = ({
|
|
|
5494
5628
|
e.preventDefault();
|
|
5495
5629
|
setDraggedValue(materialValue);
|
|
5496
5630
|
setSelectedValue(null);
|
|
5631
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5632
|
+
};
|
|
5633
|
+
const handleMouseMove = (e) => {
|
|
5634
|
+
if (!draggedValue) return;
|
|
5635
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5636
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
5637
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-matching-drop-zone]");
|
|
5638
|
+
if (dropZone) {
|
|
5639
|
+
const dropKey = dropZone.getAttribute("data-matching-drop-zone");
|
|
5640
|
+
setDropTargetKey(dropKey);
|
|
5641
|
+
} else {
|
|
5642
|
+
setDropTargetKey(null);
|
|
5643
|
+
}
|
|
5497
5644
|
};
|
|
5498
5645
|
const handleMouseUp = () => {
|
|
5499
5646
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
@@ -5501,6 +5648,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5501
5648
|
}
|
|
5502
5649
|
setDraggedValue(null);
|
|
5503
5650
|
setDropTargetKey(null);
|
|
5651
|
+
setMousePosition({ x: 0, y: 0 });
|
|
5504
5652
|
};
|
|
5505
5653
|
const handleTouchStart = (e, materialValue, element) => {
|
|
5506
5654
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5533,6 +5681,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5533
5681
|
setDraggedValue(null);
|
|
5534
5682
|
setDropTargetKey(null);
|
|
5535
5683
|
setDraggedElement(null);
|
|
5684
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
5536
5685
|
};
|
|
5537
5686
|
const handleSelectItem = (materialValue) => {
|
|
5538
5687
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5547,7 +5696,36 @@ var MatchingActivityMaterialContent = ({
|
|
|
5547
5696
|
};
|
|
5548
5697
|
const answerMap = retrieveAnswerMap();
|
|
5549
5698
|
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
5550
|
-
return /* @__PURE__ */ jsxs21("div", { onMouseUp: handleMouseUp, children: [
|
|
5699
|
+
return /* @__PURE__ */ jsxs21("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
5700
|
+
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ jsx32(
|
|
5701
|
+
"div",
|
|
5702
|
+
{
|
|
5703
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
5704
|
+
style: {
|
|
5705
|
+
left: `${mousePosition.x}px`,
|
|
5706
|
+
top: `${mousePosition.y}px`,
|
|
5707
|
+
transform: "translate(-50%, -50%)"
|
|
5708
|
+
},
|
|
5709
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx32("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx32("div", { className: "flex flex-col items-center justify-center m-2 min-w-[200px] px-4", children: /* @__PURE__ */ jsx32("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(draggedValue).map(
|
|
5710
|
+
(inputPart, index) => /* @__PURE__ */ jsx32(
|
|
5711
|
+
"span",
|
|
5712
|
+
{
|
|
5713
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5714
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx32("span", { className: "text-xl", children: /* @__PURE__ */ jsx32(InlineMath6, { math: inputPart.value }) }) : inputPart.value
|
|
5715
|
+
},
|
|
5716
|
+
index
|
|
5717
|
+
)
|
|
5718
|
+
) }) }) }) : /* @__PURE__ */ jsx32("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx32(
|
|
5719
|
+
ShowMaterialMediaByContentType_default,
|
|
5720
|
+
{
|
|
5721
|
+
contentType: contentMap.type,
|
|
5722
|
+
src: draggedValue,
|
|
5723
|
+
canFullScreen: false
|
|
5724
|
+
},
|
|
5725
|
+
`${uniqueValue}-drag-mouse`
|
|
5726
|
+
) })
|
|
5727
|
+
}
|
|
5728
|
+
),
|
|
5551
5729
|
draggedValue && touchPosition.x > 0 && /* @__PURE__ */ jsx32(
|
|
5552
5730
|
"div",
|
|
5553
5731
|
{
|
|
@@ -5573,7 +5751,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5573
5751
|
src: draggedValue,
|
|
5574
5752
|
canFullScreen: false
|
|
5575
5753
|
},
|
|
5576
|
-
`${uniqueValue}-drag`
|
|
5754
|
+
`${uniqueValue}-drag-touch`
|
|
5577
5755
|
) })
|
|
5578
5756
|
}
|
|
5579
5757
|
),
|
|
@@ -5624,7 +5802,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5624
5802
|
),
|
|
5625
5803
|
/* @__PURE__ */ jsx32("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx32(DividerLine_default, {}) })
|
|
5626
5804
|
] }) : null,
|
|
5627
|
-
|
|
5805
|
+
Object.keys(answerMap).map((answerMapKey, index) => {
|
|
5628
5806
|
const learnerAnswerState = checkAnswerState(
|
|
5629
5807
|
materialMap[answerMapKey],
|
|
5630
5808
|
answerMap[answerMapKey]
|
|
@@ -5634,16 +5812,16 @@ var MatchingActivityMaterialContent = ({
|
|
|
5634
5812
|
"div",
|
|
5635
5813
|
{
|
|
5636
5814
|
className: `${contentMap.type === "TEXT" ? "h-catchup-activity-text-box-item" : "h-catchup-activity-media-box-item"} flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3 ${learnerAnswerState === "EMPTY" ? "border-catchup-blue" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
|
|
5637
|
-
children: /* @__PURE__ */ jsx32("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4 text-center", children: /* @__PURE__ */ jsx32("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
)
|
|
5815
|
+
children: /* @__PURE__ */ jsx32("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4 text-center", children: /* @__PURE__ */ jsx32("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
|
|
5816
|
+
(inputPart, index2) => /* @__PURE__ */ jsx32(
|
|
5817
|
+
"span",
|
|
5818
|
+
{
|
|
5819
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5820
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx32("span", { className: "text-xl", children: /* @__PURE__ */ jsx32(InlineMath6, { math: inputPart.value }) }) : inputPart.value
|
|
5821
|
+
},
|
|
5822
|
+
index2
|
|
5823
|
+
)
|
|
5824
|
+
) }) })
|
|
5647
5825
|
}
|
|
5648
5826
|
) }),
|
|
5649
5827
|
/* @__PURE__ */ jsx32("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
|
|
@@ -5689,7 +5867,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5689
5867
|
}
|
|
5690
5868
|
) })
|
|
5691
5869
|
] }, index);
|
|
5692
|
-
})
|
|
5870
|
+
})
|
|
5693
5871
|
] });
|
|
5694
5872
|
};
|
|
5695
5873
|
var MatchingActivityMaterialContent_default = MatchingActivityMaterialContent;
|
|
@@ -6294,6 +6472,10 @@ var OrderingActivityMaterialContent = ({
|
|
|
6294
6472
|
null
|
|
6295
6473
|
);
|
|
6296
6474
|
const dragElementRef = useRef7(null);
|
|
6475
|
+
const [mousePosition, setMousePosition] = useState22({
|
|
6476
|
+
x: 0,
|
|
6477
|
+
y: 0
|
|
6478
|
+
});
|
|
6297
6479
|
const [touchPosition, setTouchPosition] = useState22({
|
|
6298
6480
|
x: 0,
|
|
6299
6481
|
y: 0
|
|
@@ -6355,6 +6537,19 @@ var OrderingActivityMaterialContent = ({
|
|
|
6355
6537
|
e.preventDefault();
|
|
6356
6538
|
setDraggedKey(materialKey);
|
|
6357
6539
|
setSelectedKey(null);
|
|
6540
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
6541
|
+
};
|
|
6542
|
+
const handleMouseMove = (e) => {
|
|
6543
|
+
if (!draggedKey) return;
|
|
6544
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
6545
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
6546
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-ordering-drop-zone]");
|
|
6547
|
+
if (dropZone) {
|
|
6548
|
+
const dropKey = dropZone.getAttribute("data-ordering-drop-zone");
|
|
6549
|
+
setDropTargetKey(dropKey);
|
|
6550
|
+
} else {
|
|
6551
|
+
setDropTargetKey(null);
|
|
6552
|
+
}
|
|
6358
6553
|
};
|
|
6359
6554
|
const handleMouseUp = () => {
|
|
6360
6555
|
if (dropTargetKey !== null && draggedKey !== null && dropTargetKey !== draggedKey) {
|
|
@@ -6362,6 +6557,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6362
6557
|
}
|
|
6363
6558
|
setDraggedKey(null);
|
|
6364
6559
|
setDropTargetKey(null);
|
|
6560
|
+
setMousePosition({ x: 0, y: 0 });
|
|
6365
6561
|
};
|
|
6366
6562
|
const handleTouchStart = (e, materialKey, element) => {
|
|
6367
6563
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -6394,6 +6590,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6394
6590
|
setDraggedKey(null);
|
|
6395
6591
|
setDropTargetKey(null);
|
|
6396
6592
|
setDraggedElement(null);
|
|
6593
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
6397
6594
|
};
|
|
6398
6595
|
const handleSelectItem = (materialKey) => {
|
|
6399
6596
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -6408,100 +6605,137 @@ var OrderingActivityMaterialContent = ({
|
|
|
6408
6605
|
setDraggedKey(null);
|
|
6409
6606
|
};
|
|
6410
6607
|
const answerMap = retrieveAnswerMap();
|
|
6411
|
-
return /* @__PURE__ */ jsxs29(
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
},
|
|
6421
|
-
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx40("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx40("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6422
|
-
materialMap[answerMap[draggedKey]]
|
|
6423
|
-
).map((inputPart, index) => /* @__PURE__ */ jsx40(
|
|
6424
|
-
"span",
|
|
6608
|
+
return /* @__PURE__ */ jsxs29(
|
|
6609
|
+
"div",
|
|
6610
|
+
{
|
|
6611
|
+
className: "flex flex-row flex-wrap",
|
|
6612
|
+
onMouseMove: handleMouseMove,
|
|
6613
|
+
onMouseUp: handleMouseUp,
|
|
6614
|
+
children: [
|
|
6615
|
+
draggedKey && mousePosition.x > 0 && /* @__PURE__ */ jsx40(
|
|
6616
|
+
"div",
|
|
6425
6617
|
{
|
|
6426
|
-
className:
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6618
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
6619
|
+
style: {
|
|
6620
|
+
left: `${mousePosition.x}px`,
|
|
6621
|
+
top: `${mousePosition.y}px`,
|
|
6622
|
+
transform: "translate(-50%, -50%)"
|
|
6623
|
+
},
|
|
6624
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx40("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx40("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6625
|
+
materialMap[answerMap[draggedKey]]
|
|
6626
|
+
).map((inputPart, index) => /* @__PURE__ */ jsx40(
|
|
6627
|
+
"span",
|
|
6628
|
+
{
|
|
6629
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
6630
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx40("span", { className: "text-xl", children: /* @__PURE__ */ jsx40(InlineMath9, { math: inputPart.value }) }) : inputPart.value
|
|
6631
|
+
},
|
|
6632
|
+
index
|
|
6633
|
+
)) }) }) : /* @__PURE__ */ jsx40("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx40(
|
|
6634
|
+
ShowMaterialMediaByContentType_default,
|
|
6635
|
+
{
|
|
6636
|
+
contentType: contentMap.type,
|
|
6637
|
+
src: materialMap[answerMap[draggedKey]],
|
|
6638
|
+
canFullScreen: false
|
|
6639
|
+
},
|
|
6640
|
+
`${uniqueValue}-drag-mouse`
|
|
6641
|
+
) })
|
|
6642
|
+
}
|
|
6643
|
+
),
|
|
6644
|
+
draggedKey && touchPosition.x > 0 && /* @__PURE__ */ jsx40(
|
|
6645
|
+
"div",
|
|
6432
6646
|
{
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
answerMap[materialKey] + "",
|
|
6444
|
-
index + ""
|
|
6445
|
-
);
|
|
6446
|
-
return /* @__PURE__ */ jsx40("div", { className: "w-full lg:w-1/2", children: /* @__PURE__ */ jsxs29(
|
|
6447
|
-
"div",
|
|
6448
|
-
{
|
|
6449
|
-
className: `flex flex-row items-center my-4 mx-2`,
|
|
6450
|
-
style: {
|
|
6451
|
-
marginTop: view === "PC" ? calculateMarginTop(parseFloat(materialKey)) : 0
|
|
6452
|
-
},
|
|
6453
|
-
children: [
|
|
6454
|
-
/* @__PURE__ */ jsx40("div", { className: "mr-3", children: /* @__PURE__ */ jsx40("div", { className: "h-catchup-activity-box-item w-catchup-activity-box-item flex flex-col items-center justify-center cursor-pointer transition-all duration-300 overflow-y-auto", children: /* @__PURE__ */ jsx40(
|
|
6455
|
-
"div",
|
|
6647
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
6648
|
+
style: {
|
|
6649
|
+
left: `${touchPosition.x}px`,
|
|
6650
|
+
top: `${touchPosition.y}px`,
|
|
6651
|
+
transform: "translate(-50%, -50%)"
|
|
6652
|
+
},
|
|
6653
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx40("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx40("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6654
|
+
materialMap[answerMap[draggedKey]]
|
|
6655
|
+
).map((inputPart, index) => /* @__PURE__ */ jsx40(
|
|
6656
|
+
"span",
|
|
6456
6657
|
{
|
|
6457
|
-
className: `${
|
|
6458
|
-
children: /* @__PURE__ */ jsx40("
|
|
6459
|
-
}
|
|
6460
|
-
|
|
6461
|
-
/* @__PURE__ */ jsx40(
|
|
6462
|
-
|
|
6658
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
6659
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx40("span", { className: "text-xl", children: /* @__PURE__ */ jsx40(InlineMath9, { math: inputPart.value }) }) : inputPart.value
|
|
6660
|
+
},
|
|
6661
|
+
index
|
|
6662
|
+
)) }) }) : /* @__PURE__ */ jsx40("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ jsx40(
|
|
6663
|
+
ShowMaterialMediaByContentType_default,
|
|
6463
6664
|
{
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6665
|
+
contentType: contentMap.type,
|
|
6666
|
+
src: materialMap[answerMap[draggedKey]],
|
|
6667
|
+
canFullScreen: false
|
|
6668
|
+
},
|
|
6669
|
+
`${uniqueValue}-drag-touch`
|
|
6670
|
+
) })
|
|
6671
|
+
}
|
|
6672
|
+
),
|
|
6673
|
+
Object.keys(answerMap).map((materialKey, index) => {
|
|
6674
|
+
const learnerAnswerState = checkAnswerState(
|
|
6675
|
+
answerMap[materialKey] + "",
|
|
6676
|
+
index + ""
|
|
6677
|
+
);
|
|
6678
|
+
return /* @__PURE__ */ jsx40("div", { className: "w-full lg:w-1/2", children: /* @__PURE__ */ jsxs29(
|
|
6679
|
+
"div",
|
|
6680
|
+
{
|
|
6681
|
+
className: `flex flex-row items-center my-4 mx-2`,
|
|
6682
|
+
style: {
|
|
6683
|
+
marginTop: view === "PC" ? calculateMarginTop(parseFloat(materialKey)) : 0
|
|
6684
|
+
},
|
|
6685
|
+
children: [
|
|
6686
|
+
/* @__PURE__ */ jsx40("div", { className: "mr-3", children: /* @__PURE__ */ jsx40("div", { className: "h-catchup-activity-box-item w-catchup-activity-box-item flex flex-col items-center justify-center cursor-pointer transition-all duration-300 overflow-y-auto", children: /* @__PURE__ */ jsx40(
|
|
6474
6687
|
"div",
|
|
6475
6688
|
{
|
|
6476
|
-
className: `${
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6689
|
+
className: `${selectedKey === materialKey ? "border-2 border-catchup-light-gray" : "border-2 border-catchup-blue"} flex flex-col items-center justify-center transition-all duration-300 rounded-catchup-full w-[50px] h-[50px]`,
|
|
6690
|
+
children: /* @__PURE__ */ jsx40("p", { className: "", children: parseFloat(materialKey) + 1 })
|
|
6691
|
+
}
|
|
6692
|
+
) }) }),
|
|
6693
|
+
/* @__PURE__ */ jsx40(
|
|
6694
|
+
"div",
|
|
6695
|
+
{
|
|
6696
|
+
ref: draggedKey === materialKey ? dragElementRef : null,
|
|
6697
|
+
"data-ordering-drop-zone": materialKey,
|
|
6698
|
+
className: `flex-1 ${draggedKey === materialKey ? "opacity-40" : selectedKey === materialKey ? "ring-2 ring-blue-500" : "opacity-100"} ${dropTargetKey === materialKey && draggedKey !== materialKey ? "ring-2 ring-blue-400 bg-blue-50" : ""} transition-all duration-200`,
|
|
6699
|
+
onMouseDown: (e) => handleMouseDown(e, materialKey),
|
|
6700
|
+
onMouseEnter: () => draggedKey && draggedKey !== materialKey && setDropTargetKey(materialKey),
|
|
6701
|
+
onMouseLeave: () => setDropTargetKey(null),
|
|
6702
|
+
onTouchStart: (e) => handleTouchStart(e, materialKey, e.currentTarget),
|
|
6703
|
+
onTouchMove: handleTouchMove,
|
|
6704
|
+
onTouchEnd: handleTouchEnd,
|
|
6705
|
+
children: /* @__PURE__ */ jsx40(
|
|
6706
|
+
"div",
|
|
6489
6707
|
{
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6708
|
+
className: `${contentMap.type === "TEXT" ? "h-catchup-activity-text-box-item" : "h-catchup-activity-media-box-item"} flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer p-3 ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
|
|
6709
|
+
onClick: () => handleSelectItem(materialKey),
|
|
6710
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx40("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6711
|
+
materialMap[answerMap[materialKey]]
|
|
6712
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx40(
|
|
6713
|
+
"span",
|
|
6714
|
+
{
|
|
6715
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
6716
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx40("span", { className: "text-xl", children: /* @__PURE__ */ jsx40(InlineMath9, { math: inputPart.value }) }) : inputPart.value
|
|
6717
|
+
},
|
|
6718
|
+
index2
|
|
6719
|
+
)) }) : /* @__PURE__ */ jsx40(
|
|
6720
|
+
ShowMaterialMediaByContentType_default,
|
|
6721
|
+
{
|
|
6722
|
+
contentType: contentMap.type,
|
|
6723
|
+
src: materialMap[answerMap[materialKey]],
|
|
6724
|
+
canFullScreen: true
|
|
6725
|
+
},
|
|
6726
|
+
`${uniqueValue}-${index}`
|
|
6727
|
+
)
|
|
6728
|
+
}
|
|
6495
6729
|
)
|
|
6496
6730
|
}
|
|
6497
6731
|
)
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
}
|
|
6502
|
-
|
|
6503
|
-
}
|
|
6504
|
-
|
|
6732
|
+
]
|
|
6733
|
+
}
|
|
6734
|
+
) }, index);
|
|
6735
|
+
})
|
|
6736
|
+
]
|
|
6737
|
+
}
|
|
6738
|
+
);
|
|
6505
6739
|
};
|
|
6506
6740
|
var OrderingActivityMaterialContent_default = OrderingActivityMaterialContent;
|
|
6507
6741
|
|