catchup-library-web 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +318 -300
- package/dist/index.mjs +318 -300
- package/package.json +1 -1
- package/src/components/activities/body-content/ShowBodyMediaByContentType.tsx +329 -264
- package/src/components/activities/solution-content/ActivitySolutionContent.tsx +61 -58
|
@@ -7,75 +7,78 @@ const ActivitySolutionContent = ({
|
|
|
7
7
|
activityTemplateType,
|
|
8
8
|
data,
|
|
9
9
|
}: IActivitySolutionProps) => {
|
|
10
|
-
if (!activityTemplateType) return;
|
|
10
|
+
if (!activityTemplateType) return null;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
12
|
+
// Map activity types to their corresponding solution map keys
|
|
13
|
+
const solutionMapKeys: any = {
|
|
14
|
+
ORDERING: "orderingSolutionMap",
|
|
15
|
+
DROPDOWN: "dropdownSolutionMap",
|
|
16
|
+
MCSA: "MCSASolutionMap",
|
|
17
|
+
MCMA: "MCMASolutionMap",
|
|
18
|
+
MATCHING: "matchingSolutionMap",
|
|
19
|
+
GROUPING: "groupingSolutionMap",
|
|
20
|
+
FILL_IN_THE_BLANKS: "fillInTheBlanksSolutionMap",
|
|
21
|
+
OPEN_ENDED: "openEndedSolutionMap",
|
|
22
|
+
TRUE_FALSE: "trueFalseSolutionMap",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const solutionMapKey = solutionMapKeys[activityTemplateType];
|
|
26
|
+
|
|
27
|
+
if (!solutionMapKey) return null;
|
|
28
|
+
|
|
29
|
+
const solutionMapString = data[solutionMapKey];
|
|
30
|
+
|
|
31
|
+
if (!solutionMapString || !solutionMapString.includes("[ONAYLI CEVAP]"))
|
|
32
|
+
return null;
|
|
33
|
+
|
|
34
|
+
let solutionMap;
|
|
35
|
+
try {
|
|
36
|
+
solutionMap = JSON.parse(solutionMapString);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error("Error parsing solution map:", error);
|
|
39
|
+
return null;
|
|
38
40
|
}
|
|
39
|
-
if (!solutionMapString.includes("[ONAYLI CEVAP]")) return;
|
|
40
|
-
const solutionMap = JSON.parse(solutionMapString);
|
|
41
|
-
if (!solutionMap) return;
|
|
42
41
|
|
|
43
|
-
if (Object.keys(solutionMap).length === 0) return;
|
|
42
|
+
if (!solutionMap || Object.keys(solutionMap).length === 0) return null;
|
|
43
|
+
|
|
44
44
|
return (
|
|
45
45
|
<div className="mx-2">
|
|
46
46
|
<div className="p-4 border-catchup-blue border-2 rounded-catchup-xlarge">
|
|
47
47
|
<p className="text-xl font-bold text-center mb-3">
|
|
48
48
|
{i18n.t("solution")}
|
|
49
49
|
</p>
|
|
50
|
-
{Object.keys(solutionMap).map((key
|
|
51
|
-
|
|
50
|
+
{Object.keys(solutionMap).map((key) => {
|
|
51
|
+
let currentItem;
|
|
52
|
+
try {
|
|
53
|
+
currentItem = JSON.parse(solutionMap[key]);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(`Error parsing solution item at key ${key}:`, error);
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
const { value } = currentItem;
|
|
60
|
+
|
|
53
61
|
return (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</span>
|
|
75
|
-
)
|
|
76
|
-
)}
|
|
77
|
-
</span>
|
|
78
|
-
</p>
|
|
62
|
+
<div key={key} className="my-3 text-xl">
|
|
63
|
+
{constructInputWithSpecialExpressionList(value).map(
|
|
64
|
+
(inputPart, partIndex) => (
|
|
65
|
+
<span
|
|
66
|
+
key={`${key}_part_${partIndex}`}
|
|
67
|
+
className={`${inputPart.isBold ? "font-bold" : ""} ${
|
|
68
|
+
inputPart.isUnderline ? "underline" : ""
|
|
69
|
+
}`}
|
|
70
|
+
>
|
|
71
|
+
{inputPart.isEquation ? (
|
|
72
|
+
<span className="text-2xl">
|
|
73
|
+
<InlineMath math={inputPart.value} />
|
|
74
|
+
</span>
|
|
75
|
+
) : (
|
|
76
|
+
inputPart.value
|
|
77
|
+
)}
|
|
78
|
+
</span>
|
|
79
|
+
)
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
79
82
|
);
|
|
80
83
|
})}
|
|
81
84
|
</div>
|