catchup-library-web 2.2.0 → 2.2.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 CHANGED
@@ -6866,6 +6866,7 @@ var TrueFalseActivityMaterialContent = ({
6866
6866
  showCorrectAnswer
6867
6867
  }) => {
6868
6868
  const [shuffleOptionList, setShuffleOptionList] = (0, import_react24.useState)([]);
6869
+ const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react24.useState)(answerMap);
6869
6870
  (0, import_react24.useEffect)(() => {
6870
6871
  const optionList = [];
6871
6872
  optionList.push(...materialMap.trueList);
@@ -6877,9 +6878,12 @@ var TrueFalseActivityMaterialContent = ({
6877
6878
  }
6878
6879
  }, []);
6879
6880
  (0, import_react24.useEffect)(() => {
6880
- if (!showCorrectAnswer) return;
6881
- answerMap = materialMap;
6882
- }, [showCorrectAnswer]);
6881
+ if (showCorrectAnswer) {
6882
+ setDisplayAnswerMap(materialMap);
6883
+ } else {
6884
+ setDisplayAnswerMap(answerMap);
6885
+ }
6886
+ }, [showCorrectAnswer, materialMap, answerMap]);
6883
6887
  const checkAnswerState = (correctAnswer, learnerAnswer) => {
6884
6888
  if (!isPreview) return null;
6885
6889
  if (correctAnswer === learnerAnswer) {
@@ -6932,7 +6936,7 @@ var TrueFalseActivityMaterialContent = ({
6932
6936
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6933
6937
  BaseImage_default,
6934
6938
  {
6935
- src: answerMap.trueList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6939
+ src: displayAnswerMap.trueList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6936
6940
  alt: "checkbox",
6937
6941
  size: "small",
6938
6942
  onClick: () => {
@@ -6943,7 +6947,7 @@ var TrueFalseActivityMaterialContent = ({
6943
6947
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6944
6948
  BaseImage_default,
6945
6949
  {
6946
- src: answerMap.falseList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6950
+ src: displayAnswerMap.falseList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6947
6951
  alt: "checkbox",
6948
6952
  size: "small",
6949
6953
  onClick: () => {
@@ -6957,11 +6961,11 @@ var TrueFalseActivityMaterialContent = ({
6957
6961
  index
6958
6962
  );
6959
6963
  }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
6960
- answerMap.trueList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-row items-center gap-x-2", children: [
6964
+ displayAnswerMap.trueList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-row items-center gap-x-2", children: [
6961
6965
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: item }) }),
6962
6966
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "underline", children: i18n_default.t("true") }) })
6963
6967
  ] })),
6964
- answerMap.falseList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-row items-center gap-x-2", children: [
6968
+ displayAnswerMap.falseList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-row items-center gap-x-2", children: [
6965
6969
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: item }) }),
6966
6970
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "underline", children: i18n_default.t("false") }) })
6967
6971
  ] }))
package/dist/index.mjs CHANGED
@@ -6643,6 +6643,7 @@ var TrueFalseActivityMaterialContent = ({
6643
6643
  showCorrectAnswer
6644
6644
  }) => {
6645
6645
  const [shuffleOptionList, setShuffleOptionList] = useState23([]);
6646
+ const [displayAnswerMap, setDisplayAnswerMap] = useState23(answerMap);
6646
6647
  useEffect14(() => {
6647
6648
  const optionList = [];
6648
6649
  optionList.push(...materialMap.trueList);
@@ -6654,9 +6655,12 @@ var TrueFalseActivityMaterialContent = ({
6654
6655
  }
6655
6656
  }, []);
6656
6657
  useEffect14(() => {
6657
- if (!showCorrectAnswer) return;
6658
- answerMap = materialMap;
6659
- }, [showCorrectAnswer]);
6658
+ if (showCorrectAnswer) {
6659
+ setDisplayAnswerMap(materialMap);
6660
+ } else {
6661
+ setDisplayAnswerMap(answerMap);
6662
+ }
6663
+ }, [showCorrectAnswer, materialMap, answerMap]);
6660
6664
  const checkAnswerState = (correctAnswer, learnerAnswer) => {
6661
6665
  if (!isPreview) return null;
6662
6666
  if (correctAnswer === learnerAnswer) {
@@ -6709,7 +6713,7 @@ var TrueFalseActivityMaterialContent = ({
6709
6713
  /* @__PURE__ */ jsx42("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx42("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ jsx42(
6710
6714
  BaseImage_default,
6711
6715
  {
6712
- src: answerMap.trueList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6716
+ src: displayAnswerMap.trueList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6713
6717
  alt: "checkbox",
6714
6718
  size: "small",
6715
6719
  onClick: () => {
@@ -6720,7 +6724,7 @@ var TrueFalseActivityMaterialContent = ({
6720
6724
  /* @__PURE__ */ jsx42("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx42("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ jsx42(
6721
6725
  BaseImage_default,
6722
6726
  {
6723
- src: answerMap.falseList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6727
+ src: displayAnswerMap.falseList.includes(shuffleOption) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
6724
6728
  alt: "checkbox",
6725
6729
  size: "small",
6726
6730
  onClick: () => {
@@ -6734,11 +6738,11 @@ var TrueFalseActivityMaterialContent = ({
6734
6738
  index
6735
6739
  );
6736
6740
  }) }) : /* @__PURE__ */ jsxs31(Fragment10, { children: [
6737
- answerMap.trueList.map((item) => /* @__PURE__ */ jsxs31("div", { className: "flex flex-row items-center gap-x-2", children: [
6741
+ displayAnswerMap.trueList.map((item) => /* @__PURE__ */ jsxs31("div", { className: "flex flex-row items-center gap-x-2", children: [
6738
6742
  /* @__PURE__ */ jsx42("div", { className: "flex-1", children: /* @__PURE__ */ jsx42("p", { children: item }) }),
6739
6743
  /* @__PURE__ */ jsx42("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx42("p", { className: "underline", children: i18n_default.t("true") }) })
6740
6744
  ] })),
6741
- answerMap.falseList.map((item) => /* @__PURE__ */ jsxs31("div", { className: "flex flex-row items-center gap-x-2", children: [
6745
+ displayAnswerMap.falseList.map((item) => /* @__PURE__ */ jsxs31("div", { className: "flex flex-row items-center gap-x-2", children: [
6742
6746
  /* @__PURE__ */ jsx42("div", { className: "flex-1", children: /* @__PURE__ */ jsx42("p", { children: item }) }),
6743
6747
  /* @__PURE__ */ jsx42("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx42("p", { className: "underline", children: i18n_default.t("false") }) })
6744
6748
  ] }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -19,6 +19,7 @@ const TrueFalseActivityMaterialContent = ({
19
19
  showCorrectAnswer,
20
20
  }: ITrueFalseActivityMaterialProps) => {
21
21
  const [shuffleOptionList, setShuffleOptionList] = useState<any[]>([]);
22
+ const [displayAnswerMap, setDisplayAnswerMap] = useState<any>(answerMap);
22
23
 
23
24
  useEffect(() => {
24
25
  const optionList = [];
@@ -32,9 +33,12 @@ const TrueFalseActivityMaterialContent = ({
32
33
  }, []);
33
34
 
34
35
  useEffect(() => {
35
- if (!showCorrectAnswer) return;
36
- answerMap = materialMap;
37
- }, [showCorrectAnswer]);
36
+ if (showCorrectAnswer) {
37
+ setDisplayAnswerMap(materialMap);
38
+ } else {
39
+ setDisplayAnswerMap(answerMap);
40
+ }
41
+ }, [showCorrectAnswer, materialMap, answerMap]);
38
42
 
39
43
  const checkAnswerState = (correctAnswer: string, learnerAnswer: string) => {
40
44
  if (!isPreview) return null;
@@ -130,7 +134,7 @@ const TrueFalseActivityMaterialContent = ({
130
134
  <div className="flex flex-col items-center justify-center">
131
135
  <BaseImage
132
136
  src={
133
- answerMap.trueList.includes(shuffleOption)
137
+ displayAnswerMap.trueList.includes(shuffleOption)
134
138
  ? "/icons/checkbox.webp"
135
139
  : "/icons/checkbox-empty.webp"
136
140
  }
@@ -146,7 +150,7 @@ const TrueFalseActivityMaterialContent = ({
146
150
  <div className="flex flex-col items-center justify-center">
147
151
  <BaseImage
148
152
  src={
149
- answerMap.falseList.includes(shuffleOption)
153
+ displayAnswerMap.falseList.includes(shuffleOption)
150
154
  ? "/icons/checkbox.webp"
151
155
  : "/icons/checkbox-empty.webp"
152
156
  }
@@ -165,7 +169,7 @@ const TrueFalseActivityMaterialContent = ({
165
169
  </div>
166
170
  ) : (
167
171
  <>
168
- {answerMap.trueList.map((item: string) => (
172
+ {displayAnswerMap.trueList.map((item: string) => (
169
173
  <div className="flex flex-row items-center gap-x-2">
170
174
  <div className="flex-1">
171
175
  <p>{item}</p>
@@ -175,7 +179,7 @@ const TrueFalseActivityMaterialContent = ({
175
179
  </div>
176
180
  </div>
177
181
  ))}
178
- {answerMap.falseList.map((item: string) => (
182
+ {displayAnswerMap.falseList.map((item: string) => (
179
183
  <div className="flex flex-row items-center gap-x-2">
180
184
  <div className="flex-1">
181
185
  <p>{item}</p>