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.js
CHANGED
|
@@ -4907,6 +4907,10 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4907
4907
|
null
|
|
4908
4908
|
);
|
|
4909
4909
|
const dragElementRef = (0, import_react18.useRef)(null);
|
|
4910
|
+
const [mousePosition, setMousePosition] = (0, import_react18.useState)({
|
|
4911
|
+
x: 0,
|
|
4912
|
+
y: 0
|
|
4913
|
+
});
|
|
4910
4914
|
const [touchPosition, setTouchPosition] = (0, import_react18.useState)({
|
|
4911
4915
|
x: 0,
|
|
4912
4916
|
y: 0
|
|
@@ -4949,6 +4953,19 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4949
4953
|
e.preventDefault();
|
|
4950
4954
|
setDraggedOption(option);
|
|
4951
4955
|
setSelectedOption(null);
|
|
4956
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
4957
|
+
};
|
|
4958
|
+
const handleMouseMove = (e) => {
|
|
4959
|
+
if (!draggedOption) return;
|
|
4960
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
4961
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
4962
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-drop-zone]");
|
|
4963
|
+
if (dropZone) {
|
|
4964
|
+
const dropIndex = dropZone.getAttribute("data-drop-zone");
|
|
4965
|
+
setDropTargetIndex(dropIndex);
|
|
4966
|
+
} else {
|
|
4967
|
+
setDropTargetIndex(null);
|
|
4968
|
+
}
|
|
4952
4969
|
};
|
|
4953
4970
|
const handleMouseUp = () => {
|
|
4954
4971
|
if (dropTargetIndex !== null && draggedOption !== null) {
|
|
@@ -4956,6 +4973,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4956
4973
|
}
|
|
4957
4974
|
setDraggedOption(null);
|
|
4958
4975
|
setDropTargetIndex(null);
|
|
4976
|
+
setMousePosition({ x: 0, y: 0 });
|
|
4959
4977
|
};
|
|
4960
4978
|
const handleTouchStart = (e, option, element) => {
|
|
4961
4979
|
const touch = e.touches[0];
|
|
@@ -4987,6 +5005,7 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4987
5005
|
setDraggedOption(null);
|
|
4988
5006
|
setDropTargetIndex(null);
|
|
4989
5007
|
setDraggedElement(null);
|
|
5008
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
4990
5009
|
};
|
|
4991
5010
|
const handleSelectOption = (option) => {
|
|
4992
5011
|
setSelectedOption(option);
|
|
@@ -4999,178 +5018,212 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4999
5018
|
}
|
|
5000
5019
|
};
|
|
5001
5020
|
const answerMap = retrieveAnswerMap();
|
|
5002
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
},
|
|
5014
|
-
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5015
|
-
InputWithSpecialExpression_default,
|
|
5021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5022
|
+
"div",
|
|
5023
|
+
{
|
|
5024
|
+
className: "flex flex-row flex-wrap items-center",
|
|
5025
|
+
onMouseMove: handleMouseMove,
|
|
5026
|
+
onMouseUp: handleMouseUp,
|
|
5027
|
+
children: [
|
|
5028
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_fill_in_the_blanks_text") }) }),
|
|
5029
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DividerLine_default, {}) }),
|
|
5030
|
+
draggedOption && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5031
|
+
"div",
|
|
5016
5032
|
{
|
|
5017
|
-
|
|
5018
|
-
|
|
5033
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
5034
|
+
style: {
|
|
5035
|
+
left: `${mousePosition.x}px`,
|
|
5036
|
+
top: `${mousePosition.y}px`,
|
|
5037
|
+
transform: "translate(-50%, -50%)"
|
|
5038
|
+
},
|
|
5039
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5040
|
+
InputWithSpecialExpression_default,
|
|
5041
|
+
{
|
|
5042
|
+
value: draggedOption,
|
|
5043
|
+
showSpecialOnly: false
|
|
5044
|
+
}
|
|
5045
|
+
) }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5046
|
+
ShowMaterialMediaByContentType_default,
|
|
5047
|
+
{
|
|
5048
|
+
contentType: contentMap.type,
|
|
5049
|
+
src: draggedOption,
|
|
5050
|
+
canFullScreen: false
|
|
5051
|
+
},
|
|
5052
|
+
uniqueValue
|
|
5053
|
+
) })
|
|
5019
5054
|
}
|
|
5020
|
-
)
|
|
5021
|
-
|
|
5055
|
+
),
|
|
5056
|
+
draggedOption && touchPosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5057
|
+
"div",
|
|
5022
5058
|
{
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5050
|
-
"div",
|
|
5059
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
5060
|
+
style: {
|
|
5061
|
+
left: `${touchPosition.x}px`,
|
|
5062
|
+
top: `${touchPosition.y}px`,
|
|
5063
|
+
transform: "translate(-50%, -50%)"
|
|
5064
|
+
},
|
|
5065
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5066
|
+
InputWithSpecialExpression_default,
|
|
5067
|
+
{
|
|
5068
|
+
value: draggedOption,
|
|
5069
|
+
showSpecialOnly: false
|
|
5070
|
+
}
|
|
5071
|
+
) }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5072
|
+
ShowMaterialMediaByContentType_default,
|
|
5073
|
+
{
|
|
5074
|
+
contentType: contentMap.type,
|
|
5075
|
+
src: draggedOption,
|
|
5076
|
+
canFullScreen: false
|
|
5077
|
+
},
|
|
5078
|
+
uniqueValue
|
|
5079
|
+
) })
|
|
5080
|
+
}
|
|
5081
|
+
),
|
|
5082
|
+
/* @__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(
|
|
5083
|
+
(option, index) => checkAnswerProvided(answerMap, option) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5084
|
+
ShowMaterialMediaByContentType_default,
|
|
5051
5085
|
{
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
value: option,
|
|
5058
|
-
showSpecialOnly: false
|
|
5059
|
-
}
|
|
5060
|
-
) })
|
|
5061
|
-
}
|
|
5086
|
+
contentType: contentMap.type,
|
|
5087
|
+
src: option,
|
|
5088
|
+
canFullScreen: true
|
|
5089
|
+
},
|
|
5090
|
+
`${uniqueValue}-${index}`
|
|
5062
5091
|
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5063
5092
|
"div",
|
|
5064
5093
|
{
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
canFullScreen: true
|
|
5073
|
-
},
|
|
5074
|
-
`${uniqueValue}-${index}`
|
|
5075
|
-
)
|
|
5076
|
-
}
|
|
5077
|
-
)
|
|
5078
|
-
},
|
|
5079
|
-
index
|
|
5080
|
-
)
|
|
5081
|
-
) }),
|
|
5082
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", onMouseUp: handleMouseUp, children: Object.keys(answerMap).map((materialKey, index) => {
|
|
5083
|
-
const learnerAnswerState = checkAnswerState(
|
|
5084
|
-
JSON.parse(materialMap[materialKey]),
|
|
5085
|
-
answerMap[materialKey]
|
|
5086
|
-
);
|
|
5087
|
-
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)(
|
|
5088
|
-
"div",
|
|
5089
|
-
{
|
|
5090
|
-
"data-drop-zone": materialKey,
|
|
5091
|
-
onMouseEnter: () => draggedOption && setDropTargetIndex(materialKey),
|
|
5092
|
-
onMouseLeave: () => setDropTargetIndex(null),
|
|
5093
|
-
onClick: () => handleDropZoneClick(materialKey),
|
|
5094
|
-
className: `${dropTargetIndex === materialKey ? "ring-2 ring-blue-400 bg-blue-50" : ""} transition-all duration-200 rounded-lg`,
|
|
5095
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
5096
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-xl", children: [
|
|
5097
|
-
parseFloat(materialKey) + 1,
|
|
5098
|
-
"."
|
|
5099
|
-
] }) }),
|
|
5100
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative", children: [
|
|
5101
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5094
|
+
ref: draggedOption === option ? dragElementRef : null,
|
|
5095
|
+
className: `${draggedOption === option ? "opacity-40" : selectedOption === option ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
|
|
5096
|
+
onMouseDown: (e) => handleMouseDown(e, option),
|
|
5097
|
+
onTouchStart: (e) => handleTouchStart(e, option, e.currentTarget),
|
|
5098
|
+
onTouchMove: handleTouchMove,
|
|
5099
|
+
onTouchEnd: handleTouchEnd,
|
|
5100
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5102
5101
|
"div",
|
|
5103
5102
|
{
|
|
5104
|
-
className:
|
|
5105
|
-
onClick: (
|
|
5106
|
-
|
|
5107
|
-
e.stopPropagation();
|
|
5108
|
-
onChange(answer, materialKey, "");
|
|
5109
|
-
}
|
|
5110
|
-
},
|
|
5111
|
-
children: answerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5103
|
+
className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge cursor-pointer select-none",
|
|
5104
|
+
onClick: () => handleSelectOption(option),
|
|
5105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5112
5106
|
InputWithSpecialExpression_default,
|
|
5113
5107
|
{
|
|
5114
|
-
value:
|
|
5108
|
+
value: option,
|
|
5115
5109
|
showSpecialOnly: false
|
|
5116
5110
|
}
|
|
5117
|
-
)
|
|
5118
|
-
}
|
|
5119
|
-
) }),
|
|
5120
|
-
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5121
|
-
BaseImage_default,
|
|
5122
|
-
{
|
|
5123
|
-
src: "/icons/checkbox.webp",
|
|
5124
|
-
alt: "checkbox",
|
|
5125
|
-
size: "small"
|
|
5111
|
+
) })
|
|
5126
5112
|
}
|
|
5127
|
-
)
|
|
5128
|
-
|
|
5113
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5114
|
+
"div",
|
|
5129
5115
|
{
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5116
|
+
className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge cursor-pointer select-none",
|
|
5117
|
+
onClick: () => handleSelectOption(option),
|
|
5118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5119
|
+
ShowMaterialMediaByContentType_default,
|
|
5120
|
+
{
|
|
5121
|
+
contentType: contentMap.type,
|
|
5122
|
+
src: option,
|
|
5123
|
+
canFullScreen: true
|
|
5124
|
+
},
|
|
5125
|
+
`${uniqueValue}-${index}`
|
|
5126
|
+
)
|
|
5133
5127
|
}
|
|
5134
|
-
)
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
)
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5128
|
+
)
|
|
5129
|
+
},
|
|
5130
|
+
index
|
|
5131
|
+
)
|
|
5132
|
+
) }),
|
|
5133
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
|
|
5134
|
+
const learnerAnswerState = checkAnswerState(
|
|
5135
|
+
JSON.parse(materialMap[materialKey]),
|
|
5136
|
+
answerMap[materialKey]
|
|
5137
|
+
);
|
|
5138
|
+
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)(
|
|
5139
|
+
"div",
|
|
5140
|
+
{
|
|
5141
|
+
"data-drop-zone": materialKey,
|
|
5142
|
+
onMouseEnter: () => draggedOption && setDropTargetIndex(materialKey),
|
|
5143
|
+
onMouseLeave: () => setDropTargetIndex(null),
|
|
5144
|
+
onClick: () => handleDropZoneClick(materialKey),
|
|
5145
|
+
className: `${dropTargetIndex === materialKey ? "ring-2 ring-blue-400 bg-blue-50" : ""} transition-all duration-200 rounded-lg`,
|
|
5146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
5147
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-xl", children: [
|
|
5148
|
+
parseFloat(materialKey) + 1,
|
|
5149
|
+
"."
|
|
5150
|
+
] }) }),
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative", children: [
|
|
5152
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5153
|
+
"div",
|
|
5154
|
+
{
|
|
5155
|
+
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"}`,
|
|
5156
|
+
onClick: (e) => {
|
|
5157
|
+
if (answerMap[materialKey]) {
|
|
5158
|
+
e.stopPropagation();
|
|
5159
|
+
onChange(answer, materialKey, "");
|
|
5160
|
+
}
|
|
5161
|
+
},
|
|
5162
|
+
children: answerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5163
|
+
InputWithSpecialExpression_default,
|
|
5164
|
+
{
|
|
5165
|
+
value: answerMap[materialKey],
|
|
5166
|
+
showSpecialOnly: false
|
|
5167
|
+
}
|
|
5168
|
+
) : null
|
|
5169
|
+
}
|
|
5170
|
+
) }),
|
|
5171
|
+
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5172
|
+
BaseImage_default,
|
|
5173
|
+
{
|
|
5174
|
+
src: "/icons/checkbox.webp",
|
|
5175
|
+
alt: "checkbox",
|
|
5176
|
+
size: "small"
|
|
5177
|
+
}
|
|
5178
|
+
) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5179
|
+
BaseImage_default,
|
|
5180
|
+
{
|
|
5181
|
+
src: "/icons/cross-red.webp",
|
|
5182
|
+
alt: "cross-red",
|
|
5183
|
+
size: "small"
|
|
5184
|
+
}
|
|
5185
|
+
) }) : null
|
|
5186
|
+
] }) : answerMap[materialKey] === "" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5187
|
+
"div",
|
|
5151
5188
|
{
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5189
|
+
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"}`,
|
|
5190
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "italic", children: i18n_default.t("please_drop_here") }) })
|
|
5191
|
+
}
|
|
5192
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5193
|
+
"div",
|
|
5194
|
+
{
|
|
5195
|
+
className: "flex-1 cursor-pointer",
|
|
5196
|
+
onClick: (e) => {
|
|
5197
|
+
e.stopPropagation();
|
|
5198
|
+
onChange(answer, materialKey, "");
|
|
5199
|
+
},
|
|
5200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5201
|
+
ShowMaterialMediaByContentType_default,
|
|
5202
|
+
{
|
|
5203
|
+
contentType: contentMap.type,
|
|
5204
|
+
src: answerMap[materialKey],
|
|
5205
|
+
canFullScreen: true
|
|
5206
|
+
},
|
|
5207
|
+
`${uniqueValue}-${index}`
|
|
5208
|
+
)
|
|
5209
|
+
}
|
|
5210
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
5211
|
+
answerMap[materialKey]
|
|
5212
|
+
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5213
|
+
"span",
|
|
5214
|
+
{
|
|
5215
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5216
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_katex4.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
5155
5217
|
},
|
|
5156
|
-
|
|
5157
|
-
)
|
|
5158
|
-
}
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_katex4.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
5166
|
-
},
|
|
5167
|
-
index2
|
|
5168
|
-
)) }, materialKey) })
|
|
5169
|
-
] })
|
|
5170
|
-
}
|
|
5171
|
-
) }) }, index);
|
|
5172
|
-
}) })
|
|
5173
|
-
] });
|
|
5218
|
+
index2
|
|
5219
|
+
)) }, materialKey) })
|
|
5220
|
+
] })
|
|
5221
|
+
}
|
|
5222
|
+
) }) }, index);
|
|
5223
|
+
}) })
|
|
5224
|
+
]
|
|
5225
|
+
}
|
|
5226
|
+
);
|
|
5174
5227
|
};
|
|
5175
5228
|
var FillInTheBlanksActivityMaterialContent_default = FillInTheBlanksActivityMaterialContent;
|
|
5176
5229
|
|
|
@@ -5297,6 +5350,10 @@ var GroupingActivityMaterialContent = ({
|
|
|
5297
5350
|
const [isShuffled, setIsShuffled] = (0, import_react20.useState)(false);
|
|
5298
5351
|
const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react20.useState)([]);
|
|
5299
5352
|
const dragElementRef = (0, import_react20.useRef)(null);
|
|
5353
|
+
const [mousePosition, setMousePosition] = (0, import_react20.useState)({
|
|
5354
|
+
x: 0,
|
|
5355
|
+
y: 0
|
|
5356
|
+
});
|
|
5300
5357
|
const [touchPosition, setTouchPosition] = (0, import_react20.useState)({
|
|
5301
5358
|
x: 0,
|
|
5302
5359
|
y: 0
|
|
@@ -5364,6 +5421,19 @@ var GroupingActivityMaterialContent = ({
|
|
|
5364
5421
|
e.preventDefault();
|
|
5365
5422
|
setDraggedValue(materialValue);
|
|
5366
5423
|
setSelectedValue(null);
|
|
5424
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5425
|
+
};
|
|
5426
|
+
const handleMouseMove = (e) => {
|
|
5427
|
+
if (!draggedValue) return;
|
|
5428
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5429
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
5430
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-grouping-drop-zone]");
|
|
5431
|
+
if (dropZone) {
|
|
5432
|
+
const dropKey = dropZone.getAttribute("data-grouping-drop-zone");
|
|
5433
|
+
setDropTargetKey(dropKey);
|
|
5434
|
+
} else {
|
|
5435
|
+
setDropTargetKey(null);
|
|
5436
|
+
}
|
|
5367
5437
|
};
|
|
5368
5438
|
const handleMouseUp = () => {
|
|
5369
5439
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
@@ -5371,6 +5441,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5371
5441
|
}
|
|
5372
5442
|
setDraggedValue(null);
|
|
5373
5443
|
setDropTargetKey(null);
|
|
5444
|
+
setMousePosition({ x: 0, y: 0 });
|
|
5374
5445
|
};
|
|
5375
5446
|
const handleTouchStart = (e, materialValue, element) => {
|
|
5376
5447
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5403,6 +5474,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5403
5474
|
setDraggedValue(null);
|
|
5404
5475
|
setDropTargetKey(null);
|
|
5405
5476
|
setDraggedElement(null);
|
|
5477
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
5406
5478
|
};
|
|
5407
5479
|
const handleSelectItem = (materialValue) => {
|
|
5408
5480
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5417,7 +5489,36 @@ var GroupingActivityMaterialContent = ({
|
|
|
5417
5489
|
};
|
|
5418
5490
|
const answerMap = retrieveAnswerMap();
|
|
5419
5491
|
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
5420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { onMouseUp: handleMouseUp, children: [
|
|
5492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
5493
|
+
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5494
|
+
"div",
|
|
5495
|
+
{
|
|
5496
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
5497
|
+
style: {
|
|
5498
|
+
left: `${mousePosition.x}px`,
|
|
5499
|
+
top: `${mousePosition.y}px`,
|
|
5500
|
+
transform: "translate(-50%, -50%)"
|
|
5501
|
+
},
|
|
5502
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-col items-center justify-center m-2 min-w-[200px]", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xl text-center whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(draggedValue).map(
|
|
5503
|
+
(inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5504
|
+
"span",
|
|
5505
|
+
{
|
|
5506
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5507
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_katex5.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
5508
|
+
},
|
|
5509
|
+
index
|
|
5510
|
+
)
|
|
5511
|
+
) }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5512
|
+
ShowMaterialMediaByContentType_default,
|
|
5513
|
+
{
|
|
5514
|
+
contentType: contentMap.type,
|
|
5515
|
+
src: draggedValue,
|
|
5516
|
+
canFullScreen: false
|
|
5517
|
+
},
|
|
5518
|
+
`${uniqueValue}-drag-mouse`
|
|
5519
|
+
) })
|
|
5520
|
+
}
|
|
5521
|
+
),
|
|
5421
5522
|
draggedValue && touchPosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5422
5523
|
"div",
|
|
5423
5524
|
{
|
|
@@ -5443,7 +5544,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5443
5544
|
src: draggedValue,
|
|
5444
5545
|
canFullScreen: false
|
|
5445
5546
|
},
|
|
5446
|
-
`${uniqueValue}-drag`
|
|
5547
|
+
`${uniqueValue}-drag-touch`
|
|
5447
5548
|
) })
|
|
5448
5549
|
}
|
|
5449
5550
|
),
|
|
@@ -5646,17 +5747,16 @@ var MatchingActivityMaterialContent = ({
|
|
|
5646
5747
|
const [selectedValue, setSelectedValue] = (0, import_react21.useState)(null);
|
|
5647
5748
|
const [draggedValue, setDraggedValue] = (0, import_react21.useState)(null);
|
|
5648
5749
|
const [dropTargetKey, setDropTargetKey] = (0, import_react21.useState)(null);
|
|
5649
|
-
const [draggedElement, setDraggedElement] = (0, import_react21.useState)(
|
|
5650
|
-
null
|
|
5651
|
-
);
|
|
5750
|
+
const [draggedElement, setDraggedElement] = (0, import_react21.useState)(null);
|
|
5652
5751
|
const [isShuffled, setIsShuffled] = (0, import_react21.useState)(false);
|
|
5653
5752
|
const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react21.useState)([]);
|
|
5654
5753
|
const dragElementRef = (0, import_react21.useRef)(null);
|
|
5655
|
-
const [
|
|
5656
|
-
|
|
5657
|
-
y: 0
|
|
5658
|
-
});
|
|
5754
|
+
const [mousePosition, setMousePosition] = (0, import_react21.useState)({ x: 0, y: 0 });
|
|
5755
|
+
const [touchPosition, setTouchPosition] = (0, import_react21.useState)({ x: 0, y: 0 });
|
|
5659
5756
|
const itemsRef = (0, import_react21.useRef)(null);
|
|
5757
|
+
const scrollIntervalRef = (0, import_react21.useRef)(null);
|
|
5758
|
+
const SCROLL_THRESHOLD = 100;
|
|
5759
|
+
const SCROLL_SPEED = 10;
|
|
5660
5760
|
(0, import_react21.useEffect)(() => {
|
|
5661
5761
|
const shuffleArray2 = (array) => {
|
|
5662
5762
|
if (!isShuffled) {
|
|
@@ -5678,10 +5778,44 @@ var MatchingActivityMaterialContent = ({
|
|
|
5678
5778
|
}, [materialMap, isShuffled]);
|
|
5679
5779
|
(0, import_react21.useEffect)(() => {
|
|
5680
5780
|
if (!showCorrectAnswer) return;
|
|
5681
|
-
answer.data.find(
|
|
5682
|
-
(answerData) => answerData.type === "MATCHING"
|
|
5683
|
-
).answerMap = materialMap;
|
|
5781
|
+
answer.data.find((answerData) => answerData.type === "MATCHING").answerMap = materialMap;
|
|
5684
5782
|
}, [showCorrectAnswer, answer, materialMap]);
|
|
5783
|
+
(0, import_react21.useEffect)(() => {
|
|
5784
|
+
if (!draggedValue || mousePosition.y === 0) return;
|
|
5785
|
+
const handleAutoScroll = () => {
|
|
5786
|
+
const viewportHeight = window.innerHeight;
|
|
5787
|
+
const scrollY = window.scrollY;
|
|
5788
|
+
if (mousePosition.y < SCROLL_THRESHOLD + scrollY) {
|
|
5789
|
+
window.scrollBy(0, -SCROLL_SPEED);
|
|
5790
|
+
} else if (mousePosition.y > viewportHeight + scrollY - SCROLL_THRESHOLD) {
|
|
5791
|
+
window.scrollBy(0, SCROLL_SPEED);
|
|
5792
|
+
}
|
|
5793
|
+
};
|
|
5794
|
+
scrollIntervalRef.current = setInterval(handleAutoScroll, 16);
|
|
5795
|
+
return () => {
|
|
5796
|
+
if (scrollIntervalRef.current) {
|
|
5797
|
+
clearInterval(scrollIntervalRef.current);
|
|
5798
|
+
}
|
|
5799
|
+
};
|
|
5800
|
+
}, [draggedValue, mousePosition.y]);
|
|
5801
|
+
(0, import_react21.useEffect)(() => {
|
|
5802
|
+
if (!draggedValue || touchPosition.y === 0) return;
|
|
5803
|
+
const handleAutoScroll = () => {
|
|
5804
|
+
const viewportHeight = window.innerHeight;
|
|
5805
|
+
const scrollY = window.scrollY;
|
|
5806
|
+
if (touchPosition.y < SCROLL_THRESHOLD + scrollY) {
|
|
5807
|
+
window.scrollBy(0, -SCROLL_SPEED);
|
|
5808
|
+
} else if (touchPosition.y > viewportHeight + scrollY - SCROLL_THRESHOLD) {
|
|
5809
|
+
window.scrollBy(0, SCROLL_SPEED);
|
|
5810
|
+
}
|
|
5811
|
+
};
|
|
5812
|
+
scrollIntervalRef.current = setInterval(handleAutoScroll, 16);
|
|
5813
|
+
return () => {
|
|
5814
|
+
if (scrollIntervalRef.current) {
|
|
5815
|
+
clearInterval(scrollIntervalRef.current);
|
|
5816
|
+
}
|
|
5817
|
+
};
|
|
5818
|
+
}, [draggedValue, touchPosition.y]);
|
|
5685
5819
|
const retrieveAnswerMap = () => {
|
|
5686
5820
|
const foundIndex = answer.data.findIndex(
|
|
5687
5821
|
(answerData) => answerData.type === "MATCHING"
|
|
@@ -5710,6 +5844,19 @@ var MatchingActivityMaterialContent = ({
|
|
|
5710
5844
|
e.preventDefault();
|
|
5711
5845
|
setDraggedValue(materialValue);
|
|
5712
5846
|
setSelectedValue(null);
|
|
5847
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5848
|
+
};
|
|
5849
|
+
const handleMouseMove = (e) => {
|
|
5850
|
+
if (!draggedValue) return;
|
|
5851
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
5852
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
5853
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-matching-drop-zone]");
|
|
5854
|
+
if (dropZone) {
|
|
5855
|
+
const dropKey = dropZone.getAttribute("data-matching-drop-zone");
|
|
5856
|
+
setDropTargetKey(dropKey);
|
|
5857
|
+
} else {
|
|
5858
|
+
setDropTargetKey(null);
|
|
5859
|
+
}
|
|
5713
5860
|
};
|
|
5714
5861
|
const handleMouseUp = () => {
|
|
5715
5862
|
if (dropTargetKey !== null && draggedValue !== null) {
|
|
@@ -5717,6 +5864,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5717
5864
|
}
|
|
5718
5865
|
setDraggedValue(null);
|
|
5719
5866
|
setDropTargetKey(null);
|
|
5867
|
+
setMousePosition({ x: 0, y: 0 });
|
|
5720
5868
|
};
|
|
5721
5869
|
const handleTouchStart = (e, materialValue, element) => {
|
|
5722
5870
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5749,6 +5897,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5749
5897
|
setDraggedValue(null);
|
|
5750
5898
|
setDropTargetKey(null);
|
|
5751
5899
|
setDraggedElement(null);
|
|
5900
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
5752
5901
|
};
|
|
5753
5902
|
const handleSelectItem = (materialValue) => {
|
|
5754
5903
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -5763,7 +5912,36 @@ var MatchingActivityMaterialContent = ({
|
|
|
5763
5912
|
};
|
|
5764
5913
|
const answerMap = retrieveAnswerMap();
|
|
5765
5914
|
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
5766
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { onMouseUp: handleMouseUp, children: [
|
|
5915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, children: [
|
|
5916
|
+
draggedValue && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5917
|
+
"div",
|
|
5918
|
+
{
|
|
5919
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
5920
|
+
style: {
|
|
5921
|
+
left: `${mousePosition.x}px`,
|
|
5922
|
+
top: `${mousePosition.y}px`,
|
|
5923
|
+
transform: "translate(-50%, -50%)"
|
|
5924
|
+
},
|
|
5925
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col items-center justify-center m-2 min-w-[200px] px-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(draggedValue).map(
|
|
5926
|
+
(inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5927
|
+
"span",
|
|
5928
|
+
{
|
|
5929
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5930
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_katex6.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
5931
|
+
},
|
|
5932
|
+
index
|
|
5933
|
+
)
|
|
5934
|
+
) }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "border-catchup-blue border-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5935
|
+
ShowMaterialMediaByContentType_default,
|
|
5936
|
+
{
|
|
5937
|
+
contentType: contentMap.type,
|
|
5938
|
+
src: draggedValue,
|
|
5939
|
+
canFullScreen: false
|
|
5940
|
+
},
|
|
5941
|
+
`${uniqueValue}-drag-mouse`
|
|
5942
|
+
) })
|
|
5943
|
+
}
|
|
5944
|
+
),
|
|
5767
5945
|
draggedValue && touchPosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5768
5946
|
"div",
|
|
5769
5947
|
{
|
|
@@ -5789,7 +5967,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5789
5967
|
src: draggedValue,
|
|
5790
5968
|
canFullScreen: false
|
|
5791
5969
|
},
|
|
5792
|
-
`${uniqueValue}-drag`
|
|
5970
|
+
`${uniqueValue}-drag-touch`
|
|
5793
5971
|
) })
|
|
5794
5972
|
}
|
|
5795
5973
|
),
|
|
@@ -5840,7 +6018,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5840
6018
|
),
|
|
5841
6019
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DividerLine_default, {}) })
|
|
5842
6020
|
] }) : null,
|
|
5843
|
-
|
|
6021
|
+
Object.keys(answerMap).map((answerMapKey, index) => {
|
|
5844
6022
|
const learnerAnswerState = checkAnswerState(
|
|
5845
6023
|
materialMap[answerMapKey],
|
|
5846
6024
|
answerMap[answerMapKey]
|
|
@@ -5850,16 +6028,16 @@ var MatchingActivityMaterialContent = ({
|
|
|
5850
6028
|
"div",
|
|
5851
6029
|
{
|
|
5852
6030
|
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"}`,
|
|
5853
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
)
|
|
6031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
|
|
6032
|
+
(inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6033
|
+
"span",
|
|
6034
|
+
{
|
|
6035
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
6036
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_katex6.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
6037
|
+
},
|
|
6038
|
+
index2
|
|
6039
|
+
)
|
|
6040
|
+
) }) })
|
|
5863
6041
|
}
|
|
5864
6042
|
) }),
|
|
5865
6043
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
|
|
@@ -5905,7 +6083,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5905
6083
|
}
|
|
5906
6084
|
) })
|
|
5907
6085
|
] }, index);
|
|
5908
|
-
})
|
|
6086
|
+
})
|
|
5909
6087
|
] });
|
|
5910
6088
|
};
|
|
5911
6089
|
var MatchingActivityMaterialContent_default = MatchingActivityMaterialContent;
|
|
@@ -6510,6 +6688,10 @@ var OrderingActivityMaterialContent = ({
|
|
|
6510
6688
|
null
|
|
6511
6689
|
);
|
|
6512
6690
|
const dragElementRef = (0, import_react23.useRef)(null);
|
|
6691
|
+
const [mousePosition, setMousePosition] = (0, import_react23.useState)({
|
|
6692
|
+
x: 0,
|
|
6693
|
+
y: 0
|
|
6694
|
+
});
|
|
6513
6695
|
const [touchPosition, setTouchPosition] = (0, import_react23.useState)({
|
|
6514
6696
|
x: 0,
|
|
6515
6697
|
y: 0
|
|
@@ -6571,6 +6753,19 @@ var OrderingActivityMaterialContent = ({
|
|
|
6571
6753
|
e.preventDefault();
|
|
6572
6754
|
setDraggedKey(materialKey);
|
|
6573
6755
|
setSelectedKey(null);
|
|
6756
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
6757
|
+
};
|
|
6758
|
+
const handleMouseMove = (e) => {
|
|
6759
|
+
if (!draggedKey) return;
|
|
6760
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
6761
|
+
const elementUnder = document.elementFromPoint(e.clientX, e.clientY);
|
|
6762
|
+
const dropZone = elementUnder == null ? void 0 : elementUnder.closest("[data-ordering-drop-zone]");
|
|
6763
|
+
if (dropZone) {
|
|
6764
|
+
const dropKey = dropZone.getAttribute("data-ordering-drop-zone");
|
|
6765
|
+
setDropTargetKey(dropKey);
|
|
6766
|
+
} else {
|
|
6767
|
+
setDropTargetKey(null);
|
|
6768
|
+
}
|
|
6574
6769
|
};
|
|
6575
6770
|
const handleMouseUp = () => {
|
|
6576
6771
|
if (dropTargetKey !== null && draggedKey !== null && dropTargetKey !== draggedKey) {
|
|
@@ -6578,6 +6773,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6578
6773
|
}
|
|
6579
6774
|
setDraggedKey(null);
|
|
6580
6775
|
setDropTargetKey(null);
|
|
6776
|
+
setMousePosition({ x: 0, y: 0 });
|
|
6581
6777
|
};
|
|
6582
6778
|
const handleTouchStart = (e, materialKey, element) => {
|
|
6583
6779
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -6610,6 +6806,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6610
6806
|
setDraggedKey(null);
|
|
6611
6807
|
setDropTargetKey(null);
|
|
6612
6808
|
setDraggedElement(null);
|
|
6809
|
+
setTouchPosition({ x: 0, y: 0 });
|
|
6613
6810
|
};
|
|
6614
6811
|
const handleSelectItem = (materialKey) => {
|
|
6615
6812
|
if (!checkCanAnswerQuestion()) return;
|
|
@@ -6624,100 +6821,137 @@ var OrderingActivityMaterialContent = ({
|
|
|
6624
6821
|
setDraggedKey(null);
|
|
6625
6822
|
};
|
|
6626
6823
|
const answerMap = retrieveAnswerMap();
|
|
6627
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
},
|
|
6637
|
-
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6638
|
-
materialMap[answerMap[draggedKey]]
|
|
6639
|
-
).map((inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6640
|
-
"span",
|
|
6824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6825
|
+
"div",
|
|
6826
|
+
{
|
|
6827
|
+
className: "flex flex-row flex-wrap",
|
|
6828
|
+
onMouseMove: handleMouseMove,
|
|
6829
|
+
onMouseUp: handleMouseUp,
|
|
6830
|
+
children: [
|
|
6831
|
+
draggedKey && mousePosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6832
|
+
"div",
|
|
6641
6833
|
{
|
|
6642
|
-
className:
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6834
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
6835
|
+
style: {
|
|
6836
|
+
left: `${mousePosition.x}px`,
|
|
6837
|
+
top: `${mousePosition.y}px`,
|
|
6838
|
+
transform: "translate(-50%, -50%)"
|
|
6839
|
+
},
|
|
6840
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6841
|
+
materialMap[answerMap[draggedKey]]
|
|
6842
|
+
).map((inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6843
|
+
"span",
|
|
6844
|
+
{
|
|
6845
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
6846
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_katex9.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
6847
|
+
},
|
|
6848
|
+
index
|
|
6849
|
+
)) }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6850
|
+
ShowMaterialMediaByContentType_default,
|
|
6851
|
+
{
|
|
6852
|
+
contentType: contentMap.type,
|
|
6853
|
+
src: materialMap[answerMap[draggedKey]],
|
|
6854
|
+
canFullScreen: false
|
|
6855
|
+
},
|
|
6856
|
+
`${uniqueValue}-drag-mouse`
|
|
6857
|
+
) })
|
|
6858
|
+
}
|
|
6859
|
+
),
|
|
6860
|
+
draggedKey && touchPosition.x > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6861
|
+
"div",
|
|
6648
6862
|
{
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
answerMap[materialKey] + "",
|
|
6660
|
-
index + ""
|
|
6661
|
-
);
|
|
6662
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-full lg:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6663
|
-
"div",
|
|
6664
|
-
{
|
|
6665
|
-
className: `flex flex-row items-center my-4 mx-2`,
|
|
6666
|
-
style: {
|
|
6667
|
-
marginTop: view === "PC" ? calculateMarginTop(parseFloat(materialKey)) : 0
|
|
6668
|
-
},
|
|
6669
|
-
children: [
|
|
6670
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mr-3", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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__ */ (0, import_jsx_runtime40.jsx)(
|
|
6671
|
-
"div",
|
|
6863
|
+
className: "fixed pointer-events-none z-50 opacity-80",
|
|
6864
|
+
style: {
|
|
6865
|
+
left: `${touchPosition.x}px`,
|
|
6866
|
+
top: `${touchPosition.y}px`,
|
|
6867
|
+
transform: "translate(-50%, -50%)"
|
|
6868
|
+
},
|
|
6869
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-catchup-blue border-2 px-3 py-2 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6870
|
+
materialMap[answerMap[draggedKey]]
|
|
6871
|
+
).map((inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6872
|
+
"span",
|
|
6672
6873
|
{
|
|
6673
|
-
className: `${
|
|
6674
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("
|
|
6675
|
-
}
|
|
6676
|
-
|
|
6677
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6678
|
-
|
|
6874
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
6875
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_katex9.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
6876
|
+
},
|
|
6877
|
+
index
|
|
6878
|
+
)) }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge bg-white shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6879
|
+
ShowMaterialMediaByContentType_default,
|
|
6679
6880
|
{
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6881
|
+
contentType: contentMap.type,
|
|
6882
|
+
src: materialMap[answerMap[draggedKey]],
|
|
6883
|
+
canFullScreen: false
|
|
6884
|
+
},
|
|
6885
|
+
`${uniqueValue}-drag-touch`
|
|
6886
|
+
) })
|
|
6887
|
+
}
|
|
6888
|
+
),
|
|
6889
|
+
Object.keys(answerMap).map((materialKey, index) => {
|
|
6890
|
+
const learnerAnswerState = checkAnswerState(
|
|
6891
|
+
answerMap[materialKey] + "",
|
|
6892
|
+
index + ""
|
|
6893
|
+
);
|
|
6894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-full lg:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6895
|
+
"div",
|
|
6896
|
+
{
|
|
6897
|
+
className: `flex flex-row items-center my-4 mx-2`,
|
|
6898
|
+
style: {
|
|
6899
|
+
marginTop: view === "PC" ? calculateMarginTop(parseFloat(materialKey)) : 0
|
|
6900
|
+
},
|
|
6901
|
+
children: [
|
|
6902
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mr-3", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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__ */ (0, import_jsx_runtime40.jsx)(
|
|
6690
6903
|
"div",
|
|
6691
6904
|
{
|
|
6692
|
-
className: `${
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6905
|
+
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]`,
|
|
6906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "", children: parseFloat(materialKey) + 1 })
|
|
6907
|
+
}
|
|
6908
|
+
) }) }),
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6910
|
+
"div",
|
|
6911
|
+
{
|
|
6912
|
+
ref: draggedKey === materialKey ? dragElementRef : null,
|
|
6913
|
+
"data-ordering-drop-zone": materialKey,
|
|
6914
|
+
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`,
|
|
6915
|
+
onMouseDown: (e) => handleMouseDown(e, materialKey),
|
|
6916
|
+
onMouseEnter: () => draggedKey && draggedKey !== materialKey && setDropTargetKey(materialKey),
|
|
6917
|
+
onMouseLeave: () => setDropTargetKey(null),
|
|
6918
|
+
onTouchStart: (e) => handleTouchStart(e, materialKey, e.currentTarget),
|
|
6919
|
+
onTouchMove: handleTouchMove,
|
|
6920
|
+
onTouchEnd: handleTouchEnd,
|
|
6921
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6922
|
+
"div",
|
|
6705
6923
|
{
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6924
|
+
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"}`,
|
|
6925
|
+
onClick: () => handleSelectItem(materialKey),
|
|
6926
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
6927
|
+
materialMap[answerMap[materialKey]]
|
|
6928
|
+
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6929
|
+
"span",
|
|
6930
|
+
{
|
|
6931
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
6932
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_katex9.InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
6933
|
+
},
|
|
6934
|
+
index2
|
|
6935
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6936
|
+
ShowMaterialMediaByContentType_default,
|
|
6937
|
+
{
|
|
6938
|
+
contentType: contentMap.type,
|
|
6939
|
+
src: materialMap[answerMap[materialKey]],
|
|
6940
|
+
canFullScreen: true
|
|
6941
|
+
},
|
|
6942
|
+
`${uniqueValue}-${index}`
|
|
6943
|
+
)
|
|
6944
|
+
}
|
|
6711
6945
|
)
|
|
6712
6946
|
}
|
|
6713
6947
|
)
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
}
|
|
6718
|
-
|
|
6719
|
-
}
|
|
6720
|
-
|
|
6948
|
+
]
|
|
6949
|
+
}
|
|
6950
|
+
) }, index);
|
|
6951
|
+
})
|
|
6952
|
+
]
|
|
6953
|
+
}
|
|
6954
|
+
);
|
|
6721
6955
|
};
|
|
6722
6956
|
var OrderingActivityMaterialContent_default = OrderingActivityMaterialContent;
|
|
6723
6957
|
|