catchup-library-web 1.20.29 → 1.20.31
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 +308 -304
- package/dist/index.mjs +248 -244
- package/package.json +1 -1
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx +193 -180
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent2.tsx +306 -0
package/dist/index.js
CHANGED
|
@@ -4860,95 +4860,34 @@ var DropdownActivityContent_default = DropdownActivityContent;
|
|
|
4860
4860
|
|
|
4861
4861
|
// src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx
|
|
4862
4862
|
var import_react_katex4 = require("react-katex");
|
|
4863
|
-
var import_react19 = require("react");
|
|
4864
|
-
var import_react20 = require("react");
|
|
4865
|
-
var import_react_dnd3 = require("react-dnd");
|
|
4866
|
-
|
|
4867
|
-
// src/components/dnds/DraggableItem.tsx
|
|
4868
|
-
var import_react_dnd = require("react-dnd");
|
|
4869
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4870
|
-
var DraggableItem = ({
|
|
4871
|
-
item,
|
|
4872
|
-
type,
|
|
4873
|
-
component,
|
|
4874
|
-
moveCardHandler
|
|
4875
|
-
}) => {
|
|
4876
|
-
const [{ isDragging }, drag] = (0, import_react_dnd.useDrag)({
|
|
4877
|
-
type,
|
|
4878
|
-
item,
|
|
4879
|
-
end: (item2, monitor) => {
|
|
4880
|
-
const dropResult = monitor.getDropResult();
|
|
4881
|
-
if (dropResult) {
|
|
4882
|
-
moveCardHandler();
|
|
4883
|
-
}
|
|
4884
|
-
},
|
|
4885
|
-
collect: (monitor) => ({
|
|
4886
|
-
isDragging: monitor.isDragging()
|
|
4887
|
-
})
|
|
4888
|
-
});
|
|
4889
|
-
const opacity = isDragging ? 0.4 : 1;
|
|
4890
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4891
|
-
"div",
|
|
4892
|
-
{
|
|
4893
|
-
className: `${isDragging ? "w-[0px] opacity-0" : "opacity-100"} transition-all duration-500`,
|
|
4894
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: drag, className: "", style: { opacity }, children: component })
|
|
4895
|
-
}
|
|
4896
|
-
);
|
|
4897
|
-
};
|
|
4898
|
-
var DraggableItem_default = DraggableItem;
|
|
4899
|
-
|
|
4900
|
-
// src/components/dnds/DroppableItem.tsx
|
|
4901
4863
|
var import_react18 = require("react");
|
|
4902
|
-
var import_react_dnd2 = require("react-dnd");
|
|
4903
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4904
|
-
var DroppableItem = ({
|
|
4905
|
-
item,
|
|
4906
|
-
type,
|
|
4907
|
-
component,
|
|
4908
|
-
dropRef,
|
|
4909
|
-
target,
|
|
4910
|
-
setTarget
|
|
4911
|
-
}) => {
|
|
4912
|
-
const ref = (0, import_react18.useRef)(null);
|
|
4913
|
-
const [, drop] = (0, import_react_dnd2.useDrop)({
|
|
4914
|
-
accept: type,
|
|
4915
|
-
hover() {
|
|
4916
|
-
if (item.index !== null && target !== item.index) {
|
|
4917
|
-
setTarget(item.index);
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
});
|
|
4921
|
-
dropRef(drop(ref));
|
|
4922
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `w-full transition-all duration-500 h-full`, ref, children: component });
|
|
4923
|
-
};
|
|
4924
|
-
var DroppableItem_default = DroppableItem;
|
|
4925
4864
|
|
|
4926
4865
|
// src/components/texts/InputWithSpecialExpression.tsx
|
|
4927
4866
|
var import_react_katex3 = require("react-katex");
|
|
4928
|
-
var
|
|
4867
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4929
4868
|
var InputWithSpecialExpression = ({
|
|
4930
4869
|
value,
|
|
4931
4870
|
showSpecialOnly
|
|
4932
4871
|
}) => {
|
|
4933
4872
|
const inputWithSpecialExpressionList = constructInputWithSpecialExpressionList(value);
|
|
4934
|
-
return showSpecialOnly ? inputWithSpecialExpressionList.length > 1 ? /* @__PURE__ */ (0,
|
|
4873
|
+
return showSpecialOnly ? inputWithSpecialExpressionList.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "m-2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "whitespace-pre-wrap", children: inputWithSpecialExpressionList.map((inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4935
4874
|
"span",
|
|
4936
4875
|
{
|
|
4937
4876
|
className: `${inputPart.isBold ? "font-semibold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4938
|
-
children: inputPart.isEquation ? /* @__PURE__ */ (0,
|
|
4877
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_katex3.InlineMath, { math: inputPart.value }, index) }) : inputPart.value
|
|
4939
4878
|
}
|
|
4940
|
-
)) }) }) : null : /* @__PURE__ */ (0,
|
|
4879
|
+
)) }) }) : null : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "m-2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "whitespace-pre-wrap", children: inputWithSpecialExpressionList.map((inputPart, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4941
4880
|
"span",
|
|
4942
4881
|
{
|
|
4943
4882
|
className: `${inputPart.isBold ? "font-semibold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4944
|
-
children: inputPart.isEquation ? /* @__PURE__ */ (0,
|
|
4883
|
+
children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_katex3.InlineMath, { math: inputPart.value }, index) }) : inputPart.value
|
|
4945
4884
|
}
|
|
4946
4885
|
)) }) });
|
|
4947
4886
|
};
|
|
4948
4887
|
var InputWithSpecialExpression_default = InputWithSpecialExpression;
|
|
4949
4888
|
|
|
4950
4889
|
// src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx
|
|
4951
|
-
var
|
|
4890
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4952
4891
|
var FillInTheBlanksActivityMaterialContent = ({
|
|
4953
4892
|
uniqueValue,
|
|
4954
4893
|
answer,
|
|
@@ -4960,22 +4899,14 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
4960
4899
|
isPreview,
|
|
4961
4900
|
showCorrectAnswer
|
|
4962
4901
|
}) => {
|
|
4963
|
-
const [shuffleOptionList, setShuffleOptionList] = (0,
|
|
4964
|
-
const [selectedOption, setSelectedOption] = (0,
|
|
4965
|
-
const [
|
|
4966
|
-
const [
|
|
4967
|
-
|
|
4968
|
-
drop: () => {
|
|
4969
|
-
},
|
|
4970
|
-
collect: (monitor) => ({
|
|
4971
|
-
isOver: monitor.isOver(),
|
|
4972
|
-
canDrop: monitor.canDrop()
|
|
4973
|
-
})
|
|
4974
|
-
});
|
|
4975
|
-
(0, import_react20.useEffect)(() => {
|
|
4902
|
+
const [shuffleOptionList, setShuffleOptionList] = (0, import_react18.useState)([]);
|
|
4903
|
+
const [selectedOption, setSelectedOption] = (0, import_react18.useState)(null);
|
|
4904
|
+
const [draggedOption, setDraggedOption] = (0, import_react18.useState)(null);
|
|
4905
|
+
const [dropTargetIndex, setDropTargetIndex] = (0, import_react18.useState)(null);
|
|
4906
|
+
(0, import_react18.useEffect)(() => {
|
|
4976
4907
|
setShuffleOptionList(shuffleArray(optionList));
|
|
4977
4908
|
}, []);
|
|
4978
|
-
(0,
|
|
4909
|
+
(0, import_react18.useEffect)(() => {
|
|
4979
4910
|
if (!showCorrectAnswer) return;
|
|
4980
4911
|
const foundAnswer = answer.data.find(
|
|
4981
4912
|
(answerData) => answerData.type === "FILL_IN_THE_BLANKS"
|
|
@@ -5006,181 +4937,193 @@ var FillInTheBlanksActivityMaterialContent = ({
|
|
|
5006
4937
|
const checkAnswerProvided = (answerMap2, option) => {
|
|
5007
4938
|
return Object.keys(answerMap2).findIndex((key) => answerMap2[key] === option) !== -1;
|
|
5008
4939
|
};
|
|
4940
|
+
const handleSelectOption = (option) => {
|
|
4941
|
+
setSelectedOption(option);
|
|
4942
|
+
};
|
|
4943
|
+
const handleDragStart = (option) => {
|
|
4944
|
+
setDraggedOption(option);
|
|
4945
|
+
};
|
|
4946
|
+
const handleDragEnd = () => {
|
|
4947
|
+
if (dropTargetIndex !== null && draggedOption !== null) {
|
|
4948
|
+
onChange(answer, dropTargetIndex, draggedOption);
|
|
4949
|
+
}
|
|
4950
|
+
setDraggedOption(null);
|
|
4951
|
+
setDropTargetIndex(null);
|
|
4952
|
+
};
|
|
4953
|
+
const handleDropZoneEnter = (index) => {
|
|
4954
|
+
setDropTargetIndex(index);
|
|
4955
|
+
};
|
|
4956
|
+
const handleDropZoneDrop = (index) => {
|
|
4957
|
+
if (selectedOption !== null) {
|
|
4958
|
+
onChange(answer, index, selectedOption);
|
|
4959
|
+
setSelectedOption(null);
|
|
4960
|
+
} else if (draggedOption !== null) {
|
|
4961
|
+
onChange(answer, index, draggedOption);
|
|
4962
|
+
setDraggedOption(null);
|
|
4963
|
+
}
|
|
4964
|
+
setDropTargetIndex(null);
|
|
4965
|
+
};
|
|
5009
4966
|
const answerMap = retrieveAnswerMap();
|
|
5010
|
-
return /* @__PURE__ */ (0,
|
|
5011
|
-
"div",
|
|
5012
|
-
{
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
4967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-row flex-wrap items-center", children: [
|
|
4968
|
+
/* @__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") }) }),
|
|
4969
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DividerLine_default, {}) }),
|
|
4970
|
+
/* @__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(
|
|
4971
|
+
(option, index) => checkAnswerProvided(answerMap, option) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "opacity-30", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4972
|
+
ShowMaterialMediaByContentType_default,
|
|
4973
|
+
{
|
|
4974
|
+
contentType: contentMap.type,
|
|
4975
|
+
src: option,
|
|
4976
|
+
canFullScreen: true
|
|
4977
|
+
},
|
|
4978
|
+
`${uniqueValue}-${index}`
|
|
4979
|
+
) }, index) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4980
|
+
"div",
|
|
4981
|
+
{
|
|
4982
|
+
draggable: true,
|
|
4983
|
+
onDragStart: () => handleDragStart(option),
|
|
4984
|
+
onDragEnd: handleDragEnd,
|
|
4985
|
+
className: `${draggedOption === option ? "opacity-40" : "opacity-100"} transition-opacity duration-200`,
|
|
4986
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4987
|
+
"div",
|
|
5024
4988
|
{
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
4989
|
+
className: "border-catchup-blue border-2 px-2 rounded-catchup-xlarge cursor-pointer select-none touch-none",
|
|
4990
|
+
onClick: () => handleSelectOption(option),
|
|
4991
|
+
onTouchEnd: () => handleSelectOption(option),
|
|
4992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "italic whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4993
|
+
InputWithSpecialExpression_default,
|
|
4994
|
+
{
|
|
4995
|
+
value: option,
|
|
4996
|
+
showSpecialOnly: false
|
|
4997
|
+
}
|
|
4998
|
+
) })
|
|
4999
|
+
}
|
|
5000
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5001
|
+
"div",
|
|
5032
5002
|
{
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5003
|
+
className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge cursor-pointer select-none touch-none",
|
|
5004
|
+
onClick: () => handleSelectOption(option),
|
|
5005
|
+
onTouchEnd: () => handleSelectOption(option),
|
|
5006
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5007
|
+
ShowMaterialMediaByContentType_default,
|
|
5008
|
+
{
|
|
5009
|
+
contentType: contentMap.type,
|
|
5010
|
+
src: option,
|
|
5011
|
+
canFullScreen: true
|
|
5012
|
+
},
|
|
5013
|
+
`${uniqueValue}-${index}`
|
|
5014
|
+
)
|
|
5015
|
+
}
|
|
5016
|
+
)
|
|
5017
|
+
},
|
|
5018
|
+
index
|
|
5019
|
+
)
|
|
5020
|
+
) }),
|
|
5021
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
|
|
5022
|
+
const learnerAnswerState = checkAnswerState(
|
|
5023
|
+
JSON.parse(materialMap[materialKey]),
|
|
5024
|
+
answerMap[materialKey]
|
|
5025
|
+
);
|
|
5026
|
+
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)(
|
|
5027
|
+
"div",
|
|
5028
|
+
{
|
|
5029
|
+
onDragOver: (e) => {
|
|
5030
|
+
e.preventDefault();
|
|
5031
|
+
handleDropZoneEnter(materialKey);
|
|
5032
|
+
},
|
|
5033
|
+
onDragLeave: () => setDropTargetIndex(null),
|
|
5034
|
+
onDrop: (e) => {
|
|
5035
|
+
e.preventDefault();
|
|
5036
|
+
handleDropZoneDrop(materialKey);
|
|
5037
|
+
},
|
|
5038
|
+
onClick: () => {
|
|
5039
|
+
if (selectedOption !== null) {
|
|
5040
|
+
handleDropZoneDrop(materialKey);
|
|
5041
|
+
}
|
|
5042
|
+
},
|
|
5043
|
+
className: `${dropTargetIndex === materialKey ? "ring-2 ring-blue-400" : ""}`,
|
|
5044
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
5045
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-xl", children: [
|
|
5046
|
+
parseFloat(materialKey) + 1,
|
|
5047
|
+
"."
|
|
5048
|
+
] }) }),
|
|
5049
|
+
/* @__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: [
|
|
5050
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5036
5051
|
"div",
|
|
5037
5052
|
{
|
|
5038
|
-
className: "border-catchup-blue
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
onTouchEnd: () => {
|
|
5044
|
-
setSelectedOption(option);
|
|
5045
|
-
setPasteOptionIndex(null);
|
|
5053
|
+
className: `w-full min-h-[44px] border rounded-lg ${answerMap[materialKey] ? "border-catchup-blue-400 px-2" : "bg-catchup-gray-50 border-catchup-gray-200 border-dashed py-2 px-4"}`,
|
|
5054
|
+
onClick: () => {
|
|
5055
|
+
if (answerMap[materialKey]) {
|
|
5056
|
+
onChange(answer, materialKey, "");
|
|
5057
|
+
}
|
|
5046
5058
|
},
|
|
5047
|
-
children:
|
|
5059
|
+
children: answerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5048
5060
|
InputWithSpecialExpression_default,
|
|
5049
5061
|
{
|
|
5050
|
-
value:
|
|
5062
|
+
value: answerMap[materialKey],
|
|
5051
5063
|
showSpecialOnly: false
|
|
5052
5064
|
}
|
|
5053
|
-
) })
|
|
5065
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-gray-400 italic" })
|
|
5054
5066
|
}
|
|
5055
|
-
)
|
|
5056
|
-
|
|
5067
|
+
) }),
|
|
5068
|
+
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)(
|
|
5069
|
+
BaseImage_default,
|
|
5057
5070
|
{
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
setPasteOptionIndex(null);
|
|
5062
|
-
},
|
|
5063
|
-
onTouchEnd: () => {
|
|
5064
|
-
setSelectedOption(option);
|
|
5065
|
-
setPasteOptionIndex(null);
|
|
5066
|
-
},
|
|
5067
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5068
|
-
ShowMaterialMediaByContentType_default,
|
|
5069
|
-
{
|
|
5070
|
-
contentType: contentMap.type,
|
|
5071
|
-
src: option,
|
|
5072
|
-
canFullScreen: true
|
|
5073
|
-
},
|
|
5074
|
-
`${uniqueValue}-${index}`
|
|
5075
|
-
)
|
|
5071
|
+
src: "/icons/checkbox.webp",
|
|
5072
|
+
alt: "checkbox",
|
|
5073
|
+
size: "small"
|
|
5076
5074
|
}
|
|
5077
|
-
),
|
|
5078
|
-
|
|
5079
|
-
|
|
5075
|
+
) }) : 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)(
|
|
5076
|
+
BaseImage_default,
|
|
5077
|
+
{
|
|
5078
|
+
src: "/icons/cross-red.webp",
|
|
5079
|
+
alt: "cross-red",
|
|
5080
|
+
size: "small"
|
|
5081
|
+
}
|
|
5082
|
+
) }) : null
|
|
5083
|
+
] }) : answerMap[materialKey] === "" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5084
|
+
"div",
|
|
5085
|
+
{
|
|
5086
|
+
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"}`,
|
|
5087
|
+
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") }) })
|
|
5080
5088
|
}
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5091
|
-
DroppableItem_default,
|
|
5092
|
-
{
|
|
5093
|
-
item: { index },
|
|
5094
|
-
type: "FILL_IN_THE_BLANKS",
|
|
5095
|
-
target: pasteOptionIndex,
|
|
5096
|
-
setTarget: setPasteOptionIndex,
|
|
5097
|
-
dropRef: drop,
|
|
5098
|
-
component: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
5099
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { className: "text-xl", children: [
|
|
5100
|
-
parseFloat(materialKey) + 1,
|
|
5101
|
-
"."
|
|
5102
|
-
] }) }),
|
|
5103
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "relative", children: [
|
|
5104
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5105
|
-
"div",
|
|
5106
|
-
{
|
|
5107
|
-
className: `w-full min-h-[44px] border rounded-lg ${answerMap[materialKey] ? "border-catchup-blue-400 px-2" : "bg-catchup-gray-50 border-catchup-gray-200 border-dashed py-2 px-4"}`,
|
|
5108
|
-
onClick: () => {
|
|
5109
|
-
if (answerMap[materialKey]) {
|
|
5110
|
-
onChange(answer, materialKey, "");
|
|
5111
|
-
}
|
|
5112
|
-
},
|
|
5113
|
-
children: answerMap[materialKey] ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5114
|
-
InputWithSpecialExpression_default,
|
|
5115
|
-
{
|
|
5116
|
-
value: answerMap[materialKey],
|
|
5117
|
-
showSpecialOnly: false
|
|
5118
|
-
}
|
|
5119
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-gray-400 italic" })
|
|
5120
|
-
}
|
|
5121
|
-
) }),
|
|
5122
|
-
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5123
|
-
BaseImage_default,
|
|
5124
|
-
{
|
|
5125
|
-
src: "/icons/checkbox.webp",
|
|
5126
|
-
alt: "checkbox",
|
|
5127
|
-
size: "small"
|
|
5128
|
-
}
|
|
5129
|
-
) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5130
|
-
BaseImage_default,
|
|
5131
|
-
{
|
|
5132
|
-
src: "/icons/cross-red.webp",
|
|
5133
|
-
alt: "cross-red",
|
|
5134
|
-
size: "small"
|
|
5135
|
-
}
|
|
5136
|
-
) }) : null
|
|
5137
|
-
] }) : answerMap[materialKey] === "" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5138
|
-
"div",
|
|
5139
|
-
{
|
|
5140
|
-
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"}`,
|
|
5141
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "italic", children: i18n_default.t("please_drop_here") }) })
|
|
5142
|
-
}
|
|
5143
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5144
|
-
"div",
|
|
5145
|
-
{
|
|
5146
|
-
className: "flex-1 cursor-pointer",
|
|
5147
|
-
onClick: () => {
|
|
5148
|
-
onChange(answer, materialKey, "");
|
|
5149
|
-
},
|
|
5150
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5151
|
-
ShowMaterialMediaByContentType_default,
|
|
5152
|
-
{
|
|
5153
|
-
contentType: contentMap.type,
|
|
5154
|
-
src: answerMap[materialKey],
|
|
5155
|
-
canFullScreen: true
|
|
5156
|
-
},
|
|
5157
|
-
`${uniqueValue}-${index}`
|
|
5158
|
-
)
|
|
5159
|
-
}
|
|
5160
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
5161
|
-
answerMap[materialKey]
|
|
5162
|
-
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5163
|
-
"span",
|
|
5089
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5090
|
+
"div",
|
|
5091
|
+
{
|
|
5092
|
+
className: "flex-1 cursor-pointer",
|
|
5093
|
+
onClick: () => {
|
|
5094
|
+
onChange(answer, materialKey, "");
|
|
5095
|
+
},
|
|
5096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5097
|
+
ShowMaterialMediaByContentType_default,
|
|
5164
5098
|
{
|
|
5165
|
-
|
|
5166
|
-
|
|
5099
|
+
contentType: contentMap.type,
|
|
5100
|
+
src: answerMap[materialKey],
|
|
5101
|
+
canFullScreen: true
|
|
5167
5102
|
},
|
|
5168
|
-
|
|
5169
|
-
)
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5103
|
+
`${uniqueValue}-${index}`
|
|
5104
|
+
)
|
|
5105
|
+
}
|
|
5106
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
5107
|
+
answerMap[materialKey]
|
|
5108
|
+
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5109
|
+
"span",
|
|
5110
|
+
{
|
|
5111
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5112
|
+
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
|
|
5113
|
+
},
|
|
5114
|
+
index2
|
|
5115
|
+
)) }, materialKey) })
|
|
5116
|
+
] })
|
|
5117
|
+
}
|
|
5118
|
+
) }) }, index);
|
|
5119
|
+
}) })
|
|
5120
|
+
] });
|
|
5178
5121
|
};
|
|
5179
5122
|
var FillInTheBlanksActivityMaterialContent_default = FillInTheBlanksActivityMaterialContent;
|
|
5180
5123
|
|
|
5181
5124
|
// src/components/activities/FillInTheBlanksActivityContent.tsx
|
|
5182
|
-
var
|
|
5183
|
-
var
|
|
5125
|
+
var import_react19 = require("react");
|
|
5126
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5184
5127
|
var FillInTheBlanksActivityContent = ({
|
|
5185
5128
|
answer,
|
|
5186
5129
|
data,
|
|
@@ -5200,7 +5143,7 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5200
5143
|
"FILL_IN_THE_BLANKS"
|
|
5201
5144
|
);
|
|
5202
5145
|
const fillInTheBlanksIncorrectList = data.fillInTheBlanksIncorrectList ? JSON.parse(data.fillInTheBlanksIncorrectList) : [];
|
|
5203
|
-
const [currentAnswerMap, setCurrentAnswerMap] = (0,
|
|
5146
|
+
const [currentAnswerMap, setCurrentAnswerMap] = (0, import_react19.useState)(() => {
|
|
5204
5147
|
return retrieveCurrentAnswerMap();
|
|
5205
5148
|
});
|
|
5206
5149
|
function retrieveCurrentAnswerMap() {
|
|
@@ -5209,7 +5152,7 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5209
5152
|
);
|
|
5210
5153
|
return answer.data[foundIndex].answerMap;
|
|
5211
5154
|
}
|
|
5212
|
-
(0,
|
|
5155
|
+
(0, import_react19.useEffect)(() => {
|
|
5213
5156
|
setCurrentAnswerMap(retrieveCurrentAnswerMap());
|
|
5214
5157
|
}, [answer]);
|
|
5215
5158
|
const constructAnswerOptionList = () => {
|
|
@@ -5248,8 +5191,8 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5248
5191
|
setCurrentAnswerMap(newAnswerMap);
|
|
5249
5192
|
changeAnswer(newAnswer);
|
|
5250
5193
|
};
|
|
5251
|
-
return /* @__PURE__ */ (0,
|
|
5252
|
-
/* @__PURE__ */ (0,
|
|
5194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
|
|
5195
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:w-[60%]"}`, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5253
5196
|
ActivityBodyContent_default,
|
|
5254
5197
|
{
|
|
5255
5198
|
bodyMap: fillInTheBlanksBodyMap,
|
|
@@ -5258,9 +5201,9 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5258
5201
|
templateType: "FILL_IN_THE_BLANKS"
|
|
5259
5202
|
}
|
|
5260
5203
|
) }),
|
|
5261
|
-
/* @__PURE__ */ (0,
|
|
5262
|
-
/* @__PURE__ */ (0,
|
|
5263
|
-
/* @__PURE__ */ (0,
|
|
5204
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `${isFullScreen ? "contents" : "contents md:hidden"}`, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DividerLine_default, {}) }),
|
|
5205
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `${isFullScreen ? "hidden" : "hidden md:block"}`, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(VerticalDividerLine_default, {}) }),
|
|
5206
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `${isFullScreen ? "w-full" : "w-full md:flex-1"}`, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5264
5207
|
FillInTheBlanksActivityMaterialContent_default,
|
|
5265
5208
|
{
|
|
5266
5209
|
uniqueValue: JSON.stringify(data.contentMap),
|
|
@@ -5279,9 +5222,70 @@ var FillInTheBlanksActivityContent = ({
|
|
|
5279
5222
|
var FillInTheBlanksActivityContent_default = FillInTheBlanksActivityContent;
|
|
5280
5223
|
|
|
5281
5224
|
// src/components/activities/material-contents/GroupingActivityMaterialContent.tsx
|
|
5282
|
-
var
|
|
5283
|
-
var
|
|
5225
|
+
var import_react21 = require("react");
|
|
5226
|
+
var import_react_dnd3 = require("react-dnd");
|
|
5284
5227
|
var import_react_katex5 = require("react-katex");
|
|
5228
|
+
|
|
5229
|
+
// src/components/dnds/DraggableItem.tsx
|
|
5230
|
+
var import_react_dnd = require("react-dnd");
|
|
5231
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5232
|
+
var DraggableItem = ({
|
|
5233
|
+
item,
|
|
5234
|
+
type,
|
|
5235
|
+
component,
|
|
5236
|
+
moveCardHandler
|
|
5237
|
+
}) => {
|
|
5238
|
+
const [{ isDragging }, drag] = (0, import_react_dnd.useDrag)({
|
|
5239
|
+
type,
|
|
5240
|
+
item,
|
|
5241
|
+
end: (item2, monitor) => {
|
|
5242
|
+
const dropResult = monitor.getDropResult();
|
|
5243
|
+
if (dropResult) {
|
|
5244
|
+
moveCardHandler();
|
|
5245
|
+
}
|
|
5246
|
+
},
|
|
5247
|
+
collect: (monitor) => ({
|
|
5248
|
+
isDragging: monitor.isDragging()
|
|
5249
|
+
})
|
|
5250
|
+
});
|
|
5251
|
+
const opacity = isDragging ? 0.4 : 1;
|
|
5252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5253
|
+
"div",
|
|
5254
|
+
{
|
|
5255
|
+
className: `${isDragging ? "w-[0px] opacity-0" : "opacity-100"} transition-all duration-500`,
|
|
5256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref: drag, className: "", style: { opacity }, children: component })
|
|
5257
|
+
}
|
|
5258
|
+
);
|
|
5259
|
+
};
|
|
5260
|
+
var DraggableItem_default = DraggableItem;
|
|
5261
|
+
|
|
5262
|
+
// src/components/dnds/DroppableItem.tsx
|
|
5263
|
+
var import_react20 = require("react");
|
|
5264
|
+
var import_react_dnd2 = require("react-dnd");
|
|
5265
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5266
|
+
var DroppableItem = ({
|
|
5267
|
+
item,
|
|
5268
|
+
type,
|
|
5269
|
+
component,
|
|
5270
|
+
dropRef,
|
|
5271
|
+
target,
|
|
5272
|
+
setTarget
|
|
5273
|
+
}) => {
|
|
5274
|
+
const ref = (0, import_react20.useRef)(null);
|
|
5275
|
+
const [, drop] = (0, import_react_dnd2.useDrop)({
|
|
5276
|
+
accept: type,
|
|
5277
|
+
hover() {
|
|
5278
|
+
if (item.index !== null && target !== item.index) {
|
|
5279
|
+
setTarget(item.index);
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
});
|
|
5283
|
+
dropRef(drop(ref));
|
|
5284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `w-full transition-all duration-500 h-full`, ref, children: component });
|
|
5285
|
+
};
|
|
5286
|
+
var DroppableItem_default = DroppableItem;
|
|
5287
|
+
|
|
5288
|
+
// src/components/activities/material-contents/GroupingActivityMaterialContent.tsx
|
|
5285
5289
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5286
5290
|
var GroupingActivityMaterialContent = ({
|
|
5287
5291
|
uniqueValue,
|
|
@@ -5293,11 +5297,11 @@ var GroupingActivityMaterialContent = ({
|
|
|
5293
5297
|
isPreview,
|
|
5294
5298
|
showCorrectAnswer
|
|
5295
5299
|
}) => {
|
|
5296
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
5297
|
-
const [selectedTargetKey, setSelectedTargetKey] = (0,
|
|
5298
|
-
const [isShuffled, setIsShuffled] = (0,
|
|
5299
|
-
const [shuffledMaterialList, setShuffledMaterialList] = (0,
|
|
5300
|
-
const [{ isOver, canDrop }, drop] = (0,
|
|
5300
|
+
const [selectedValue, setSelectedValue] = (0, import_react21.useState)(null);
|
|
5301
|
+
const [selectedTargetKey, setSelectedTargetKey] = (0, import_react21.useState)(null);
|
|
5302
|
+
const [isShuffled, setIsShuffled] = (0, import_react21.useState)(false);
|
|
5303
|
+
const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react21.useState)([]);
|
|
5304
|
+
const [{ isOver, canDrop }, drop] = (0, import_react_dnd3.useDrop)({
|
|
5301
5305
|
accept: "GROUPING",
|
|
5302
5306
|
drop: () => {
|
|
5303
5307
|
},
|
|
@@ -5306,8 +5310,8 @@ var GroupingActivityMaterialContent = ({
|
|
|
5306
5310
|
canDrop: monitor.canDrop()
|
|
5307
5311
|
})
|
|
5308
5312
|
});
|
|
5309
|
-
const ref = (0,
|
|
5310
|
-
(0,
|
|
5313
|
+
const ref = (0, import_react21.useRef)(null);
|
|
5314
|
+
(0, import_react21.useEffect)(() => {
|
|
5311
5315
|
const shuffleArray2 = (array) => {
|
|
5312
5316
|
if (!isShuffled) {
|
|
5313
5317
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
@@ -5328,7 +5332,7 @@ var GroupingActivityMaterialContent = ({
|
|
|
5328
5332
|
});
|
|
5329
5333
|
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5330
5334
|
}, []);
|
|
5331
|
-
(0,
|
|
5335
|
+
(0, import_react21.useEffect)(() => {
|
|
5332
5336
|
if (!showCorrectAnswer) return;
|
|
5333
5337
|
answer.data.find(
|
|
5334
5338
|
(answerData) => answerData.type === "GROUPING"
|
|
@@ -5586,8 +5590,8 @@ var GroupingActivityContent = ({
|
|
|
5586
5590
|
var GroupingActivityContent_default = GroupingActivityContent;
|
|
5587
5591
|
|
|
5588
5592
|
// src/components/activities/material-contents/MatchingActivityMaterialContent.tsx
|
|
5589
|
-
var
|
|
5590
|
-
var
|
|
5593
|
+
var import_react22 = require("react");
|
|
5594
|
+
var import_react_dnd4 = require("react-dnd");
|
|
5591
5595
|
var import_react_katex6 = require("react-katex");
|
|
5592
5596
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5593
5597
|
var MatchingActivityMaterialContent = ({
|
|
@@ -5600,11 +5604,11 @@ var MatchingActivityMaterialContent = ({
|
|
|
5600
5604
|
isPreview,
|
|
5601
5605
|
showCorrectAnswer
|
|
5602
5606
|
}) => {
|
|
5603
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
5604
|
-
const [selectedTargetKey, setSelectedTargetKey] = (0,
|
|
5605
|
-
const [isShuffled, setIsShuffled] = (0,
|
|
5606
|
-
const [shuffledMaterialList, setShuffledMaterialList] = (0,
|
|
5607
|
-
const [{ isOver, canDrop }, drop] = (0,
|
|
5607
|
+
const [selectedValue, setSelectedValue] = (0, import_react22.useState)(null);
|
|
5608
|
+
const [selectedTargetKey, setSelectedTargetKey] = (0, import_react22.useState)(null);
|
|
5609
|
+
const [isShuffled, setIsShuffled] = (0, import_react22.useState)(false);
|
|
5610
|
+
const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react22.useState)([]);
|
|
5611
|
+
const [{ isOver, canDrop }, drop] = (0, import_react_dnd4.useDrop)({
|
|
5608
5612
|
accept: "MATCHING",
|
|
5609
5613
|
drop: () => {
|
|
5610
5614
|
},
|
|
@@ -5613,8 +5617,8 @@ var MatchingActivityMaterialContent = ({
|
|
|
5613
5617
|
canDrop: monitor.canDrop()
|
|
5614
5618
|
})
|
|
5615
5619
|
});
|
|
5616
|
-
const itemsRef = (0,
|
|
5617
|
-
(0,
|
|
5620
|
+
const itemsRef = (0, import_react22.useRef)(null);
|
|
5621
|
+
(0, import_react22.useEffect)(() => {
|
|
5618
5622
|
const shuffleArray2 = (array) => {
|
|
5619
5623
|
if (!isShuffled) {
|
|
5620
5624
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
@@ -5633,7 +5637,7 @@ var MatchingActivityMaterialContent = ({
|
|
|
5633
5637
|
});
|
|
5634
5638
|
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5635
5639
|
}, []);
|
|
5636
|
-
(0,
|
|
5640
|
+
(0, import_react22.useEffect)(() => {
|
|
5637
5641
|
if (!showCorrectAnswer) return;
|
|
5638
5642
|
answer.data.find(
|
|
5639
5643
|
(answerData) => answerData.type === "MATCHING"
|
|
@@ -6368,22 +6372,22 @@ var OpenEndedActivityContent = ({
|
|
|
6368
6372
|
var OpenEndedActivityContent_default = OpenEndedActivityContent;
|
|
6369
6373
|
|
|
6370
6374
|
// src/components/activities/material-contents/OrderingActivityMaterialContent.tsx
|
|
6371
|
-
var
|
|
6372
|
-
var
|
|
6375
|
+
var import_react25 = require("react");
|
|
6376
|
+
var import_react_dnd6 = require("react-dnd");
|
|
6373
6377
|
var import_react_katex9 = require("react-katex");
|
|
6374
6378
|
|
|
6375
6379
|
// src/hooks/useScreenSize.ts
|
|
6376
|
-
var
|
|
6380
|
+
var import_react23 = require("react");
|
|
6377
6381
|
var useScreenSize = () => {
|
|
6378
|
-
const [containerSize, setContainerSize] = (0,
|
|
6382
|
+
const [containerSize, setContainerSize] = (0, import_react23.useState)({
|
|
6379
6383
|
width: 0,
|
|
6380
6384
|
height: 0
|
|
6381
6385
|
});
|
|
6382
|
-
const [screenSize, setScreenSize] = (0,
|
|
6386
|
+
const [screenSize, setScreenSize] = (0, import_react23.useState)({
|
|
6383
6387
|
width: window.innerWidth,
|
|
6384
6388
|
height: window.innerHeight
|
|
6385
6389
|
});
|
|
6386
|
-
(0,
|
|
6390
|
+
(0, import_react23.useEffect)(() => {
|
|
6387
6391
|
const handleResize = () => {
|
|
6388
6392
|
setScreenSize({
|
|
6389
6393
|
width: window.innerWidth,
|
|
@@ -6408,8 +6412,8 @@ var useScreenSize = () => {
|
|
|
6408
6412
|
var useScreenSize_default = useScreenSize;
|
|
6409
6413
|
|
|
6410
6414
|
// src/components/dnds/DraggableDroppableItem.tsx
|
|
6411
|
-
var
|
|
6412
|
-
var
|
|
6415
|
+
var import_react24 = require("react");
|
|
6416
|
+
var import_react_dnd5 = require("react-dnd");
|
|
6413
6417
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6414
6418
|
var DraggableDroppableItem = ({
|
|
6415
6419
|
item,
|
|
@@ -6420,8 +6424,8 @@ var DraggableDroppableItem = ({
|
|
|
6420
6424
|
target,
|
|
6421
6425
|
setTarget
|
|
6422
6426
|
}) => {
|
|
6423
|
-
const ref = (0,
|
|
6424
|
-
const [, drop] = (0,
|
|
6427
|
+
const ref = (0, import_react24.useRef)(null);
|
|
6428
|
+
const [, drop] = (0, import_react_dnd5.useDrop)({
|
|
6425
6429
|
accept: type,
|
|
6426
6430
|
hover() {
|
|
6427
6431
|
if (!ref.current) {
|
|
@@ -6432,7 +6436,7 @@ var DraggableDroppableItem = ({
|
|
|
6432
6436
|
}
|
|
6433
6437
|
}
|
|
6434
6438
|
});
|
|
6435
|
-
const [{ isDragging }, drag] = (0,
|
|
6439
|
+
const [{ isDragging }, drag] = (0, import_react_dnd5.useDrag)({
|
|
6436
6440
|
type,
|
|
6437
6441
|
item,
|
|
6438
6442
|
end: (item2, monitor) => {
|
|
@@ -6470,11 +6474,11 @@ var OrderingActivityMaterialContent = ({
|
|
|
6470
6474
|
isPreview,
|
|
6471
6475
|
showCorrectAnswer
|
|
6472
6476
|
}) => {
|
|
6473
|
-
const [selectedTargetKey, setSelectedTargetKey] = (0,
|
|
6474
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
6477
|
+
const [selectedTargetKey, setSelectedTargetKey] = (0, import_react25.useState)(null);
|
|
6478
|
+
const [selectedKey, setSelectedKey] = (0, import_react25.useState)(null);
|
|
6475
6479
|
const { screenSize } = useScreenSize_default();
|
|
6476
|
-
const [view, setView] = (0,
|
|
6477
|
-
const [{ isOver, canDrop }, drop] = (0,
|
|
6480
|
+
const [view, setView] = (0, import_react25.useState)("PC");
|
|
6481
|
+
const [{ isOver, canDrop }, drop] = (0, import_react_dnd6.useDrop)({
|
|
6478
6482
|
accept: "ORDERING",
|
|
6479
6483
|
drop: () => {
|
|
6480
6484
|
},
|
|
@@ -6483,7 +6487,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6483
6487
|
canDrop: monitor.canDrop()
|
|
6484
6488
|
})
|
|
6485
6489
|
});
|
|
6486
|
-
(0,
|
|
6490
|
+
(0, import_react25.useEffect)(() => {
|
|
6487
6491
|
if (!screenSize) return;
|
|
6488
6492
|
if (screenSize.width <= 1024) {
|
|
6489
6493
|
setView("TABLET");
|
|
@@ -6491,7 +6495,7 @@ var OrderingActivityMaterialContent = ({
|
|
|
6491
6495
|
setView("PC");
|
|
6492
6496
|
}
|
|
6493
6497
|
}, [screenSize]);
|
|
6494
|
-
(0,
|
|
6498
|
+
(0, import_react25.useEffect)(() => {
|
|
6495
6499
|
if (!showCorrectAnswer) return;
|
|
6496
6500
|
const answerMap2 = answer.data.find(
|
|
6497
6501
|
(answerData) => answerData.type === "ORDERING"
|
|
@@ -6684,7 +6688,7 @@ var OrderingActivityContent = ({
|
|
|
6684
6688
|
var OrderingActivityContent_default = OrderingActivityContent;
|
|
6685
6689
|
|
|
6686
6690
|
// src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx
|
|
6687
|
-
var
|
|
6691
|
+
var import_react26 = require("react");
|
|
6688
6692
|
var import_react_katex10 = require("react-katex");
|
|
6689
6693
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
6690
6694
|
var TrueFalseActivityMaterialContent = ({
|
|
@@ -6698,8 +6702,8 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
6698
6702
|
showCorrectAnswer
|
|
6699
6703
|
}) => {
|
|
6700
6704
|
const { screenSize } = useScreenSize_default();
|
|
6701
|
-
const [shuffleOptionList, setShuffleOptionList] = (0,
|
|
6702
|
-
(0,
|
|
6705
|
+
const [shuffleOptionList, setShuffleOptionList] = (0, import_react26.useState)([]);
|
|
6706
|
+
(0, import_react26.useEffect)(() => {
|
|
6703
6707
|
const optionList = [];
|
|
6704
6708
|
optionList.push(...materialMap.trueList);
|
|
6705
6709
|
optionList.push(...materialMap.falseList);
|
|
@@ -6709,7 +6713,7 @@ var TrueFalseActivityMaterialContent = ({
|
|
|
6709
6713
|
setShuffleOptionList(shuffleArray(optionList));
|
|
6710
6714
|
}
|
|
6711
6715
|
}, []);
|
|
6712
|
-
(0,
|
|
6716
|
+
(0, import_react26.useEffect)(() => {
|
|
6713
6717
|
if (!showCorrectAnswer) return;
|
|
6714
6718
|
answer.data.find(
|
|
6715
6719
|
(answerData) => answerData.type === "TRUE_FALSE"
|
|
@@ -7019,7 +7023,7 @@ var ActivityEvaluationRubricContent = ({
|
|
|
7019
7023
|
var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
|
|
7020
7024
|
|
|
7021
7025
|
// src/components/activities/ActivityPreviewByData.tsx
|
|
7022
|
-
var
|
|
7026
|
+
var import_react27 = require("react");
|
|
7023
7027
|
|
|
7024
7028
|
// src/components/boxes/SelectionBox.tsx
|
|
7025
7029
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
@@ -7071,14 +7075,14 @@ var ActivityPreviewByData = ({
|
|
|
7071
7075
|
showDifficulty,
|
|
7072
7076
|
isFullScreen
|
|
7073
7077
|
}) => {
|
|
7074
|
-
const [key, setKey] = (0,
|
|
7075
|
-
const [selectedType, setSelectedType] = (0,
|
|
7076
|
-
const [optionList, setOptionList] = (0,
|
|
7077
|
-
(0,
|
|
7078
|
+
const [key, setKey] = (0, import_react27.useState)((/* @__PURE__ */ new Date()).getTime());
|
|
7079
|
+
const [selectedType, setSelectedType] = (0, import_react27.useState)(null);
|
|
7080
|
+
const [optionList, setOptionList] = (0, import_react27.useState)([]);
|
|
7081
|
+
(0, import_react27.useEffect)(() => {
|
|
7078
7082
|
if (!data) return;
|
|
7079
7083
|
setKey((/* @__PURE__ */ new Date()).getTime());
|
|
7080
7084
|
}, [data]);
|
|
7081
|
-
(0,
|
|
7085
|
+
(0, import_react27.useEffect)(() => {
|
|
7082
7086
|
if (!typeOptionList) return;
|
|
7083
7087
|
if (typeOptionList.length === 0) return;
|
|
7084
7088
|
let foundTypeOption;
|
|
@@ -7093,7 +7097,7 @@ var ActivityPreviewByData = ({
|
|
|
7093
7097
|
setSelectedType(typeOptionList[0].id);
|
|
7094
7098
|
}
|
|
7095
7099
|
}, [typeOptionList, lockedType]);
|
|
7096
|
-
(0,
|
|
7100
|
+
(0, import_react27.useEffect)(() => {
|
|
7097
7101
|
if (!data) return;
|
|
7098
7102
|
if (!typeOptionList) return;
|
|
7099
7103
|
if (typeOptionList.length === 0) return;
|
|
@@ -7276,7 +7280,7 @@ var ActivityPreviewByData = ({
|
|
|
7276
7280
|
var ActivityPreviewByData_default = ActivityPreviewByData;
|
|
7277
7281
|
|
|
7278
7282
|
// src/components/activities/ActivityPreviewByAnswerData.tsx
|
|
7279
|
-
var
|
|
7283
|
+
var import_react28 = require("react");
|
|
7280
7284
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
7281
7285
|
var ActivityPreviewByAnswerData = ({
|
|
7282
7286
|
data,
|
|
@@ -7291,11 +7295,11 @@ var ActivityPreviewByAnswerData = ({
|
|
|
7291
7295
|
showCorrectAnswer = false
|
|
7292
7296
|
}) => {
|
|
7293
7297
|
var _a;
|
|
7294
|
-
const [key, setKey] = (0,
|
|
7295
|
-
const [selectedType, setSelectedType] = (0,
|
|
7296
|
-
const [optionList, setOptionList] = (0,
|
|
7297
|
-
const [answer, setAnswer] = (0,
|
|
7298
|
-
(0,
|
|
7298
|
+
const [key, setKey] = (0, import_react28.useState)((/* @__PURE__ */ new Date()).getTime());
|
|
7299
|
+
const [selectedType, setSelectedType] = (0, import_react28.useState)(null);
|
|
7300
|
+
const [optionList, setOptionList] = (0, import_react28.useState)([]);
|
|
7301
|
+
const [answer, setAnswer] = (0, import_react28.useState)({ data: [] });
|
|
7302
|
+
(0, import_react28.useEffect)(() => {
|
|
7299
7303
|
if (!data) return;
|
|
7300
7304
|
setKey((/* @__PURE__ */ new Date()).getTime());
|
|
7301
7305
|
}, [data]);
|
|
@@ -7308,7 +7312,7 @@ var ActivityPreviewByAnswerData = ({
|
|
|
7308
7312
|
}
|
|
7309
7313
|
return null;
|
|
7310
7314
|
};
|
|
7311
|
-
(0,
|
|
7315
|
+
(0, import_react28.useEffect)(() => {
|
|
7312
7316
|
if (!data) return;
|
|
7313
7317
|
const constructAnswerBasedOnData2 = () => {
|
|
7314
7318
|
const newAnswer = { data: [] };
|
|
@@ -7347,7 +7351,7 @@ var ActivityPreviewByAnswerData = ({
|
|
|
7347
7351
|
};
|
|
7348
7352
|
constructAnswerBasedOnData2();
|
|
7349
7353
|
}, [data, lockedType]);
|
|
7350
|
-
(0,
|
|
7354
|
+
(0, import_react28.useEffect)(() => {
|
|
7351
7355
|
if (!data || !answer.data.length) return;
|
|
7352
7356
|
let currentTypeOptionList = typeOptionList || answer.data.map((item) => ({
|
|
7353
7357
|
id: item.type,
|
|
@@ -7514,7 +7518,7 @@ var LeftTextRightInputGroup = ({
|
|
|
7514
7518
|
var LeftTextRightInputGroup_default = LeftTextRightInputGroup;
|
|
7515
7519
|
|
|
7516
7520
|
// src/components/groups/PageTravelGroup.tsx
|
|
7517
|
-
var
|
|
7521
|
+
var import_react29 = require("react");
|
|
7518
7522
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
7519
7523
|
var PageTravelGroup = ({
|
|
7520
7524
|
isImageProcessing,
|
|
@@ -7524,13 +7528,13 @@ var PageTravelGroup = ({
|
|
|
7524
7528
|
setPageNumber,
|
|
7525
7529
|
setImageReady
|
|
7526
7530
|
}) => {
|
|
7527
|
-
const [totalPageNumber, setTotalPageNumber] = (0,
|
|
7528
|
-
const [newPageNumber, setNewPageNumber] = (0,
|
|
7529
|
-
(0,
|
|
7531
|
+
const [totalPageNumber, setTotalPageNumber] = (0, import_react29.useState)(0);
|
|
7532
|
+
const [newPageNumber, setNewPageNumber] = (0, import_react29.useState)(0);
|
|
7533
|
+
(0, import_react29.useEffect)(() => {
|
|
7530
7534
|
if (!initialTotalPageNumber) return;
|
|
7531
7535
|
setTotalPageNumber(initialTotalPageNumber);
|
|
7532
7536
|
}, [initialTotalPageNumber]);
|
|
7533
|
-
(0,
|
|
7537
|
+
(0, import_react29.useEffect)(() => {
|
|
7534
7538
|
setNewPageNumber(pageNumber + 1);
|
|
7535
7539
|
}, [pageNumber]);
|
|
7536
7540
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex-1 flex flex-row justify-center items-center flex-wrap", children: [
|