catchup-library-web 2.7.8 → 2.7.9

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
@@ -4891,7 +4891,7 @@ var DropdownActivityMaterialContent = ({
4891
4891
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
4892
4892
  (materialKey, index) => {
4893
4893
  const answerKey = Object.keys(materialMap[materialKey])[0];
4894
- const learnerAnswerState = !isPreview ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4894
+ const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4895
4895
  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.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4896
4896
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-xl", children: [
4897
4897
  parseFloat(materialKey) + 1,
@@ -7088,7 +7088,7 @@ var OrderingActivityMaterialContent = ({
7088
7088
  }
7089
7089
  ),
7090
7090
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
7091
- const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
7091
+ const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
7092
7092
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
7093
7093
  "div",
7094
7094
  {
@@ -7227,16 +7227,22 @@ var TrueFalseActivityMaterialContent = ({
7227
7227
  }) => {
7228
7228
  const [shuffleOptionList, setShuffleOptionList] = (0, import_react26.useState)([]);
7229
7229
  const [displayAnswerMap, setDisplayAnswerMap] = (0, import_react26.useState)(answerMap);
7230
+ const hasShuffledRef = (0, import_react26.useRef)(false);
7230
7231
  (0, import_react26.useEffect)(() => {
7231
7232
  const optionList = [];
7232
7233
  optionList.push(...materialMap.trueList);
7233
7234
  optionList.push(...materialMap.falseList);
7234
- if (isPreview) {
7235
- setShuffleOptionList(optionList);
7235
+ if (!hasShuffledRef.current) {
7236
+ if (isPreview) {
7237
+ setShuffleOptionList(optionList);
7238
+ } else {
7239
+ setShuffleOptionList(shuffleArray(optionList));
7240
+ }
7241
+ hasShuffledRef.current = true;
7236
7242
  } else {
7237
- setShuffleOptionList(shuffleArray(optionList));
7243
+ setShuffleOptionList(optionList);
7238
7244
  }
7239
- }, []);
7245
+ }, [materialMap]);
7240
7246
  (0, import_react26.useEffect)(() => {
7241
7247
  if (showCorrectAnswer) {
7242
7248
  setDisplayAnswerMap(materialMap);
package/dist/index.mjs CHANGED
@@ -4651,7 +4651,7 @@ var DropdownActivityMaterialContent = ({
4651
4651
  /* @__PURE__ */ jsx28("div", { className: "flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ jsx28("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(displayAnswerMap).map(
4652
4652
  (materialKey, index) => {
4653
4653
  const answerKey = Object.keys(materialMap[materialKey])[0];
4654
- const learnerAnswerState = !isPreview ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4654
+ const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
4655
4655
  return /* @__PURE__ */ jsx28("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx28("div", { className: "mx-2", children: /* @__PURE__ */ jsxs18("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
4656
4656
  /* @__PURE__ */ jsx28("div", { className: "my-auto", children: /* @__PURE__ */ jsxs18("p", { className: "text-xl", children: [
4657
4657
  parseFloat(materialKey) + 1,
@@ -6848,7 +6848,7 @@ var OrderingActivityMaterialContent = ({
6848
6848
  }
6849
6849
  ),
6850
6850
  /* @__PURE__ */ jsx42("div", { className: "flex-1 min-h-0 overflow-y-auto", children: Object.keys(displayAnswerMap).map((materialKey, index) => {
6851
- const learnerAnswerState = !isPreview ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
6851
+ const learnerAnswerState = !isPreview ? null : !showCorrectAnswer ? null : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
6852
6852
  return /* @__PURE__ */ jsx42("div", { className: "w-full", children: /* @__PURE__ */ jsxs32(
6853
6853
  "div",
6854
6854
  {
@@ -6972,7 +6972,7 @@ var OrderingActivityContent = ({
6972
6972
  var OrderingActivityContent_default = OrderingActivityContent;
6973
6973
 
6974
6974
  // src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx
6975
- import { useEffect as useEffect15, useState as useState25 } from "react";
6975
+ import { useEffect as useEffect15, useRef as useRef8, useState as useState25 } from "react";
6976
6976
  import { InlineMath as InlineMath10 } from "react-katex";
6977
6977
  import { Fragment as Fragment7, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
6978
6978
  var TrueFalseActivityMaterialContent = ({
@@ -6987,16 +6987,22 @@ var TrueFalseActivityMaterialContent = ({
6987
6987
  }) => {
6988
6988
  const [shuffleOptionList, setShuffleOptionList] = useState25([]);
6989
6989
  const [displayAnswerMap, setDisplayAnswerMap] = useState25(answerMap);
6990
+ const hasShuffledRef = useRef8(false);
6990
6991
  useEffect15(() => {
6991
6992
  const optionList = [];
6992
6993
  optionList.push(...materialMap.trueList);
6993
6994
  optionList.push(...materialMap.falseList);
6994
- if (isPreview) {
6995
- setShuffleOptionList(optionList);
6995
+ if (!hasShuffledRef.current) {
6996
+ if (isPreview) {
6997
+ setShuffleOptionList(optionList);
6998
+ } else {
6999
+ setShuffleOptionList(shuffleArray(optionList));
7000
+ }
7001
+ hasShuffledRef.current = true;
6996
7002
  } else {
6997
- setShuffleOptionList(shuffleArray(optionList));
7003
+ setShuffleOptionList(optionList);
6998
7004
  }
6999
- }, []);
7005
+ }, [materialMap]);
7000
7006
  useEffect15(() => {
7001
7007
  if (showCorrectAnswer) {
7002
7008
  setDisplayAnswerMap(materialMap);
@@ -7283,7 +7289,7 @@ var ActivityEvaluationRubricContent = ({
7283
7289
  var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
7284
7290
 
7285
7291
  // src/components/activities/ActivityPreviewByData.tsx
7286
- import { useEffect as useEffect16, useRef as useRef8, useState as useState26 } from "react";
7292
+ import { useEffect as useEffect16, useRef as useRef9, useState as useState26 } from "react";
7287
7293
 
7288
7294
  // src/components/boxes/SelectionBox.tsx
7289
7295
  import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -7400,7 +7406,7 @@ var ActivityPreviewByData = ({
7400
7406
  if (optionList.length === 0) return;
7401
7407
  setSelectedType(optionList[0].id);
7402
7408
  }, [optionList]);
7403
- const prevDataStringRef = useRef8("");
7409
+ const prevDataStringRef = useRef9("");
7404
7410
  useEffect16(() => {
7405
7411
  if (activityTemplateTypeList.length === 0) return;
7406
7412
  const dataString = JSON.stringify(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.7.8",
3
+ "version": "2.7.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -55,7 +55,9 @@ const DropdownActivityMaterialContent = ({
55
55
  const answerKey = Object.keys(materialMap[materialKey])[0];
56
56
  const learnerAnswerState = !isPreview
57
57
  ? null
58
- : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
58
+ : !showCorrectAnswer
59
+ ? null
60
+ : checkAnswerState(answerKey, displayAnswerMap[materialKey]);
59
61
  return (
60
62
  <div key={index} className="w-full md:w-1/2">
61
63
  <div className="mx-2">
@@ -256,7 +256,9 @@ const OrderingActivityMaterialContent = ({
256
256
  {Object.keys(displayAnswerMap).map((materialKey, index) => {
257
257
  const learnerAnswerState = !isPreview
258
258
  ? null
259
- : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
259
+ : !showCorrectAnswer
260
+ ? null
261
+ : checkAnswerState(displayAnswerMap[materialKey] + "", index + "");
260
262
  return (
261
263
  <div className="w-full" key={index}>
262
264
  <div
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from "react";
1
+ import { useEffect, useRef, useState } from "react";
2
2
  import i18n from "../../../language/i18n";
3
3
  import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
4
4
  import { InlineMath } from "react-katex";
@@ -21,16 +21,22 @@ const TrueFalseActivityMaterialContent = ({
21
21
  const [shuffleOptionList, setShuffleOptionList] = useState<any[]>([]);
22
22
  const [displayAnswerMap, setDisplayAnswerMap] = useState<any>(answerMap);
23
23
 
24
+ const hasShuffledRef = useRef<boolean>(false);
24
25
  useEffect(() => {
25
- const optionList = [];
26
+ const optionList: any[] = [];
26
27
  optionList.push(...materialMap.trueList);
27
28
  optionList.push(...materialMap.falseList);
28
- if (isPreview) {
29
- setShuffleOptionList(optionList);
29
+ if (!hasShuffledRef.current) {
30
+ if (isPreview) {
31
+ setShuffleOptionList(optionList);
32
+ } else {
33
+ setShuffleOptionList(shuffleArray(optionList));
34
+ }
35
+ hasShuffledRef.current = true;
30
36
  } else {
31
- setShuffleOptionList(shuffleArray(optionList));
37
+ setShuffleOptionList(optionList);
32
38
  }
33
- }, []);
39
+ }, [materialMap]);
34
40
 
35
41
  useEffect(() => {
36
42
  if (showCorrectAnswer) {