catchup-library-web 2.7.5 → 2.7.7

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
@@ -890,7 +890,7 @@ var DeleteButton = ({
890
890
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
891
891
  "button",
892
892
  {
893
- className: `border border-catchup-red bg-catchup-white text-catchup-red rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-red hover:text-catchup-white hover:border-catchup-red active:bg-catchup-red active:hover:border-catchup-red active:text-catchup-white active:opacity-80"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
893
+ className: `border border-catchup-red bg-catchup-red text-catchup-white rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-white hover:text-catchup-red hover:border-catchup-red active:bg-catchup-white active:hover:border-catchup-red active:text-catchup-red active:opacity-80"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
894
894
  onClick: internalOnClick,
895
895
  onMouseEnter: () => {
896
896
  setIsHovered(true);
@@ -910,7 +910,7 @@ var DeleteButton = ({
910
910
  iconPosition === "left" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
911
911
  BaseImage_default,
912
912
  {
913
- src: `${isHovered ? "/icons/remove-white.webp" : "/icons/remove-red.webp"}`,
913
+ src: `${isHovered ? "/icons/remove-red.webp" : "/icons/remove-white.webp"}`,
914
914
  alt: "remove-white",
915
915
  size: "xsmall"
916
916
  }
@@ -919,7 +919,7 @@ var DeleteButton = ({
919
919
  textOnly || iconPosition === "left" ? null : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
920
920
  BaseImage_default,
921
921
  {
922
- src: `${isHovered ? "/icons/remove-white.webp" : "/icons/remove-red.webp"}`,
922
+ src: `${isHovered ? "/icons/remove-red.webp" : "/icons/remove-white.webp"}`,
923
923
  alt: "remove-white",
924
924
  size: "xsmall"
925
925
  }
@@ -5521,7 +5521,6 @@ var GroupingActivityMaterialContent = ({
5521
5521
  };
5522
5522
  }, [draggedValue]);
5523
5523
  (0, import_react21.useEffect)(() => {
5524
- if (hasShuffledRef.current) return;
5525
5524
  const shuffleArray2 = (array) => {
5526
5525
  const copyArray = JSON.parse(JSON.stringify(array));
5527
5526
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5536,8 +5535,12 @@ var GroupingActivityMaterialContent = ({
5536
5535
  materialList.push(materialValue);
5537
5536
  }
5538
5537
  });
5539
- setShuffledMaterialList(shuffleArray2(materialList));
5540
- hasShuffledRef.current = true;
5538
+ if (!hasShuffledRef.current) {
5539
+ setShuffledMaterialList(shuffleArray2(materialList));
5540
+ hasShuffledRef.current = true;
5541
+ } else {
5542
+ setShuffledMaterialList(materialList);
5543
+ }
5541
5544
  }, [materialMap]);
5542
5545
  (0, import_react21.useEffect)(() => {
5543
5546
  if (showCorrectAnswer) {
@@ -5969,7 +5972,6 @@ var MatchingActivityMaterialContent = ({
5969
5972
  };
5970
5973
  }, [draggedValue]);
5971
5974
  (0, import_react22.useEffect)(() => {
5972
- if (hasShuffledRef.current) return;
5973
5975
  const shuffleArray2 = (array) => {
5974
5976
  const copyArray = JSON.parse(JSON.stringify(array));
5975
5977
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5982,8 +5984,12 @@ var MatchingActivityMaterialContent = ({
5982
5984
  Object.keys(materialMap).forEach((materialKey) => {
5983
5985
  materialList.push(materialMap[materialKey]);
5984
5986
  });
5985
- setShuffledMaterialList(shuffleArray2(materialList));
5986
- hasShuffledRef.current = true;
5987
+ if (!hasShuffledRef.current) {
5988
+ setShuffledMaterialList(shuffleArray2(materialList));
5989
+ hasShuffledRef.current = true;
5990
+ } else {
5991
+ setShuffledMaterialList(materialList);
5992
+ }
5987
5993
  }, [materialMap]);
5988
5994
  (0, import_react22.useEffect)(() => {
5989
5995
  if (showCorrectAnswer) {
@@ -7647,7 +7653,7 @@ var ActivityPreviewByData = ({
7647
7653
  }
7648
7654
  }
7649
7655
  setAnswerMapMap(currentAnswerMapMap);
7650
- }, [activityTemplateTypeList]);
7656
+ }, [activityTemplateTypeList, data]);
7651
7657
  const RenderSelectedActivityContent = () => {
7652
7658
  if (!selectedType) return null;
7653
7659
  const commonProps = {
package/dist/index.mjs CHANGED
@@ -650,7 +650,7 @@ var DeleteButton = ({
650
650
  return /* @__PURE__ */ jsx9(
651
651
  "button",
652
652
  {
653
- className: `border border-catchup-red bg-catchup-white text-catchup-red rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-red hover:text-catchup-white hover:border-catchup-red active:bg-catchup-red active:hover:border-catchup-red active:text-catchup-white active:opacity-80"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
653
+ className: `border border-catchup-red bg-catchup-red text-catchup-white rounded-catchup-button ${loading ? "" : disabled ? "opacity-50" : "hover:bg-catchup-white hover:text-catchup-red hover:border-catchup-red active:bg-catchup-white active:hover:border-catchup-red active:text-catchup-red active:opacity-80"} transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`,
654
654
  onClick: internalOnClick,
655
655
  onMouseEnter: () => {
656
656
  setIsHovered(true);
@@ -670,7 +670,7 @@ var DeleteButton = ({
670
670
  iconPosition === "left" ? /* @__PURE__ */ jsx9(
671
671
  BaseImage_default,
672
672
  {
673
- src: `${isHovered ? "/icons/remove-white.webp" : "/icons/remove-red.webp"}`,
673
+ src: `${isHovered ? "/icons/remove-red.webp" : "/icons/remove-white.webp"}`,
674
674
  alt: "remove-white",
675
675
  size: "xsmall"
676
676
  }
@@ -679,7 +679,7 @@ var DeleteButton = ({
679
679
  textOnly || iconPosition === "left" ? null : /* @__PURE__ */ jsx9(
680
680
  BaseImage_default,
681
681
  {
682
- src: `${isHovered ? "/icons/remove-white.webp" : "/icons/remove-red.webp"}`,
682
+ src: `${isHovered ? "/icons/remove-red.webp" : "/icons/remove-white.webp"}`,
683
683
  alt: "remove-white",
684
684
  size: "xsmall"
685
685
  }
@@ -5281,7 +5281,6 @@ var GroupingActivityMaterialContent = ({
5281
5281
  };
5282
5282
  }, [draggedValue]);
5283
5283
  useEffect10(() => {
5284
- if (hasShuffledRef.current) return;
5285
5284
  const shuffleArray2 = (array) => {
5286
5285
  const copyArray = JSON.parse(JSON.stringify(array));
5287
5286
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5296,8 +5295,12 @@ var GroupingActivityMaterialContent = ({
5296
5295
  materialList.push(materialValue);
5297
5296
  }
5298
5297
  });
5299
- setShuffledMaterialList(shuffleArray2(materialList));
5300
- hasShuffledRef.current = true;
5298
+ if (!hasShuffledRef.current) {
5299
+ setShuffledMaterialList(shuffleArray2(materialList));
5300
+ hasShuffledRef.current = true;
5301
+ } else {
5302
+ setShuffledMaterialList(materialList);
5303
+ }
5301
5304
  }, [materialMap]);
5302
5305
  useEffect10(() => {
5303
5306
  if (showCorrectAnswer) {
@@ -5729,7 +5732,6 @@ var MatchingActivityMaterialContent = ({
5729
5732
  };
5730
5733
  }, [draggedValue]);
5731
5734
  useEffect11(() => {
5732
- if (hasShuffledRef.current) return;
5733
5735
  const shuffleArray2 = (array) => {
5734
5736
  const copyArray = JSON.parse(JSON.stringify(array));
5735
5737
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5742,8 +5744,12 @@ var MatchingActivityMaterialContent = ({
5742
5744
  Object.keys(materialMap).forEach((materialKey) => {
5743
5745
  materialList.push(materialMap[materialKey]);
5744
5746
  });
5745
- setShuffledMaterialList(shuffleArray2(materialList));
5746
- hasShuffledRef.current = true;
5747
+ if (!hasShuffledRef.current) {
5748
+ setShuffledMaterialList(shuffleArray2(materialList));
5749
+ hasShuffledRef.current = true;
5750
+ } else {
5751
+ setShuffledMaterialList(materialList);
5752
+ }
5747
5753
  }, [materialMap]);
5748
5754
  useEffect11(() => {
5749
5755
  if (showCorrectAnswer) {
@@ -7407,7 +7413,7 @@ var ActivityPreviewByData = ({
7407
7413
  }
7408
7414
  }
7409
7415
  setAnswerMapMap(currentAnswerMapMap);
7410
- }, [activityTemplateTypeList]);
7416
+ }, [activityTemplateTypeList, data]);
7411
7417
  const RenderSelectedActivityContent = () => {
7412
7418
  if (!selectedType) return null;
7413
7419
  const commonProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.7.5",
3
+ "version": "2.7.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -117,7 +117,7 @@ const ActivityPreviewByData = ({
117
117
  }
118
118
  }
119
119
  setAnswerMapMap(currentAnswerMapMap);
120
- }, [activityTemplateTypeList]);
120
+ }, [activityTemplateTypeList, data]);
121
121
 
122
122
  const RenderSelectedActivityContent = () => {
123
123
  if (!selectedType) return null;
@@ -48,8 +48,6 @@ const GroupingActivityMaterialContent = ({
48
48
  }, [draggedValue]);
49
49
 
50
50
  useEffect(() => {
51
- if (hasShuffledRef.current) return;
52
-
53
51
  const shuffleArray = (array: any) => {
54
52
  const copyArray = JSON.parse(JSON.stringify(array));
55
53
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -66,8 +64,12 @@ const GroupingActivityMaterialContent = ({
66
64
  }
67
65
  });
68
66
 
69
- setShuffledMaterialList(shuffleArray(materialList));
70
- hasShuffledRef.current = true;
67
+ if (!hasShuffledRef.current) {
68
+ setShuffledMaterialList(shuffleArray(materialList));
69
+ hasShuffledRef.current = true;
70
+ } else {
71
+ setShuffledMaterialList(materialList);
72
+ }
71
73
  }, [materialMap]);
72
74
 
73
75
  useEffect(() => {
@@ -48,9 +48,6 @@ const MatchingActivityMaterialContent = ({
48
48
  }, [draggedValue]);
49
49
 
50
50
  useEffect(() => {
51
- // Only shuffle once, ever
52
- if (hasShuffledRef.current) return;
53
-
54
51
  const shuffleArray = (array: any) => {
55
52
  const copyArray = JSON.parse(JSON.stringify(array));
56
53
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -65,8 +62,12 @@ const MatchingActivityMaterialContent = ({
65
62
  materialList.push(materialMap[materialKey]);
66
63
  });
67
64
 
68
- setShuffledMaterialList(shuffleArray(materialList));
69
- hasShuffledRef.current = true;
65
+ if (!hasShuffledRef.current) {
66
+ setShuffledMaterialList(shuffleArray(materialList));
67
+ hasShuffledRef.current = true;
68
+ } else {
69
+ setShuffledMaterialList(materialList);
70
+ }
70
71
  }, [materialMap]);
71
72
 
72
73
  useEffect(() => {
@@ -46,12 +46,12 @@ const DeleteButton = ({
46
46
 
47
47
  return (
48
48
  <button
49
- className={`border border-catchup-red bg-catchup-white text-catchup-red rounded-catchup-button ${
49
+ className={`border border-catchup-red bg-catchup-red text-catchup-white rounded-catchup-button ${
50
50
  loading
51
51
  ? ""
52
52
  : disabled
53
53
  ? "opacity-50"
54
- : "hover:bg-catchup-red hover:text-catchup-white hover:border-catchup-red active:bg-catchup-red active:hover:border-catchup-red active:text-catchup-white active:opacity-80"
54
+ : "hover:bg-catchup-white hover:text-catchup-red hover:border-catchup-red active:bg-catchup-white active:hover:border-catchup-red active:text-catchup-red active:opacity-80"
55
55
  } transition duration-300 ${currentWidthClassName} ${currentHeightClassName}`}
56
56
  onClick={internalOnClick}
57
57
  onMouseEnter={() => {
@@ -74,8 +74,8 @@ const DeleteButton = ({
74
74
  <BaseImage
75
75
  src={`${
76
76
  isHovered
77
- ? "/icons/remove-white.webp"
78
- : "/icons/remove-red.webp"
77
+ ? "/icons/remove-red.webp"
78
+ : "/icons/remove-white.webp"
79
79
  }`}
80
80
  alt="remove-white"
81
81
  size="xsmall"
@@ -87,8 +87,8 @@ const DeleteButton = ({
87
87
  <BaseImage
88
88
  src={`${
89
89
  isHovered
90
- ? "/icons/remove-white.webp"
91
- : "/icons/remove-red.webp"
90
+ ? "/icons/remove-red.webp"
91
+ : "/icons/remove-white.webp"
92
92
  }`}
93
93
  alt="remove-white"
94
94
  size="xsmall"