catchup-library-web 1.0.0 → 1.0.2
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 +239 -2
- package/dist/index.d.ts +239 -2
- package/dist/index.js +4686 -2
- package/dist/index.mjs +4621 -1
- package/package.json +10 -2
- package/src/components/activities/DropdownActivityContent.tsx +73 -0
- package/src/components/activities/FillInTheBlanksActivityContent.tsx +102 -0
- package/src/components/activities/GroupingActivityContent.tsx +62 -0
- package/src/components/activities/MCMAActivityContent.tsx +65 -0
- package/src/components/activities/MCSAActivityContent.tsx +58 -0
- package/src/components/activities/MatchingActivityContent.tsx +57 -0
- package/src/components/activities/OpenEndedActivityContent.tsx +92 -0
- package/src/components/activities/OrderingActivityContent.tsx +59 -0
- package/src/components/activities/TrueFalseActivityContent.tsx +98 -0
- package/src/components/activities/body-content/ActivityBodyContent.tsx +108 -0
- package/src/components/activities/body-content/ShowBodyMediaByContentType.tsx +404 -0
- package/src/components/activities/empty-content/ActivityEmptyContent.tsx +15 -0
- package/src/components/activities/material-content/DropdownActivityMaterialContent.tsx +227 -0
- package/src/components/activities/material-content/FillInTheBlanksActivityMaterialContent.tsx +270 -0
- package/src/components/activities/material-content/GroupingActivityMaterialContent.tsx +359 -0
- package/src/components/activities/material-content/MCMAActivityMaterialContent.tsx +166 -0
- package/src/components/activities/material-content/MCSAActivityMaterialContent.tsx +165 -0
- package/src/components/activities/material-content/MatchingActivityMaterialContent.tsx +332 -0
- package/src/components/activities/material-content/OpenEndedActivityMaterialContent.tsx +818 -0
- package/src/components/activities/material-content/OrderingActivityMaterialContent.tsx +216 -0
- package/src/components/activities/material-content/ShowMaterialMediaByContentType.tsx +172 -0
- package/src/components/activities/material-content/TrueFalseActivityMaterialContent.tsx +217 -0
- package/src/components/activities/solution-content/ActivitySolutionContent.tsx +86 -0
- package/src/components/dividers/BlueVerticalDividerLine.tsx +13 -0
- package/src/components/dividers/DividerLine.tsx +5 -0
- package/src/components/dividers/VerticalDividerLine.tsx +5 -0
- package/src/components/dnds/DraggableDroppableItem.tsx +62 -0
- package/src/components/dnds/DraggableItem.tsx +41 -0
- package/src/components/dnds/DroppableItem.tsx +38 -0
- package/src/components/dropdowns/MediaDropdown.tsx +51 -0
- package/src/components/groups/InputGroup.tsx +330 -0
- package/src/hooks/useScreenSize.ts +40 -0
- package/src/index.ts +24 -0
- package/src/language/i18n.ts +10 -0
- package/src/properties/ActivityProperties.ts +204 -0
- package/src/properties/ButtonProperties.ts +1 -1
- package/src/properties/CommonProperties.ts +1 -1
- package/src/properties/DividerLineProperties.ts +3 -0
- package/src/properties/DnDProperties.ts +28 -0
- package/src/properties/DropdownProperties.ts +5 -0
- package/src/properties/EnumProperties.ts +11 -0
- package/src/properties/GroupProperties.ts +19 -0
- package/src/utilization/AppUtilization.ts +56 -0
- package/src/utilization/CatchtivityUtilization.ts +1566 -0
- package/src/utilization/StorageUtilization.ts +35 -0
- package/tsconfig.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1
20
|
var __async = (__this, __arguments, generator) => {
|
|
2
21
|
return new Promise((resolve, reject) => {
|
|
3
22
|
var fulfilled = (value) => {
|
|
@@ -629,13 +648,4614 @@ var ApproveButton = ({
|
|
|
629
648
|
);
|
|
630
649
|
};
|
|
631
650
|
var ApproveButton_default = ApproveButton;
|
|
651
|
+
|
|
652
|
+
// src/language/i18n.ts
|
|
653
|
+
import i18n from "i18next";
|
|
654
|
+
import { initReactI18next } from "react-i18next";
|
|
655
|
+
i18n.use(initReactI18next);
|
|
656
|
+
var i18n_default = i18n;
|
|
657
|
+
|
|
658
|
+
// src/utilization/CatchtivityUtilization.ts
|
|
659
|
+
var retrieveColorByScore = (score) => {
|
|
660
|
+
if (score <= 25) {
|
|
661
|
+
return "#F96666";
|
|
662
|
+
} else if (score > 25 && score <= 50) {
|
|
663
|
+
return "#f98d66";
|
|
664
|
+
} else if (score > 50 && score <= 75) {
|
|
665
|
+
return "#cbd357";
|
|
666
|
+
} else {
|
|
667
|
+
return "#ABD357";
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
var retrieveContentTypeOptionList = (textOnly) => {
|
|
671
|
+
if (textOnly) {
|
|
672
|
+
return [
|
|
673
|
+
{
|
|
674
|
+
id: "TEXT",
|
|
675
|
+
value: "TEXT",
|
|
676
|
+
text: i18n_default.t("TEXT"),
|
|
677
|
+
icon: "/icons/text-gray.png"
|
|
678
|
+
}
|
|
679
|
+
];
|
|
680
|
+
} else {
|
|
681
|
+
return [
|
|
682
|
+
{
|
|
683
|
+
id: "TEXT",
|
|
684
|
+
value: "TEXT",
|
|
685
|
+
text: i18n_default.t("TEXT"),
|
|
686
|
+
icon: "/icons/text-gray.png"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
id: "IMAGE",
|
|
690
|
+
value: "IMAGE",
|
|
691
|
+
text: i18n_default.t("IMAGE"),
|
|
692
|
+
icon: "/icons/image-gray.png"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
id: "VIDEO",
|
|
696
|
+
value: "VIDEO",
|
|
697
|
+
text: i18n_default.t("VIDEO"),
|
|
698
|
+
icon: "/icons/video-gray.png"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
id: "AUDIO",
|
|
702
|
+
value: "AUDIO",
|
|
703
|
+
text: i18n_default.t("AUDIO"),
|
|
704
|
+
icon: "/icons/audio-gray.png"
|
|
705
|
+
}
|
|
706
|
+
];
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
var retrieveStatusOptionList = () => {
|
|
710
|
+
return [
|
|
711
|
+
{
|
|
712
|
+
value: "ACTIVE",
|
|
713
|
+
text: i18n_default.t("ACTIVE")
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
value: "PASSIVE",
|
|
717
|
+
text: i18n_default.t("PASSIVE")
|
|
718
|
+
}
|
|
719
|
+
];
|
|
720
|
+
};
|
|
721
|
+
var retrieveDurationTypeOptionList = () => {
|
|
722
|
+
return [
|
|
723
|
+
{ value: "NONE", text: i18n_default.t("NONE") },
|
|
724
|
+
{ value: "ALL", text: i18n_default.t("ALL") },
|
|
725
|
+
{ value: "EACH", text: i18n_default.t("EACH") }
|
|
726
|
+
];
|
|
727
|
+
};
|
|
728
|
+
var retrieveDurationInMinutesOptionList = (durationType) => {
|
|
729
|
+
if (durationType === "ALL") {
|
|
730
|
+
return [
|
|
731
|
+
{ value: 15, text: 15 },
|
|
732
|
+
{ value: 30, text: 30 },
|
|
733
|
+
{ value: 45, text: 45 },
|
|
734
|
+
{ value: 60, text: 60 },
|
|
735
|
+
{ value: 75, text: 75 },
|
|
736
|
+
{ value: 90, text: 90 },
|
|
737
|
+
{ value: 105, text: 105 },
|
|
738
|
+
{ value: 120, text: 120 }
|
|
739
|
+
];
|
|
740
|
+
} else if (durationType === "EACH") {
|
|
741
|
+
return [
|
|
742
|
+
{ value: 1, text: 1 },
|
|
743
|
+
{ value: 2, text: 2 },
|
|
744
|
+
{ value: 3, text: 3 },
|
|
745
|
+
{ value: 5, text: 5 },
|
|
746
|
+
{ value: 10, text: 10 }
|
|
747
|
+
];
|
|
748
|
+
}
|
|
749
|
+
return [];
|
|
750
|
+
};
|
|
751
|
+
var retrieveDurationInSecondsOptionList = () => {
|
|
752
|
+
return [
|
|
753
|
+
{ value: 15, text: `15 ${i18n_default.t("seconds")}` },
|
|
754
|
+
{ value: 20, text: `20 ${i18n_default.t("seconds")}` },
|
|
755
|
+
{ value: 25, text: `25 ${i18n_default.t("seconds")}` },
|
|
756
|
+
{ value: 30, text: `30 ${i18n_default.t("seconds")}` },
|
|
757
|
+
{ value: 35, text: `35 ${i18n_default.t("seconds")}` },
|
|
758
|
+
{ value: 40, text: `40 ${i18n_default.t("seconds")}` },
|
|
759
|
+
{ value: 45, text: `45 ${i18n_default.t("seconds")}` }
|
|
760
|
+
];
|
|
761
|
+
};
|
|
762
|
+
var retrieveTaxonomyType = () => {
|
|
763
|
+
return [
|
|
764
|
+
{
|
|
765
|
+
value: "BLOOM",
|
|
766
|
+
text: i18n_default.t("BLOOM")
|
|
767
|
+
}
|
|
768
|
+
];
|
|
769
|
+
};
|
|
770
|
+
var retrieveTaxonomyGroupName = () => {
|
|
771
|
+
return [
|
|
772
|
+
{
|
|
773
|
+
type: "BLOOM",
|
|
774
|
+
value: "BLOOM",
|
|
775
|
+
text: i18n_default.t("BLOOM")
|
|
776
|
+
}
|
|
777
|
+
];
|
|
778
|
+
};
|
|
779
|
+
var retrieveTaxonomyName = () => {
|
|
780
|
+
return [
|
|
781
|
+
{
|
|
782
|
+
stage: 1,
|
|
783
|
+
groupName: "BLOOM",
|
|
784
|
+
value: "REMEMBER",
|
|
785
|
+
text: i18n_default.t("REMEMBER")
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
stage: 2,
|
|
789
|
+
groupName: "BLOOM",
|
|
790
|
+
value: "UNDERSTAND",
|
|
791
|
+
text: i18n_default.t("UNDERSTAND")
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
stage: 3,
|
|
795
|
+
groupName: "BLOOM",
|
|
796
|
+
value: "APPLY",
|
|
797
|
+
text: i18n_default.t("APPLY")
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
stage: 4,
|
|
801
|
+
groupName: "BLOOM",
|
|
802
|
+
value: "ANALYZE",
|
|
803
|
+
text: i18n_default.t("ANALYZE")
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
stage: 5,
|
|
807
|
+
groupName: "BLOOM",
|
|
808
|
+
value: "EVALUATE",
|
|
809
|
+
text: i18n_default.t("EVALUATE")
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
stage: 6,
|
|
813
|
+
groupName: "BLOOM",
|
|
814
|
+
value: "CREATE",
|
|
815
|
+
text: i18n_default.t("CREATE")
|
|
816
|
+
}
|
|
817
|
+
];
|
|
818
|
+
};
|
|
819
|
+
var constructInputWithSpecialExpressionList = (inputText) => {
|
|
820
|
+
const inputPartList = [];
|
|
821
|
+
if (!inputText) return [];
|
|
822
|
+
const splittedBold = inputText.split("**");
|
|
823
|
+
let isBold = false;
|
|
824
|
+
for (let i = 0; i < splittedBold.length; i++) {
|
|
825
|
+
let isUnderline = false;
|
|
826
|
+
const splittedUnderline = splittedBold[i].split("__");
|
|
827
|
+
for (let j = 0; j < splittedUnderline.length; j++) {
|
|
828
|
+
let isEquation = false;
|
|
829
|
+
const splittedEquation = splittedUnderline[j].split("`");
|
|
830
|
+
for (let k = 0; k < splittedEquation.length; k++) {
|
|
831
|
+
inputPartList.push({
|
|
832
|
+
value: splittedEquation[k],
|
|
833
|
+
isEquation,
|
|
834
|
+
isUnderline,
|
|
835
|
+
isBold
|
|
836
|
+
});
|
|
837
|
+
isEquation = !isEquation;
|
|
838
|
+
}
|
|
839
|
+
isUnderline = !isUnderline;
|
|
840
|
+
}
|
|
841
|
+
isBold = !isBold;
|
|
842
|
+
}
|
|
843
|
+
return inputPartList;
|
|
844
|
+
};
|
|
845
|
+
var retrieveStandardExamTypeOptionList = () => {
|
|
846
|
+
return [
|
|
847
|
+
{ value: "AYT", text: "AYT" },
|
|
848
|
+
{ value: "TYT", text: "TYT" },
|
|
849
|
+
{ value: "LGS", text: "LGS" }
|
|
850
|
+
];
|
|
851
|
+
};
|
|
852
|
+
var retrieveStandardExamTypeIcon = (baseReportType) => {
|
|
853
|
+
if (baseReportType === "TYT") {
|
|
854
|
+
return "/icons/tyt.png";
|
|
855
|
+
} else if (baseReportType === "AYT") {
|
|
856
|
+
return "/icons/ayt.png";
|
|
857
|
+
} else if (baseReportType === "LGS") {
|
|
858
|
+
return "/icons/lgs.png";
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
var retrieveCoterieTypeFromStandardExamCoterieType = (standardExamType, standardExamCoterieType) => {
|
|
862
|
+
if (standardExamCoterieType === "TURKISH") {
|
|
863
|
+
return "TURKISH";
|
|
864
|
+
} else if (standardExamCoterieType === "SCIENCE") {
|
|
865
|
+
return "SCIENCE";
|
|
866
|
+
} else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "PHYSICS") {
|
|
867
|
+
return "PHYSICS";
|
|
868
|
+
} else if (standardExamType === "LGS" && standardExamCoterieType === "PHYSICS") {
|
|
869
|
+
return "SOCIAL_STUDIES";
|
|
870
|
+
} else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "CHEMISTRY") {
|
|
871
|
+
return "CHEMISTRY";
|
|
872
|
+
} else if (standardExamType === "LGS" && standardExamCoterieType === "CHEMISTRY") {
|
|
873
|
+
return "SOCIAL_STUDIES";
|
|
874
|
+
} else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "BIOLOGY") {
|
|
875
|
+
return "BIOLOGY";
|
|
876
|
+
} else if (standardExamType === "LGS" && standardExamCoterieType === "BIOLOGY") {
|
|
877
|
+
return "SOCIAL_STUDIES";
|
|
878
|
+
} else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "HISTORY") {
|
|
879
|
+
return "HISTORY";
|
|
880
|
+
} else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "GEOGRAPHY") {
|
|
881
|
+
return "GEOGRAPHY";
|
|
882
|
+
} else if (standardExamType === "LGS" && standardExamCoterieType === "HISTORY" || standardExamType === "LGS" && standardExamCoterieType === "GEOGRAPHY" || standardExamCoterieType === "REVOLUTION_HISTORY") {
|
|
883
|
+
return "SOCIAL_STUDIES";
|
|
884
|
+
} else if (standardExamCoterieType === "HISTORY_I" || standardExamCoterieType === "HISTORY_II") {
|
|
885
|
+
return "HISTORY";
|
|
886
|
+
} else if (standardExamCoterieType === "GEOGRAPHY_I" || standardExamCoterieType === "GEOGRAPHY_II") {
|
|
887
|
+
return "GEOGRAPHY";
|
|
888
|
+
} else if (standardExamCoterieType === "MATHEMATICS" || standardExamCoterieType === "GEOMETRY") {
|
|
889
|
+
return "MATHEMATICS";
|
|
890
|
+
} else if (standardExamCoterieType === "PHILOSOPHY" || standardExamCoterieType === "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE") {
|
|
891
|
+
return "PHILOSOPHY";
|
|
892
|
+
} else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "CULTURE_AND_RELIGION_KNOWLEDGE") {
|
|
893
|
+
return "CULTURE_AND_RELIGION_KNOWLEDGE";
|
|
894
|
+
} else if (standardExamType === "LGS" && standardExamCoterieType === "CULTURE_AND_RELIGION_KNOWLEDGE") {
|
|
895
|
+
return "CULTURE_AND_RELIGION_KNOWLEDGE";
|
|
896
|
+
} else if (standardExamCoterieType === "ENGLISH") {
|
|
897
|
+
return "ENGLISH";
|
|
898
|
+
} else if (standardExamCoterieType === "LITERATURE") {
|
|
899
|
+
return "LITERATURE";
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
var retrieveStandardExamCoterieTypeOptionListByStandardExamType = (standardExamType) => {
|
|
903
|
+
if (standardExamType === "TYT") {
|
|
904
|
+
return retrieveStandardExamCoterieTypeOptionList().filter(
|
|
905
|
+
(item) => item.value === "TURKISH" || item.value === "HISTORY" || item.value === "GEOGRAPHY" || item.value === "PHILOSOPHY" || item.value === "CULTURE_AND_RELIGION_KNOWLEDGE" || item.value === "MATHEMATICS" || item.value === "GEOMETRY" || item.value === "PHYSICS" || item.value === "CHEMISTRY" || item.value === "BIOLOGY"
|
|
906
|
+
);
|
|
907
|
+
} else if (standardExamType === "AYT") {
|
|
908
|
+
return retrieveStandardExamCoterieTypeOptionList().filter(
|
|
909
|
+
(item) => item.value === "LITERATURE" || item.value === "HISTORY_I" || item.value === "HISTORY_II" || item.value === "GEOGRAPHY_I" || item.value === "GEOGRAPHY_II" || item.value === "PHILOSOPHY" || item.value === "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE" || item.value === "MATHEMATICS" || item.value === "GEOMETRY" || item.value === "PHYSICS" || item.value === "CHEMISTRY" || item.value === "BIOLOGY" || item.value === "ENGLISH"
|
|
910
|
+
);
|
|
911
|
+
} else if (standardExamType === "LGS") {
|
|
912
|
+
return retrieveStandardExamCoterieTypeOptionList().filter(
|
|
913
|
+
(item) => item.value === "TURKISH" || item.value === "REVOLUTION_HISTORY" || item.value === "CULTURE_AND_RELIGION_KNOWLEDGE" || item.value === "MATHEMATICS" || item.value === "SCIENCE" || item.value === "ENGLISH"
|
|
914
|
+
);
|
|
915
|
+
} else return [];
|
|
916
|
+
};
|
|
917
|
+
var retrieveStandardExamCoterieTypeOptionList = () => {
|
|
918
|
+
return [
|
|
919
|
+
{ value: "TURKISH", text: i18n_default.t("TURKISH") },
|
|
920
|
+
{ value: "SCIENCE", text: i18n_default.t("SCIENCE") },
|
|
921
|
+
{ value: "HISTORY", text: i18n_default.t("HISTORY") },
|
|
922
|
+
{ value: "GEOGRAPHY", text: i18n_default.t("GEOGRAPHY") },
|
|
923
|
+
{ value: "PHILOSOPHY", text: i18n_default.t("PHILOSOPHY") },
|
|
924
|
+
{
|
|
925
|
+
value: "CULTURE_AND_RELIGION_KNOWLEDGE",
|
|
926
|
+
text: i18n_default.t("CULTURE_AND_RELIGION_KNOWLEDGE")
|
|
927
|
+
},
|
|
928
|
+
{ value: "MATHEMATICS", text: i18n_default.t("MATHEMATICS") },
|
|
929
|
+
{ value: "GEOMETRY", text: i18n_default.t("GEOMETRY") },
|
|
930
|
+
{ value: "PHYSICS", text: i18n_default.t("PHYSICS") },
|
|
931
|
+
{ value: "CHEMISTRY", text: i18n_default.t("CHEMISTRY") },
|
|
932
|
+
{ value: "BIOLOGY", text: i18n_default.t("BIOLOGY") },
|
|
933
|
+
{ value: "LITERATURE", text: i18n_default.t("LITERATURE") },
|
|
934
|
+
{ value: "HISTORY_I", text: i18n_default.t("HISTORY_I") },
|
|
935
|
+
{ value: "HISTORY_II", text: i18n_default.t("HISTORY_II") },
|
|
936
|
+
{ value: "GEOGRAPHY_I", text: i18n_default.t("GEOGRAPHY_I") },
|
|
937
|
+
{ value: "GEOGRAPHY_II", text: i18n_default.t("GEOGRAPHY_II") },
|
|
938
|
+
{
|
|
939
|
+
value: "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE",
|
|
940
|
+
text: i18n_default.t("PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE")
|
|
941
|
+
},
|
|
942
|
+
{ value: "ENGLISH", text: i18n_default.t("ENGLISH") },
|
|
943
|
+
{ value: "REVOLUTION_HISTORY", text: i18n_default.t("REVOLUTION_HISTORY") }
|
|
944
|
+
];
|
|
945
|
+
};
|
|
946
|
+
var retrieveValidationRequirementList_AYT = () => {
|
|
947
|
+
return [
|
|
948
|
+
{
|
|
949
|
+
value: "LITERATURE",
|
|
950
|
+
count: 24
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
value: "HISTORY_I",
|
|
954
|
+
count: 10
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
value: "HISTORY_II",
|
|
958
|
+
count: 11
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
value: "GEOGRAPHY_I",
|
|
962
|
+
count: 6
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
value: "GEOGRAPHY_II",
|
|
966
|
+
count: 11
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
value: "PHILOSOPHY",
|
|
970
|
+
count: 12
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
value: "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE",
|
|
974
|
+
count: 6
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
value: "MATHEMATICS",
|
|
978
|
+
count: 30
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
value: "GEOMETRY",
|
|
982
|
+
count: 10
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
value: "PHYSICS",
|
|
986
|
+
count: 14
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
value: "CHEMISTRY",
|
|
990
|
+
count: 13
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
value: "BIOLOGY",
|
|
994
|
+
count: 13
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
value: "ENGLISH",
|
|
998
|
+
count: 80
|
|
999
|
+
}
|
|
1000
|
+
];
|
|
1001
|
+
};
|
|
1002
|
+
var retrieveValidationRequirementList_TYT = () => {
|
|
1003
|
+
return [
|
|
1004
|
+
{
|
|
1005
|
+
value: "TURKISH",
|
|
1006
|
+
count: 40
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
value: "HISTORY",
|
|
1010
|
+
count: 5
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
value: "GEOGRAPHY",
|
|
1014
|
+
count: 5
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
value: "PHILOSOPHY",
|
|
1018
|
+
count: 5
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
value: "CULTURE_AND_RELIGION_KNOWLEDGE",
|
|
1022
|
+
count: 5
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
value: "MATHEMATICS",
|
|
1026
|
+
count: 30
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
value: "GEOMETRY",
|
|
1030
|
+
count: 10
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
value: "PHYSICS",
|
|
1034
|
+
count: 7
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
value: "CHEMISTRY",
|
|
1038
|
+
count: 7
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
value: "BIOLOGY",
|
|
1042
|
+
count: 6
|
|
1043
|
+
}
|
|
1044
|
+
];
|
|
1045
|
+
};
|
|
1046
|
+
var retrieveValidationRequirementList_LGS = () => {
|
|
1047
|
+
return [
|
|
1048
|
+
{
|
|
1049
|
+
value: "TURKISH",
|
|
1050
|
+
count: 20
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
value: "REVOLUTION_HISTORY",
|
|
1054
|
+
count: 10
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
value: "CULTURE_AND_RELIGION_KNOWLEDGE",
|
|
1058
|
+
count: 10
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
value: "MATHEMATICS",
|
|
1062
|
+
count: 20
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
value: "SCIENCE",
|
|
1066
|
+
count: 20
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
value: "ENGLISH",
|
|
1070
|
+
count: 10
|
|
1071
|
+
}
|
|
1072
|
+
];
|
|
1073
|
+
};
|
|
1074
|
+
var retrieveValidationRequirementList = (selectedStandardExamType) => {
|
|
1075
|
+
if (selectedStandardExamType === "TYT") {
|
|
1076
|
+
return retrieveValidationRequirementList_TYT();
|
|
1077
|
+
} else if (selectedStandardExamType === "AYT") {
|
|
1078
|
+
return retrieveValidationRequirementList_AYT();
|
|
1079
|
+
} else if (selectedStandardExamType === "LGS") {
|
|
1080
|
+
return retrieveValidationRequirementList_LGS();
|
|
1081
|
+
}
|
|
1082
|
+
return [];
|
|
1083
|
+
};
|
|
1084
|
+
var constructActivityItemListWithSolutionForAI = (bodyMap, materialMap, type, imageContentList) => {
|
|
1085
|
+
const itemList = [];
|
|
1086
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1087
|
+
const bodyItem = bodyMap[key];
|
|
1088
|
+
if (bodyItem.type === "IMAGE") {
|
|
1089
|
+
if (imageContentList && imageContentList.length > 0) {
|
|
1090
|
+
const foundImageContent = imageContentList.find(
|
|
1091
|
+
(imageContent) => imageContent.url === bodyItem.value
|
|
1092
|
+
);
|
|
1093
|
+
itemList.push({
|
|
1094
|
+
type: "text",
|
|
1095
|
+
text: foundImageContent.content
|
|
1096
|
+
});
|
|
1097
|
+
} else {
|
|
1098
|
+
itemList.push({
|
|
1099
|
+
type: "image_url",
|
|
1100
|
+
imageUrl: bodyItem.value
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
} else {
|
|
1104
|
+
itemList.push({
|
|
1105
|
+
type: "text",
|
|
1106
|
+
text: bodyItem.value.replaceAll("@@", "___________")
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
if (type === "ORDERING") {
|
|
1111
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1112
|
+
itemList.push({
|
|
1113
|
+
type: "text",
|
|
1114
|
+
text: `${i18n_default.t("correct_order")}: `
|
|
1115
|
+
});
|
|
1116
|
+
Object.keys(materialMap).forEach((key) => {
|
|
1117
|
+
itemList.push({
|
|
1118
|
+
type: "text",
|
|
1119
|
+
text: materialMap[key]
|
|
1120
|
+
});
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
} else if (type === "DROPDOWN") {
|
|
1124
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1125
|
+
itemList.push({
|
|
1126
|
+
type: "text",
|
|
1127
|
+
text: `${i18n_default.t("correct_blanks")}: `
|
|
1128
|
+
});
|
|
1129
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1130
|
+
itemList.push({
|
|
1131
|
+
type: "text",
|
|
1132
|
+
text: `${i18n_default.t("blank")} ${index + 1}: ${Object.keys(materialMap[key])[0]}`
|
|
1133
|
+
});
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
} else if (type === "MCSA") {
|
|
1137
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1138
|
+
const answer = Object.keys(materialMap)[0];
|
|
1139
|
+
materialMap[answer].forEach((option) => {
|
|
1140
|
+
itemList.push({
|
|
1141
|
+
type: "text",
|
|
1142
|
+
text: option
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
1145
|
+
materialMap[answer].forEach((option) => {
|
|
1146
|
+
if (option === answer) {
|
|
1147
|
+
itemList.push({
|
|
1148
|
+
type: "text",
|
|
1149
|
+
text: `[${i18n_default.t("answer").toUpperCase()}]${option}`
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
} else if (type === "MCMA") {
|
|
1155
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1156
|
+
const answer = Object.keys(materialMap)[0];
|
|
1157
|
+
materialMap[answer].forEach((option) => {
|
|
1158
|
+
itemList.push({
|
|
1159
|
+
type: "text",
|
|
1160
|
+
text: option
|
|
1161
|
+
});
|
|
1162
|
+
});
|
|
1163
|
+
const splittedTextList = answer.split("\xA7");
|
|
1164
|
+
materialMap[answer].forEach((option) => {
|
|
1165
|
+
if (splittedTextList.includes(option)) {
|
|
1166
|
+
itemList.push({
|
|
1167
|
+
type: "text",
|
|
1168
|
+
text: `[${i18n_default.t("answer").toUpperCase()}]${option}`
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
} else if (type === "MATCHING") {
|
|
1174
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1175
|
+
itemList.push({
|
|
1176
|
+
type: "text",
|
|
1177
|
+
text: `${i18n_default.t("correct_matching")}: `
|
|
1178
|
+
});
|
|
1179
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1180
|
+
const matchingKey = Object.keys(materialMap[key])[0];
|
|
1181
|
+
const matchingValue = materialMap[key][matchingKey];
|
|
1182
|
+
itemList.push({
|
|
1183
|
+
type: "text",
|
|
1184
|
+
text: `${matchingKey}: ${matchingValue}`
|
|
1185
|
+
});
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
} else if (type === "GROUPING") {
|
|
1189
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1190
|
+
itemList.push({
|
|
1191
|
+
type: "text",
|
|
1192
|
+
text: `${i18n_default.t("correct_grouping")}: `
|
|
1193
|
+
});
|
|
1194
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1195
|
+
let text = `${i18n_default.t("group")} ${index + 1}: `;
|
|
1196
|
+
itemList.push({
|
|
1197
|
+
type: "text",
|
|
1198
|
+
text
|
|
1199
|
+
});
|
|
1200
|
+
const groupName = Object.keys(materialMap[key])[0];
|
|
1201
|
+
let currentText = "";
|
|
1202
|
+
materialMap[key][groupName].forEach((item) => {
|
|
1203
|
+
currentText += `${item}, `;
|
|
1204
|
+
});
|
|
1205
|
+
currentText = currentText.substring(0, currentText.length - 2);
|
|
1206
|
+
itemList.push({
|
|
1207
|
+
type: "text",
|
|
1208
|
+
text: `${groupName}: ${currentText}`
|
|
1209
|
+
});
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
1213
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1214
|
+
itemList.push({
|
|
1215
|
+
type: "text",
|
|
1216
|
+
text: `${i18n_default.t("correct_blanks")}: `
|
|
1217
|
+
});
|
|
1218
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1219
|
+
materialMap[key].forEach((item) => {
|
|
1220
|
+
itemList.push({
|
|
1221
|
+
type: "text",
|
|
1222
|
+
text: `${i18n_default.t("blank")} ${index + 1}: ${item}`
|
|
1223
|
+
});
|
|
1224
|
+
});
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
} else if (type === "OPEN_ENDED") {
|
|
1228
|
+
} else if (type === "TRUE_FALSE") {
|
|
1229
|
+
if (materialMap.trueList && Object.keys(materialMap.trueList).length > 0) {
|
|
1230
|
+
materialMap.trueList.forEach((item) => {
|
|
1231
|
+
itemList.push({
|
|
1232
|
+
type: "text",
|
|
1233
|
+
text: `[${i18n_default.t("correct").toUpperCase()}]${item}`
|
|
1234
|
+
});
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
if (materialMap.falseList && Object.keys(materialMap.falseList).length > 0) {
|
|
1238
|
+
materialMap.falseList.forEach((item) => {
|
|
1239
|
+
itemList.push({
|
|
1240
|
+
type: "text",
|
|
1241
|
+
text: `[${i18n_default.t("incorrect").toUpperCase()}]${item}`
|
|
1242
|
+
});
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return itemList;
|
|
1247
|
+
};
|
|
1248
|
+
var constructActivityItemListWithAnswersForAI = (bodyMap, materialMap, type) => {
|
|
1249
|
+
const itemList = [];
|
|
1250
|
+
if (type === "ORDERING") {
|
|
1251
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1252
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1253
|
+
if (bodyItem.type === "IMAGE") {
|
|
1254
|
+
itemList.push({
|
|
1255
|
+
type: "image_url",
|
|
1256
|
+
imageUrl: bodyItem.value
|
|
1257
|
+
});
|
|
1258
|
+
} else {
|
|
1259
|
+
itemList.push({
|
|
1260
|
+
type: "text",
|
|
1261
|
+
text: bodyItem.value
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
});
|
|
1265
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1266
|
+
itemList.push({
|
|
1267
|
+
type: "text",
|
|
1268
|
+
text: `${i18n_default.t("correct_order")}: `
|
|
1269
|
+
});
|
|
1270
|
+
Object.keys(materialMap).forEach((key) => {
|
|
1271
|
+
itemList.push({
|
|
1272
|
+
type: "text",
|
|
1273
|
+
text: materialMap[key]
|
|
1274
|
+
});
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
} else if (type === "DROPDOWN") {
|
|
1278
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1279
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1280
|
+
if (bodyItem.type === "IMAGE") {
|
|
1281
|
+
itemList.push({
|
|
1282
|
+
type: "image_url",
|
|
1283
|
+
imageUrl: bodyItem.value
|
|
1284
|
+
});
|
|
1285
|
+
} else {
|
|
1286
|
+
itemList.push({
|
|
1287
|
+
type: "text",
|
|
1288
|
+
text: bodyItem.value.replaceAll("@@", "___________")
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1293
|
+
itemList.push({
|
|
1294
|
+
type: "text",
|
|
1295
|
+
text: `${i18n_default.t("correct_blanks")}: `
|
|
1296
|
+
});
|
|
1297
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1298
|
+
itemList.push({
|
|
1299
|
+
type: "text",
|
|
1300
|
+
text: `${index + 1}. ${Object.keys(materialMap[key])[0]}`
|
|
1301
|
+
});
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
} else if (type === "MCSA") {
|
|
1305
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1306
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1307
|
+
if (bodyItem.type === "IMAGE") {
|
|
1308
|
+
itemList.push({
|
|
1309
|
+
type: "image_url",
|
|
1310
|
+
imageUrl: bodyItem.value
|
|
1311
|
+
});
|
|
1312
|
+
} else {
|
|
1313
|
+
itemList.push({
|
|
1314
|
+
type: "text",
|
|
1315
|
+
text: bodyItem.value
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1320
|
+
itemList.push({
|
|
1321
|
+
type: "text",
|
|
1322
|
+
text: `${i18n_default.t("correct_answer")}: `
|
|
1323
|
+
});
|
|
1324
|
+
Object.keys(materialMap).forEach((key) => {
|
|
1325
|
+
itemList.push({
|
|
1326
|
+
type: "text",
|
|
1327
|
+
text: key
|
|
1328
|
+
});
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
} else if (type === "MCMA") {
|
|
1332
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1333
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1334
|
+
if (bodyItem.type === "IMAGE") {
|
|
1335
|
+
itemList.push({
|
|
1336
|
+
type: "image_url",
|
|
1337
|
+
imageUrl: bodyItem.value
|
|
1338
|
+
});
|
|
1339
|
+
} else {
|
|
1340
|
+
itemList.push({
|
|
1341
|
+
type: "text",
|
|
1342
|
+
text: bodyItem.value
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1347
|
+
itemList.push({
|
|
1348
|
+
type: "text",
|
|
1349
|
+
text: `${i18n_default.t("correct_answers")}: `
|
|
1350
|
+
});
|
|
1351
|
+
const splittedTextList = Object.keys(materialMap)[0].split("\xA7");
|
|
1352
|
+
splittedTextList.forEach((item) => {
|
|
1353
|
+
const parsedItemList = JSON.parse(item);
|
|
1354
|
+
for (const parsedItem of parsedItemList) {
|
|
1355
|
+
itemList.push({
|
|
1356
|
+
type: "text",
|
|
1357
|
+
text: parsedItem
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
} else if (type === "MATCHING") {
|
|
1363
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1364
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1365
|
+
if (bodyItem.type === "IMAGE") {
|
|
1366
|
+
itemList.push({
|
|
1367
|
+
type: "image_url",
|
|
1368
|
+
imageUrl: bodyItem.value
|
|
1369
|
+
});
|
|
1370
|
+
} else {
|
|
1371
|
+
itemList.push({
|
|
1372
|
+
type: "text",
|
|
1373
|
+
text: bodyItem.value
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1378
|
+
itemList.push({
|
|
1379
|
+
type: "text",
|
|
1380
|
+
text: `${i18n_default.t("correct_answers")}: `
|
|
1381
|
+
});
|
|
1382
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1383
|
+
itemList.push({
|
|
1384
|
+
type: "text",
|
|
1385
|
+
text: `${i18n_default.t("match")} ${index + 1}:`
|
|
1386
|
+
});
|
|
1387
|
+
itemList.push({
|
|
1388
|
+
type: "text",
|
|
1389
|
+
text: `${key}: ${materialMap[key]}`
|
|
1390
|
+
});
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
} else if (type === "GROUPING") {
|
|
1394
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1395
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1396
|
+
if (bodyItem.type === "IMAGE") {
|
|
1397
|
+
itemList.push({
|
|
1398
|
+
type: "image_url",
|
|
1399
|
+
imageUrl: bodyItem.value
|
|
1400
|
+
});
|
|
1401
|
+
} else {
|
|
1402
|
+
itemList.push({
|
|
1403
|
+
type: "text",
|
|
1404
|
+
text: bodyItem.value
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1409
|
+
itemList.push({
|
|
1410
|
+
type: "text",
|
|
1411
|
+
text: `${i18n_default.t("correct_answers")}: `
|
|
1412
|
+
});
|
|
1413
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1414
|
+
let text = `${i18n_default.t("group")} ${index + 1}: `;
|
|
1415
|
+
itemList.push({
|
|
1416
|
+
type: "text",
|
|
1417
|
+
text
|
|
1418
|
+
});
|
|
1419
|
+
const groupName = key;
|
|
1420
|
+
let currentText = "";
|
|
1421
|
+
materialMap[groupName].forEach((item) => {
|
|
1422
|
+
currentText += `${item}, `;
|
|
1423
|
+
});
|
|
1424
|
+
currentText = currentText.substring(0, currentText.length - 2);
|
|
1425
|
+
itemList.push({
|
|
1426
|
+
type: "text",
|
|
1427
|
+
text: `${groupName}: [${currentText}]`
|
|
1428
|
+
});
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
1432
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1433
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1434
|
+
if (bodyItem.type === "IMAGE") {
|
|
1435
|
+
itemList.push({
|
|
1436
|
+
type: "image_url",
|
|
1437
|
+
imageUrl: bodyItem.value
|
|
1438
|
+
});
|
|
1439
|
+
} else {
|
|
1440
|
+
itemList.push({
|
|
1441
|
+
type: "text",
|
|
1442
|
+
text: bodyItem.value.replaceAll("@@", "___________")
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1446
|
+
if (Object.keys(materialMap).length > 0) {
|
|
1447
|
+
itemList.push({
|
|
1448
|
+
type: "text",
|
|
1449
|
+
text: `${i18n_default.t("correct_blanks")}: `
|
|
1450
|
+
});
|
|
1451
|
+
Object.keys(materialMap).forEach((key, index) => {
|
|
1452
|
+
JSON.parse(materialMap[key]).forEach((item) => {
|
|
1453
|
+
itemList.push({
|
|
1454
|
+
type: "text",
|
|
1455
|
+
text: `${index + 1}. ${item}`
|
|
1456
|
+
});
|
|
1457
|
+
});
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
} else if (type === "OPEN_ENDED") {
|
|
1461
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1462
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1463
|
+
if (bodyItem.type === "IMAGE") {
|
|
1464
|
+
itemList.push({
|
|
1465
|
+
type: "image_url",
|
|
1466
|
+
imageUrl: bodyItem.value
|
|
1467
|
+
});
|
|
1468
|
+
} else {
|
|
1469
|
+
itemList.push({
|
|
1470
|
+
type: "text",
|
|
1471
|
+
text: bodyItem.value
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
} else if (type === "TRUE_FALSE") {
|
|
1476
|
+
Object.keys(bodyMap).forEach((key) => {
|
|
1477
|
+
const bodyItem = JSON.parse(bodyMap[key]);
|
|
1478
|
+
if (bodyItem.type === "IMAGE") {
|
|
1479
|
+
itemList.push({
|
|
1480
|
+
type: "image_url",
|
|
1481
|
+
imageUrl: bodyItem.value
|
|
1482
|
+
});
|
|
1483
|
+
} else {
|
|
1484
|
+
itemList.push({
|
|
1485
|
+
type: "text",
|
|
1486
|
+
text: bodyItem.value
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
if (materialMap.trueList && Object.keys(materialMap.trueList).length > 0) {
|
|
1491
|
+
itemList.push({
|
|
1492
|
+
type: "text",
|
|
1493
|
+
text: `${i18n_default.t("correct_answers")}: `
|
|
1494
|
+
});
|
|
1495
|
+
materialMap.trueList.forEach((item) => {
|
|
1496
|
+
itemList.push({
|
|
1497
|
+
type: "text",
|
|
1498
|
+
text: item
|
|
1499
|
+
});
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
if (materialMap.falseList && Object.keys(materialMap.falseList).length > 0) {
|
|
1503
|
+
itemList.push({
|
|
1504
|
+
type: "text",
|
|
1505
|
+
text: `${i18n_default.t("incorrect_answers")}: `
|
|
1506
|
+
});
|
|
1507
|
+
materialMap.falseList.forEach((item) => {
|
|
1508
|
+
itemList.push({
|
|
1509
|
+
type: "text",
|
|
1510
|
+
text: item
|
|
1511
|
+
});
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
return itemList;
|
|
1516
|
+
};
|
|
1517
|
+
var retrieveActivityTemplateDTOOptionList = (activityTemplateSet) => {
|
|
1518
|
+
return activityTemplateSet.map((activityTemplateDTO) => ({
|
|
1519
|
+
id: activityTemplateDTO.id,
|
|
1520
|
+
value: activityTemplateDTO.id,
|
|
1521
|
+
text: i18n_default.t(activityTemplateDTO.type)
|
|
1522
|
+
}));
|
|
1523
|
+
};
|
|
1524
|
+
var retrieveDefaultOrderingDataMap = (orderingMaterialMap) => {
|
|
1525
|
+
const dataMap = {};
|
|
1526
|
+
Object.keys(orderingMaterialMap).sort(() => 0.5 - Math.random()).forEach((key, index) => {
|
|
1527
|
+
dataMap[index] = key;
|
|
1528
|
+
});
|
|
1529
|
+
return dataMap;
|
|
1530
|
+
};
|
|
1531
|
+
var retrieveDefaultDropdownMap = (dropdownMaterialMap) => {
|
|
1532
|
+
const dataMap = {};
|
|
1533
|
+
Object.keys(dropdownMaterialMap).forEach((key) => {
|
|
1534
|
+
dataMap[key] = "DEFAULT_OPTION";
|
|
1535
|
+
});
|
|
1536
|
+
return dataMap;
|
|
1537
|
+
};
|
|
1538
|
+
var retrieveDefaultMCSAMap = (MCSAMaterialMap) => {
|
|
1539
|
+
const dataMap = {};
|
|
1540
|
+
Object.keys(MCSAMaterialMap).forEach((key, index) => {
|
|
1541
|
+
dataMap[key] = "ANSWER_KEY";
|
|
1542
|
+
});
|
|
1543
|
+
return dataMap;
|
|
1544
|
+
};
|
|
1545
|
+
var retrieveDefaultMCMAMap = (MCMAMaterialMap) => {
|
|
1546
|
+
const dataMap = {};
|
|
1547
|
+
Object.keys(MCMAMaterialMap).forEach((key, index) => {
|
|
1548
|
+
dataMap[key] = [];
|
|
1549
|
+
});
|
|
1550
|
+
return dataMap;
|
|
1551
|
+
};
|
|
1552
|
+
var retrieveDefaultMatchingMap = (matchingMaterialMap) => {
|
|
1553
|
+
const dataMap = {};
|
|
1554
|
+
Object.keys(matchingMaterialMap).forEach((key, index) => {
|
|
1555
|
+
dataMap[key] = "";
|
|
1556
|
+
});
|
|
1557
|
+
return dataMap;
|
|
1558
|
+
};
|
|
1559
|
+
var retrieveDefaultGroupingMap = (groupingMaterialMap) => {
|
|
1560
|
+
const dataMap = {};
|
|
1561
|
+
Object.keys(groupingMaterialMap).forEach((key, index) => {
|
|
1562
|
+
dataMap[key] = [];
|
|
1563
|
+
});
|
|
1564
|
+
return dataMap;
|
|
1565
|
+
};
|
|
1566
|
+
var retrieveDefaultFillInTheBlanksMap = (fillInTheBlanksMaterialMap) => {
|
|
1567
|
+
const dataMap = {};
|
|
1568
|
+
Object.keys(fillInTheBlanksMaterialMap).forEach((key) => {
|
|
1569
|
+
dataMap[key] = "";
|
|
1570
|
+
});
|
|
1571
|
+
return dataMap;
|
|
1572
|
+
};
|
|
1573
|
+
var retrieveDefaultOpenEndedMap = () => {
|
|
1574
|
+
return { ANSWER: "" };
|
|
1575
|
+
};
|
|
1576
|
+
var retrieveDefaultTrueFalseMap = () => {
|
|
1577
|
+
return { trueList: [], falseList: [] };
|
|
1578
|
+
};
|
|
1579
|
+
var retrieveCurrentDefaultDataMap = (activityTemplate, activityData) => {
|
|
1580
|
+
const defaultDataMap = {
|
|
1581
|
+
activityTemplateId: activityTemplate.id,
|
|
1582
|
+
type: activityTemplate.type
|
|
1583
|
+
};
|
|
1584
|
+
if (activityTemplate.type === "ORDERING") {
|
|
1585
|
+
defaultDataMap.answerMap = retrieveDefaultOrderingDataMap(
|
|
1586
|
+
activityData.orderingMaterialMap
|
|
1587
|
+
);
|
|
1588
|
+
} else if (activityTemplate.type === "DROPDOWN") {
|
|
1589
|
+
defaultDataMap.answerMap = retrieveDefaultDropdownMap(
|
|
1590
|
+
activityData.dropdownMaterialMap
|
|
1591
|
+
);
|
|
1592
|
+
} else if (activityTemplate.type === "MCSA") {
|
|
1593
|
+
defaultDataMap.answerMap = retrieveDefaultMCSAMap(
|
|
1594
|
+
activityData.MCSAMaterialMap
|
|
1595
|
+
);
|
|
1596
|
+
} else if (activityTemplate.type === "MCMA") {
|
|
1597
|
+
defaultDataMap.answerMap = retrieveDefaultMCMAMap(
|
|
1598
|
+
activityData.MCMAMaterialMap
|
|
1599
|
+
);
|
|
1600
|
+
} else if (activityTemplate.type === "MATCHING") {
|
|
1601
|
+
defaultDataMap.answerMap = retrieveDefaultMatchingMap(
|
|
1602
|
+
activityData.matchingMaterialMap
|
|
1603
|
+
);
|
|
1604
|
+
} else if (activityTemplate.type === "GROUPING") {
|
|
1605
|
+
defaultDataMap.answerMap = retrieveDefaultGroupingMap(
|
|
1606
|
+
activityData.groupingMaterialMap
|
|
1607
|
+
);
|
|
1608
|
+
} else if (activityTemplate.type === "FILL_IN_THE_BLANKS") {
|
|
1609
|
+
defaultDataMap.answerMap = retrieveDefaultFillInTheBlanksMap(
|
|
1610
|
+
activityData.fillInTheBlanksMaterialMap
|
|
1611
|
+
);
|
|
1612
|
+
} else if (activityTemplate.type === "OPEN_ENDED") {
|
|
1613
|
+
defaultDataMap.answerMap = retrieveDefaultOpenEndedMap();
|
|
1614
|
+
} else if (activityTemplate.type === "TRUE_FALSE") {
|
|
1615
|
+
defaultDataMap.answerMap = retrieveDefaultTrueFalseMap();
|
|
1616
|
+
}
|
|
1617
|
+
return defaultDataMap;
|
|
1618
|
+
};
|
|
1619
|
+
var constructActivityAnswerMap = (activityTemplate, activityData) => {
|
|
1620
|
+
if (activityTemplate.type === "ORDERING") {
|
|
1621
|
+
activityData.orderingMaterialMap = JSON.parse(
|
|
1622
|
+
activityData.orderingMaterialMap
|
|
1623
|
+
);
|
|
1624
|
+
} else if (activityTemplate.type === "DROPDOWN") {
|
|
1625
|
+
activityData.dropdownMaterialMap = JSON.parse(
|
|
1626
|
+
activityData.dropdownMaterialMap
|
|
1627
|
+
);
|
|
1628
|
+
} else if (activityTemplate.type === "MCSA") {
|
|
1629
|
+
activityData.MCSAMaterialMap = JSON.parse(activityData.MCSAMaterialMap);
|
|
1630
|
+
} else if (activityTemplate.type === "MCMA") {
|
|
1631
|
+
activityData.MCMAMaterialMap = JSON.parse(activityData.MCMAMaterialMap);
|
|
1632
|
+
} else if (activityTemplate.type === "MATCHING") {
|
|
1633
|
+
activityData.matchingMaterialMap = JSON.parse(
|
|
1634
|
+
activityData.matchingMaterialMap
|
|
1635
|
+
);
|
|
1636
|
+
} else if (activityTemplate.type === "GROUPING") {
|
|
1637
|
+
activityData.groupingMaterialMap = JSON.parse(
|
|
1638
|
+
activityData.groupingMaterialMap
|
|
1639
|
+
);
|
|
1640
|
+
} else if (activityTemplate.type === "FILL_IN_THE_BLANKS") {
|
|
1641
|
+
activityData.fillInTheBlanksMaterialMap = JSON.parse(
|
|
1642
|
+
activityData.fillInTheBlanksMaterialMap
|
|
1643
|
+
);
|
|
1644
|
+
} else if (activityTemplate.type === "OPEN_ENDED") {
|
|
1645
|
+
activityData.openEndedMaterialMap = {};
|
|
1646
|
+
} else if (activityTemplate.type === "TRUE_FALSE") {
|
|
1647
|
+
activityData.trueFalseMaterialMap = { trueList: [], falseList: [] };
|
|
1648
|
+
}
|
|
1649
|
+
return retrieveCurrentDefaultDataMap(activityTemplate, activityData);
|
|
1650
|
+
};
|
|
1651
|
+
var ignoreMathematicalExpression = (inputText) => {
|
|
1652
|
+
return inputText.replaceAll("{", "").replaceAll("}", "").replaceAll("_", "").replaceAll("^", "").replaceAll("\\frac", "").replaceAll("\\text", "").replaceAll("\\sqrt", "");
|
|
1653
|
+
};
|
|
1654
|
+
var checkIfAnswerIsEmpty = (answer) => {
|
|
1655
|
+
const { data } = answer;
|
|
1656
|
+
if (data && data.length > 0) {
|
|
1657
|
+
const foundAnswer = data[0];
|
|
1658
|
+
const { type, answerMap } = foundAnswer;
|
|
1659
|
+
if (type === "ORDERING") {
|
|
1660
|
+
return false;
|
|
1661
|
+
} else if (type === "DROPDOWN") {
|
|
1662
|
+
for (const key of Object.keys(answerMap)) {
|
|
1663
|
+
if (answerMap[key] !== "DEFAULT_OPTION") {
|
|
1664
|
+
return false;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
} else if (type === "MCSA") {
|
|
1668
|
+
const key = Object.keys(answerMap)[0];
|
|
1669
|
+
if (answerMap[key] !== "ANSWER_KEY") {
|
|
1670
|
+
return false;
|
|
1671
|
+
}
|
|
1672
|
+
} else if (type === "MCMA") {
|
|
1673
|
+
const key = Object.keys(answerMap)[0];
|
|
1674
|
+
if (answerMap[key].length !== 0) {
|
|
1675
|
+
return false;
|
|
1676
|
+
}
|
|
1677
|
+
} else if (type === "MATCHING") {
|
|
1678
|
+
for (const key of Object.keys(answerMap)) {
|
|
1679
|
+
if (answerMap[key]) {
|
|
1680
|
+
return false;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
} else if (type === "GROUPING") {
|
|
1684
|
+
for (const key of Object.keys(answerMap)) {
|
|
1685
|
+
if (answerMap[key].length !== 0) {
|
|
1686
|
+
return false;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
1690
|
+
for (const key of Object.keys(answerMap)) {
|
|
1691
|
+
if (answerMap[key]) {
|
|
1692
|
+
return false;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
} else if (type === "OPEN_ENDED") {
|
|
1696
|
+
const key = Object.keys(answerMap)[0];
|
|
1697
|
+
if (answerMap[key]) {
|
|
1698
|
+
return false;
|
|
1699
|
+
}
|
|
1700
|
+
} else if (type === "TRUE_FALSE") {
|
|
1701
|
+
return answerMap.trueList.length === 0 && answerMap.falseList.length === 0;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
return true;
|
|
1705
|
+
};
|
|
1706
|
+
var constructActivityAnswerStateList = (answerList, activityList) => {
|
|
1707
|
+
const stateList = [];
|
|
1708
|
+
activityList.forEach((activity, index) => {
|
|
1709
|
+
stateList.push({
|
|
1710
|
+
index,
|
|
1711
|
+
id: activity.id,
|
|
1712
|
+
state: checkActivityAnswerState(answerList, activity)
|
|
1713
|
+
});
|
|
1714
|
+
});
|
|
1715
|
+
return stateList;
|
|
1716
|
+
};
|
|
1717
|
+
var retrieveActivityAnswerFromAnswerList = (answerList, activity) => {
|
|
1718
|
+
return answerList.find(
|
|
1719
|
+
(answer) => parseFloat(answer.activityDTO.id) === parseFloat(activity.id)
|
|
1720
|
+
);
|
|
1721
|
+
};
|
|
1722
|
+
var checkActivityAnswerState = (answerList, activity) => {
|
|
1723
|
+
const activityAnswer = retrieveActivityAnswerFromAnswerList(
|
|
1724
|
+
answerList,
|
|
1725
|
+
activity
|
|
1726
|
+
);
|
|
1727
|
+
if (!activityAnswer) {
|
|
1728
|
+
return "NOT_EXISTS";
|
|
1729
|
+
}
|
|
1730
|
+
const { data } = activityAnswer;
|
|
1731
|
+
if (!data) return "NOT_EXISTS";
|
|
1732
|
+
const parsedData = JSON.parse(data);
|
|
1733
|
+
if (parsedData.filter((item) => !item.isEmpty).length === parsedData.length) {
|
|
1734
|
+
return "ANSWERED";
|
|
1735
|
+
} else {
|
|
1736
|
+
return "EMPTY";
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
var findBestFitActivity = (activity, individualModelList, outcomeModelList) => {
|
|
1740
|
+
const { activityTemplateDTOList, data, coterieType, categoryIdList } = activity;
|
|
1741
|
+
const parsedData = JSON.parse(data);
|
|
1742
|
+
const {
|
|
1743
|
+
orderingTaxonomyMap,
|
|
1744
|
+
dropdownTaxonomyMap,
|
|
1745
|
+
MCSATaxonomyMap,
|
|
1746
|
+
MCMATaxonomyMap,
|
|
1747
|
+
matchingTaxonomyMap,
|
|
1748
|
+
groupingTaxonomyMap,
|
|
1749
|
+
fillInTheBlanksTaxonomyMap,
|
|
1750
|
+
openEndedTaxonomyMap,
|
|
1751
|
+
trueFalseTaxonomyMap
|
|
1752
|
+
} = parsedData;
|
|
1753
|
+
const taxonomyMap = {};
|
|
1754
|
+
if (orderingTaxonomyMap) {
|
|
1755
|
+
taxonomyMap["orderingTaxonomyMap"] = JSON.parse(orderingTaxonomyMap);
|
|
1756
|
+
}
|
|
1757
|
+
if (dropdownTaxonomyMap) {
|
|
1758
|
+
taxonomyMap["dropdownTaxonomyMap"] = JSON.parse(dropdownTaxonomyMap);
|
|
1759
|
+
}
|
|
1760
|
+
if (MCSATaxonomyMap) {
|
|
1761
|
+
taxonomyMap["MCSATaxonomyMap"] = JSON.parse(MCSATaxonomyMap);
|
|
1762
|
+
}
|
|
1763
|
+
if (MCMATaxonomyMap) {
|
|
1764
|
+
taxonomyMap["MCMATaxonomyMap"] = JSON.parse(MCMATaxonomyMap);
|
|
1765
|
+
}
|
|
1766
|
+
if (matchingTaxonomyMap) {
|
|
1767
|
+
taxonomyMap["matchingTaxonomyMap"] = JSON.parse(matchingTaxonomyMap);
|
|
1768
|
+
}
|
|
1769
|
+
if (groupingTaxonomyMap) {
|
|
1770
|
+
taxonomyMap["groupingTaxonomyMap"] = JSON.parse(groupingTaxonomyMap);
|
|
1771
|
+
}
|
|
1772
|
+
if (fillInTheBlanksTaxonomyMap) {
|
|
1773
|
+
taxonomyMap["fillInTheBlanksTaxonomyMap"] = JSON.parse(
|
|
1774
|
+
fillInTheBlanksTaxonomyMap
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1777
|
+
if (trueFalseTaxonomyMap) {
|
|
1778
|
+
taxonomyMap["trueFalseTaxonomyMap"] = JSON.parse(trueFalseTaxonomyMap);
|
|
1779
|
+
}
|
|
1780
|
+
if (openEndedTaxonomyMap) {
|
|
1781
|
+
taxonomyMap["openEndedTaxonomyMap"] = JSON.parse(openEndedTaxonomyMap);
|
|
1782
|
+
}
|
|
1783
|
+
let coterieField = "VERBAL";
|
|
1784
|
+
if (coterieType === "MATHEMATICS" || coterieType === "BIOLOGY" || coterieType === "PHYSICS" || coterieType === "CHEMISTRY" || coterieType === "SCIENCE") {
|
|
1785
|
+
coterieField = "NUMERIC";
|
|
1786
|
+
}
|
|
1787
|
+
let foundModel;
|
|
1788
|
+
let isOutcomeFound = true;
|
|
1789
|
+
if (categoryIdList.length > 0) {
|
|
1790
|
+
const categoryId = categoryIdList[0];
|
|
1791
|
+
foundModel = outcomeModelList.find(
|
|
1792
|
+
(outcomeModel) => outcomeModel.outcomeId === categoryId
|
|
1793
|
+
);
|
|
1794
|
+
if (!foundModel) isOutcomeFound = false;
|
|
1795
|
+
} else {
|
|
1796
|
+
isOutcomeFound = false;
|
|
1797
|
+
}
|
|
1798
|
+
if (!isOutcomeFound) {
|
|
1799
|
+
foundModel = individualModelList.find(
|
|
1800
|
+
(individualModel) => individualModel.coterieField === coterieField
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
let bestScore = Number.MAX_SAFE_INTEGER;
|
|
1804
|
+
let bestActivityTemplate;
|
|
1805
|
+
let bestActivityTemplateList = [];
|
|
1806
|
+
const activityTemplateValueMap = {};
|
|
1807
|
+
for (const activityTemplateDTO of activityTemplateDTOList) {
|
|
1808
|
+
const { type } = activityTemplateDTO;
|
|
1809
|
+
let currentTaxonomyMap;
|
|
1810
|
+
if (type === "ORDERING") {
|
|
1811
|
+
currentTaxonomyMap = taxonomyMap["orderingTaxonomyMap"];
|
|
1812
|
+
} else if (type === "DROPDOWN") {
|
|
1813
|
+
currentTaxonomyMap = taxonomyMap["dropdownTaxonomyMap"];
|
|
1814
|
+
} else if (type === "MCSA") {
|
|
1815
|
+
currentTaxonomyMap = taxonomyMap["MCSATaxonomyMap"];
|
|
1816
|
+
} else if (type === "MCMA") {
|
|
1817
|
+
currentTaxonomyMap = taxonomyMap["MCMATaxonomyMap"];
|
|
1818
|
+
} else if (type === "MATCHING") {
|
|
1819
|
+
currentTaxonomyMap = taxonomyMap["matchingTaxonomyMap"];
|
|
1820
|
+
} else if (type === "GROUPING") {
|
|
1821
|
+
currentTaxonomyMap = taxonomyMap["groupingTaxonomyMap"];
|
|
1822
|
+
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
1823
|
+
currentTaxonomyMap = taxonomyMap["fillInTheBlanksTaxonomyMap"];
|
|
1824
|
+
} else if (type === "OPEN_ENDED") {
|
|
1825
|
+
currentTaxonomyMap = taxonomyMap["openEndedTaxonomyMap"];
|
|
1826
|
+
} else if (type === "TRUE_FALSE") {
|
|
1827
|
+
currentTaxonomyMap = taxonomyMap["trueFalseTaxonomyMap"];
|
|
1828
|
+
}
|
|
1829
|
+
const {
|
|
1830
|
+
type: taxonomyType,
|
|
1831
|
+
groupName: taxonomyGroupName,
|
|
1832
|
+
name: taxonomyName
|
|
1833
|
+
} = currentTaxonomyMap;
|
|
1834
|
+
const taxonomyString = taxonomyType.toLowerCase() + taxonomyGroupName.toLowerCase().charAt(0).toUpperCase() + taxonomyGroupName.toLowerCase().substring(1) + taxonomyName.toLowerCase().charAt(0).toUpperCase() + taxonomyName.toLowerCase().substring(1);
|
|
1835
|
+
const currentTaxonomyScore = foundModel[taxonomyString];
|
|
1836
|
+
const splittedTypeList = type.split("_");
|
|
1837
|
+
let activityTemplateString = "";
|
|
1838
|
+
for (let i = 0; i < splittedTypeList.length; i++) {
|
|
1839
|
+
const currentType = splittedTypeList[i].toLowerCase();
|
|
1840
|
+
if (i === 0) {
|
|
1841
|
+
activityTemplateString += currentType;
|
|
1842
|
+
} else {
|
|
1843
|
+
activityTemplateString += currentType.charAt(0).toUpperCase() + currentType.substring(1);
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
const currentActivityTemplateScore = foundModel[activityTemplateString];
|
|
1847
|
+
const currentScore = currentTaxonomyScore * currentActivityTemplateScore;
|
|
1848
|
+
activityTemplateValueMap[type] = currentScore;
|
|
1849
|
+
if (currentScore < bestScore) {
|
|
1850
|
+
bestScore = currentScore;
|
|
1851
|
+
bestActivityTemplate = type;
|
|
1852
|
+
bestActivityTemplateList = [type];
|
|
1853
|
+
} else if (currentScore === bestScore) {
|
|
1854
|
+
bestActivityTemplateList.push(type);
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
return {
|
|
1858
|
+
bestScore,
|
|
1859
|
+
bestActivityTemplate,
|
|
1860
|
+
bestActivityTemplateList,
|
|
1861
|
+
activityTemplateValueMap
|
|
1862
|
+
};
|
|
1863
|
+
};
|
|
1864
|
+
var retrieveContestTypeOptionList = () => {
|
|
1865
|
+
return [
|
|
1866
|
+
{
|
|
1867
|
+
value: "QUIZ",
|
|
1868
|
+
text: i18n_default.t("QUIZ")
|
|
1869
|
+
}
|
|
1870
|
+
];
|
|
1871
|
+
};
|
|
1872
|
+
var retrieveFrequencyTypeOptionList = () => {
|
|
1873
|
+
return [
|
|
1874
|
+
{
|
|
1875
|
+
value: "WEEKLY",
|
|
1876
|
+
text: i18n_default.t("WEEKLY")
|
|
1877
|
+
}
|
|
1878
|
+
];
|
|
1879
|
+
};
|
|
1880
|
+
var retrieveDistintCoterieTypeFromCatchtivityApplicationDTO = (catchtivityApplicationDTOList) => {
|
|
1881
|
+
const coterieTypeList = [];
|
|
1882
|
+
for (const catchtivityApplicationDTO of catchtivityApplicationDTOList) {
|
|
1883
|
+
const { catchtivityDTO } = catchtivityApplicationDTO;
|
|
1884
|
+
const { coterieType } = catchtivityDTO;
|
|
1885
|
+
if (coterieTypeList.findIndex(
|
|
1886
|
+
(foundCoterieType) => foundCoterieType === coterieType
|
|
1887
|
+
) === -1) {
|
|
1888
|
+
coterieTypeList.push(coterieType);
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
return coterieTypeList;
|
|
1892
|
+
};
|
|
1893
|
+
var retrieveClockTimeLeft = (type, value, durationType, durationInMinutes, activityProgressDTOSet, activity) => {
|
|
1894
|
+
if (type === "CATCHTIVITY" || type === "CATCHXAM" || type === "CONTEST") {
|
|
1895
|
+
if (durationType === "ALL") {
|
|
1896
|
+
return durationInMinutes ? durationInMinutes * 60 - retrieveTotalTimeSpentInSeconds(activityProgressDTOSet) : 0;
|
|
1897
|
+
} else if (durationType === "EACH") {
|
|
1898
|
+
return durationInMinutes ? durationInMinutes * 60 - retrieveEachTimeSpentInSeconds(activityProgressDTOSet, activity) : 0;
|
|
1899
|
+
} else return 0;
|
|
1900
|
+
} else if (type === "ACTIVITY") {
|
|
1901
|
+
return value - retrieveEachTimeSpentInSeconds(activityProgressDTOSet, activity);
|
|
1902
|
+
}
|
|
1903
|
+
return 0;
|
|
1904
|
+
};
|
|
1905
|
+
var retrieveEachTimeSpentInSeconds = (activityProgressList, activity) => {
|
|
1906
|
+
if (!activityProgressList || !activity) return 0;
|
|
1907
|
+
const foundActivityProgress = activityProgressList.find(
|
|
1908
|
+
(activityProgress) => parseFloat(activityProgress.activityDTO.id) === parseFloat(activity.id)
|
|
1909
|
+
);
|
|
1910
|
+
if (foundActivityProgress) {
|
|
1911
|
+
return foundActivityProgress.timeSpent / 1e3;
|
|
1912
|
+
}
|
|
1913
|
+
return 0;
|
|
1914
|
+
};
|
|
1915
|
+
var retrieveTotalTimeSpentInSeconds = (activityProgressList) => {
|
|
1916
|
+
let timeSpent = 0;
|
|
1917
|
+
if (!activityProgressList) return 0;
|
|
1918
|
+
activityProgressList.forEach((activityProgress) => {
|
|
1919
|
+
timeSpent += activityProgress.timeSpent;
|
|
1920
|
+
});
|
|
1921
|
+
return timeSpent / 1e3;
|
|
1922
|
+
};
|
|
1923
|
+
var retrieveTotalTimeSpentInMinutes = (activityProgressList) => {
|
|
1924
|
+
return retrieveTotalTimeSpentInSeconds(activityProgressList) / 60;
|
|
1925
|
+
};
|
|
1926
|
+
var parseContentMapFromData = (data) => {
|
|
1927
|
+
return JSON.parse(data.contentMap);
|
|
1928
|
+
};
|
|
1929
|
+
var parseBodyMapFromData = (data, type) => {
|
|
1930
|
+
if (type === "ORDERING") {
|
|
1931
|
+
return JSON.parse(data.orderingBodyMap);
|
|
1932
|
+
} else if (type === "DROPDOWN") {
|
|
1933
|
+
return JSON.parse(data.dropdownBodyMap);
|
|
1934
|
+
} else if (type === "MCSA") {
|
|
1935
|
+
return JSON.parse(data.MCSABodyMap);
|
|
1936
|
+
} else if (type === "MCMA") {
|
|
1937
|
+
return JSON.parse(data.MCMABodyMap);
|
|
1938
|
+
} else if (type === "MATCHING") {
|
|
1939
|
+
return JSON.parse(data.matchingBodyMap);
|
|
1940
|
+
} else if (type === "GROUPING") {
|
|
1941
|
+
return JSON.parse(data.groupingBodyMap);
|
|
1942
|
+
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
1943
|
+
return JSON.parse(data.fillInTheBlanksBodyMap);
|
|
1944
|
+
} else if (type === "OPEN_ENDED") {
|
|
1945
|
+
return JSON.parse(data.openEndedBodyMap);
|
|
1946
|
+
} else if (type === "TRUE_FALSE") {
|
|
1947
|
+
return JSON.parse(data.trueFalseBodyMap);
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
var parseMaterialMapFromData = (data, type) => {
|
|
1951
|
+
if (type === "ORDERING") {
|
|
1952
|
+
return JSON.parse(data.orderingMaterialMap);
|
|
1953
|
+
} else if (type === "DROPDOWN") {
|
|
1954
|
+
const dropdownMaterialMap = JSON.parse(data.dropdownMaterialMap);
|
|
1955
|
+
Object.keys(dropdownMaterialMap).forEach((materialKey) => {
|
|
1956
|
+
dropdownMaterialMap[materialKey] = JSON.parse(
|
|
1957
|
+
dropdownMaterialMap[materialKey]
|
|
1958
|
+
);
|
|
1959
|
+
const answerKey = Object.keys(dropdownMaterialMap[materialKey])[0];
|
|
1960
|
+
dropdownMaterialMap[materialKey][answerKey] = JSON.parse(
|
|
1961
|
+
dropdownMaterialMap[materialKey][answerKey]
|
|
1962
|
+
);
|
|
1963
|
+
});
|
|
1964
|
+
return dropdownMaterialMap;
|
|
1965
|
+
} else if (type === "MCSA") {
|
|
1966
|
+
const MCSAMaterialMap = JSON.parse(data.MCSAMaterialMap);
|
|
1967
|
+
Object.keys(MCSAMaterialMap).forEach((key) => {
|
|
1968
|
+
MCSAMaterialMap[key] = JSON.parse(MCSAMaterialMap[key]);
|
|
1969
|
+
});
|
|
1970
|
+
return MCSAMaterialMap;
|
|
1971
|
+
} else if (type === "MCMA") {
|
|
1972
|
+
const MCMAMaterialMap = JSON.parse(data.MCMAMaterialMap);
|
|
1973
|
+
Object.keys(MCMAMaterialMap).forEach((key) => {
|
|
1974
|
+
MCMAMaterialMap[key] = JSON.parse(MCMAMaterialMap[key]);
|
|
1975
|
+
});
|
|
1976
|
+
return MCMAMaterialMap;
|
|
1977
|
+
} else if (type === "MATCHING") {
|
|
1978
|
+
return JSON.parse(data.matchingMaterialMap);
|
|
1979
|
+
} else if (type === "GROUPING") {
|
|
1980
|
+
const groupingMaterialMap = JSON.parse(data.groupingMaterialMap);
|
|
1981
|
+
Object.keys(groupingMaterialMap).forEach((key) => {
|
|
1982
|
+
groupingMaterialMap[key] = JSON.parse(groupingMaterialMap[key]);
|
|
1983
|
+
});
|
|
1984
|
+
return groupingMaterialMap;
|
|
1985
|
+
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
1986
|
+
return JSON.parse(data.fillInTheBlanksMaterialMap);
|
|
1987
|
+
} else if (type === "OPEN_ENDED") {
|
|
1988
|
+
return {};
|
|
1989
|
+
} else if (type === "TRUE_FALSE") {
|
|
1990
|
+
const trueFalseMaterialMap = JSON.parse(data.trueFalseMaterialMap);
|
|
1991
|
+
Object.keys(trueFalseMaterialMap).forEach((key) => {
|
|
1992
|
+
trueFalseMaterialMap[key] = JSON.parse(trueFalseMaterialMap[key]);
|
|
1993
|
+
});
|
|
1994
|
+
return trueFalseMaterialMap;
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
|
|
1998
|
+
// src/components/dividers/DividerLine.tsx
|
|
1999
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2000
|
+
var DividerLine = () => {
|
|
2001
|
+
return /* @__PURE__ */ jsx9("div", { className: "bg-catchup-gray-50 h-[1px] w-full my-3" });
|
|
2002
|
+
};
|
|
2003
|
+
var DividerLine_default = DividerLine;
|
|
2004
|
+
|
|
2005
|
+
// src/components/dividers/VerticalDividerLine.tsx
|
|
2006
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2007
|
+
var VerticalDividerLine = () => {
|
|
2008
|
+
return /* @__PURE__ */ jsx10("div", { className: "bg-catchup-gray-50 h-full w-[1px] mx-3" });
|
|
2009
|
+
};
|
|
2010
|
+
var VerticalDividerLine_default = VerticalDividerLine;
|
|
2011
|
+
|
|
2012
|
+
// src/components/activities/body-content/ShowBodyMediaByContentType.tsx
|
|
2013
|
+
import { useState as useState8 } from "react";
|
|
2014
|
+
import Modal from "react-modal";
|
|
2015
|
+
import { InlineMath } from "react-katex";
|
|
2016
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2017
|
+
var ShowBodyMediaByContentType = ({
|
|
2018
|
+
index,
|
|
2019
|
+
type,
|
|
2020
|
+
value,
|
|
2021
|
+
size
|
|
2022
|
+
}) => {
|
|
2023
|
+
const [showFullScreen, setShowFullScreen] = useState8(false);
|
|
2024
|
+
const [selectedFullScreenItem, setSelectedFullScreenItem] = useState8("");
|
|
2025
|
+
const convertToPercentage = (size2) => {
|
|
2026
|
+
if (size2 === "1/3") {
|
|
2027
|
+
return "w-small-media";
|
|
2028
|
+
} else if (size2 === "1/2") {
|
|
2029
|
+
return "w-medium-media";
|
|
2030
|
+
} else if (size2 === "1") {
|
|
2031
|
+
return "w-large-media";
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2034
|
+
const retrieveValueParts = (value2) => {
|
|
2035
|
+
let currentIndex = 0;
|
|
2036
|
+
const valuePartList = [];
|
|
2037
|
+
let copyValue = JSON.parse(JSON.stringify(value2));
|
|
2038
|
+
currentIndex = 0;
|
|
2039
|
+
let checkText = "--TEXT--";
|
|
2040
|
+
while (copyValue.includes(checkText)) {
|
|
2041
|
+
const firstIndex = copyValue.indexOf(checkText);
|
|
2042
|
+
let textValue = copyValue.substring(0, firstIndex);
|
|
2043
|
+
let addition = 0;
|
|
2044
|
+
if (textValue.trim() !== "") {
|
|
2045
|
+
if ((textValue.split("__").length - 1) % 2 === 1) {
|
|
2046
|
+
textValue = textValue + "__";
|
|
2047
|
+
addition += 2;
|
|
2048
|
+
}
|
|
2049
|
+
if ((textValue.split("**").length - 1) % 2 === 1) {
|
|
2050
|
+
textValue = textValue + "**";
|
|
2051
|
+
addition += 2;
|
|
2052
|
+
}
|
|
2053
|
+
if ((textValue.split("`").length - 1) % 2 === 1) {
|
|
2054
|
+
textValue = textValue + "`";
|
|
2055
|
+
addition += 1;
|
|
2056
|
+
}
|
|
2057
|
+
valuePartList.push(
|
|
2058
|
+
/* @__PURE__ */ jsx11(
|
|
2059
|
+
"span",
|
|
2060
|
+
{
|
|
2061
|
+
className: "text-xl whitespace-pre-wrap",
|
|
2062
|
+
children: constructInputWithSpecialExpressionList(textValue).map(
|
|
2063
|
+
(inputPart, index2) => /* @__PURE__ */ jsx11(
|
|
2064
|
+
"span",
|
|
2065
|
+
{
|
|
2066
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
2067
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx11("span", { className: "text-2xl", children: /* @__PURE__ */ jsx11(InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
2068
|
+
},
|
|
2069
|
+
index2
|
|
2070
|
+
)
|
|
2071
|
+
)
|
|
2072
|
+
},
|
|
2073
|
+
`${index}-${currentIndex}`
|
|
2074
|
+
)
|
|
2075
|
+
);
|
|
2076
|
+
}
|
|
2077
|
+
const subValue = copyValue.substring(firstIndex + checkText.length);
|
|
2078
|
+
const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length - addition;
|
|
2079
|
+
currentIndex++;
|
|
2080
|
+
valuePartList.push(
|
|
2081
|
+
/* @__PURE__ */ jsx11(
|
|
2082
|
+
"span",
|
|
2083
|
+
{
|
|
2084
|
+
className: `text-xl font-bold whitespace-pre-wrap`,
|
|
2085
|
+
children: constructInputWithSpecialExpressionList(
|
|
2086
|
+
copyValue.substring(firstIndex + checkText.length, secondIndex)
|
|
2087
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx11(
|
|
2088
|
+
"span",
|
|
2089
|
+
{
|
|
2090
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
2091
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx11("span", { className: "text-2xl", children: /* @__PURE__ */ jsx11(InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
2092
|
+
},
|
|
2093
|
+
index2
|
|
2094
|
+
))
|
|
2095
|
+
},
|
|
2096
|
+
`${index}-${currentIndex}`
|
|
2097
|
+
)
|
|
2098
|
+
);
|
|
2099
|
+
copyValue = copyValue.substring(secondIndex + checkText.length);
|
|
2100
|
+
if ((copyValue.split("`").length - 1) % 2 === 1) {
|
|
2101
|
+
copyValue = "`" + copyValue;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
checkText = "--IMAGE--";
|
|
2105
|
+
while (copyValue.includes(checkText)) {
|
|
2106
|
+
const firstIndex = copyValue.indexOf(checkText);
|
|
2107
|
+
const textValue = copyValue.substring(0, firstIndex);
|
|
2108
|
+
if (textValue.trim() !== "") {
|
|
2109
|
+
currentIndex++;
|
|
2110
|
+
valuePartList.push(
|
|
2111
|
+
/* @__PURE__ */ jsx11("p", { className: "text-xl", children: textValue }, `${index}_${currentIndex}`)
|
|
2112
|
+
);
|
|
2113
|
+
}
|
|
2114
|
+
const subValue = copyValue.substring(firstIndex + checkText.length);
|
|
2115
|
+
const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length;
|
|
2116
|
+
const imageSource = copyValue.substring(
|
|
2117
|
+
firstIndex + checkText.length,
|
|
2118
|
+
secondIndex
|
|
2119
|
+
);
|
|
2120
|
+
currentIndex++;
|
|
2121
|
+
valuePartList.push(
|
|
2122
|
+
/* @__PURE__ */ jsxs7("div", { className: "relative w-[200px]", children: [
|
|
2123
|
+
/* @__PURE__ */ jsx11(
|
|
2124
|
+
BaseImage_default,
|
|
2125
|
+
{
|
|
2126
|
+
src: imageSource,
|
|
2127
|
+
alt: "media",
|
|
2128
|
+
size: "custom",
|
|
2129
|
+
className: "rounded-catchup-xlarge"
|
|
2130
|
+
}
|
|
2131
|
+
),
|
|
2132
|
+
/* @__PURE__ */ jsx11(
|
|
2133
|
+
"div",
|
|
2134
|
+
{
|
|
2135
|
+
className: "absolute flex items-center justify-center top-2 right-2 h-6 w-6 cursor-pointer border rounded-catchup-xlarge border-catchup-blue p-1",
|
|
2136
|
+
onClick: (event) => {
|
|
2137
|
+
setShowFullScreen(true);
|
|
2138
|
+
setSelectedFullScreenItem(imageSource);
|
|
2139
|
+
},
|
|
2140
|
+
children: /* @__PURE__ */ jsx11(
|
|
2141
|
+
BaseImage_default,
|
|
2142
|
+
{
|
|
2143
|
+
src: "/icons/arrow-up.png",
|
|
2144
|
+
alt: "arrow-up",
|
|
2145
|
+
size: "custom",
|
|
2146
|
+
className: "w-full"
|
|
2147
|
+
}
|
|
2148
|
+
)
|
|
2149
|
+
}
|
|
2150
|
+
)
|
|
2151
|
+
] }, `${index}-${currentIndex}`)
|
|
2152
|
+
);
|
|
2153
|
+
copyValue = copyValue.substring(secondIndex + checkText.length);
|
|
2154
|
+
}
|
|
2155
|
+
checkText = "--VIDEO--";
|
|
2156
|
+
while (copyValue.includes(checkText)) {
|
|
2157
|
+
const firstIndex = copyValue.indexOf(checkText);
|
|
2158
|
+
const textValue = copyValue.substring(0, firstIndex);
|
|
2159
|
+
if (textValue.trim() !== "") {
|
|
2160
|
+
currentIndex++;
|
|
2161
|
+
valuePartList.push(
|
|
2162
|
+
/* @__PURE__ */ jsx11("p", { className: "text-xl", children: textValue }, `${index}-${currentIndex}`)
|
|
2163
|
+
);
|
|
2164
|
+
}
|
|
2165
|
+
const subValue = copyValue.substring(firstIndex + checkText.length);
|
|
2166
|
+
const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length;
|
|
2167
|
+
const videoSource = copyValue.substring(
|
|
2168
|
+
firstIndex + checkText.length,
|
|
2169
|
+
secondIndex
|
|
2170
|
+
);
|
|
2171
|
+
currentIndex++;
|
|
2172
|
+
valuePartList.push(
|
|
2173
|
+
/* @__PURE__ */ jsx11(
|
|
2174
|
+
"video",
|
|
2175
|
+
{
|
|
2176
|
+
src: videoSource,
|
|
2177
|
+
className: `w-[200px] rounded-catchup-xlarge`
|
|
2178
|
+
},
|
|
2179
|
+
`${index}-${currentIndex}`
|
|
2180
|
+
)
|
|
2181
|
+
);
|
|
2182
|
+
copyValue = copyValue.substring(secondIndex + checkText.length);
|
|
2183
|
+
}
|
|
2184
|
+
checkText = "--AUDIO--";
|
|
2185
|
+
while (copyValue.includes(checkText)) {
|
|
2186
|
+
const firstIndex = copyValue.indexOf(checkText);
|
|
2187
|
+
const textValue = copyValue.substring(0, firstIndex);
|
|
2188
|
+
if (textValue.trim() !== "") {
|
|
2189
|
+
currentIndex++;
|
|
2190
|
+
valuePartList.push(
|
|
2191
|
+
/* @__PURE__ */ jsx11("p", { className: "text-xl", children: textValue }, `${index}-${currentIndex}`)
|
|
2192
|
+
);
|
|
2193
|
+
}
|
|
2194
|
+
const subValue = copyValue.substring(firstIndex + checkText.length);
|
|
2195
|
+
const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length;
|
|
2196
|
+
const audioSource = copyValue.substring(
|
|
2197
|
+
firstIndex + checkText.length,
|
|
2198
|
+
secondIndex
|
|
2199
|
+
);
|
|
2200
|
+
currentIndex++;
|
|
2201
|
+
valuePartList.push(
|
|
2202
|
+
/* @__PURE__ */ jsx11(
|
|
2203
|
+
"audio",
|
|
2204
|
+
{
|
|
2205
|
+
src: audioSource,
|
|
2206
|
+
className: `w-[200px] rounded-catchup-xlarge`
|
|
2207
|
+
},
|
|
2208
|
+
`${index}-${currentIndex}`
|
|
2209
|
+
)
|
|
2210
|
+
);
|
|
2211
|
+
copyValue = copyValue.substring(secondIndex + checkText.length);
|
|
2212
|
+
}
|
|
2213
|
+
if (copyValue.trim() !== "") {
|
|
2214
|
+
currentIndex++;
|
|
2215
|
+
if ((copyValue.split("__").length - 1) % 2 === 1) {
|
|
2216
|
+
copyValue = "__" + copyValue;
|
|
2217
|
+
}
|
|
2218
|
+
if ((copyValue.split("**").length - 1) % 2 === 1) {
|
|
2219
|
+
copyValue = "**" + copyValue;
|
|
2220
|
+
}
|
|
2221
|
+
if ((copyValue.split("`").length - 1) % 2 === 1) {
|
|
2222
|
+
copyValue = "`" + copyValue;
|
|
2223
|
+
}
|
|
2224
|
+
const regexMatchImageText = copyValue.match(/<image>([\s\S]*?)<\/image>/);
|
|
2225
|
+
if (regexMatchImageText) {
|
|
2226
|
+
const imageText = regexMatchImageText[1];
|
|
2227
|
+
valuePartList.push(
|
|
2228
|
+
/* @__PURE__ */ jsxs7("div", { className: "bg-catchup-gray-50 relative px-4 py-4 rounded-catchup-small mt-2", children: [
|
|
2229
|
+
/* @__PURE__ */ jsx11("div", { className: "absolute -top-3 bg-catchup-white border rounded-catchup-small px-2 left-2", children: /* @__PURE__ */ jsx11("p", { className: "font-bold", children: i18n_default.t("image_description") }) }),
|
|
2230
|
+
/* @__PURE__ */ jsx11(
|
|
2231
|
+
"span",
|
|
2232
|
+
{
|
|
2233
|
+
className: "text-xl whitespace-pre-wrap ",
|
|
2234
|
+
children: imageText
|
|
2235
|
+
},
|
|
2236
|
+
`${index}-${currentIndex}`
|
|
2237
|
+
)
|
|
2238
|
+
] })
|
|
2239
|
+
);
|
|
2240
|
+
} else {
|
|
2241
|
+
valuePartList.push(
|
|
2242
|
+
/* @__PURE__ */ jsx11(
|
|
2243
|
+
"span",
|
|
2244
|
+
{
|
|
2245
|
+
className: "text-xl whitespace-pre-wrap",
|
|
2246
|
+
children: constructInputWithSpecialExpressionList(copyValue).map(
|
|
2247
|
+
(inputPart, index2) => /* @__PURE__ */ jsx11(
|
|
2248
|
+
"span",
|
|
2249
|
+
{
|
|
2250
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
2251
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx11("span", { className: "text-2xl", children: /* @__PURE__ */ jsx11(InlineMath, { math: inputPart.value }) }) : inputPart.value
|
|
2252
|
+
},
|
|
2253
|
+
index2
|
|
2254
|
+
)
|
|
2255
|
+
)
|
|
2256
|
+
},
|
|
2257
|
+
`${index}-${currentIndex}`
|
|
2258
|
+
)
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
return valuePartList;
|
|
2263
|
+
};
|
|
2264
|
+
const RenderShowFullScreenItem = () => {
|
|
2265
|
+
return /* @__PURE__ */ jsx11(
|
|
2266
|
+
Modal,
|
|
2267
|
+
{
|
|
2268
|
+
isOpen: showFullScreen,
|
|
2269
|
+
onAfterOpen: () => {
|
|
2270
|
+
},
|
|
2271
|
+
onRequestClose: () => {
|
|
2272
|
+
setShowFullScreen(false);
|
|
2273
|
+
setSelectedFullScreenItem("");
|
|
2274
|
+
},
|
|
2275
|
+
style: {
|
|
2276
|
+
content: {
|
|
2277
|
+
top: "50%",
|
|
2278
|
+
left: "50%",
|
|
2279
|
+
right: "auto",
|
|
2280
|
+
bottom: "auto",
|
|
2281
|
+
marginRight: "-50%",
|
|
2282
|
+
transform: "translate(-50%, -50%)",
|
|
2283
|
+
padding: 0,
|
|
2284
|
+
borderRadius: 20,
|
|
2285
|
+
background: "",
|
|
2286
|
+
border: "",
|
|
2287
|
+
width: "900px",
|
|
2288
|
+
maxHeight: "70%",
|
|
2289
|
+
overflow: "auto"
|
|
2290
|
+
},
|
|
2291
|
+
overlay: {
|
|
2292
|
+
background: "rgba(0, 0, 0, 0.6)"
|
|
2293
|
+
}
|
|
2294
|
+
},
|
|
2295
|
+
contentLabel: "",
|
|
2296
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex-1 flex flex-col", children: [
|
|
2297
|
+
/* @__PURE__ */ jsx11("div", { className: "ml-auto px-5 py-3", children: /* @__PURE__ */ jsx11(
|
|
2298
|
+
BaseImage_default,
|
|
2299
|
+
{
|
|
2300
|
+
src: "/icons/cross-red.png",
|
|
2301
|
+
alt: "cross-red",
|
|
2302
|
+
size: "medium",
|
|
2303
|
+
onClick: () => {
|
|
2304
|
+
setShowFullScreen(false);
|
|
2305
|
+
setSelectedFullScreenItem("");
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
) }),
|
|
2309
|
+
/* @__PURE__ */ jsx11("div", { className: "flex items-center justify-center h-[500]", children: /* @__PURE__ */ jsx11(
|
|
2310
|
+
BaseImage_default,
|
|
2311
|
+
{
|
|
2312
|
+
src: selectedFullScreenItem,
|
|
2313
|
+
alt: "selected-fullscreen-item",
|
|
2314
|
+
size: "custom",
|
|
2315
|
+
className: "w-full"
|
|
2316
|
+
}
|
|
2317
|
+
) })
|
|
2318
|
+
] })
|
|
2319
|
+
}
|
|
2320
|
+
);
|
|
2321
|
+
};
|
|
2322
|
+
const RenderMainContent = () => {
|
|
2323
|
+
if (type === "TEXT") {
|
|
2324
|
+
return /* @__PURE__ */ jsx11("div", { className: "mb-3 flex flex-row flex-wrap items-center mx-auto w-full", children: /* @__PURE__ */ jsx11("span", { children: retrieveValueParts(value) }) });
|
|
2325
|
+
} else if (type === "IMAGE") {
|
|
2326
|
+
return /* @__PURE__ */ jsx11("div", { className: "mb-3 flex flex-col items-center relative", children: /* @__PURE__ */ jsxs7(
|
|
2327
|
+
"div",
|
|
2328
|
+
{
|
|
2329
|
+
className: `${size ? `${convertToPercentage(size)}` : ""} rounded-catchup-xlarge relative`,
|
|
2330
|
+
children: [
|
|
2331
|
+
/* @__PURE__ */ jsx11(
|
|
2332
|
+
BaseImage_default,
|
|
2333
|
+
{
|
|
2334
|
+
src: value,
|
|
2335
|
+
alt: "body-image",
|
|
2336
|
+
size: "custom",
|
|
2337
|
+
className: "w-full rounded-catchup-xlarge"
|
|
2338
|
+
}
|
|
2339
|
+
),
|
|
2340
|
+
/* @__PURE__ */ jsx11(
|
|
2341
|
+
"div",
|
|
2342
|
+
{
|
|
2343
|
+
className: "absolute flex items-center justify-center top-2 right-2 h-6 w-6 cursor-pointer border rounded-catchup-xlarge border-catchup-blue p-1",
|
|
2344
|
+
onClick: () => {
|
|
2345
|
+
setShowFullScreen(true);
|
|
2346
|
+
setSelectedFullScreenItem(value);
|
|
2347
|
+
},
|
|
2348
|
+
children: /* @__PURE__ */ jsx11(
|
|
2349
|
+
BaseImage_default,
|
|
2350
|
+
{
|
|
2351
|
+
src: "/icons/arrow-up.png",
|
|
2352
|
+
alt: "arrow-up",
|
|
2353
|
+
size: "custom",
|
|
2354
|
+
className: "w-full"
|
|
2355
|
+
}
|
|
2356
|
+
)
|
|
2357
|
+
}
|
|
2358
|
+
)
|
|
2359
|
+
]
|
|
2360
|
+
}
|
|
2361
|
+
) });
|
|
2362
|
+
} else if (type === "VIDEO") {
|
|
2363
|
+
return /* @__PURE__ */ jsx11("div", { className: "mb-3 flex flex-col items-center", children: /* @__PURE__ */ jsx11(
|
|
2364
|
+
"video",
|
|
2365
|
+
{
|
|
2366
|
+
src: value,
|
|
2367
|
+
className: `${size ? `${convertToPercentage(size)}` : ""} rounded-catchup-xlarge`,
|
|
2368
|
+
controls: true
|
|
2369
|
+
}
|
|
2370
|
+
) });
|
|
2371
|
+
} else if (type === "AUDIO") {
|
|
2372
|
+
return /* @__PURE__ */ jsx11("div", { className: "mb-3 flex flex-col items-center", children: /* @__PURE__ */ jsx11("audio", { src: value, controls: true, className: `rounded-catchup-xlarge` }) });
|
|
2373
|
+
}
|
|
2374
|
+
};
|
|
2375
|
+
return /* @__PURE__ */ jsxs7("div", { className: "w-full", children: [
|
|
2376
|
+
RenderShowFullScreenItem(),
|
|
2377
|
+
RenderMainContent()
|
|
2378
|
+
] }, index);
|
|
2379
|
+
};
|
|
2380
|
+
var ShowBodyMediaByContentType_default = ShowBodyMediaByContentType;
|
|
2381
|
+
|
|
2382
|
+
// src/components/activities/body-content/ActivityBodyContent.tsx
|
|
2383
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2384
|
+
var ActivityBodyContent = ({
|
|
2385
|
+
templateType,
|
|
2386
|
+
bodyMap,
|
|
2387
|
+
contentMap,
|
|
2388
|
+
answerMap
|
|
2389
|
+
}) => {
|
|
2390
|
+
let currentQQIndex = 0;
|
|
2391
|
+
return /* @__PURE__ */ jsx12("div", { className: "flex flex-col justify-center items-center", children: Object.keys(bodyMap).map((key, index) => {
|
|
2392
|
+
const body = JSON.parse(bodyMap[key]);
|
|
2393
|
+
if (templateType === "DROPDOWN") {
|
|
2394
|
+
while (body.value.includes("@@")) {
|
|
2395
|
+
if (answerMap[currentQQIndex].trim() === "" || answerMap[currentQQIndex].trim() === "DEFAULT_OPTION") {
|
|
2396
|
+
body.value = body.value.replace(
|
|
2397
|
+
"@@",
|
|
2398
|
+
`----(${currentQQIndex + 1})----`
|
|
2399
|
+
);
|
|
2400
|
+
} else {
|
|
2401
|
+
if (contentMap["type"] === "TEXT") {
|
|
2402
|
+
body.value = body.value.replace(
|
|
2403
|
+
"@@",
|
|
2404
|
+
`--TEXT--${answerMap[currentQQIndex]}--TEXT--`
|
|
2405
|
+
);
|
|
2406
|
+
} else if (contentMap["type"] === "IMAGE") {
|
|
2407
|
+
body.value = body.value.replace(
|
|
2408
|
+
"@@",
|
|
2409
|
+
`--IMAGE--${answerMap[currentQQIndex]}--IMAGE--`
|
|
2410
|
+
);
|
|
2411
|
+
} else if (contentMap["type"] === "VIDEO") {
|
|
2412
|
+
body.value = body.value.replace(
|
|
2413
|
+
"@@",
|
|
2414
|
+
`--VIDEO--${answerMap[currentQQIndex]}--VIDEO--`
|
|
2415
|
+
);
|
|
2416
|
+
} else if (contentMap["type"] === "AUDIO") {
|
|
2417
|
+
body.value = body.value.replace(
|
|
2418
|
+
"@@",
|
|
2419
|
+
`--AUDIO--${answerMap[currentQQIndex]}--AUDIO--`
|
|
2420
|
+
);
|
|
2421
|
+
} else {
|
|
2422
|
+
body.value = body.value.replace(
|
|
2423
|
+
"@@",
|
|
2424
|
+
answerMap[currentQQIndex]
|
|
2425
|
+
);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
currentQQIndex++;
|
|
2429
|
+
}
|
|
2430
|
+
} else if (templateType === "FILL_IN_THE_BLANKS") {
|
|
2431
|
+
while (body.value.includes("@@")) {
|
|
2432
|
+
if (answerMap[currentQQIndex].trim() === "") {
|
|
2433
|
+
body.value = body.value.replace(
|
|
2434
|
+
"@@",
|
|
2435
|
+
`----(${currentQQIndex + 1})----`
|
|
2436
|
+
);
|
|
2437
|
+
} else {
|
|
2438
|
+
if (contentMap["type"] === "TEXT") {
|
|
2439
|
+
body.value = body.value.replace(
|
|
2440
|
+
"@@",
|
|
2441
|
+
`--TEXT--${answerMap[currentQQIndex]}--TEXT--`
|
|
2442
|
+
);
|
|
2443
|
+
} else if (contentMap["type"] === "IMAGE") {
|
|
2444
|
+
body.value = body.value.replace(
|
|
2445
|
+
"@@",
|
|
2446
|
+
`--IMAGE--${answerMap[currentQQIndex]}--IMAGE--`
|
|
2447
|
+
);
|
|
2448
|
+
} else if (contentMap["type"] === "VIDEO") {
|
|
2449
|
+
body.value = body.value.replace(
|
|
2450
|
+
"@@",
|
|
2451
|
+
`--VIDEO--${answerMap[currentQQIndex]}--VIDEO--`
|
|
2452
|
+
);
|
|
2453
|
+
} else if (contentMap["type"] === "AUDIO") {
|
|
2454
|
+
body.value = body.value.replace(
|
|
2455
|
+
"@@",
|
|
2456
|
+
`--AUDIO--${answerMap[currentQQIndex]}--AUDIO--`
|
|
2457
|
+
);
|
|
2458
|
+
} else {
|
|
2459
|
+
body.value = body.value.replace(
|
|
2460
|
+
"@@",
|
|
2461
|
+
answerMap[currentQQIndex]
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
currentQQIndex++;
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
return /* @__PURE__ */ jsx12(
|
|
2469
|
+
ShowBodyMediaByContentType_default,
|
|
2470
|
+
{
|
|
2471
|
+
index,
|
|
2472
|
+
type: body.type,
|
|
2473
|
+
value: body.value,
|
|
2474
|
+
size: body.size
|
|
2475
|
+
}
|
|
2476
|
+
);
|
|
2477
|
+
}) });
|
|
2478
|
+
};
|
|
2479
|
+
var ActivityBodyContent_default = ActivityBodyContent;
|
|
2480
|
+
|
|
2481
|
+
// src/components/activities/material-content/DropdownActivityMaterialContent.tsx
|
|
2482
|
+
import { InlineMath as InlineMath2 } from "react-katex";
|
|
2483
|
+
|
|
2484
|
+
// src/components/groups/InputGroup.tsx
|
|
2485
|
+
import Select from "react-select";
|
|
2486
|
+
import { useEffect, useRef } from "react";
|
|
2487
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2488
|
+
var InputGroup = ({
|
|
2489
|
+
type,
|
|
2490
|
+
title,
|
|
2491
|
+
defaultValue,
|
|
2492
|
+
placeholder,
|
|
2493
|
+
value,
|
|
2494
|
+
onFocus,
|
|
2495
|
+
onChange,
|
|
2496
|
+
onClick,
|
|
2497
|
+
onKeyDown,
|
|
2498
|
+
optionList,
|
|
2499
|
+
errorText,
|
|
2500
|
+
multiple,
|
|
2501
|
+
accept,
|
|
2502
|
+
theme,
|
|
2503
|
+
useMinHeight,
|
|
2504
|
+
disabled,
|
|
2505
|
+
limit
|
|
2506
|
+
}) => {
|
|
2507
|
+
const textAreaRef = useRef(null);
|
|
2508
|
+
useEffect(() => {
|
|
2509
|
+
if (!textAreaRef) return;
|
|
2510
|
+
if (!textAreaRef.current) return;
|
|
2511
|
+
if (value) {
|
|
2512
|
+
textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;
|
|
2513
|
+
} else {
|
|
2514
|
+
textAreaRef.current.style.height = `44px`;
|
|
2515
|
+
}
|
|
2516
|
+
}, [textAreaRef, value]);
|
|
2517
|
+
const retrieveNullableOptionList = () => {
|
|
2518
|
+
if (!optionList) return [];
|
|
2519
|
+
const currentOptionList = {
|
|
2520
|
+
text: i18n_default.t("option_please_select"),
|
|
2521
|
+
value: "DEFAULT_OPTION"
|
|
2522
|
+
};
|
|
2523
|
+
return [currentOptionList, ...optionList];
|
|
2524
|
+
};
|
|
2525
|
+
const convertOptionListToSelectComponent = (optionList2) => {
|
|
2526
|
+
return optionList2.map((option) => ({
|
|
2527
|
+
value: option.value,
|
|
2528
|
+
label: option.text
|
|
2529
|
+
}));
|
|
2530
|
+
};
|
|
2531
|
+
const handleTextAreaOnChange = (e) => {
|
|
2532
|
+
if (!textAreaRef) return;
|
|
2533
|
+
if (!textAreaRef.current) return;
|
|
2534
|
+
textAreaRef.current.style.height = `30px`;
|
|
2535
|
+
textAreaRef.current.style.height = `${e.target.scrollHeight + 6}px`;
|
|
2536
|
+
if (limit) {
|
|
2537
|
+
if (e.target.value.length <= limit) {
|
|
2538
|
+
onChange && onChange(e);
|
|
2539
|
+
}
|
|
2540
|
+
} else {
|
|
2541
|
+
onChange && onChange(e);
|
|
2542
|
+
}
|
|
2543
|
+
};
|
|
2544
|
+
const CheckboxInputGroup = () => {
|
|
2545
|
+
return /* @__PURE__ */ jsxs8(
|
|
2546
|
+
"div",
|
|
2547
|
+
{
|
|
2548
|
+
className: "flex flex-row items-center gap-x-1 cursor-pointer",
|
|
2549
|
+
onClick,
|
|
2550
|
+
children: [
|
|
2551
|
+
/* @__PURE__ */ jsx13(
|
|
2552
|
+
BaseImage_default,
|
|
2553
|
+
{
|
|
2554
|
+
src: value ? "/icons/checkbox.png" : "/icons/checkbox-empty.png",
|
|
2555
|
+
alt: "checkbox",
|
|
2556
|
+
size: "xsmall",
|
|
2557
|
+
onClick: () => {
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
),
|
|
2561
|
+
/* @__PURE__ */ jsx13("p", { className: "", children: title })
|
|
2562
|
+
]
|
|
2563
|
+
}
|
|
2564
|
+
);
|
|
2565
|
+
};
|
|
2566
|
+
const FileInputGroup = () => {
|
|
2567
|
+
return /* @__PURE__ */ jsxs8("div", { className: "my-1", children: [
|
|
2568
|
+
title ? /* @__PURE__ */ jsx13("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
|
|
2569
|
+
/* @__PURE__ */ jsx13(
|
|
2570
|
+
"input",
|
|
2571
|
+
{
|
|
2572
|
+
className: "w-full py-2 px-4 border border-catchup-gray-100 placeholder-catchup-gray-200 rounded-catchup-large text-black focus:outline-none focus:border-catchup-blue-400 focus:shadow-input",
|
|
2573
|
+
type,
|
|
2574
|
+
defaultValue,
|
|
2575
|
+
placeholder,
|
|
2576
|
+
value,
|
|
2577
|
+
onChange,
|
|
2578
|
+
onClick,
|
|
2579
|
+
multiple,
|
|
2580
|
+
accept
|
|
2581
|
+
}
|
|
2582
|
+
)
|
|
2583
|
+
] });
|
|
2584
|
+
};
|
|
2585
|
+
const DateInputGroup = () => {
|
|
2586
|
+
return /* @__PURE__ */ jsxs8("div", { className: "my-1", children: [
|
|
2587
|
+
title ? /* @__PURE__ */ jsx13("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
|
|
2588
|
+
/* @__PURE__ */ jsx13(
|
|
2589
|
+
"input",
|
|
2590
|
+
{
|
|
2591
|
+
className: `w-full py-2 px-4 border ${errorText ? "border-catchup-red shadow-error" : theme === "red" ? "border-catchup-red bg-catchup-red text-catchup-white focus:border-catchup-red" : "border-catchup-gray-100 placeholder-catchup-gray-200 focus:border-catchup-blue-400"} rounded-catchup-large text-black focus:outline-none focus:shadow-input`,
|
|
2592
|
+
type,
|
|
2593
|
+
defaultValue,
|
|
2594
|
+
placeholder,
|
|
2595
|
+
value,
|
|
2596
|
+
onChange,
|
|
2597
|
+
disabled
|
|
2598
|
+
}
|
|
2599
|
+
)
|
|
2600
|
+
] });
|
|
2601
|
+
};
|
|
2602
|
+
const SearchableSelectInputGroup = () => {
|
|
2603
|
+
return /* @__PURE__ */ jsxs8("div", { className: "my-1", children: [
|
|
2604
|
+
title ? /* @__PURE__ */ jsx13("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400 ", children: title }) : null,
|
|
2605
|
+
/* @__PURE__ */ jsx13(
|
|
2606
|
+
Select,
|
|
2607
|
+
{
|
|
2608
|
+
options: convertOptionListToSelectComponent(
|
|
2609
|
+
retrieveNullableOptionList()
|
|
2610
|
+
),
|
|
2611
|
+
className: `w-full`,
|
|
2612
|
+
styles: {
|
|
2613
|
+
control: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
|
|
2614
|
+
borderWidth: 1,
|
|
2615
|
+
borderStyle: "solid",
|
|
2616
|
+
borderRadius: 16,
|
|
2617
|
+
borderColor: errorText ? "#ff6b6b" : theme === "red" ? "#ff6b6b" : state.isFocused ? "#73d7e6" : state.isActive ? "#d2dde1" : "#d2dde1",
|
|
2618
|
+
backgroundColor: theme !== "red" ? "#ffffff" : "#ff6b6b",
|
|
2619
|
+
paddingRight: 6,
|
|
2620
|
+
paddingLeft: 6,
|
|
2621
|
+
paddingTop: 2,
|
|
2622
|
+
paddingBottom: 2,
|
|
2623
|
+
outline: "none",
|
|
2624
|
+
margin: 0,
|
|
2625
|
+
text: theme === "red" ? "#ffffff" : "#55777f",
|
|
2626
|
+
boxShadow: errorText ? "0px 0px 7px 0px rgba(255, 107, 107, 1)" : state.isFocused ? "0px 0px 7px 0px rgba(115, 215, 230, 100)" : "none",
|
|
2627
|
+
"&:hover": {
|
|
2628
|
+
outline: "none"
|
|
2629
|
+
}
|
|
2630
|
+
}),
|
|
2631
|
+
menu: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
|
|
2632
|
+
borderRadius: 16,
|
|
2633
|
+
paddingTop: 10,
|
|
2634
|
+
paddingBottom: 10,
|
|
2635
|
+
boxShadow: "0px 0px 6px 0px rgba(0, 0, 0, 0.25)"
|
|
2636
|
+
}),
|
|
2637
|
+
option: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
|
|
2638
|
+
color: state.isSelected ? "#2b3a41" : "#2b3a41",
|
|
2639
|
+
backgroundColor: state.isSelected ? "#eaecf1" : "",
|
|
2640
|
+
"&:hover": {
|
|
2641
|
+
backgroundColor: "#eaecf1"
|
|
2642
|
+
},
|
|
2643
|
+
paddingLeft: 20,
|
|
2644
|
+
paddingRight: 20
|
|
2645
|
+
}),
|
|
2646
|
+
dropdownIndicator: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
|
|
2647
|
+
color: state.isFocused ? "#57c2d3" : "#55777f",
|
|
2648
|
+
"&:hover": {
|
|
2649
|
+
color: state.isFocused ? "#57c2d3" : "#55777f"
|
|
2650
|
+
}
|
|
2651
|
+
})
|
|
2652
|
+
},
|
|
2653
|
+
components: {
|
|
2654
|
+
IndicatorSeparator: () => null
|
|
2655
|
+
},
|
|
2656
|
+
value: convertOptionListToSelectComponent(
|
|
2657
|
+
retrieveNullableOptionList()
|
|
2658
|
+
).find((option) => option.value === value),
|
|
2659
|
+
onChange: (target) => {
|
|
2660
|
+
const event = { target };
|
|
2661
|
+
onChange && onChange(event);
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
)
|
|
2665
|
+
] });
|
|
2666
|
+
};
|
|
2667
|
+
const TextAreaInputGroup = () => {
|
|
2668
|
+
return /* @__PURE__ */ jsxs8("div", { className: "my-1 flex-1 flex flex-col relative", children: [
|
|
2669
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-row justify-between items-center", children: [
|
|
2670
|
+
/* @__PURE__ */ jsx13("div", { children: title ? /* @__PURE__ */ jsx13("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null }),
|
|
2671
|
+
/* @__PURE__ */ jsx13("div", { children: limit ? /* @__PURE__ */ jsxs8("p", { className: "text-md font-semibold pr-2 py-1 text-catchup-gray-400", children: [
|
|
2672
|
+
value.length,
|
|
2673
|
+
" / ",
|
|
2674
|
+
limit
|
|
2675
|
+
] }) : null })
|
|
2676
|
+
] }),
|
|
2677
|
+
/* @__PURE__ */ jsx13(
|
|
2678
|
+
"textarea",
|
|
2679
|
+
{
|
|
2680
|
+
ref: textAreaRef,
|
|
2681
|
+
disabled,
|
|
2682
|
+
className: `w-full ${useMinHeight ? "min-h-[250px]" : ""} resize-none overflow-hidden py-2 px-4 border ${errorText ? "border-catchup-red shadow-error placeholder:text-catchup-red placeholder:opacity-80" : "border-catchup-gray-100"} placeholder-catchup-gray-200 rounded-catchup-large focus:outline-none focus:border-catchup-blue-400 ${disabled ? "bg-catchup-lighter-gray" : null} focus:shadow-input`,
|
|
2683
|
+
placeholder: errorText ? errorText : placeholder,
|
|
2684
|
+
value,
|
|
2685
|
+
onLoad: (e) => {
|
|
2686
|
+
console.log(e);
|
|
2687
|
+
},
|
|
2688
|
+
onChange: handleTextAreaOnChange,
|
|
2689
|
+
onFocus,
|
|
2690
|
+
onKeyDown
|
|
2691
|
+
}
|
|
2692
|
+
)
|
|
2693
|
+
] });
|
|
2694
|
+
};
|
|
2695
|
+
const TextInputGroup = () => {
|
|
2696
|
+
return /* @__PURE__ */ jsxs8("div", { className: "my-1 relative", children: [
|
|
2697
|
+
title ? /* @__PURE__ */ jsx13("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
|
|
2698
|
+
/* @__PURE__ */ jsx13(
|
|
2699
|
+
"input",
|
|
2700
|
+
{
|
|
2701
|
+
disabled,
|
|
2702
|
+
className: `w-full py-2 px-4 border ${errorText ? "border-catchup-red shadow-error placeholder:text-catchup-red placeholder:opacity-80" : "border-catchup-gray-100"} rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 focus:border-catchup-blue-400 ${disabled ? "bg-catchup-lighter-gray" : null} focus:shadow-input`,
|
|
2703
|
+
type,
|
|
2704
|
+
defaultValue,
|
|
2705
|
+
placeholder: errorText ? errorText : placeholder,
|
|
2706
|
+
value,
|
|
2707
|
+
onChange,
|
|
2708
|
+
onFocus,
|
|
2709
|
+
onKeyDown
|
|
2710
|
+
}
|
|
2711
|
+
)
|
|
2712
|
+
] });
|
|
2713
|
+
};
|
|
2714
|
+
const RenderMainContent = () => {
|
|
2715
|
+
if (type === "text" || type === "number") {
|
|
2716
|
+
return TextInputGroup();
|
|
2717
|
+
} else if (type === "textarea") {
|
|
2718
|
+
return TextAreaInputGroup();
|
|
2719
|
+
} else if (type === "password") {
|
|
2720
|
+
return TextInputGroup();
|
|
2721
|
+
} else if (type === "select") {
|
|
2722
|
+
return SearchableSelectInputGroup();
|
|
2723
|
+
} else if (type === "date" || type === "datetime-local") {
|
|
2724
|
+
return DateInputGroup();
|
|
2725
|
+
} else if (type === "file") {
|
|
2726
|
+
return FileInputGroup();
|
|
2727
|
+
} else if (type === "checkbox") {
|
|
2728
|
+
return CheckboxInputGroup();
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
return RenderMainContent();
|
|
2732
|
+
};
|
|
2733
|
+
var InputGroup_default = InputGroup;
|
|
2734
|
+
|
|
2735
|
+
// src/components/activities/material-content/DropdownActivityMaterialContent.tsx
|
|
2736
|
+
import { useEffect as useEffect3 } from "react";
|
|
2737
|
+
import { useState as useState11 } from "react";
|
|
2738
|
+
|
|
2739
|
+
// src/utilization/AppUtilization.ts
|
|
2740
|
+
var colors = [
|
|
2741
|
+
"#FF5733",
|
|
2742
|
+
// Fiery Red
|
|
2743
|
+
"#3357FF",
|
|
2744
|
+
// Royal Blue
|
|
2745
|
+
"#FF33A1",
|
|
2746
|
+
// Fuchsia Pink
|
|
2747
|
+
"#33FFF0",
|
|
2748
|
+
// Aqua Blue
|
|
2749
|
+
"#FF9633",
|
|
2750
|
+
// Tangerine
|
|
2751
|
+
"#8D33FF",
|
|
2752
|
+
// Violet
|
|
2753
|
+
"#FFD733",
|
|
2754
|
+
// Sunny Yellow
|
|
2755
|
+
"#33FF6D",
|
|
2756
|
+
// Mint Green
|
|
2757
|
+
"#FFB833",
|
|
2758
|
+
// Amber
|
|
2759
|
+
"#33C7FF",
|
|
2760
|
+
// Sky Blue
|
|
2761
|
+
"#FF33E4",
|
|
2762
|
+
// Magenta
|
|
2763
|
+
"#5EFF33",
|
|
2764
|
+
// Neon Green
|
|
2765
|
+
"#FF3380",
|
|
2766
|
+
// Hot Pink
|
|
2767
|
+
"#33FFAF",
|
|
2768
|
+
// Seafoam Green
|
|
2769
|
+
"#3383FF",
|
|
2770
|
+
// Dodger Blue
|
|
2771
|
+
"#FF9533",
|
|
2772
|
+
// Pumpkin Orange
|
|
2773
|
+
"#BF33FF",
|
|
2774
|
+
// Electric Purple
|
|
2775
|
+
"#FFDA33",
|
|
2776
|
+
// Golden Yellow
|
|
2777
|
+
"#33FF89",
|
|
2778
|
+
// Turquoise
|
|
2779
|
+
"#FF3333",
|
|
2780
|
+
// Red
|
|
2781
|
+
"#33BFFF",
|
|
2782
|
+
// Light Blue
|
|
2783
|
+
"#FF33B3",
|
|
2784
|
+
// Pink
|
|
2785
|
+
"#5BFF33",
|
|
2786
|
+
// Light Green
|
|
2787
|
+
"#FF3385",
|
|
2788
|
+
// Rose
|
|
2789
|
+
"#33FFC9",
|
|
2790
|
+
// Aquamarine
|
|
2791
|
+
"#33A1FF",
|
|
2792
|
+
// Azure
|
|
2793
|
+
"#FF7A33",
|
|
2794
|
+
// Cantaloupe
|
|
2795
|
+
"#A533FF",
|
|
2796
|
+
// Lavender
|
|
2797
|
+
"#FFE033",
|
|
2798
|
+
// Mustard Yellow
|
|
2799
|
+
"#33FF7A",
|
|
2800
|
+
// Apple Green
|
|
2801
|
+
"#FF4D33",
|
|
2802
|
+
// Bright Red
|
|
2803
|
+
"#33FF95",
|
|
2804
|
+
// Light Turquoise
|
|
2805
|
+
"#FFC433",
|
|
2806
|
+
// Peach
|
|
2807
|
+
"#33FF7D",
|
|
2808
|
+
// Green Apple
|
|
2809
|
+
"#FF338A",
|
|
2810
|
+
// Raspberry Pink
|
|
2811
|
+
"#33FFE4",
|
|
2812
|
+
// Light Aqua
|
|
2813
|
+
"#336AFF",
|
|
2814
|
+
// Cobalt Blue
|
|
2815
|
+
"#FF3370",
|
|
2816
|
+
// Raspberry
|
|
2817
|
+
"#33FF95",
|
|
2818
|
+
// Light Green
|
|
2819
|
+
"#FFA633",
|
|
2820
|
+
// Orange
|
|
2821
|
+
"#33FF57"
|
|
2822
|
+
// Lime Green
|
|
2823
|
+
];
|
|
2824
|
+
var shuffleArray = (array) => {
|
|
2825
|
+
const copyArray = JSON.parse(JSON.stringify(array));
|
|
2826
|
+
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
2827
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
2828
|
+
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
2829
|
+
}
|
|
2830
|
+
return copyArray;
|
|
2831
|
+
};
|
|
2832
|
+
var getColorByIndex = (index) => {
|
|
2833
|
+
return colors[index];
|
|
2834
|
+
};
|
|
2835
|
+
|
|
2836
|
+
// src/components/dropdowns/MediaDropdown.tsx
|
|
2837
|
+
import { useState as useState9 } from "react";
|
|
2838
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2839
|
+
var MediaDropdown = ({ id, answer, optionList }) => {
|
|
2840
|
+
const [showDropdown, setShowDropdown] = useState9(false);
|
|
2841
|
+
return /* @__PURE__ */ jsxs9(
|
|
2842
|
+
"div",
|
|
2843
|
+
{
|
|
2844
|
+
className: "w-full relative",
|
|
2845
|
+
onMouseEnter: () => {
|
|
2846
|
+
setShowDropdown(true);
|
|
2847
|
+
},
|
|
2848
|
+
onMouseLeave: () => {
|
|
2849
|
+
setShowDropdown(false);
|
|
2850
|
+
},
|
|
2851
|
+
children: [
|
|
2852
|
+
/* @__PURE__ */ jsx14("div", { className: "w-full flex flex-col items-center justify-center", children: answer }),
|
|
2853
|
+
/* @__PURE__ */ jsx14(
|
|
2854
|
+
"ul",
|
|
2855
|
+
{
|
|
2856
|
+
className: `absolute ${showDropdown ? "opacity-100 visible" : "opacity-0 invisible"} flex flex-col items-center w-[300px] rounded-catchup-xlarge border-3 transition-all duration-300 border-catchup-blue bg-catchup-white px-4 py-4 translate-x-1/2 right-1/2 mt-2 z-10`,
|
|
2857
|
+
children: optionList.map((option, index) => /* @__PURE__ */ jsxs9(
|
|
2858
|
+
"li",
|
|
2859
|
+
{
|
|
2860
|
+
className: `${option.listItemClassNames ? option.listItemClassNames : ""}`,
|
|
2861
|
+
children: [
|
|
2862
|
+
/* @__PURE__ */ jsx14(
|
|
2863
|
+
"div",
|
|
2864
|
+
{
|
|
2865
|
+
className: `w-full flex flex-col my-2 ${option.divClassNames ? option.divClassNames : ""}`,
|
|
2866
|
+
onClick: option.onClick,
|
|
2867
|
+
children: option.media
|
|
2868
|
+
}
|
|
2869
|
+
),
|
|
2870
|
+
index !== optionList.length - 1 ? /* @__PURE__ */ jsx14("div", { className: "w-full border my-1 border-catchup-light-blue rounded-catchup-full" }) : null
|
|
2871
|
+
]
|
|
2872
|
+
},
|
|
2873
|
+
option.id
|
|
2874
|
+
))
|
|
2875
|
+
}
|
|
2876
|
+
)
|
|
2877
|
+
]
|
|
2878
|
+
},
|
|
2879
|
+
id
|
|
2880
|
+
);
|
|
2881
|
+
};
|
|
2882
|
+
var MediaDropdown_default = MediaDropdown;
|
|
2883
|
+
|
|
2884
|
+
// src/components/activities/material-content/ShowMaterialMediaByContentType.tsx
|
|
2885
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState10 } from "react";
|
|
2886
|
+
import Modal2 from "react-modal";
|
|
2887
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2888
|
+
var ShowMaterialMediaByContentType = ({
|
|
2889
|
+
key,
|
|
2890
|
+
contentType,
|
|
2891
|
+
src,
|
|
2892
|
+
canFullScreen
|
|
2893
|
+
}) => {
|
|
2894
|
+
const [showFullScreen, setShowFullScreen] = useState10(false);
|
|
2895
|
+
const [selectedFullScreenItem, setSelectedFullScreenItem] = useState10(null);
|
|
2896
|
+
const [isLoaded, setIsLoaded] = useState10(false);
|
|
2897
|
+
const [isFullHeight, setIsFullHeight] = useState10(false);
|
|
2898
|
+
const imageRef = useRef2(null);
|
|
2899
|
+
useEffect2(() => {
|
|
2900
|
+
setIsLoaded(false);
|
|
2901
|
+
}, []);
|
|
2902
|
+
useEffect2(() => {
|
|
2903
|
+
if (!isLoaded) return;
|
|
2904
|
+
if (!imageRef) return;
|
|
2905
|
+
if (!imageRef.current) return;
|
|
2906
|
+
const w = imageRef.current.naturalWidth;
|
|
2907
|
+
const h = imageRef.current.naturalHeight;
|
|
2908
|
+
if (w >= h) {
|
|
2909
|
+
setIsFullHeight(false);
|
|
2910
|
+
} else {
|
|
2911
|
+
setIsFullHeight(true);
|
|
2912
|
+
}
|
|
2913
|
+
}, [isLoaded, key]);
|
|
2914
|
+
const RenderShowFullScreenItem = () => {
|
|
2915
|
+
return /* @__PURE__ */ jsx15(
|
|
2916
|
+
Modal2,
|
|
2917
|
+
{
|
|
2918
|
+
isOpen: showFullScreen,
|
|
2919
|
+
onAfterOpen: () => {
|
|
2920
|
+
},
|
|
2921
|
+
onRequestClose: () => {
|
|
2922
|
+
setShowFullScreen(false);
|
|
2923
|
+
setSelectedFullScreenItem(null);
|
|
2924
|
+
},
|
|
2925
|
+
style: {
|
|
2926
|
+
content: {
|
|
2927
|
+
top: "50%",
|
|
2928
|
+
left: "50%",
|
|
2929
|
+
right: "auto",
|
|
2930
|
+
bottom: "auto",
|
|
2931
|
+
marginRight: "-50%",
|
|
2932
|
+
transform: "translate(-50%, -50%)",
|
|
2933
|
+
padding: 0,
|
|
2934
|
+
borderRadius: 20,
|
|
2935
|
+
background: "",
|
|
2936
|
+
border: "",
|
|
2937
|
+
width: "900px",
|
|
2938
|
+
maxHeight: "70%",
|
|
2939
|
+
overflow: "auto"
|
|
2940
|
+
},
|
|
2941
|
+
overlay: {
|
|
2942
|
+
background: "rgba(0, 0, 0, 0.6)"
|
|
2943
|
+
}
|
|
2944
|
+
},
|
|
2945
|
+
contentLabel: "",
|
|
2946
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "flex-1 flex flex-col", children: [
|
|
2947
|
+
/* @__PURE__ */ jsx15("div", { className: "ml-auto px-5 py-3", children: /* @__PURE__ */ jsx15(
|
|
2948
|
+
BaseImage_default,
|
|
2949
|
+
{
|
|
2950
|
+
src: "/icons/cross-red.png",
|
|
2951
|
+
alt: "cross-red",
|
|
2952
|
+
size: "medium",
|
|
2953
|
+
onClick: () => {
|
|
2954
|
+
setShowFullScreen(false);
|
|
2955
|
+
setSelectedFullScreenItem(null);
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
) }),
|
|
2959
|
+
/* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx15(
|
|
2960
|
+
BaseImage_default,
|
|
2961
|
+
{
|
|
2962
|
+
src: selectedFullScreenItem,
|
|
2963
|
+
alt: "selected-fullscreen-item",
|
|
2964
|
+
size: "custom",
|
|
2965
|
+
className: "w-full"
|
|
2966
|
+
}
|
|
2967
|
+
) })
|
|
2968
|
+
] })
|
|
2969
|
+
}
|
|
2970
|
+
);
|
|
2971
|
+
};
|
|
2972
|
+
return contentType === "IMAGE" ? /* @__PURE__ */ jsxs10("div", { children: [
|
|
2973
|
+
RenderShowFullScreenItem(),
|
|
2974
|
+
/* @__PURE__ */ jsx15("div", { className: "my-2", children: /* @__PURE__ */ jsx15("div", { className: "h-full flex flex-row flex-wrap items-center", children: /* @__PURE__ */ jsxs10(
|
|
2975
|
+
"div",
|
|
2976
|
+
{
|
|
2977
|
+
className: `${isFullHeight ? "h-catchup-activity-box-item" : "max-w-catchup-activity-box-item"} flex flex-col justify-center items-center relative`,
|
|
2978
|
+
children: [
|
|
2979
|
+
/* @__PURE__ */ jsx15(
|
|
2980
|
+
BaseImage_default,
|
|
2981
|
+
{
|
|
2982
|
+
src,
|
|
2983
|
+
alt: "image",
|
|
2984
|
+
ref: imageRef,
|
|
2985
|
+
size: "custom",
|
|
2986
|
+
className: "h-full rounded-catchup-xlarge",
|
|
2987
|
+
onLoad: () => {
|
|
2988
|
+
setIsLoaded(true);
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
),
|
|
2992
|
+
src !== null && src !== "" && src !== "DEFAULT_OPTION" && canFullScreen ? /* @__PURE__ */ jsx15(
|
|
2993
|
+
"div",
|
|
2994
|
+
{
|
|
2995
|
+
className: "absolute flex items-center justify-center top-2 right-2 h-6 w-6 cursor-pointer border rounded-catchup-xlarge border-catchup-blue p-1",
|
|
2996
|
+
onMouseEnter: (e) => {
|
|
2997
|
+
e.preventDefault();
|
|
2998
|
+
},
|
|
2999
|
+
onClick: (e) => {
|
|
3000
|
+
e.preventDefault();
|
|
3001
|
+
setShowFullScreen(true);
|
|
3002
|
+
setSelectedFullScreenItem(src);
|
|
3003
|
+
},
|
|
3004
|
+
children: /* @__PURE__ */ jsx15(
|
|
3005
|
+
BaseImage_default,
|
|
3006
|
+
{
|
|
3007
|
+
src: "/icons/arrow-up.png",
|
|
3008
|
+
alt: "arrow-up",
|
|
3009
|
+
size: "custom",
|
|
3010
|
+
className: "w-full"
|
|
3011
|
+
}
|
|
3012
|
+
)
|
|
3013
|
+
}
|
|
3014
|
+
) : null
|
|
3015
|
+
]
|
|
3016
|
+
}
|
|
3017
|
+
) }) })
|
|
3018
|
+
] }, key) : contentType === "VIDEO" ? /* @__PURE__ */ jsx15("div", { className: "my-2", children: /* @__PURE__ */ jsx15("div", { className: "h-full flex flex-row flex-wrap items-center", children: /* @__PURE__ */ jsx15("div", { className: "h-full flex flex-col justify-center items-center", children: /* @__PURE__ */ jsx15(
|
|
3019
|
+
"video",
|
|
3020
|
+
{
|
|
3021
|
+
className: "h-catchup-activity-box-item rounded-catchup-xlarge",
|
|
3022
|
+
src,
|
|
3023
|
+
controls: true,
|
|
3024
|
+
onClick: () => {
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
) }) }) }) : contentType === "AUDIO" ? /* @__PURE__ */ jsx15("div", { className: "my-2", children: /* @__PURE__ */ jsx15("div", { className: "h-full flex flex-row flex-wrap items-center", children: /* @__PURE__ */ jsx15("div", { className: "h-full flex flex-col justify-center items-center", children: /* @__PURE__ */ jsx15(
|
|
3028
|
+
"audio",
|
|
3029
|
+
{
|
|
3030
|
+
className: "h-catchup-activity-box-item rounded-catchup-xlarge",
|
|
3031
|
+
src,
|
|
3032
|
+
controls: true,
|
|
3033
|
+
onClick: () => {
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
) }) }) }) : null;
|
|
3037
|
+
};
|
|
3038
|
+
var ShowMaterialMediaByContentType_default = ShowMaterialMediaByContentType;
|
|
3039
|
+
|
|
3040
|
+
// src/components/activities/material-content/DropdownActivityMaterialContent.tsx
|
|
3041
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3042
|
+
var DropdownActivityMaterialContent = ({
|
|
3043
|
+
uniqueValue,
|
|
3044
|
+
answer,
|
|
3045
|
+
materialMap,
|
|
3046
|
+
contentMap,
|
|
3047
|
+
checkCanAnswerQuestion,
|
|
3048
|
+
onChange,
|
|
3049
|
+
isPreview,
|
|
3050
|
+
showCorrectAnswer
|
|
3051
|
+
}) => {
|
|
3052
|
+
const [updated, setUpdated] = useState11(false);
|
|
3053
|
+
useEffect3(() => {
|
|
3054
|
+
if (!showCorrectAnswer) return;
|
|
3055
|
+
const foundAnswer = answer.data.find(
|
|
3056
|
+
(answerData) => answerData.type === "DROPDOWN"
|
|
3057
|
+
);
|
|
3058
|
+
if (foundAnswer.answerMap.length === 0) return;
|
|
3059
|
+
foundAnswer.answerMap = Object.keys(materialMap).map(
|
|
3060
|
+
(materialMapKey, index) => Object.keys(materialMap[materialMapKey])[0]
|
|
3061
|
+
);
|
|
3062
|
+
onChange(answer, 0, Object.keys(materialMap[0])[0]);
|
|
3063
|
+
setUpdated(true);
|
|
3064
|
+
}, [showCorrectAnswer]);
|
|
3065
|
+
useEffect3(() => {
|
|
3066
|
+
if (!updated) return;
|
|
3067
|
+
setUpdated(false);
|
|
3068
|
+
}, [updated]);
|
|
3069
|
+
const retrieveAnswerMap = () => {
|
|
3070
|
+
const foundIndex = answer.data.findIndex(
|
|
3071
|
+
(answerData) => answerData.type === "DROPDOWN"
|
|
3072
|
+
);
|
|
3073
|
+
return answer.data[foundIndex].answerMap;
|
|
3074
|
+
};
|
|
3075
|
+
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
3076
|
+
if (!isPreview) return "HIDDEN";
|
|
3077
|
+
if (correctAnswer === learnerAnswer) {
|
|
3078
|
+
return "CORRECT";
|
|
3079
|
+
}
|
|
3080
|
+
return "INCORRECT";
|
|
3081
|
+
};
|
|
3082
|
+
const answerMap = retrieveAnswerMap();
|
|
3083
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-row flex-wrap items-center", children: [
|
|
3084
|
+
/* @__PURE__ */ jsx16("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx16("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_dropdown_text") }) }),
|
|
3085
|
+
/* @__PURE__ */ jsx16("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx16(DividerLine_default, {}) }),
|
|
3086
|
+
/* @__PURE__ */ jsx16("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
|
|
3087
|
+
const answerKey = Object.keys(materialMap[materialKey])[0];
|
|
3088
|
+
const learnerAnswerState = checkAnswerState(
|
|
3089
|
+
answerKey,
|
|
3090
|
+
answerMap[materialKey]
|
|
3091
|
+
);
|
|
3092
|
+
return /* @__PURE__ */ jsx16("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx16("div", { className: "mx-2", children: /* @__PURE__ */ jsxs11("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
3093
|
+
/* @__PURE__ */ jsx16("div", { className: "my-auto", children: /* @__PURE__ */ jsxs11("p", { className: "text-xl", children: [
|
|
3094
|
+
parseFloat(materialKey) + 1,
|
|
3095
|
+
"."
|
|
3096
|
+
] }) }),
|
|
3097
|
+
/* @__PURE__ */ jsxs11("div", { className: "w-full relative", children: [
|
|
3098
|
+
/* @__PURE__ */ jsx16("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ jsx16("div", { className: "flex-1", children: /* @__PURE__ */ jsx16(
|
|
3099
|
+
InputGroup_default,
|
|
3100
|
+
{
|
|
3101
|
+
type: "select",
|
|
3102
|
+
value: answerMap[materialKey],
|
|
3103
|
+
optionList: shuffleArray(
|
|
3104
|
+
materialMap[materialKey][answerKey]
|
|
3105
|
+
).map((materialOption) => ({
|
|
3106
|
+
text: /* @__PURE__ */ jsx16("span", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
3107
|
+
materialOption
|
|
3108
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx16(
|
|
3109
|
+
"span",
|
|
3110
|
+
{
|
|
3111
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
3112
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx16("span", { className: "text-2xl", children: /* @__PURE__ */ jsx16(
|
|
3113
|
+
InlineMath2,
|
|
3114
|
+
{
|
|
3115
|
+
math: inputPart.value
|
|
3116
|
+
}
|
|
3117
|
+
) }) : inputPart.value
|
|
3118
|
+
},
|
|
3119
|
+
index2
|
|
3120
|
+
)) }),
|
|
3121
|
+
value: materialOption
|
|
3122
|
+
})),
|
|
3123
|
+
onChange: (e) => {
|
|
3124
|
+
onChange(answer, materialKey, e.target.value);
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
) }) : /* @__PURE__ */ jsx16(
|
|
3128
|
+
MediaDropdown_default,
|
|
3129
|
+
{
|
|
3130
|
+
id: materialKey,
|
|
3131
|
+
answer: answerMap[materialKey] === "DEFAULT_OPTION" ? /* @__PURE__ */ jsx16("div", { className: "w-catchup-activity-box-item border h-catchup-activity-box-item rounded-catchup-xlarge border-dashed border-catchup-blue", children: /* @__PURE__ */ jsx16("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ jsx16("span", { className: "italic", children: i18n_default.t("please_select") }) }) }) : /* @__PURE__ */ jsx16(
|
|
3132
|
+
ShowMaterialMediaByContentType_default,
|
|
3133
|
+
{
|
|
3134
|
+
contentType: contentMap.type,
|
|
3135
|
+
src: answerMap[materialKey],
|
|
3136
|
+
canFullScreen: false
|
|
3137
|
+
},
|
|
3138
|
+
`${uniqueValue}-${index}`
|
|
3139
|
+
),
|
|
3140
|
+
optionList: materialMap[materialKey][answerKey].map(
|
|
3141
|
+
(materialOption, index2) => ({
|
|
3142
|
+
id: index2,
|
|
3143
|
+
media: /* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16(
|
|
3144
|
+
ShowMaterialMediaByContentType_default,
|
|
3145
|
+
{
|
|
3146
|
+
contentType: contentMap.type,
|
|
3147
|
+
src: materialOption,
|
|
3148
|
+
canFullScreen: false
|
|
3149
|
+
},
|
|
3150
|
+
`${uniqueValue}-${index2}`
|
|
3151
|
+
) }, index2),
|
|
3152
|
+
onClick: (e) => {
|
|
3153
|
+
onChange(
|
|
3154
|
+
answer,
|
|
3155
|
+
materialKey,
|
|
3156
|
+
e.target.currentSrc
|
|
3157
|
+
);
|
|
3158
|
+
}
|
|
3159
|
+
})
|
|
3160
|
+
)
|
|
3161
|
+
}
|
|
3162
|
+
) : /* @__PURE__ */ jsx16("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
3163
|
+
answerMap[materialKey]
|
|
3164
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx16(
|
|
3165
|
+
"span",
|
|
3166
|
+
{
|
|
3167
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
3168
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx16("span", { className: "text-2xl", children: /* @__PURE__ */ jsx16(InlineMath2, { math: inputPart.value }) }) : inputPart.value
|
|
3169
|
+
},
|
|
3170
|
+
index2
|
|
3171
|
+
)) }) }),
|
|
3172
|
+
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ jsx16("div", { className: "absolute top-[0px] right-4 bg-catchup-white", children: /* @__PURE__ */ jsx16(
|
|
3173
|
+
BaseImage_default,
|
|
3174
|
+
{
|
|
3175
|
+
src: "/icons/checkbox.png",
|
|
3176
|
+
alt: "chekbbox",
|
|
3177
|
+
size: "small"
|
|
3178
|
+
}
|
|
3179
|
+
) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ jsx16("div", { className: "absolute top-[0px] right-4 bg-catchup-white", children: /* @__PURE__ */ jsx16(
|
|
3180
|
+
BaseImage_default,
|
|
3181
|
+
{
|
|
3182
|
+
src: "/icons/cross-red.png",
|
|
3183
|
+
alt: "cross-red",
|
|
3184
|
+
size: "small"
|
|
3185
|
+
}
|
|
3186
|
+
) }) : null
|
|
3187
|
+
] })
|
|
3188
|
+
] }) }) }, index);
|
|
3189
|
+
}) })
|
|
3190
|
+
] });
|
|
3191
|
+
};
|
|
3192
|
+
var DropdownActivityMaterialContent_default = DropdownActivityMaterialContent;
|
|
3193
|
+
|
|
3194
|
+
// src/components/activities/DropdownActivityContent.tsx
|
|
3195
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3196
|
+
var DropdownActivityContent = ({
|
|
3197
|
+
answer,
|
|
3198
|
+
data,
|
|
3199
|
+
canAnswerQuestion,
|
|
3200
|
+
changeAnswer,
|
|
3201
|
+
isPreview,
|
|
3202
|
+
showCorrectAnswer
|
|
3203
|
+
}) => {
|
|
3204
|
+
const contentMap = parseContentMapFromData(data);
|
|
3205
|
+
const dropdownBodyMap = parseBodyMapFromData(data, "DROPDOWN");
|
|
3206
|
+
const dropdownMaterialMap = parseMaterialMapFromData(data, "DROPDOWN");
|
|
3207
|
+
const retrieveCurrentAnswerMap = () => {
|
|
3208
|
+
let foundIndex = answer.data.findIndex(
|
|
3209
|
+
(answerData) => answerData.type === "DROPDOWN"
|
|
3210
|
+
);
|
|
3211
|
+
return answer.data[foundIndex].answerMap;
|
|
3212
|
+
};
|
|
3213
|
+
const handleDropdownAnswerOnChange = (answer2, key, value) => {
|
|
3214
|
+
const answerMap = retrieveCurrentAnswerMap();
|
|
3215
|
+
answerMap[key] = value;
|
|
3216
|
+
changeAnswer(answer2);
|
|
3217
|
+
};
|
|
3218
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex flex-row flex-wrap", children: [
|
|
3219
|
+
/* @__PURE__ */ jsx17("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ jsx17(
|
|
3220
|
+
ActivityBodyContent_default,
|
|
3221
|
+
{
|
|
3222
|
+
bodyMap: dropdownBodyMap,
|
|
3223
|
+
answerMap: retrieveCurrentAnswerMap(),
|
|
3224
|
+
contentMap,
|
|
3225
|
+
templateType: "DROPDOWN"
|
|
3226
|
+
}
|
|
3227
|
+
) }),
|
|
3228
|
+
/* @__PURE__ */ jsx17("div", { className: "contents md:hidden", children: /* @__PURE__ */ jsx17(DividerLine_default, {}) }),
|
|
3229
|
+
/* @__PURE__ */ jsx17("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx17(VerticalDividerLine_default, {}) }),
|
|
3230
|
+
/* @__PURE__ */ jsx17("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ jsx17(
|
|
3231
|
+
DropdownActivityMaterialContent_default,
|
|
3232
|
+
{
|
|
3233
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
3234
|
+
answer,
|
|
3235
|
+
materialMap: dropdownMaterialMap,
|
|
3236
|
+
contentMap,
|
|
3237
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
3238
|
+
onChange: handleDropdownAnswerOnChange,
|
|
3239
|
+
isPreview,
|
|
3240
|
+
showCorrectAnswer
|
|
3241
|
+
}
|
|
3242
|
+
) })
|
|
3243
|
+
] });
|
|
3244
|
+
};
|
|
3245
|
+
var DropdownActivityContent_default = DropdownActivityContent;
|
|
3246
|
+
|
|
3247
|
+
// src/components/activities/material-content/FillInTheBlanksActivityMaterialContent.tsx
|
|
3248
|
+
import { InlineMath as InlineMath3 } from "react-katex";
|
|
3249
|
+
import { useState as useState12 } from "react";
|
|
3250
|
+
import { useEffect as useEffect4 } from "react";
|
|
3251
|
+
import { useDrop as useDrop2 } from "react-dnd";
|
|
3252
|
+
|
|
3253
|
+
// src/components/dnds/DraggableItem.tsx
|
|
3254
|
+
import { useDrag } from "react-dnd";
|
|
3255
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3256
|
+
var DraggableItem = ({
|
|
3257
|
+
key,
|
|
3258
|
+
item,
|
|
3259
|
+
type,
|
|
3260
|
+
component,
|
|
3261
|
+
moveCardHandler
|
|
3262
|
+
}) => {
|
|
3263
|
+
const [{ isDragging }, drag] = useDrag({
|
|
3264
|
+
type,
|
|
3265
|
+
item,
|
|
3266
|
+
end: (item2, monitor) => {
|
|
3267
|
+
const dropResult = monitor.getDropResult();
|
|
3268
|
+
if (dropResult) {
|
|
3269
|
+
moveCardHandler();
|
|
3270
|
+
}
|
|
3271
|
+
},
|
|
3272
|
+
collect: (monitor) => ({
|
|
3273
|
+
isDragging: monitor.isDragging()
|
|
3274
|
+
})
|
|
3275
|
+
});
|
|
3276
|
+
const opacity = isDragging ? 0.4 : 1;
|
|
3277
|
+
return /* @__PURE__ */ jsx18(
|
|
3278
|
+
"div",
|
|
3279
|
+
{
|
|
3280
|
+
className: `${isDragging ? "w-[0px] opacity-0" : "opacity-100"} transition-all duration-500`,
|
|
3281
|
+
children: /* @__PURE__ */ jsx18("div", { ref: drag, className: "", style: { opacity }, children: component })
|
|
3282
|
+
},
|
|
3283
|
+
key
|
|
3284
|
+
);
|
|
3285
|
+
};
|
|
3286
|
+
var DraggableItem_default = DraggableItem;
|
|
3287
|
+
|
|
3288
|
+
// src/components/dnds/DroppableItem.tsx
|
|
3289
|
+
import { useRef as useRef3 } from "react";
|
|
3290
|
+
import { useDrop } from "react-dnd";
|
|
3291
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3292
|
+
var DroppableItem = ({
|
|
3293
|
+
key,
|
|
3294
|
+
item,
|
|
3295
|
+
type,
|
|
3296
|
+
component,
|
|
3297
|
+
dropRef,
|
|
3298
|
+
target,
|
|
3299
|
+
setTarget
|
|
3300
|
+
}) => {
|
|
3301
|
+
const ref = useRef3(null);
|
|
3302
|
+
const [, drop] = useDrop({
|
|
3303
|
+
accept: type,
|
|
3304
|
+
hover() {
|
|
3305
|
+
if (item.index !== null && target !== item.index) {
|
|
3306
|
+
setTarget(item.index);
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
dropRef(drop(ref));
|
|
3311
|
+
return /* @__PURE__ */ jsx19(
|
|
3312
|
+
"div",
|
|
3313
|
+
{
|
|
3314
|
+
className: `w-full transition-all duration-500 h-full`,
|
|
3315
|
+
ref,
|
|
3316
|
+
children: component
|
|
3317
|
+
},
|
|
3318
|
+
key
|
|
3319
|
+
);
|
|
3320
|
+
};
|
|
3321
|
+
var DroppableItem_default = DroppableItem;
|
|
3322
|
+
|
|
3323
|
+
// src/components/activities/material-content/FillInTheBlanksActivityMaterialContent.tsx
|
|
3324
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3325
|
+
var FillInTheBlanksActivityMaterialContent = ({
|
|
3326
|
+
uniqueValue,
|
|
3327
|
+
answer,
|
|
3328
|
+
optionList,
|
|
3329
|
+
materialMap,
|
|
3330
|
+
contentMap,
|
|
3331
|
+
checkCanAnswerQuestion,
|
|
3332
|
+
onChange,
|
|
3333
|
+
isPreview,
|
|
3334
|
+
showCorrectAnswer
|
|
3335
|
+
}) => {
|
|
3336
|
+
const [shuffleOptionList, setShuffleOptionList] = useState12([]);
|
|
3337
|
+
const [selectedOption, setSelectedOption] = useState12(null);
|
|
3338
|
+
const [pasteOptionIndex, setPasteOptionIndex] = useState12(null);
|
|
3339
|
+
const [{ isOver, canDrop }, drop] = useDrop2({
|
|
3340
|
+
accept: "FILL_IN_THE_BLANKS",
|
|
3341
|
+
drop: () => {
|
|
3342
|
+
},
|
|
3343
|
+
collect: (monitor) => ({
|
|
3344
|
+
isOver: monitor.isOver(),
|
|
3345
|
+
canDrop: monitor.canDrop()
|
|
3346
|
+
})
|
|
3347
|
+
});
|
|
3348
|
+
useEffect4(() => {
|
|
3349
|
+
setShuffleOptionList(shuffleArray(optionList));
|
|
3350
|
+
}, []);
|
|
3351
|
+
useEffect4(() => {
|
|
3352
|
+
if (!showCorrectAnswer) return;
|
|
3353
|
+
const foundAnswer = answer.data.find(
|
|
3354
|
+
(answerData) => answerData.type === "FILL_IN_THE_BLANKS"
|
|
3355
|
+
);
|
|
3356
|
+
if (foundAnswer.answerMap.length === 0) return;
|
|
3357
|
+
foundAnswer.answerMap = Object.keys(materialMap).map(
|
|
3358
|
+
(materialMapKey, index) => JSON.parse(materialMap[materialMapKey])[0]
|
|
3359
|
+
);
|
|
3360
|
+
onChange(answer, 0, JSON.parse(materialMap[0])[0]);
|
|
3361
|
+
}, [showCorrectAnswer]);
|
|
3362
|
+
const retrieveAnswerMap = () => {
|
|
3363
|
+
const foundIndex = answer.data.findIndex(
|
|
3364
|
+
(answerData) => answerData.type === "FILL_IN_THE_BLANKS"
|
|
3365
|
+
);
|
|
3366
|
+
return answer.data[foundIndex].answerMap;
|
|
3367
|
+
};
|
|
3368
|
+
const checkAnswerState = (correctAnswerList, learnerAnswer) => {
|
|
3369
|
+
if (!isPreview) return "HIDDEN";
|
|
3370
|
+
const foundIndex = correctAnswerList.findIndex(
|
|
3371
|
+
(correctAnswer) => correctAnswer === learnerAnswer
|
|
3372
|
+
);
|
|
3373
|
+
if (foundIndex !== -1) {
|
|
3374
|
+
return "CORRECT";
|
|
3375
|
+
}
|
|
3376
|
+
return "INCORRECT";
|
|
3377
|
+
};
|
|
3378
|
+
const checkAnswerProvided = (answerMap2, option) => {
|
|
3379
|
+
return Object.keys(answerMap2).findIndex((key) => answerMap2[key] === option) !== -1;
|
|
3380
|
+
};
|
|
3381
|
+
const answerMap = retrieveAnswerMap();
|
|
3382
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex flex-row flex-wrap items-center", onMouseUp: () => {
|
|
3383
|
+
}, children: [
|
|
3384
|
+
/* @__PURE__ */ jsx20("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx20("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_fill_in_the_blanks_text") }) }),
|
|
3385
|
+
/* @__PURE__ */ jsx20("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx20(DividerLine_default, {}) }),
|
|
3386
|
+
/* @__PURE__ */ jsx20("div", { className: "w-full flex flex-row flex-wrap gap-x-2 gap-y-2 my-2", children: shuffleOptionList.map(
|
|
3387
|
+
(option, index) => checkAnswerProvided(answerMap, option) ? /* @__PURE__ */ jsx20("div", { className: "opacity-30", children: /* @__PURE__ */ jsx20(
|
|
3388
|
+
ShowMaterialMediaByContentType_default,
|
|
3389
|
+
{
|
|
3390
|
+
contentType: contentMap.type,
|
|
3391
|
+
src: option,
|
|
3392
|
+
canFullScreen: true
|
|
3393
|
+
},
|
|
3394
|
+
`${uniqueValue}-${index}`
|
|
3395
|
+
) }) : /* @__PURE__ */ jsx20(
|
|
3396
|
+
DraggableItem_default,
|
|
3397
|
+
{
|
|
3398
|
+
item: { index: option },
|
|
3399
|
+
type: "FILL_IN_THE_BLANKS",
|
|
3400
|
+
component: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx20(
|
|
3401
|
+
"div",
|
|
3402
|
+
{
|
|
3403
|
+
className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge cursor-pointer",
|
|
3404
|
+
onMouseDown: () => {
|
|
3405
|
+
setSelectedOption(option);
|
|
3406
|
+
setPasteOptionIndex(null);
|
|
3407
|
+
},
|
|
3408
|
+
children: /* @__PURE__ */ jsx20("p", { className: "italic whitespace-pre-wrap", children: option })
|
|
3409
|
+
}
|
|
3410
|
+
) : /* @__PURE__ */ jsx20(
|
|
3411
|
+
"div",
|
|
3412
|
+
{
|
|
3413
|
+
className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge cursor-pointer",
|
|
3414
|
+
onMouseDown: () => {
|
|
3415
|
+
setSelectedOption(option);
|
|
3416
|
+
setPasteOptionIndex(null);
|
|
3417
|
+
},
|
|
3418
|
+
children: /* @__PURE__ */ jsx20(
|
|
3419
|
+
ShowMaterialMediaByContentType_default,
|
|
3420
|
+
{
|
|
3421
|
+
contentType: contentMap.type,
|
|
3422
|
+
src: option,
|
|
3423
|
+
canFullScreen: true
|
|
3424
|
+
},
|
|
3425
|
+
`${uniqueValue}-${index}`
|
|
3426
|
+
)
|
|
3427
|
+
}
|
|
3428
|
+
),
|
|
3429
|
+
moveCardHandler: () => {
|
|
3430
|
+
onChange(answer, pasteOptionIndex, selectedOption);
|
|
3431
|
+
}
|
|
3432
|
+
},
|
|
3433
|
+
index
|
|
3434
|
+
)
|
|
3435
|
+
) }),
|
|
3436
|
+
/* @__PURE__ */ jsx20("div", { className: "flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
|
|
3437
|
+
const learnerAnswerState = checkAnswerState(
|
|
3438
|
+
JSON.parse(materialMap[materialKey]),
|
|
3439
|
+
answerMap[materialKey]
|
|
3440
|
+
);
|
|
3441
|
+
return /* @__PURE__ */ jsx20("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ jsx20("div", { className: "mx-2", children: /* @__PURE__ */ jsx20(
|
|
3442
|
+
DroppableItem_default,
|
|
3443
|
+
{
|
|
3444
|
+
item: { index },
|
|
3445
|
+
type: "FILL_IN_THE_BLANKS",
|
|
3446
|
+
target: pasteOptionIndex,
|
|
3447
|
+
setTarget: setPasteOptionIndex,
|
|
3448
|
+
dropRef: drop,
|
|
3449
|
+
component: /* @__PURE__ */ jsxs13("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
|
|
3450
|
+
/* @__PURE__ */ jsx20("div", { className: "my-auto", children: /* @__PURE__ */ jsxs13("p", { className: "text-xl", children: [
|
|
3451
|
+
parseFloat(materialKey) + 1,
|
|
3452
|
+
"."
|
|
3453
|
+
] }) }),
|
|
3454
|
+
/* @__PURE__ */ jsx20("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
3455
|
+
/* @__PURE__ */ jsx20("div", { className: "flex-1", children: /* @__PURE__ */ jsx20(
|
|
3456
|
+
InputGroup_default,
|
|
3457
|
+
{
|
|
3458
|
+
type: "textarea",
|
|
3459
|
+
value: answerMap[materialKey],
|
|
3460
|
+
useMinHeight: false,
|
|
3461
|
+
onChange: (e) => {
|
|
3462
|
+
onChange(
|
|
3463
|
+
answer,
|
|
3464
|
+
materialKey,
|
|
3465
|
+
e.target.value
|
|
3466
|
+
);
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
) }),
|
|
3470
|
+
learnerAnswerState === "CORRECT" ? /* @__PURE__ */ jsx20("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ jsx20(
|
|
3471
|
+
BaseImage_default,
|
|
3472
|
+
{
|
|
3473
|
+
src: "/icons/checkbox.png",
|
|
3474
|
+
alt: "checkbox",
|
|
3475
|
+
size: "small"
|
|
3476
|
+
}
|
|
3477
|
+
) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ jsx20("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ jsx20(
|
|
3478
|
+
BaseImage_default,
|
|
3479
|
+
{
|
|
3480
|
+
src: "/icons/cross-red.png",
|
|
3481
|
+
alt: "cross-red",
|
|
3482
|
+
size: "small"
|
|
3483
|
+
}
|
|
3484
|
+
) }) : null
|
|
3485
|
+
] }) : answerMap[materialKey] === "" ? /* @__PURE__ */ jsx20(
|
|
3486
|
+
"div",
|
|
3487
|
+
{
|
|
3488
|
+
className: `w-catchup-activity-box-item border h-catchup-activity-box-item rounded-catchup-xlarge border-dashed ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
|
|
3489
|
+
children: /* @__PURE__ */ jsx20("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ jsx20("span", { className: "italic", children: i18n_default.t("please_drop_here") }) })
|
|
3490
|
+
}
|
|
3491
|
+
) : /* @__PURE__ */ jsx20(
|
|
3492
|
+
"div",
|
|
3493
|
+
{
|
|
3494
|
+
className: "flex-1 cursor-pointer",
|
|
3495
|
+
onClick: () => {
|
|
3496
|
+
onChange(answer, materialKey, "");
|
|
3497
|
+
},
|
|
3498
|
+
children: /* @__PURE__ */ jsx20(
|
|
3499
|
+
ShowMaterialMediaByContentType_default,
|
|
3500
|
+
{
|
|
3501
|
+
contentType: contentMap.type,
|
|
3502
|
+
src: answerMap[materialKey],
|
|
3503
|
+
canFullScreen: true
|
|
3504
|
+
},
|
|
3505
|
+
`${uniqueValue}-${index}`
|
|
3506
|
+
)
|
|
3507
|
+
}
|
|
3508
|
+
) : /* @__PURE__ */ jsx20("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
3509
|
+
answerMap[materialKey]
|
|
3510
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx20(
|
|
3511
|
+
"span",
|
|
3512
|
+
{
|
|
3513
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
3514
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx20("span", { className: "text-2xl", children: /* @__PURE__ */ jsx20(InlineMath3, { math: inputPart.value }) }) : inputPart.value
|
|
3515
|
+
},
|
|
3516
|
+
index2
|
|
3517
|
+
)) }, materialKey) })
|
|
3518
|
+
] })
|
|
3519
|
+
},
|
|
3520
|
+
index
|
|
3521
|
+
) }) }, index);
|
|
3522
|
+
}) })
|
|
3523
|
+
] });
|
|
3524
|
+
};
|
|
3525
|
+
var FillInTheBlanksActivityMaterialContent_default = FillInTheBlanksActivityMaterialContent;
|
|
3526
|
+
|
|
3527
|
+
// src/components/activities/FillInTheBlanksActivityContent.tsx
|
|
3528
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3529
|
+
var FillInTheBlanksActivityContent = ({
|
|
3530
|
+
answer,
|
|
3531
|
+
data,
|
|
3532
|
+
canAnswerQuestion,
|
|
3533
|
+
changeAnswer,
|
|
3534
|
+
isPreview,
|
|
3535
|
+
showCorrectAnswer
|
|
3536
|
+
}) => {
|
|
3537
|
+
const contentMap = parseContentMapFromData(data);
|
|
3538
|
+
const fillInTheBlanksBodyMap = parseBodyMapFromData(
|
|
3539
|
+
data,
|
|
3540
|
+
"FILL_IN_THE_BLANKS"
|
|
3541
|
+
);
|
|
3542
|
+
const fillInTheBlanksMaterialMap = parseMaterialMapFromData(
|
|
3543
|
+
data,
|
|
3544
|
+
"FILL_IN_THE_BLANKS"
|
|
3545
|
+
);
|
|
3546
|
+
const fillInTheBlanksIncorrectList = data.fillInTheBlanksIncorrectList ? JSON.parse(data.fillInTheBlanksIncorrectList) : [];
|
|
3547
|
+
const retrieveCurrentAnswerMap = () => {
|
|
3548
|
+
let foundIndex = answer.data.findIndex(
|
|
3549
|
+
(answerData) => answerData.type === "FILL_IN_THE_BLANKS"
|
|
3550
|
+
);
|
|
3551
|
+
return answer.data[foundIndex].answerMap;
|
|
3552
|
+
};
|
|
3553
|
+
const constructAnswerOptionList = () => {
|
|
3554
|
+
const optionList = [];
|
|
3555
|
+
Object.keys(fillInTheBlanksMaterialMap).forEach((key) => {
|
|
3556
|
+
const array = JSON.parse(fillInTheBlanksMaterialMap[key]);
|
|
3557
|
+
for (const item of array) {
|
|
3558
|
+
const foundIndex = optionList.findIndex(
|
|
3559
|
+
(option) => option === item
|
|
3560
|
+
);
|
|
3561
|
+
if (foundIndex === -1) {
|
|
3562
|
+
optionList.push(item);
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
});
|
|
3566
|
+
fillInTheBlanksIncorrectList.forEach((value) => {
|
|
3567
|
+
optionList.push(value);
|
|
3568
|
+
});
|
|
3569
|
+
return optionList;
|
|
3570
|
+
};
|
|
3571
|
+
const handleFillInTheBlanksAnswerOnChange = (answer2, key, value) => {
|
|
3572
|
+
const answerMap = retrieveCurrentAnswerMap();
|
|
3573
|
+
answerMap[key] = value;
|
|
3574
|
+
changeAnswer(answer2);
|
|
3575
|
+
};
|
|
3576
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-row flex-wrap", children: [
|
|
3577
|
+
/* @__PURE__ */ jsx21("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ jsx21(
|
|
3578
|
+
ActivityBodyContent_default,
|
|
3579
|
+
{
|
|
3580
|
+
bodyMap: fillInTheBlanksBodyMap,
|
|
3581
|
+
answerMap: retrieveCurrentAnswerMap(),
|
|
3582
|
+
contentMap,
|
|
3583
|
+
templateType: "FILL_IN_THE_BLANKS"
|
|
3584
|
+
}
|
|
3585
|
+
) }),
|
|
3586
|
+
/* @__PURE__ */ jsx21("div", { className: "contents md:hidden", children: /* @__PURE__ */ jsx21(DividerLine_default, {}) }),
|
|
3587
|
+
/* @__PURE__ */ jsx21("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx21(VerticalDividerLine_default, {}) }),
|
|
3588
|
+
/* @__PURE__ */ jsx21("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ jsx21(
|
|
3589
|
+
FillInTheBlanksActivityMaterialContent_default,
|
|
3590
|
+
{
|
|
3591
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
3592
|
+
answer,
|
|
3593
|
+
optionList: constructAnswerOptionList(),
|
|
3594
|
+
materialMap: fillInTheBlanksMaterialMap,
|
|
3595
|
+
contentMap,
|
|
3596
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
3597
|
+
onChange: handleFillInTheBlanksAnswerOnChange,
|
|
3598
|
+
isPreview,
|
|
3599
|
+
showCorrectAnswer
|
|
3600
|
+
}
|
|
3601
|
+
) })
|
|
3602
|
+
] });
|
|
3603
|
+
};
|
|
3604
|
+
var FillInTheBlanksActivityContent_default = FillInTheBlanksActivityContent;
|
|
3605
|
+
|
|
3606
|
+
// src/components/activities/material-content/GroupingActivityMaterialContent.tsx
|
|
3607
|
+
import { useEffect as useEffect6, useRef as useRef4, useState as useState14 } from "react";
|
|
3608
|
+
import { useDrop as useDrop3 } from "react-dnd";
|
|
3609
|
+
import { InlineMath as InlineMath4 } from "react-katex";
|
|
3610
|
+
|
|
3611
|
+
// src/hooks/useScreenSize.ts
|
|
3612
|
+
import { useState as useState13, useEffect as useEffect5 } from "react";
|
|
3613
|
+
var useScreenSize = () => {
|
|
3614
|
+
const [containerSize, setContainerSize] = useState13({
|
|
3615
|
+
width: 0,
|
|
3616
|
+
height: 0
|
|
3617
|
+
});
|
|
3618
|
+
const [screenSize, setScreenSize] = useState13({
|
|
3619
|
+
width: window.innerWidth,
|
|
3620
|
+
height: window.innerHeight
|
|
3621
|
+
});
|
|
3622
|
+
useEffect5(() => {
|
|
3623
|
+
const handleResize = () => {
|
|
3624
|
+
setScreenSize({
|
|
3625
|
+
width: window.innerWidth,
|
|
3626
|
+
height: window.innerHeight
|
|
3627
|
+
});
|
|
3628
|
+
const container = document.getElementById("container");
|
|
3629
|
+
if (!container) return;
|
|
3630
|
+
const boundingClientRect = container.getBoundingClientRect();
|
|
3631
|
+
setContainerSize({
|
|
3632
|
+
width: boundingClientRect.width,
|
|
3633
|
+
height: boundingClientRect.height
|
|
3634
|
+
});
|
|
3635
|
+
};
|
|
3636
|
+
handleResize();
|
|
3637
|
+
window.addEventListener("resize", handleResize);
|
|
3638
|
+
return () => {
|
|
3639
|
+
window.removeEventListener("resize", handleResize);
|
|
3640
|
+
};
|
|
3641
|
+
}, []);
|
|
3642
|
+
return { screenSize, containerSize };
|
|
3643
|
+
};
|
|
3644
|
+
var useScreenSize_default = useScreenSize;
|
|
3645
|
+
|
|
3646
|
+
// src/components/activities/material-content/GroupingActivityMaterialContent.tsx
|
|
3647
|
+
import { Fragment, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3648
|
+
var GroupingActivityMaterialContent = ({
|
|
3649
|
+
uniqueValue,
|
|
3650
|
+
answer,
|
|
3651
|
+
materialMap,
|
|
3652
|
+
contentMap,
|
|
3653
|
+
checkCanAnswerQuestion,
|
|
3654
|
+
onChange,
|
|
3655
|
+
isPreview,
|
|
3656
|
+
showCorrectAnswer
|
|
3657
|
+
}) => {
|
|
3658
|
+
const [selectedValue, setSelectedValue] = useState14(null);
|
|
3659
|
+
const [selectedTargetKey, setSelectedTargetKey] = useState14(null);
|
|
3660
|
+
const [isShuffled, setIsShuffled] = useState14(false);
|
|
3661
|
+
const [shuffledMaterialList, setShuffledMaterialList] = useState14([]);
|
|
3662
|
+
const { screenSize, containerSize } = useScreenSize_default();
|
|
3663
|
+
const [{ isOver, canDrop }, drop] = useDrop3({
|
|
3664
|
+
accept: "GROUPING",
|
|
3665
|
+
drop: () => {
|
|
3666
|
+
},
|
|
3667
|
+
collect: (monitor) => ({
|
|
3668
|
+
isOver: monitor.isOver(),
|
|
3669
|
+
canDrop: monitor.canDrop()
|
|
3670
|
+
})
|
|
3671
|
+
});
|
|
3672
|
+
const ref = useRef4(null);
|
|
3673
|
+
const itemsRef = useRef4(null);
|
|
3674
|
+
const [maxWidth, setMaxWidth] = useState14(0);
|
|
3675
|
+
useEffect6(() => {
|
|
3676
|
+
if (!ref) return;
|
|
3677
|
+
if (!ref.current) return;
|
|
3678
|
+
if (!screenSize) return;
|
|
3679
|
+
setMaxWidth(ref.current.offsetWidth - 12);
|
|
3680
|
+
}, [ref, screenSize]);
|
|
3681
|
+
useEffect6(() => {
|
|
3682
|
+
if (!itemsRef) return;
|
|
3683
|
+
if (!itemsRef.current) return;
|
|
3684
|
+
if (!containerSize) return;
|
|
3685
|
+
itemsRef.current.style.width = `${containerSize.width - 200}px`;
|
|
3686
|
+
}, [itemsRef, containerSize]);
|
|
3687
|
+
useEffect6(() => {
|
|
3688
|
+
const shuffleArray2 = (array) => {
|
|
3689
|
+
if (!isShuffled) {
|
|
3690
|
+
const copyArray = JSON.parse(JSON.stringify(array));
|
|
3691
|
+
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
3692
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
3693
|
+
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
3694
|
+
}
|
|
3695
|
+
setIsShuffled(true);
|
|
3696
|
+
return copyArray;
|
|
3697
|
+
}
|
|
3698
|
+
return array;
|
|
3699
|
+
};
|
|
3700
|
+
const materialList = [];
|
|
3701
|
+
Object.keys(materialMap).forEach((materialKey) => {
|
|
3702
|
+
for (const materialValue of materialMap[materialKey]) {
|
|
3703
|
+
materialList.push(materialValue);
|
|
3704
|
+
}
|
|
3705
|
+
});
|
|
3706
|
+
setShuffledMaterialList(shuffleArray2(materialList));
|
|
3707
|
+
}, []);
|
|
3708
|
+
useEffect6(() => {
|
|
3709
|
+
if (!showCorrectAnswer) return;
|
|
3710
|
+
answer.data.find(
|
|
3711
|
+
(answerData) => answerData.type === "GROUPING"
|
|
3712
|
+
).answerMap = materialMap;
|
|
3713
|
+
}, [showCorrectAnswer]);
|
|
3714
|
+
const retrieveAnswerMap = () => {
|
|
3715
|
+
const foundIndex = answer.data.findIndex(
|
|
3716
|
+
(answerData) => answerData.type === "GROUPING"
|
|
3717
|
+
);
|
|
3718
|
+
const answerMap2 = answer.data[foundIndex].answerMap;
|
|
3719
|
+
return answerMap2;
|
|
3720
|
+
};
|
|
3721
|
+
const retrieveFilteredMaterialList = (answerMap2) => {
|
|
3722
|
+
const selectedValueList = [];
|
|
3723
|
+
Object.keys(answerMap2).forEach((key) => {
|
|
3724
|
+
answerMap2[key].forEach((value) => {
|
|
3725
|
+
selectedValueList.push(value);
|
|
3726
|
+
});
|
|
3727
|
+
});
|
|
3728
|
+
return shuffledMaterialList.filter(
|
|
3729
|
+
(material) => selectedValueList.findIndex((value) => material === value) === -1
|
|
3730
|
+
);
|
|
3731
|
+
};
|
|
3732
|
+
const checkAnswerState = (correctAnswerList, learnerAnswer) => {
|
|
3733
|
+
if (!isPreview) return "HIDDEN";
|
|
3734
|
+
if (!learnerAnswer) return "EMPTY";
|
|
3735
|
+
if (!correctAnswerList) return "EMPTY";
|
|
3736
|
+
const foundIndex = correctAnswerList.findIndex(
|
|
3737
|
+
(correctAnswer) => correctAnswer === learnerAnswer
|
|
3738
|
+
);
|
|
3739
|
+
if (foundIndex !== -1) {
|
|
3740
|
+
return "CORRECT";
|
|
3741
|
+
}
|
|
3742
|
+
return "INCORRECT";
|
|
3743
|
+
};
|
|
3744
|
+
const handleGroupingActivityItemOnChange = (selectedTargetKey2, selectedValue2) => {
|
|
3745
|
+
if (checkCanAnswerQuestion()) {
|
|
3746
|
+
onChange(answer, selectedTargetKey2, selectedValue2, null);
|
|
3747
|
+
setSelectedValue(null);
|
|
3748
|
+
}
|
|
3749
|
+
};
|
|
3750
|
+
const answerMap = retrieveAnswerMap();
|
|
3751
|
+
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
3752
|
+
return /* @__PURE__ */ jsxs15(Fragment, { children: [
|
|
3753
|
+
/* @__PURE__ */ jsx22(
|
|
3754
|
+
"div",
|
|
3755
|
+
{
|
|
3756
|
+
ref: itemsRef,
|
|
3757
|
+
className: "flex-1 flex flex-row gap-x-4 gap-y-4 overflow-auto py-2",
|
|
3758
|
+
children: filteredMaterialList.map((materialValue, index) => {
|
|
3759
|
+
return /* @__PURE__ */ jsx22(
|
|
3760
|
+
DraggableItem_default,
|
|
3761
|
+
{
|
|
3762
|
+
item: { index: materialValue },
|
|
3763
|
+
type: "GROUPING",
|
|
3764
|
+
component: /* @__PURE__ */ jsx22(
|
|
3765
|
+
"div",
|
|
3766
|
+
{
|
|
3767
|
+
className: `${selectedValue === materialValue ? "border-catchup-blue" : "border-catchup-lighter-gray"} h-catchup-activity-covering-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300`,
|
|
3768
|
+
onMouseDown: () => {
|
|
3769
|
+
if (checkCanAnswerQuestion()) {
|
|
3770
|
+
setSelectedValue(materialValue);
|
|
3771
|
+
}
|
|
3772
|
+
},
|
|
3773
|
+
onMouseUp: () => {
|
|
3774
|
+
if (checkCanAnswerQuestion()) {
|
|
3775
|
+
setSelectedValue(null);
|
|
3776
|
+
}
|
|
3777
|
+
},
|
|
3778
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx22(
|
|
3779
|
+
"div",
|
|
3780
|
+
{
|
|
3781
|
+
className: `flex flex-col items-center justify-center m-4 min-h-[64px] min-w-[200px]`,
|
|
3782
|
+
children: /* @__PURE__ */ jsx22("p", { className: "text-xl text-center whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
3783
|
+
materialValue
|
|
3784
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx22(
|
|
3785
|
+
"span",
|
|
3786
|
+
{
|
|
3787
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
3788
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx22("span", { className: "text-2xl", children: /* @__PURE__ */ jsx22(InlineMath4, { math: inputPart.value }) }) : inputPart.value
|
|
3789
|
+
},
|
|
3790
|
+
index2
|
|
3791
|
+
)) })
|
|
3792
|
+
}
|
|
3793
|
+
) : /* @__PURE__ */ jsx22(
|
|
3794
|
+
ShowMaterialMediaByContentType_default,
|
|
3795
|
+
{
|
|
3796
|
+
contentType: contentMap.type,
|
|
3797
|
+
src: materialValue,
|
|
3798
|
+
canFullScreen: true
|
|
3799
|
+
},
|
|
3800
|
+
`${uniqueValue}-${index}`
|
|
3801
|
+
)
|
|
3802
|
+
}
|
|
3803
|
+
),
|
|
3804
|
+
moveCardHandler: () => {
|
|
3805
|
+
if (!selectedTargetKey) return;
|
|
3806
|
+
if (!selectedValue) return;
|
|
3807
|
+
handleGroupingActivityItemOnChange(
|
|
3808
|
+
selectedTargetKey,
|
|
3809
|
+
selectedValue
|
|
3810
|
+
);
|
|
3811
|
+
}
|
|
3812
|
+
},
|
|
3813
|
+
index
|
|
3814
|
+
);
|
|
3815
|
+
})
|
|
3816
|
+
}
|
|
3817
|
+
),
|
|
3818
|
+
filteredMaterialList.length > 0 ? /* @__PURE__ */ jsx22(DividerLine_default, {}) : null,
|
|
3819
|
+
Object.keys(answerMap).map((answerMapKey, index) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-row w-full", children: [
|
|
3820
|
+
/* @__PURE__ */ jsx22("div", { className: "w-1/3", children: /* @__PURE__ */ jsx22(
|
|
3821
|
+
"div",
|
|
3822
|
+
{
|
|
3823
|
+
className: `border-catchup-blue h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3`,
|
|
3824
|
+
children: /* @__PURE__ */ jsx22(
|
|
3825
|
+
"div",
|
|
3826
|
+
{
|
|
3827
|
+
className: `flex flex-col items-center justify-center transition-all duration-300 m-4`,
|
|
3828
|
+
children: /* @__PURE__ */ jsx22("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
|
|
3829
|
+
(inputPart, index2) => /* @__PURE__ */ jsx22(
|
|
3830
|
+
"span",
|
|
3831
|
+
{
|
|
3832
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
3833
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx22("span", { className: "text-2xl", children: /* @__PURE__ */ jsx22(InlineMath4, { math: inputPart.value }) }) : inputPart.value
|
|
3834
|
+
},
|
|
3835
|
+
index2
|
|
3836
|
+
)
|
|
3837
|
+
) })
|
|
3838
|
+
}
|
|
3839
|
+
)
|
|
3840
|
+
}
|
|
3841
|
+
) }),
|
|
3842
|
+
/* @__PURE__ */ jsx22("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
|
|
3843
|
+
/* @__PURE__ */ jsx22("div", { className: "flex-1", ref, children: /* @__PURE__ */ jsx22("div", { className: "h-full py-3", children: /* @__PURE__ */ jsx22(
|
|
3844
|
+
"div",
|
|
3845
|
+
{
|
|
3846
|
+
className: `${canDrop ? selectedTargetKey === answerMapKey ? "bg-catchup-light-blue" : "bg-catchup-light-blue opacity-40" : ""} flex-1 border-catchup-blue rounded-catchup-xlarge border-2 h-full p-1`,
|
|
3847
|
+
children: /* @__PURE__ */ jsx22(
|
|
3848
|
+
DroppableItem_default,
|
|
3849
|
+
{
|
|
3850
|
+
item: { index: answerMapKey },
|
|
3851
|
+
type: "GROUPING",
|
|
3852
|
+
target: selectedTargetKey,
|
|
3853
|
+
setTarget: setSelectedTargetKey,
|
|
3854
|
+
dropRef: drop,
|
|
3855
|
+
component: /* @__PURE__ */ jsx22(
|
|
3856
|
+
"div",
|
|
3857
|
+
{
|
|
3858
|
+
className: "h-full flex-1 flex flex-row items-center overflow-x-auto",
|
|
3859
|
+
style: {
|
|
3860
|
+
maxWidth
|
|
3861
|
+
},
|
|
3862
|
+
children: answerMap[answerMapKey].map(
|
|
3863
|
+
(answerMapValue, answerMapIndex) => {
|
|
3864
|
+
const learnerAnswerState = checkAnswerState(
|
|
3865
|
+
materialMap[answerMapKey],
|
|
3866
|
+
answerMapValue
|
|
3867
|
+
);
|
|
3868
|
+
return /* @__PURE__ */ jsx22("div", { className: "p-1", children: /* @__PURE__ */ jsx22("div", { className: "h-catchup-activity-box-item", children: /* @__PURE__ */ jsx22(
|
|
3869
|
+
"div",
|
|
3870
|
+
{
|
|
3871
|
+
className: `${learnerAnswerState === "EMPTY" ? "border-catchup-lighter-gray" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"} border-2 rounded-catchup-xlarge h-full flex flex-col items-center justify-center transition-all duration-300 cursor-pointer`,
|
|
3872
|
+
onClick: (e) => {
|
|
3873
|
+
e.preventDefault();
|
|
3874
|
+
if (checkCanAnswerQuestion()) {
|
|
3875
|
+
onChange(
|
|
3876
|
+
answer,
|
|
3877
|
+
answerMapKey,
|
|
3878
|
+
null,
|
|
3879
|
+
answerMapIndex
|
|
3880
|
+
);
|
|
3881
|
+
setSelectedValue(null);
|
|
3882
|
+
}
|
|
3883
|
+
},
|
|
3884
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx22(
|
|
3885
|
+
"div",
|
|
3886
|
+
{
|
|
3887
|
+
className: `flex flex-col items-center justify-center transition-all duration-300 min-h-[64px] min-w-[200px]`,
|
|
3888
|
+
children: /* @__PURE__ */ jsx22("div", { className: "m-2", children: /* @__PURE__ */ jsx22("p", { className: "text-xl text-center whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
3889
|
+
answerMapValue
|
|
3890
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx22(
|
|
3891
|
+
"span",
|
|
3892
|
+
{
|
|
3893
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
3894
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx22("span", { className: "text-2xl", children: /* @__PURE__ */ jsx22(
|
|
3895
|
+
InlineMath4,
|
|
3896
|
+
{
|
|
3897
|
+
math: inputPart.value
|
|
3898
|
+
}
|
|
3899
|
+
) }) : inputPart.value
|
|
3900
|
+
},
|
|
3901
|
+
index2
|
|
3902
|
+
)) }) })
|
|
3903
|
+
}
|
|
3904
|
+
) : /* @__PURE__ */ jsx22(
|
|
3905
|
+
ShowMaterialMediaByContentType_default,
|
|
3906
|
+
{
|
|
3907
|
+
contentType: contentMap.type,
|
|
3908
|
+
src: answerMapValue,
|
|
3909
|
+
canFullScreen: false
|
|
3910
|
+
},
|
|
3911
|
+
`${uniqueValue}-${index}`
|
|
3912
|
+
)
|
|
3913
|
+
}
|
|
3914
|
+
) }) });
|
|
3915
|
+
}
|
|
3916
|
+
)
|
|
3917
|
+
}
|
|
3918
|
+
)
|
|
3919
|
+
},
|
|
3920
|
+
index
|
|
3921
|
+
)
|
|
3922
|
+
}
|
|
3923
|
+
) }) })
|
|
3924
|
+
] }, index))
|
|
3925
|
+
] });
|
|
3926
|
+
};
|
|
3927
|
+
var GroupingActivityMaterialContent_default = GroupingActivityMaterialContent;
|
|
3928
|
+
|
|
3929
|
+
// src/components/activities/GroupingActivityContent.tsx
|
|
3930
|
+
import { Fragment as Fragment2, jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3931
|
+
var GroupingActivityContent = ({
|
|
3932
|
+
answer,
|
|
3933
|
+
data,
|
|
3934
|
+
canAnswerQuestion,
|
|
3935
|
+
changeAnswer,
|
|
3936
|
+
isPreview,
|
|
3937
|
+
showCorrectAnswer
|
|
3938
|
+
}) => {
|
|
3939
|
+
const contentMap = parseContentMapFromData(data);
|
|
3940
|
+
const groupingBodyMap = parseBodyMapFromData(data, "GROUPING");
|
|
3941
|
+
const groupingMaterialMap = parseMaterialMapFromData(data, "GROUPING");
|
|
3942
|
+
const handleGroupingAnswerOnChange = (answer2, key, value, index) => {
|
|
3943
|
+
let foundIndex = answer2.data.findIndex(
|
|
3944
|
+
(answerData) => answerData.type === "GROUPING"
|
|
3945
|
+
);
|
|
3946
|
+
const answerMap = answer2.data[foundIndex].answerMap;
|
|
3947
|
+
if (value) {
|
|
3948
|
+
answerMap[key].push(value);
|
|
3949
|
+
} else {
|
|
3950
|
+
answerMap[key].splice(index, 1);
|
|
3951
|
+
}
|
|
3952
|
+
changeAnswer(answer2);
|
|
3953
|
+
};
|
|
3954
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
3955
|
+
/* @__PURE__ */ jsx23(
|
|
3956
|
+
ActivityBodyContent_default,
|
|
3957
|
+
{
|
|
3958
|
+
bodyMap: groupingBodyMap,
|
|
3959
|
+
templateType: "GROUPING"
|
|
3960
|
+
}
|
|
3961
|
+
),
|
|
3962
|
+
/* @__PURE__ */ jsx23(DividerLine_default, {}),
|
|
3963
|
+
/* @__PURE__ */ jsx23(
|
|
3964
|
+
GroupingActivityMaterialContent_default,
|
|
3965
|
+
{
|
|
3966
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
3967
|
+
answer,
|
|
3968
|
+
materialMap: groupingMaterialMap,
|
|
3969
|
+
contentMap,
|
|
3970
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
3971
|
+
onChange: handleGroupingAnswerOnChange,
|
|
3972
|
+
isPreview,
|
|
3973
|
+
showCorrectAnswer
|
|
3974
|
+
}
|
|
3975
|
+
)
|
|
3976
|
+
] });
|
|
3977
|
+
};
|
|
3978
|
+
var GroupingActivityContent_default = GroupingActivityContent;
|
|
3979
|
+
|
|
3980
|
+
// src/components/activities/material-content/MatchingActivityMaterialContent.tsx
|
|
3981
|
+
import { useEffect as useEffect7, useRef as useRef5, useState as useState15 } from "react";
|
|
3982
|
+
import { useDrop as useDrop4 } from "react-dnd";
|
|
3983
|
+
import { InlineMath as InlineMath5 } from "react-katex";
|
|
3984
|
+
import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3985
|
+
var MatchingActivityMaterialContent = ({
|
|
3986
|
+
uniqueValue,
|
|
3987
|
+
answer,
|
|
3988
|
+
materialMap,
|
|
3989
|
+
contentMap,
|
|
3990
|
+
checkCanAnswerQuestion,
|
|
3991
|
+
onChange,
|
|
3992
|
+
isPreview,
|
|
3993
|
+
showCorrectAnswer
|
|
3994
|
+
}) => {
|
|
3995
|
+
const [selectedValue, setSelectedValue] = useState15(null);
|
|
3996
|
+
const [selectedTargetKey, setSelectedTargetKey] = useState15(null);
|
|
3997
|
+
const [isShuffled, setIsShuffled] = useState15(false);
|
|
3998
|
+
const [shuffledMaterialList, setShuffledMaterialList] = useState15([]);
|
|
3999
|
+
const [{ isOver, canDrop }, drop] = useDrop4({
|
|
4000
|
+
accept: "MATCHING",
|
|
4001
|
+
drop: () => {
|
|
4002
|
+
},
|
|
4003
|
+
collect: (monitor) => ({
|
|
4004
|
+
isOver: monitor.isOver(),
|
|
4005
|
+
canDrop: monitor.canDrop()
|
|
4006
|
+
})
|
|
4007
|
+
});
|
|
4008
|
+
const { containerSize } = useScreenSize_default();
|
|
4009
|
+
const itemsRef = useRef5(null);
|
|
4010
|
+
useEffect7(() => {
|
|
4011
|
+
const shuffleArray2 = (array) => {
|
|
4012
|
+
if (!isShuffled) {
|
|
4013
|
+
const copyArray = JSON.parse(JSON.stringify(array));
|
|
4014
|
+
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
4015
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
4016
|
+
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
4017
|
+
}
|
|
4018
|
+
setIsShuffled(true);
|
|
4019
|
+
return copyArray;
|
|
4020
|
+
}
|
|
4021
|
+
return array;
|
|
4022
|
+
};
|
|
4023
|
+
const materialList = [];
|
|
4024
|
+
Object.keys(materialMap).forEach((materialKey) => {
|
|
4025
|
+
materialList.push(materialMap[materialKey]);
|
|
4026
|
+
});
|
|
4027
|
+
setShuffledMaterialList(shuffleArray2(materialList));
|
|
4028
|
+
}, []);
|
|
4029
|
+
useEffect7(() => {
|
|
4030
|
+
if (!showCorrectAnswer) return;
|
|
4031
|
+
answer.data.find(
|
|
4032
|
+
(answerData) => answerData.type === "MATCHING"
|
|
4033
|
+
).answerMap = materialMap;
|
|
4034
|
+
}, [showCorrectAnswer]);
|
|
4035
|
+
useEffect7(() => {
|
|
4036
|
+
if (!itemsRef) return;
|
|
4037
|
+
if (!itemsRef.current) return;
|
|
4038
|
+
if (!containerSize) return;
|
|
4039
|
+
itemsRef.current.style.width = `${containerSize.width - 220}px`;
|
|
4040
|
+
}, [itemsRef, containerSize]);
|
|
4041
|
+
const retrieveAnswerMap = () => {
|
|
4042
|
+
const foundIndex = answer.data.findIndex(
|
|
4043
|
+
(answerData) => answerData.type === "MATCHING"
|
|
4044
|
+
);
|
|
4045
|
+
const answerMap2 = answer.data[foundIndex].answerMap;
|
|
4046
|
+
const sortedAnswerMapKeys = Object.keys(answerMap2).sort(
|
|
4047
|
+
(a, b) => answerMap2[a] ? answerMap2[b] ? answerMap2[a].localeCompare(answerMap2[b]) : 1 : -1
|
|
4048
|
+
);
|
|
4049
|
+
const sortedAnswerMap = {};
|
|
4050
|
+
for (const answerMapKey of sortedAnswerMapKeys) {
|
|
4051
|
+
sortedAnswerMap[answerMapKey] = answerMap2[answerMapKey];
|
|
4052
|
+
}
|
|
4053
|
+
return sortedAnswerMap;
|
|
4054
|
+
};
|
|
4055
|
+
const retrieveFilteredMaterialList = (answerMap2) => {
|
|
4056
|
+
const selectedValueList = [];
|
|
4057
|
+
Object.keys(answerMap2).forEach((key) => {
|
|
4058
|
+
selectedValueList.push(answerMap2[key]);
|
|
4059
|
+
});
|
|
4060
|
+
return shuffledMaterialList.filter(
|
|
4061
|
+
(material) => selectedValueList.findIndex((value) => material === value) === -1
|
|
4062
|
+
);
|
|
4063
|
+
};
|
|
4064
|
+
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
4065
|
+
if (!isPreview) return "HIDDEN";
|
|
4066
|
+
if (!learnerAnswer) return "EMPTY";
|
|
4067
|
+
if (correctAnswer === learnerAnswer) {
|
|
4068
|
+
return "CORRECT";
|
|
4069
|
+
}
|
|
4070
|
+
return "INCORRECT";
|
|
4071
|
+
};
|
|
4072
|
+
const handleMatchingActivityItemOnChange = (selectedTargetKey2, selectedValue2) => {
|
|
4073
|
+
if (checkCanAnswerQuestion()) {
|
|
4074
|
+
onChange(answer, selectedTargetKey2, selectedValue2);
|
|
4075
|
+
setSelectedValue(null);
|
|
4076
|
+
}
|
|
4077
|
+
};
|
|
4078
|
+
const answerMap = retrieveAnswerMap();
|
|
4079
|
+
const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
|
|
4080
|
+
return /* @__PURE__ */ jsxs17(Fragment3, { children: [
|
|
4081
|
+
/* @__PURE__ */ jsx24(
|
|
4082
|
+
"div",
|
|
4083
|
+
{
|
|
4084
|
+
ref: itemsRef,
|
|
4085
|
+
className: "flex-1 flex flex-row gap-x-4 gap-y-4 overflow-auto py-2",
|
|
4086
|
+
children: filteredMaterialList.map((materialValue, index) => /* @__PURE__ */ jsx24(
|
|
4087
|
+
DraggableItem_default,
|
|
4088
|
+
{
|
|
4089
|
+
item: { index: materialValue },
|
|
4090
|
+
type: "MATCHING",
|
|
4091
|
+
component: /* @__PURE__ */ jsx24(
|
|
4092
|
+
"div",
|
|
4093
|
+
{
|
|
4094
|
+
className: `${selectedValue === materialValue ? "border-catchup-blue" : "border-catchup-lighter-gray"} h-catchup-activity-covering-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300`,
|
|
4095
|
+
onMouseDown: () => {
|
|
4096
|
+
if (checkCanAnswerQuestion()) {
|
|
4097
|
+
setSelectedValue(materialValue);
|
|
4098
|
+
}
|
|
4099
|
+
},
|
|
4100
|
+
onMouseUp: () => {
|
|
4101
|
+
if (checkCanAnswerQuestion()) {
|
|
4102
|
+
setSelectedValue(null);
|
|
4103
|
+
}
|
|
4104
|
+
},
|
|
4105
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx24(
|
|
4106
|
+
"div",
|
|
4107
|
+
{
|
|
4108
|
+
className: `flex flex-col items-center justify-center m-4 min-h-[64px] min-w-[200px]`,
|
|
4109
|
+
children: /* @__PURE__ */ jsx24("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4110
|
+
materialValue
|
|
4111
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx24(
|
|
4112
|
+
"span",
|
|
4113
|
+
{
|
|
4114
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4115
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx24("span", { className: "text-2xl", children: /* @__PURE__ */ jsx24(InlineMath5, { math: inputPart.value }) }) : inputPart.value
|
|
4116
|
+
},
|
|
4117
|
+
index2
|
|
4118
|
+
)) })
|
|
4119
|
+
}
|
|
4120
|
+
) : /* @__PURE__ */ jsx24(
|
|
4121
|
+
ShowMaterialMediaByContentType_default,
|
|
4122
|
+
{
|
|
4123
|
+
contentType: contentMap.type,
|
|
4124
|
+
src: materialValue,
|
|
4125
|
+
canFullScreen: true
|
|
4126
|
+
},
|
|
4127
|
+
`${uniqueValue}-${index}`
|
|
4128
|
+
)
|
|
4129
|
+
}
|
|
4130
|
+
),
|
|
4131
|
+
moveCardHandler: () => {
|
|
4132
|
+
if (!selectedTargetKey) return;
|
|
4133
|
+
if (!selectedValue) return;
|
|
4134
|
+
handleMatchingActivityItemOnChange(
|
|
4135
|
+
selectedTargetKey,
|
|
4136
|
+
selectedValue
|
|
4137
|
+
);
|
|
4138
|
+
}
|
|
4139
|
+
},
|
|
4140
|
+
index
|
|
4141
|
+
))
|
|
4142
|
+
}
|
|
4143
|
+
),
|
|
4144
|
+
filteredMaterialList.length > 0 ? /* @__PURE__ */ jsx24(DividerLine_default, {}) : null,
|
|
4145
|
+
Object.keys(answerMap).map((answerMapKey, index) => {
|
|
4146
|
+
const learnerAnswerState = checkAnswerState(
|
|
4147
|
+
materialMap[answerMapKey],
|
|
4148
|
+
answerMap[answerMapKey]
|
|
4149
|
+
);
|
|
4150
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex flex-row w-full", children: [
|
|
4151
|
+
/* @__PURE__ */ jsx24("div", { className: "w-1/3", children: /* @__PURE__ */ jsx24(
|
|
4152
|
+
"div",
|
|
4153
|
+
{
|
|
4154
|
+
className: `h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3 ${learnerAnswerState === "EMPTY" ? "border-catchup-blue" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
|
|
4155
|
+
children: /* @__PURE__ */ jsx24(
|
|
4156
|
+
"div",
|
|
4157
|
+
{
|
|
4158
|
+
className: `flex flex-col items-center justify-center transition-all duration-300 m-4`,
|
|
4159
|
+
children: /* @__PURE__ */ jsx24("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
|
|
4160
|
+
(inputPart, index2) => /* @__PURE__ */ jsx24(
|
|
4161
|
+
"span",
|
|
4162
|
+
{
|
|
4163
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4164
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx24("span", { className: "text-2xl", children: /* @__PURE__ */ jsx24(InlineMath5, { math: inputPart.value }) }) : inputPart.value
|
|
4165
|
+
},
|
|
4166
|
+
index2
|
|
4167
|
+
)
|
|
4168
|
+
) })
|
|
4169
|
+
}
|
|
4170
|
+
)
|
|
4171
|
+
}
|
|
4172
|
+
) }),
|
|
4173
|
+
/* @__PURE__ */ jsx24("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
|
|
4174
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1", children: /* @__PURE__ */ jsx24(
|
|
4175
|
+
"div",
|
|
4176
|
+
{
|
|
4177
|
+
className: `${canDrop ? selectedTargetKey === answerMapKey ? "bg-catchup-light-blue" : "bg-catchup-light-blue opacity-40" : ""} h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300 my-3 ${learnerAnswerState === "EMPTY" ? "border-catchup-blue" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
|
|
4178
|
+
onClick: () => {
|
|
4179
|
+
if (checkCanAnswerQuestion()) {
|
|
4180
|
+
setSelectedValue(null);
|
|
4181
|
+
}
|
|
4182
|
+
},
|
|
4183
|
+
children: /* @__PURE__ */ jsx24(
|
|
4184
|
+
DroppableItem_default,
|
|
4185
|
+
{
|
|
4186
|
+
item: { index: answerMapKey },
|
|
4187
|
+
type: "MATCHING",
|
|
4188
|
+
target: selectedTargetKey,
|
|
4189
|
+
setTarget: setSelectedTargetKey,
|
|
4190
|
+
dropRef: drop,
|
|
4191
|
+
component: /* @__PURE__ */ jsx24(
|
|
4192
|
+
"div",
|
|
4193
|
+
{
|
|
4194
|
+
className: `h-full flex-1 flex flex-row items-center justify-center `,
|
|
4195
|
+
onClick: (e) => {
|
|
4196
|
+
e.preventDefault();
|
|
4197
|
+
if (checkCanAnswerQuestion()) {
|
|
4198
|
+
handleMatchingActivityItemOnChange(
|
|
4199
|
+
answerMapKey,
|
|
4200
|
+
null
|
|
4201
|
+
);
|
|
4202
|
+
}
|
|
4203
|
+
},
|
|
4204
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx24("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4205
|
+
answerMap[answerMapKey]
|
|
4206
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx24(
|
|
4207
|
+
"span",
|
|
4208
|
+
{
|
|
4209
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4210
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx24("span", { className: "text-2xl", children: /* @__PURE__ */ jsx24(InlineMath5, { math: inputPart.value }) }) : inputPart.value
|
|
4211
|
+
},
|
|
4212
|
+
index2
|
|
4213
|
+
)) }) : /* @__PURE__ */ jsx24(
|
|
4214
|
+
ShowMaterialMediaByContentType_default,
|
|
4215
|
+
{
|
|
4216
|
+
contentType: contentMap.type,
|
|
4217
|
+
src: answerMap[answerMapKey],
|
|
4218
|
+
canFullScreen: false
|
|
4219
|
+
},
|
|
4220
|
+
`${uniqueValue}-${index}`
|
|
4221
|
+
)
|
|
4222
|
+
}
|
|
4223
|
+
)
|
|
4224
|
+
},
|
|
4225
|
+
index
|
|
4226
|
+
)
|
|
4227
|
+
}
|
|
4228
|
+
) })
|
|
4229
|
+
] }, index);
|
|
4230
|
+
})
|
|
4231
|
+
] });
|
|
4232
|
+
};
|
|
4233
|
+
var MatchingActivityMaterialContent_default = MatchingActivityMaterialContent;
|
|
4234
|
+
|
|
4235
|
+
// src/components/activities/MatchingActivityContent.tsx
|
|
4236
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4237
|
+
var MatchingActivityContent = ({
|
|
4238
|
+
answer,
|
|
4239
|
+
data,
|
|
4240
|
+
canAnswerQuestion,
|
|
4241
|
+
changeAnswer,
|
|
4242
|
+
isPreview,
|
|
4243
|
+
showCorrectAnswer
|
|
4244
|
+
}) => {
|
|
4245
|
+
const contentMap = parseContentMapFromData(data);
|
|
4246
|
+
const matchingBodyMap = parseBodyMapFromData(data, "MATCHING");
|
|
4247
|
+
const matchingMaterialMap = parseMaterialMapFromData(data, "MATCHING");
|
|
4248
|
+
const handleMatchingAnswerOnChange = (answer2, key, value) => {
|
|
4249
|
+
let foundIndex = answer2.data.findIndex(
|
|
4250
|
+
(answerData) => answerData.type === "MATCHING"
|
|
4251
|
+
);
|
|
4252
|
+
const answerMap = answer2.data[foundIndex].answerMap;
|
|
4253
|
+
answerMap[key] = value;
|
|
4254
|
+
changeAnswer(answer2);
|
|
4255
|
+
};
|
|
4256
|
+
return /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
4257
|
+
/* @__PURE__ */ jsx25(
|
|
4258
|
+
ActivityBodyContent_default,
|
|
4259
|
+
{
|
|
4260
|
+
bodyMap: matchingBodyMap,
|
|
4261
|
+
templateType: "MATCHING"
|
|
4262
|
+
}
|
|
4263
|
+
),
|
|
4264
|
+
/* @__PURE__ */ jsx25(DividerLine_default, {}),
|
|
4265
|
+
/* @__PURE__ */ jsx25(
|
|
4266
|
+
MatchingActivityMaterialContent_default,
|
|
4267
|
+
{
|
|
4268
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
4269
|
+
answer,
|
|
4270
|
+
materialMap: matchingMaterialMap,
|
|
4271
|
+
contentMap,
|
|
4272
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
4273
|
+
onChange: handleMatchingAnswerOnChange,
|
|
4274
|
+
isPreview,
|
|
4275
|
+
showCorrectAnswer
|
|
4276
|
+
}
|
|
4277
|
+
)
|
|
4278
|
+
] });
|
|
4279
|
+
};
|
|
4280
|
+
var MatchingActivityContent_default = MatchingActivityContent;
|
|
4281
|
+
|
|
4282
|
+
// src/components/activities/material-content/MCMAActivityMaterialContent.tsx
|
|
4283
|
+
import { InlineMath as InlineMath6 } from "react-katex";
|
|
4284
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4285
|
+
var MCMAActivityMaterialContent = ({
|
|
4286
|
+
uniqueValue,
|
|
4287
|
+
answer,
|
|
4288
|
+
materialMap,
|
|
4289
|
+
contentMap,
|
|
4290
|
+
checkCanAnswerQuestion,
|
|
4291
|
+
onChange,
|
|
4292
|
+
isPreview
|
|
4293
|
+
}) => {
|
|
4294
|
+
const retrieveAnswerMap = () => {
|
|
4295
|
+
const foundIndex = answer.data.findIndex(
|
|
4296
|
+
(answerData) => answerData.type === "MCMA"
|
|
4297
|
+
);
|
|
4298
|
+
return answer.data[foundIndex].answerMap;
|
|
4299
|
+
};
|
|
4300
|
+
const retrieveCorrectAnswerList = () => {
|
|
4301
|
+
return JSON.parse(Object.keys(materialMap)[0]);
|
|
4302
|
+
};
|
|
4303
|
+
const checkAnswerState = (correctAnswerList2, currentAnswer, learnerAnswer) => {
|
|
4304
|
+
if (!isPreview) return "HIDDEN";
|
|
4305
|
+
if (currentAnswer !== learnerAnswer) return "EMPTY";
|
|
4306
|
+
const foundIndex = correctAnswerList2.findIndex(
|
|
4307
|
+
(correctAnswer) => correctAnswer === learnerAnswer
|
|
4308
|
+
);
|
|
4309
|
+
if (foundIndex !== -1) {
|
|
4310
|
+
return "CORRECT";
|
|
4311
|
+
}
|
|
4312
|
+
return "INCORRECT";
|
|
4313
|
+
};
|
|
4314
|
+
const answerMap = retrieveAnswerMap();
|
|
4315
|
+
const correctAnswerList = retrieveCorrectAnswerList();
|
|
4316
|
+
return Object.keys(materialMap).map((materialKey, index) => {
|
|
4317
|
+
return /* @__PURE__ */ jsx26("div", { className: "flex flex-row items-center my-1", children: /* @__PURE__ */ jsxs19("div", { className: "flex-1 flex flex-col justify-center border-catchup-lighter-gray rounded-catchup-xlarge px-5", children: [
|
|
4318
|
+
/* @__PURE__ */ jsx26("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx26("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_mcma_text") }) }),
|
|
4319
|
+
/* @__PURE__ */ jsx26("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx26(DividerLine_default, {}) }),
|
|
4320
|
+
checkCanAnswerQuestion() ? /* @__PURE__ */ jsx26("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
|
|
4321
|
+
(materialSubKey, index2) => {
|
|
4322
|
+
const foundAnswer = answerMap[materialKey].find(
|
|
4323
|
+
(learnerAnswer) => learnerAnswer === materialSubKey
|
|
4324
|
+
);
|
|
4325
|
+
const learnerAnswerState = checkAnswerState(
|
|
4326
|
+
correctAnswerList,
|
|
4327
|
+
materialSubKey,
|
|
4328
|
+
foundAnswer
|
|
4329
|
+
);
|
|
4330
|
+
const foundIndex = correctAnswerList.findIndex(
|
|
4331
|
+
(correctAnswer) => correctAnswer === materialSubKey
|
|
4332
|
+
);
|
|
4333
|
+
return /* @__PURE__ */ jsxs19(
|
|
4334
|
+
"div",
|
|
4335
|
+
{
|
|
4336
|
+
className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 gap-x-2 ${learnerAnswerState === "EMPTY" && foundIndex !== -1 || learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge" : ""}`,
|
|
4337
|
+
onClick: () => {
|
|
4338
|
+
onChange(answer, materialKey, materialSubKey);
|
|
4339
|
+
},
|
|
4340
|
+
children: [
|
|
4341
|
+
/* @__PURE__ */ jsx26("div", { className: "", children: /* @__PURE__ */ jsx26(
|
|
4342
|
+
BaseImage_default,
|
|
4343
|
+
{
|
|
4344
|
+
src: answerMap[materialKey].includes(materialSubKey) ? "/icons/checkbox.png" : "/icons/empty-checkbox.png",
|
|
4345
|
+
alt: "checkbox-empty-checkbox",
|
|
4346
|
+
size: "small",
|
|
4347
|
+
onClick: () => {
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
) }),
|
|
4351
|
+
/* @__PURE__ */ jsx26("div", { className: "flex-1", children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx26("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4352
|
+
materialSubKey
|
|
4353
|
+
).map((inputPart, index3) => /* @__PURE__ */ jsx26(
|
|
4354
|
+
"span",
|
|
4355
|
+
{
|
|
4356
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4357
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx26("span", { className: "text-2xl", children: /* @__PURE__ */ jsx26(InlineMath6, { math: inputPart.value }) }) : inputPart.value
|
|
4358
|
+
},
|
|
4359
|
+
index3
|
|
4360
|
+
)) }) : /* @__PURE__ */ jsx26(
|
|
4361
|
+
ShowMaterialMediaByContentType_default,
|
|
4362
|
+
{
|
|
4363
|
+
contentType: contentMap.type,
|
|
4364
|
+
src: materialSubKey,
|
|
4365
|
+
canFullScreen: true
|
|
4366
|
+
},
|
|
4367
|
+
`${uniqueValue}-${index2}`
|
|
4368
|
+
) })
|
|
4369
|
+
]
|
|
4370
|
+
},
|
|
4371
|
+
index2
|
|
4372
|
+
);
|
|
4373
|
+
}
|
|
4374
|
+
) }) : /* @__PURE__ */ jsx26("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
4375
|
+
answerMap[materialKey]
|
|
4376
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx26(
|
|
4377
|
+
"span",
|
|
4378
|
+
{
|
|
4379
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4380
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx26("span", { className: "text-2xl", children: /* @__PURE__ */ jsx26(InlineMath6, { math: inputPart.value }) }) : inputPart.value
|
|
4381
|
+
},
|
|
4382
|
+
index2
|
|
4383
|
+
)) }, materialKey)
|
|
4384
|
+
] }) }, index);
|
|
4385
|
+
});
|
|
4386
|
+
};
|
|
4387
|
+
var MCMAActivityMaterialContent_default = MCMAActivityMaterialContent;
|
|
4388
|
+
|
|
4389
|
+
// src/components/activities/MCMAActivityContent.tsx
|
|
4390
|
+
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4391
|
+
var MCMAActivityContent = ({
|
|
4392
|
+
answer,
|
|
4393
|
+
data,
|
|
4394
|
+
canAnswerQuestion,
|
|
4395
|
+
changeAnswer,
|
|
4396
|
+
isPreview
|
|
4397
|
+
}) => {
|
|
4398
|
+
const contentMap = parseContentMapFromData(data);
|
|
4399
|
+
const MCMABodyMap = parseBodyMapFromData(data, "MCMA");
|
|
4400
|
+
const MCMAMaterialMap = parseMaterialMapFromData(data, "MCMA");
|
|
4401
|
+
const handleMCMAAnswerOnChange = (answer2, key, value) => {
|
|
4402
|
+
let foundIndex = answer2.data.findIndex(
|
|
4403
|
+
(answerData) => answerData.type === "MCMA"
|
|
4404
|
+
);
|
|
4405
|
+
const answerMap = answer2.data[foundIndex].answerMap;
|
|
4406
|
+
const foundSubIndex = answerMap[key].findIndex(
|
|
4407
|
+
(answerMaterialKey) => answerMaterialKey === value
|
|
4408
|
+
);
|
|
4409
|
+
if (foundSubIndex === -1) {
|
|
4410
|
+
answerMap[key].push(value);
|
|
4411
|
+
} else {
|
|
4412
|
+
answerMap[key].splice(foundSubIndex, 1);
|
|
4413
|
+
}
|
|
4414
|
+
changeAnswer(answer2);
|
|
4415
|
+
};
|
|
4416
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-row flex-wrap", children: [
|
|
4417
|
+
/* @__PURE__ */ jsx27("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ jsx27(ActivityBodyContent_default, { bodyMap: MCMABodyMap, templateType: "MCMA" }) }),
|
|
4418
|
+
/* @__PURE__ */ jsx27("div", { className: "contents md:hidden", children: /* @__PURE__ */ jsx27(DividerLine_default, {}) }),
|
|
4419
|
+
/* @__PURE__ */ jsx27("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx27(VerticalDividerLine_default, {}) }),
|
|
4420
|
+
/* @__PURE__ */ jsx27("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ jsx27(
|
|
4421
|
+
MCMAActivityMaterialContent_default,
|
|
4422
|
+
{
|
|
4423
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
4424
|
+
answer,
|
|
4425
|
+
materialMap: MCMAMaterialMap,
|
|
4426
|
+
contentMap,
|
|
4427
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
4428
|
+
onChange: handleMCMAAnswerOnChange,
|
|
4429
|
+
isPreview
|
|
4430
|
+
}
|
|
4431
|
+
) })
|
|
4432
|
+
] });
|
|
4433
|
+
};
|
|
4434
|
+
var MCMAActivityContent_default = MCMAActivityContent;
|
|
4435
|
+
|
|
4436
|
+
// src/components/activities/material-content/MCSAActivityMaterialContent.tsx
|
|
4437
|
+
import { InlineMath as InlineMath7 } from "react-katex";
|
|
4438
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4439
|
+
var MCSAActivityMaterialContent = ({
|
|
4440
|
+
uniqueValue,
|
|
4441
|
+
answer,
|
|
4442
|
+
materialMap,
|
|
4443
|
+
contentMap,
|
|
4444
|
+
checkCanAnswerQuestion,
|
|
4445
|
+
onChange,
|
|
4446
|
+
isPreview
|
|
4447
|
+
}) => {
|
|
4448
|
+
const retrieveAnswerMap = () => {
|
|
4449
|
+
const foundIndex = answer.data.findIndex(
|
|
4450
|
+
(answerData) => answerData.type === "MCSA"
|
|
4451
|
+
);
|
|
4452
|
+
return answer.data[foundIndex].answerMap;
|
|
4453
|
+
};
|
|
4454
|
+
const retrieveCorrectAnswer = () => {
|
|
4455
|
+
return Object.keys(materialMap)[0];
|
|
4456
|
+
};
|
|
4457
|
+
const checkAnswerState = (correctAnswer2, currentAnswer, learnerAnswer) => {
|
|
4458
|
+
if (!isPreview) return "HIDDEN";
|
|
4459
|
+
if (currentAnswer !== learnerAnswer) return "EMPTY";
|
|
4460
|
+
if (correctAnswer2 === learnerAnswer) {
|
|
4461
|
+
return "CORRECT";
|
|
4462
|
+
}
|
|
4463
|
+
return "INCORRECT";
|
|
4464
|
+
};
|
|
4465
|
+
const answerMap = retrieveAnswerMap();
|
|
4466
|
+
const correctAnswer = retrieveCorrectAnswer();
|
|
4467
|
+
return Object.keys(materialMap).map((materialKey, index) => {
|
|
4468
|
+
return /* @__PURE__ */ jsx28("div", { className: "flex flex-row items-center my-1", children: /* @__PURE__ */ jsxs21("div", { className: "flex-1 flex flex-col justify-center border-catchup-lighter-gray rounded-catchup-xlarge px-5", children: [
|
|
4469
|
+
/* @__PURE__ */ jsx28("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx28("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_mcsa_text") }) }),
|
|
4470
|
+
/* @__PURE__ */ jsx28("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx28(DividerLine_default, {}) }),
|
|
4471
|
+
checkCanAnswerQuestion() ? /* @__PURE__ */ jsx28(
|
|
4472
|
+
"div",
|
|
4473
|
+
{
|
|
4474
|
+
className: `flex flex-row w-full ${Object.keys(materialMap[materialKey]).length <= 4 ? "justify-center" : ""} flex-wrap`,
|
|
4475
|
+
children: materialMap[materialKey].map(
|
|
4476
|
+
(materialSubKey, index2) => {
|
|
4477
|
+
const learnerAnswerState = checkAnswerState(
|
|
4478
|
+
correctAnswer,
|
|
4479
|
+
materialSubKey,
|
|
4480
|
+
answerMap[materialKey]
|
|
4481
|
+
);
|
|
4482
|
+
return /* @__PURE__ */ jsxs21(
|
|
4483
|
+
"div",
|
|
4484
|
+
{
|
|
4485
|
+
className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 gap-x-2 ${learnerAnswerState === "EMPTY" && materialSubKey === correctAnswer || learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge" : ""}`,
|
|
4486
|
+
onClick: () => {
|
|
4487
|
+
onChange(answer, materialKey, materialSubKey);
|
|
4488
|
+
},
|
|
4489
|
+
children: [
|
|
4490
|
+
/* @__PURE__ */ jsx28("div", { className: "", children: /* @__PURE__ */ jsx28(
|
|
4491
|
+
BaseImage_default,
|
|
4492
|
+
{
|
|
4493
|
+
src: answerMap[materialKey] === materialSubKey ? "/icons/item-element.png" : "/icons/not-selected-item-element.png",
|
|
4494
|
+
alt: "circle",
|
|
4495
|
+
size: "small",
|
|
4496
|
+
onClick: () => {
|
|
4497
|
+
}
|
|
4498
|
+
}
|
|
4499
|
+
) }),
|
|
4500
|
+
/* @__PURE__ */ jsx28("div", { className: "flex-1", children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx28("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4501
|
+
materialSubKey
|
|
4502
|
+
).map((inputPart, index3) => /* @__PURE__ */ jsx28(
|
|
4503
|
+
"span",
|
|
4504
|
+
{
|
|
4505
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4506
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx28("span", { className: "text-2xl", children: /* @__PURE__ */ jsx28(InlineMath7, { math: inputPart.value }) }) : inputPart.value
|
|
4507
|
+
},
|
|
4508
|
+
index3
|
|
4509
|
+
)) }) : /* @__PURE__ */ jsx28(
|
|
4510
|
+
ShowMaterialMediaByContentType_default,
|
|
4511
|
+
{
|
|
4512
|
+
contentType: contentMap.type,
|
|
4513
|
+
src: materialSubKey,
|
|
4514
|
+
canFullScreen: true
|
|
4515
|
+
},
|
|
4516
|
+
`${uniqueValue}-${index2}`
|
|
4517
|
+
) })
|
|
4518
|
+
]
|
|
4519
|
+
},
|
|
4520
|
+
index2
|
|
4521
|
+
);
|
|
4522
|
+
}
|
|
4523
|
+
)
|
|
4524
|
+
}
|
|
4525
|
+
) : /* @__PURE__ */ jsx28("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4526
|
+
answerMap[materialKey]
|
|
4527
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx28(
|
|
4528
|
+
"span",
|
|
4529
|
+
{
|
|
4530
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4531
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx28("span", { className: "text-2xl", children: /* @__PURE__ */ jsx28(InlineMath7, { math: inputPart.value }) }) : inputPart.value
|
|
4532
|
+
},
|
|
4533
|
+
index2
|
|
4534
|
+
)) })
|
|
4535
|
+
] }) }, index);
|
|
4536
|
+
});
|
|
4537
|
+
};
|
|
4538
|
+
var MCSAActivityMaterialContent_default = MCSAActivityMaterialContent;
|
|
4539
|
+
|
|
4540
|
+
// src/components/activities/MCSAActivityContent.tsx
|
|
4541
|
+
import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4542
|
+
var MCSAActivityContent = ({
|
|
4543
|
+
answer,
|
|
4544
|
+
data,
|
|
4545
|
+
canAnswerQuestion,
|
|
4546
|
+
changeAnswer,
|
|
4547
|
+
isPreview
|
|
4548
|
+
}) => {
|
|
4549
|
+
const contentMap = parseContentMapFromData(data);
|
|
4550
|
+
const MCSABodyMap = parseBodyMapFromData(data, "MCSA");
|
|
4551
|
+
const MCSAMaterialMap = parseMaterialMapFromData(data, "MCSA");
|
|
4552
|
+
const handleMCSAAnswerOnChange = (answer2, key, value) => {
|
|
4553
|
+
let foundIndex = answer2.data.findIndex(
|
|
4554
|
+
(answerData) => answerData.type === "MCSA"
|
|
4555
|
+
);
|
|
4556
|
+
const answerMap = answer2.data[foundIndex].answerMap;
|
|
4557
|
+
answerMap[key] = value;
|
|
4558
|
+
changeAnswer(answer2);
|
|
4559
|
+
};
|
|
4560
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex flex-row flex-wrap", children: [
|
|
4561
|
+
/* @__PURE__ */ jsx29("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ jsx29(ActivityBodyContent_default, { bodyMap: MCSABodyMap, templateType: "MCSA" }) }),
|
|
4562
|
+
/* @__PURE__ */ jsx29("div", { className: "contents md:hidden", children: /* @__PURE__ */ jsx29(DividerLine_default, {}) }),
|
|
4563
|
+
/* @__PURE__ */ jsx29("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx29(VerticalDividerLine_default, {}) }),
|
|
4564
|
+
/* @__PURE__ */ jsx29("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ jsx29(
|
|
4565
|
+
MCSAActivityMaterialContent_default,
|
|
4566
|
+
{
|
|
4567
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
4568
|
+
answer,
|
|
4569
|
+
materialMap: MCSAMaterialMap,
|
|
4570
|
+
contentMap,
|
|
4571
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
4572
|
+
onChange: handleMCSAAnswerOnChange,
|
|
4573
|
+
isPreview
|
|
4574
|
+
}
|
|
4575
|
+
) })
|
|
4576
|
+
] });
|
|
4577
|
+
};
|
|
4578
|
+
var MCSAActivityContent_default = MCSAActivityContent;
|
|
4579
|
+
|
|
4580
|
+
// src/components/activities/material-content/OpenEndedActivityMaterialContent.tsx
|
|
4581
|
+
import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4582
|
+
var OpenEndedActivityMaterialContent = ({
|
|
4583
|
+
answer,
|
|
4584
|
+
contentMap,
|
|
4585
|
+
onChange
|
|
4586
|
+
}) => {
|
|
4587
|
+
const retrieveAnswer = () => {
|
|
4588
|
+
if (!answer)
|
|
4589
|
+
return {
|
|
4590
|
+
answerMap: {
|
|
4591
|
+
ANSWER: ""
|
|
4592
|
+
}
|
|
4593
|
+
};
|
|
4594
|
+
return answer.data.find(
|
|
4595
|
+
(answerData) => answerData.type === "OPEN_ENDED"
|
|
4596
|
+
);
|
|
4597
|
+
};
|
|
4598
|
+
const retrieveAnswerMap = () => {
|
|
4599
|
+
const { answerMap: answerMap2 } = retrieveAnswer();
|
|
4600
|
+
return answerMap2;
|
|
4601
|
+
};
|
|
4602
|
+
const checkShowContent = () => {
|
|
4603
|
+
return false;
|
|
4604
|
+
};
|
|
4605
|
+
const RenderTextContent = (answerMap2) => {
|
|
4606
|
+
const answerMapAnswer = answerMap2["ANSWER"];
|
|
4607
|
+
return /* @__PURE__ */ jsx30(
|
|
4608
|
+
InputGroup_default,
|
|
4609
|
+
{
|
|
4610
|
+
type: "textarea",
|
|
4611
|
+
value: answerMapAnswer,
|
|
4612
|
+
useMinHeight: true,
|
|
4613
|
+
onChange: (e) => {
|
|
4614
|
+
onChange(answer, e.target.value);
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4617
|
+
);
|
|
4618
|
+
};
|
|
4619
|
+
const answerMap = retrieveAnswerMap();
|
|
4620
|
+
return /* @__PURE__ */ jsx30(Fragment5, { children: /* @__PURE__ */ jsxs23("div", { className: "", children: [
|
|
4621
|
+
/* @__PURE__ */ jsx30("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx30("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_open_ended_text") }) }),
|
|
4622
|
+
/* @__PURE__ */ jsx30("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx30(DividerLine_default, {}) }),
|
|
4623
|
+
contentMap.type === "TEXT" ? RenderTextContent(answerMap) : null
|
|
4624
|
+
] }) });
|
|
4625
|
+
};
|
|
4626
|
+
var OpenEndedActivityMaterialContent_default = OpenEndedActivityMaterialContent;
|
|
4627
|
+
|
|
4628
|
+
// src/components/activities/OpenEndedActivityContent.tsx
|
|
4629
|
+
import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4630
|
+
var OpenEndedActivityContent = ({
|
|
4631
|
+
answer,
|
|
4632
|
+
data,
|
|
4633
|
+
changeAnswer,
|
|
4634
|
+
showMaterialContent
|
|
4635
|
+
}) => {
|
|
4636
|
+
const contentMap = parseContentMapFromData(data);
|
|
4637
|
+
const openEndedBodyMap = parseBodyMapFromData(data, "OPEN_ENDED");
|
|
4638
|
+
const handleOpenEndedAnswerOnChange = (answer2, value) => {
|
|
4639
|
+
let foundIndex = answer2.data.findIndex(
|
|
4640
|
+
(answerData) => answerData.type === "OPEN_ENDED"
|
|
4641
|
+
);
|
|
4642
|
+
const answerMap = answer2.data[foundIndex].answerMap;
|
|
4643
|
+
answerMap["ANSWER"] = value;
|
|
4644
|
+
changeAnswer(answer2);
|
|
4645
|
+
};
|
|
4646
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-row flex-wrap", children: [
|
|
4647
|
+
/* @__PURE__ */ jsx31(
|
|
4648
|
+
"div",
|
|
4649
|
+
{
|
|
4650
|
+
className: `${showMaterialContent ? "w-full md:w-[40%]" : "w-full"}`,
|
|
4651
|
+
children: /* @__PURE__ */ jsx31(
|
|
4652
|
+
ActivityBodyContent_default,
|
|
4653
|
+
{
|
|
4654
|
+
bodyMap: openEndedBodyMap,
|
|
4655
|
+
templateType: "OPEN_ENDED"
|
|
4656
|
+
}
|
|
4657
|
+
)
|
|
4658
|
+
}
|
|
4659
|
+
),
|
|
4660
|
+
showMaterialContent ? /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
4661
|
+
/* @__PURE__ */ jsx31("div", { className: "contents md:hidden", children: /* @__PURE__ */ jsx31(DividerLine_default, {}) }),
|
|
4662
|
+
/* @__PURE__ */ jsx31("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx31(VerticalDividerLine_default, {}) }),
|
|
4663
|
+
/* @__PURE__ */ jsx31("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ jsx31(
|
|
4664
|
+
OpenEndedActivityMaterialContent_default,
|
|
4665
|
+
{
|
|
4666
|
+
answer,
|
|
4667
|
+
contentMap,
|
|
4668
|
+
onChange: handleOpenEndedAnswerOnChange
|
|
4669
|
+
}
|
|
4670
|
+
) })
|
|
4671
|
+
] }) : null
|
|
4672
|
+
] });
|
|
4673
|
+
};
|
|
4674
|
+
var OpenEndedActivityContent_default = OpenEndedActivityContent;
|
|
4675
|
+
|
|
4676
|
+
// src/components/activities/material-content/OrderingActivityMaterialContent.tsx
|
|
4677
|
+
import { useEffect as useEffect8, useState as useState16 } from "react";
|
|
4678
|
+
import { useDrop as useDrop6 } from "react-dnd";
|
|
4679
|
+
import { InlineMath as InlineMath8 } from "react-katex";
|
|
4680
|
+
|
|
4681
|
+
// src/components/dnds/DraggableDroppableItem.tsx
|
|
4682
|
+
import { useRef as useRef6 } from "react";
|
|
4683
|
+
import { useDrag as useDrag2, useDrop as useDrop5 } from "react-dnd";
|
|
4684
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
4685
|
+
var DraggableDroppableItem = ({
|
|
4686
|
+
key,
|
|
4687
|
+
item,
|
|
4688
|
+
type,
|
|
4689
|
+
component,
|
|
4690
|
+
moveCardHandler,
|
|
4691
|
+
dropRef,
|
|
4692
|
+
target,
|
|
4693
|
+
setTarget
|
|
4694
|
+
}) => {
|
|
4695
|
+
const ref = useRef6(null);
|
|
4696
|
+
const [, drop] = useDrop5({
|
|
4697
|
+
accept: type,
|
|
4698
|
+
hover() {
|
|
4699
|
+
if (!ref.current) {
|
|
4700
|
+
return;
|
|
4701
|
+
}
|
|
4702
|
+
if (item.index && target !== item.index) {
|
|
4703
|
+
setTarget(item.index);
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
});
|
|
4707
|
+
const [{ isDragging }, drag] = useDrag2({
|
|
4708
|
+
type,
|
|
4709
|
+
item,
|
|
4710
|
+
end: (item2, monitor) => {
|
|
4711
|
+
const dropResult = monitor.getDropResult();
|
|
4712
|
+
if (dropResult) {
|
|
4713
|
+
moveCardHandler();
|
|
4714
|
+
}
|
|
4715
|
+
},
|
|
4716
|
+
collect: (monitor) => ({
|
|
4717
|
+
isDragging: monitor.isDragging()
|
|
4718
|
+
})
|
|
4719
|
+
});
|
|
4720
|
+
const opacity = isDragging ? 0.4 : 1;
|
|
4721
|
+
drag(drop(ref));
|
|
4722
|
+
return /* @__PURE__ */ jsx32(
|
|
4723
|
+
"div",
|
|
4724
|
+
{
|
|
4725
|
+
className: `${isDragging ? "w-[0px] opacity-0" : "w-full opacity-100"} transition-all duration-500`,
|
|
4726
|
+
ref: dropRef,
|
|
4727
|
+
children: /* @__PURE__ */ jsx32("div", { ref, className: "w-full", style: { opacity }, children: component })
|
|
4728
|
+
},
|
|
4729
|
+
key
|
|
4730
|
+
);
|
|
4731
|
+
};
|
|
4732
|
+
var DraggableDroppableItem_default = DraggableDroppableItem;
|
|
4733
|
+
|
|
4734
|
+
// src/components/activities/material-content/OrderingActivityMaterialContent.tsx
|
|
4735
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4736
|
+
var OrderingActivityMaterialContent = ({
|
|
4737
|
+
uniqueValue,
|
|
4738
|
+
answer,
|
|
4739
|
+
materialMap,
|
|
4740
|
+
contentMap,
|
|
4741
|
+
checkCanAnswerQuestion,
|
|
4742
|
+
onChange,
|
|
4743
|
+
isPreview,
|
|
4744
|
+
showCorrectAnswer
|
|
4745
|
+
}) => {
|
|
4746
|
+
const [selectedTargetKey, setSelectedTargetKey] = useState16(null);
|
|
4747
|
+
const [selectedKey, setSelectedKey] = useState16(null);
|
|
4748
|
+
const { screenSize } = useScreenSize_default();
|
|
4749
|
+
const [view, setView] = useState16("PC");
|
|
4750
|
+
const [{ isOver, canDrop }, drop] = useDrop6({
|
|
4751
|
+
accept: "ORDERING",
|
|
4752
|
+
drop: () => {
|
|
4753
|
+
},
|
|
4754
|
+
collect: (monitor) => ({
|
|
4755
|
+
isOver: monitor.isOver(),
|
|
4756
|
+
canDrop: monitor.canDrop()
|
|
4757
|
+
})
|
|
4758
|
+
});
|
|
4759
|
+
useEffect8(() => {
|
|
4760
|
+
if (!screenSize) return;
|
|
4761
|
+
if (screenSize.width <= 768) {
|
|
4762
|
+
setView("TABLET");
|
|
4763
|
+
} else {
|
|
4764
|
+
setView("PC");
|
|
4765
|
+
}
|
|
4766
|
+
}, [screenSize]);
|
|
4767
|
+
useEffect8(() => {
|
|
4768
|
+
if (!showCorrectAnswer) return;
|
|
4769
|
+
const answerMap2 = answer.data.find(
|
|
4770
|
+
(answerData) => answerData.type === "ORDERING"
|
|
4771
|
+
).answerMap;
|
|
4772
|
+
Object.keys(answerMap2).forEach((answerKey, index) => {
|
|
4773
|
+
answerMap2[answerKey] = index;
|
|
4774
|
+
});
|
|
4775
|
+
}, [showCorrectAnswer]);
|
|
4776
|
+
const retrieveAnswerMap = () => {
|
|
4777
|
+
const foundIndex = answer.data.findIndex(
|
|
4778
|
+
(answerData) => answerData.type === "ORDERING"
|
|
4779
|
+
);
|
|
4780
|
+
return answer.data[foundIndex].answerMap;
|
|
4781
|
+
};
|
|
4782
|
+
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
4783
|
+
if (!isPreview) return "HIDDEN";
|
|
4784
|
+
if (correctAnswer === learnerAnswer) {
|
|
4785
|
+
return "CORRECT";
|
|
4786
|
+
}
|
|
4787
|
+
return "INCORRECT";
|
|
4788
|
+
};
|
|
4789
|
+
const handleOrderingActivityItemChange = (selectedKey2, materialKey) => {
|
|
4790
|
+
if (checkCanAnswerQuestion()) {
|
|
4791
|
+
if (selectedKey2) {
|
|
4792
|
+
onChange(answer, selectedKey2, materialKey);
|
|
4793
|
+
setSelectedKey(null);
|
|
4794
|
+
} else {
|
|
4795
|
+
setSelectedKey(materialKey);
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4798
|
+
};
|
|
4799
|
+
const calculateMarginTop = (index) => {
|
|
4800
|
+
if (index === 0) {
|
|
4801
|
+
return 0;
|
|
4802
|
+
} else if (index === 1) {
|
|
4803
|
+
return 150;
|
|
4804
|
+
} else if (index % 2 === 0) {
|
|
4805
|
+
return -150;
|
|
4806
|
+
} else if (index % 2 === 1) {
|
|
4807
|
+
return 0;
|
|
4808
|
+
}
|
|
4809
|
+
return 0;
|
|
4810
|
+
};
|
|
4811
|
+
const answerMap = retrieveAnswerMap();
|
|
4812
|
+
return /* @__PURE__ */ jsx33("div", { className: "flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
|
|
4813
|
+
const learnerAnswerState = checkAnswerState(
|
|
4814
|
+
answerMap[materialKey] + "",
|
|
4815
|
+
index + ""
|
|
4816
|
+
);
|
|
4817
|
+
return /* @__PURE__ */ jsx33("div", { className: "w-full lg:w-1/2", children: /* @__PURE__ */ jsxs25(
|
|
4818
|
+
"div",
|
|
4819
|
+
{
|
|
4820
|
+
className: `flex flex-row items-center my-4 mx-2`,
|
|
4821
|
+
style: {
|
|
4822
|
+
marginTop: view === "PC" ? calculateMarginTop(parseFloat(materialKey)) : 0
|
|
4823
|
+
},
|
|
4824
|
+
children: [
|
|
4825
|
+
/* @__PURE__ */ jsx33("div", { className: "mr-3", children: /* @__PURE__ */ jsx33(
|
|
4826
|
+
"div",
|
|
4827
|
+
{
|
|
4828
|
+
className: `${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : selectedKey === materialKey ? "border-catchup-blue" : "border-catchup-lighter-gray"} min-h-catchup-activity-outer-box-item w-catchup-activity-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300`,
|
|
4829
|
+
children: /* @__PURE__ */ jsx33(
|
|
4830
|
+
"div",
|
|
4831
|
+
{
|
|
4832
|
+
className: `${selectedKey === materialKey ? "border-2 border-catchup-light-gray" : "border-2 border-catchup-blue"} flex flex-col items-center justify-center transition-all duration-300 rounded-catchup-full w-[50px] h-[50px]`,
|
|
4833
|
+
children: /* @__PURE__ */ jsx33("p", { className: "", children: parseFloat(materialKey) + 1 })
|
|
4834
|
+
}
|
|
4835
|
+
)
|
|
4836
|
+
}
|
|
4837
|
+
) }),
|
|
4838
|
+
/* @__PURE__ */ jsx33(
|
|
4839
|
+
DraggableDroppableItem_default,
|
|
4840
|
+
{
|
|
4841
|
+
item: { index: materialKey },
|
|
4842
|
+
type: "ORDERING",
|
|
4843
|
+
dropRef: drop,
|
|
4844
|
+
component: /* @__PURE__ */ jsx33(
|
|
4845
|
+
"div",
|
|
4846
|
+
{
|
|
4847
|
+
className: `${canDrop ? selectedKey !== materialKey ? selectedTargetKey === materialKey ? "bg-catchup-light-blue rounded-catchup-xlarge" : "bg-catchup-light-blue rounded-catchup-xlarge opacity-40" : "" : ""} flex-1 min-h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer p-3 ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
|
|
4848
|
+
onMouseDown: () => {
|
|
4849
|
+
if (checkCanAnswerQuestion()) {
|
|
4850
|
+
setSelectedKey(materialKey);
|
|
4851
|
+
}
|
|
4852
|
+
},
|
|
4853
|
+
children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx33("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
4854
|
+
materialMap[answerMap[materialKey]]
|
|
4855
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx33(
|
|
4856
|
+
"span",
|
|
4857
|
+
{
|
|
4858
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
4859
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx33("span", { className: "text-2xl", children: /* @__PURE__ */ jsx33(InlineMath8, { math: inputPart.value }) }) : inputPart.value
|
|
4860
|
+
},
|
|
4861
|
+
index2
|
|
4862
|
+
)) }) : /* @__PURE__ */ jsx33(
|
|
4863
|
+
ShowMaterialMediaByContentType_default,
|
|
4864
|
+
{
|
|
4865
|
+
contentType: contentMap.type,
|
|
4866
|
+
src: materialMap[answerMap[materialKey]],
|
|
4867
|
+
canFullScreen: true
|
|
4868
|
+
},
|
|
4869
|
+
`${uniqueValue}-${index}`
|
|
4870
|
+
)
|
|
4871
|
+
}
|
|
4872
|
+
),
|
|
4873
|
+
target: selectedTargetKey,
|
|
4874
|
+
setTarget: setSelectedTargetKey,
|
|
4875
|
+
moveCardHandler: () => {
|
|
4876
|
+
if (!selectedKey) return;
|
|
4877
|
+
if (!selectedTargetKey) return;
|
|
4878
|
+
handleOrderingActivityItemChange(
|
|
4879
|
+
selectedKey,
|
|
4880
|
+
selectedTargetKey
|
|
4881
|
+
);
|
|
4882
|
+
}
|
|
4883
|
+
},
|
|
4884
|
+
index
|
|
4885
|
+
)
|
|
4886
|
+
]
|
|
4887
|
+
}
|
|
4888
|
+
) }, index);
|
|
4889
|
+
}) });
|
|
4890
|
+
};
|
|
4891
|
+
var OrderingActivityMaterialContent_default = OrderingActivityMaterialContent;
|
|
4892
|
+
|
|
4893
|
+
// src/components/activities/OrderingActivityContent.tsx
|
|
4894
|
+
import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4895
|
+
var OrderingActivityContent = ({
|
|
4896
|
+
answer,
|
|
4897
|
+
data,
|
|
4898
|
+
canAnswerQuestion,
|
|
4899
|
+
changeAnswer,
|
|
4900
|
+
isPreview,
|
|
4901
|
+
showCorrectAnswer
|
|
4902
|
+
}) => {
|
|
4903
|
+
const contentMap = parseContentMapFromData(data);
|
|
4904
|
+
const orderingBodyMap = parseBodyMapFromData(data, "ORDERING");
|
|
4905
|
+
const orderingMaterialMap = parseMaterialMapFromData(data, "ORDERING");
|
|
4906
|
+
const handleOrderingAnswerOnChange = (answer2, primaryKey, secondaryKey) => {
|
|
4907
|
+
let foundIndex = answer2.data.findIndex(
|
|
4908
|
+
(answerData) => answerData.type === "ORDERING"
|
|
4909
|
+
);
|
|
4910
|
+
const answerMap = answer2.data[foundIndex].answerMap;
|
|
4911
|
+
const prevValue = answerMap[primaryKey];
|
|
4912
|
+
answerMap[primaryKey] = answerMap[secondaryKey];
|
|
4913
|
+
answerMap[secondaryKey] = prevValue;
|
|
4914
|
+
changeAnswer(answer2);
|
|
4915
|
+
};
|
|
4916
|
+
return /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
4917
|
+
/* @__PURE__ */ jsx34(
|
|
4918
|
+
ActivityBodyContent_default,
|
|
4919
|
+
{
|
|
4920
|
+
bodyMap: orderingBodyMap,
|
|
4921
|
+
templateType: "ORDERING"
|
|
4922
|
+
}
|
|
4923
|
+
),
|
|
4924
|
+
/* @__PURE__ */ jsx34(DividerLine_default, {}),
|
|
4925
|
+
/* @__PURE__ */ jsx34(
|
|
4926
|
+
OrderingActivityMaterialContent_default,
|
|
4927
|
+
{
|
|
4928
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
4929
|
+
answer,
|
|
4930
|
+
materialMap: orderingMaterialMap,
|
|
4931
|
+
contentMap,
|
|
4932
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
4933
|
+
onChange: handleOrderingAnswerOnChange,
|
|
4934
|
+
isPreview,
|
|
4935
|
+
showCorrectAnswer
|
|
4936
|
+
}
|
|
4937
|
+
)
|
|
4938
|
+
] });
|
|
4939
|
+
};
|
|
4940
|
+
var OrderingActivityContent_default = OrderingActivityContent;
|
|
4941
|
+
|
|
4942
|
+
// src/components/activities/material-content/TrueFalseActivityMaterialContent.tsx
|
|
4943
|
+
import { useEffect as useEffect9, useState as useState17 } from "react";
|
|
4944
|
+
import { InlineMath as InlineMath9 } from "react-katex";
|
|
4945
|
+
import { Fragment as Fragment8, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4946
|
+
var TrueFalseActivityMaterialContent = ({
|
|
4947
|
+
uniqueValue,
|
|
4948
|
+
answer,
|
|
4949
|
+
materialMap,
|
|
4950
|
+
contentMap,
|
|
4951
|
+
checkCanAnswerQuestion,
|
|
4952
|
+
onChange,
|
|
4953
|
+
isPreview,
|
|
4954
|
+
showCorrectAnswer
|
|
4955
|
+
}) => {
|
|
4956
|
+
const { screenSize } = useScreenSize_default();
|
|
4957
|
+
const [shuffleOptionList, setShuffleOptionList] = useState17([]);
|
|
4958
|
+
useEffect9(() => {
|
|
4959
|
+
const optionList = [];
|
|
4960
|
+
optionList.push(...materialMap.trueList);
|
|
4961
|
+
optionList.push(...materialMap.falseList);
|
|
4962
|
+
if (isPreview) {
|
|
4963
|
+
setShuffleOptionList(optionList);
|
|
4964
|
+
} else {
|
|
4965
|
+
setShuffleOptionList(shuffleArray(optionList));
|
|
4966
|
+
}
|
|
4967
|
+
}, []);
|
|
4968
|
+
useEffect9(() => {
|
|
4969
|
+
if (!showCorrectAnswer) return;
|
|
4970
|
+
answer.data.find(
|
|
4971
|
+
(answerData) => answerData.type === "TRUE_FALSE"
|
|
4972
|
+
).answerMap = materialMap;
|
|
4973
|
+
}, [showCorrectAnswer]);
|
|
4974
|
+
const retrieveAnswer = () => {
|
|
4975
|
+
if (!answer)
|
|
4976
|
+
return {
|
|
4977
|
+
answerMap: {
|
|
4978
|
+
trueList: [],
|
|
4979
|
+
falseList: []
|
|
4980
|
+
}
|
|
4981
|
+
};
|
|
4982
|
+
return answer.data.find(
|
|
4983
|
+
(answerData) => answerData.type === "TRUE_FALSE"
|
|
4984
|
+
);
|
|
4985
|
+
};
|
|
4986
|
+
const retrieveAnswerMap = () => {
|
|
4987
|
+
const { answerMap: answerMap2 } = retrieveAnswer();
|
|
4988
|
+
return answerMap2;
|
|
4989
|
+
};
|
|
4990
|
+
const checkAnswerState = (correctAnswer, learnerAnswer) => {
|
|
4991
|
+
if (!isPreview) return "HIDDEN";
|
|
4992
|
+
if (correctAnswer === learnerAnswer) {
|
|
4993
|
+
return "CORRECT";
|
|
4994
|
+
}
|
|
4995
|
+
return "INCORRECT";
|
|
4996
|
+
};
|
|
4997
|
+
const answerMap = retrieveAnswerMap();
|
|
4998
|
+
return /* @__PURE__ */ jsxs27("div", { className: "", children: [
|
|
4999
|
+
/* @__PURE__ */ jsx35("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx35("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_true_false_text") }) }),
|
|
5000
|
+
/* @__PURE__ */ jsx35("div", { className: "hidden md:contents", children: /* @__PURE__ */ jsx35(DividerLine_default, {}) }),
|
|
5001
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-row justify-end items-center gap-x-2", children: [
|
|
5002
|
+
/* @__PURE__ */ jsx35("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx35("p", { className: "font-bold text-lg", children: i18n_default.t("true") }) }),
|
|
5003
|
+
/* @__PURE__ */ jsx35("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx35("p", { className: "font-bold text-lg", children: i18n_default.t("false") }) })
|
|
5004
|
+
] }),
|
|
5005
|
+
checkCanAnswerQuestion() ? /* @__PURE__ */ jsx35("div", { className: `flex flex-row w-full justify-center flex-wrap`, children: shuffleOptionList.map((shuffleOption, index) => {
|
|
5006
|
+
const correctAnswer = materialMap.trueList.find(
|
|
5007
|
+
(trueItem) => trueItem === shuffleOption
|
|
5008
|
+
) !== void 0 ? "TRUE" : "FALSE";
|
|
5009
|
+
const learnerAnswer = answerMap.trueList.find(
|
|
5010
|
+
(trueItem) => trueItem === shuffleOption
|
|
5011
|
+
) !== void 0 ? "TRUE" : "FALSE";
|
|
5012
|
+
const learnerAnswerState = checkAnswerState(
|
|
5013
|
+
correctAnswer,
|
|
5014
|
+
learnerAnswer
|
|
5015
|
+
);
|
|
5016
|
+
return /* @__PURE__ */ jsxs27(
|
|
5017
|
+
"div",
|
|
5018
|
+
{
|
|
5019
|
+
className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 ${learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge" : ""}`,
|
|
5020
|
+
children: [
|
|
5021
|
+
/* @__PURE__ */ jsx35("div", { className: "flex-1", children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx35("p", { className: "text-xl p-2 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
|
|
5022
|
+
shuffleOption
|
|
5023
|
+
).map((inputPart, index2) => /* @__PURE__ */ jsx35(
|
|
5024
|
+
"span",
|
|
5025
|
+
{
|
|
5026
|
+
className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
|
|
5027
|
+
children: inputPart.isEquation ? /* @__PURE__ */ jsx35("span", { className: "text-2xl", children: /* @__PURE__ */ jsx35(InlineMath9, { math: inputPart.value }) }) : inputPart.value
|
|
5028
|
+
},
|
|
5029
|
+
index2
|
|
5030
|
+
)) }) : /* @__PURE__ */ jsx35(
|
|
5031
|
+
ShowMaterialMediaByContentType_default,
|
|
5032
|
+
{
|
|
5033
|
+
contentType: contentMap.type,
|
|
5034
|
+
src: shuffleOption,
|
|
5035
|
+
canFullScreen: true
|
|
5036
|
+
},
|
|
5037
|
+
`${uniqueValue}-${index}`
|
|
5038
|
+
) }),
|
|
5039
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-row items-center gap-x-2", children: [
|
|
5040
|
+
/* @__PURE__ */ jsx35("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx35("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ jsx35(
|
|
5041
|
+
BaseImage_default,
|
|
5042
|
+
{
|
|
5043
|
+
src: answerMap.trueList.includes(shuffleOption) ? "/icons/checkbox.png" : "/icons/empty-checkbox.png",
|
|
5044
|
+
alt: "checkbox-empty-checkbox",
|
|
5045
|
+
size: "small",
|
|
5046
|
+
onClick: () => {
|
|
5047
|
+
onChange(answer, "TRUE", shuffleOption);
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
) }) }),
|
|
5051
|
+
/* @__PURE__ */ jsx35("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx35("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ jsx35(
|
|
5052
|
+
BaseImage_default,
|
|
5053
|
+
{
|
|
5054
|
+
src: answerMap.falseList.includes(shuffleOption) ? "/icons/checkbox.png" : "/icons/empty-checkbox.png",
|
|
5055
|
+
alt: "checkbox-empty-checkbox",
|
|
5056
|
+
size: "small",
|
|
5057
|
+
onClick: () => {
|
|
5058
|
+
onChange(answer, "FALSE", shuffleOption);
|
|
5059
|
+
}
|
|
5060
|
+
}
|
|
5061
|
+
) }) })
|
|
5062
|
+
] })
|
|
5063
|
+
]
|
|
5064
|
+
},
|
|
5065
|
+
index
|
|
5066
|
+
);
|
|
5067
|
+
}) }) : /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
5068
|
+
answerMap.trueList.map((item) => /* @__PURE__ */ jsxs27("div", { className: "flex flex-row items-center gap-x-2", children: [
|
|
5069
|
+
/* @__PURE__ */ jsx35("div", { className: "flex-1", children: /* @__PURE__ */ jsx35("p", { children: item }) }),
|
|
5070
|
+
/* @__PURE__ */ jsx35("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx35("p", { className: "underline", children: i18n_default.t("true") }) })
|
|
5071
|
+
] })),
|
|
5072
|
+
answerMap.falseList.map((item) => /* @__PURE__ */ jsxs27("div", { className: "flex flex-row items-center gap-x-2", children: [
|
|
5073
|
+
/* @__PURE__ */ jsx35("div", { className: "flex-1", children: /* @__PURE__ */ jsx35("p", { children: item }) }),
|
|
5074
|
+
/* @__PURE__ */ jsx35("div", { className: "w-[50px]", children: /* @__PURE__ */ jsx35("p", { className: "underline", children: i18n_default.t("false") }) })
|
|
5075
|
+
] }))
|
|
5076
|
+
] })
|
|
5077
|
+
] });
|
|
5078
|
+
};
|
|
5079
|
+
var TrueFalseActivityMaterialContent_default = TrueFalseActivityMaterialContent;
|
|
5080
|
+
|
|
5081
|
+
// src/components/activities/TrueFalseActivityContent.tsx
|
|
5082
|
+
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5083
|
+
var TrueFalseActivityContent = ({
|
|
5084
|
+
answer,
|
|
5085
|
+
data,
|
|
5086
|
+
canAnswerQuestion,
|
|
5087
|
+
changeAnswer,
|
|
5088
|
+
isPreview,
|
|
5089
|
+
showCorrectAnswer
|
|
5090
|
+
}) => {
|
|
5091
|
+
const contentMap = parseContentMapFromData(data);
|
|
5092
|
+
const trueFalseBodyMap = parseBodyMapFromData(data, "TRUE_FALSE");
|
|
5093
|
+
const trueFalseMaterialMap = parseMaterialMapFromData(data, "TRUE_FALSE");
|
|
5094
|
+
const retrieveCurrentAnswerMap = () => {
|
|
5095
|
+
let foundIndex = answer.data.findIndex(
|
|
5096
|
+
(answerData) => answerData.type === "TRUE_FALSE"
|
|
5097
|
+
);
|
|
5098
|
+
return answer.data[foundIndex].answerMap;
|
|
5099
|
+
};
|
|
5100
|
+
const handleTrueFalseAnswerOnChange = (answer2, key, value) => {
|
|
5101
|
+
const answerMap = retrieveCurrentAnswerMap();
|
|
5102
|
+
if (key === "TRUE") {
|
|
5103
|
+
const foundFalseIndex = answerMap.falseList.findIndex(
|
|
5104
|
+
(item) => item === value
|
|
5105
|
+
);
|
|
5106
|
+
if (foundFalseIndex !== -1) {
|
|
5107
|
+
answerMap.falseList.splice(foundFalseIndex, 1);
|
|
5108
|
+
}
|
|
5109
|
+
const foundTrueIndex = answerMap.falseList.findIndex(
|
|
5110
|
+
(item) => item === value
|
|
5111
|
+
);
|
|
5112
|
+
if (foundTrueIndex === -1) {
|
|
5113
|
+
answerMap.trueList.push(value);
|
|
5114
|
+
}
|
|
5115
|
+
} else if (key === "FALSE") {
|
|
5116
|
+
const foundTrueIndex = answerMap.trueList.findIndex(
|
|
5117
|
+
(item) => item === value
|
|
5118
|
+
);
|
|
5119
|
+
if (foundTrueIndex !== -1) {
|
|
5120
|
+
answerMap.trueList.splice(foundTrueIndex, 1);
|
|
5121
|
+
}
|
|
5122
|
+
const foundFalseIndex = answerMap.falseList.findIndex(
|
|
5123
|
+
(item) => item === value
|
|
5124
|
+
);
|
|
5125
|
+
if (foundFalseIndex === -1) {
|
|
5126
|
+
answerMap.falseList.push(value);
|
|
5127
|
+
}
|
|
5128
|
+
}
|
|
5129
|
+
changeAnswer(answer2);
|
|
5130
|
+
};
|
|
5131
|
+
return /* @__PURE__ */ jsxs28("div", { className: "flex flex-row flex-wrap", children: [
|
|
5132
|
+
/* @__PURE__ */ jsx36("div", { className: "w-full md:w-[40%]", children: /* @__PURE__ */ jsx36(
|
|
5133
|
+
ActivityBodyContent_default,
|
|
5134
|
+
{
|
|
5135
|
+
bodyMap: trueFalseBodyMap,
|
|
5136
|
+
templateType: "GROUPING"
|
|
5137
|
+
}
|
|
5138
|
+
) }),
|
|
5139
|
+
/* @__PURE__ */ jsx36("div", { className: "contents md:hidden", children: /* @__PURE__ */ jsx36(DividerLine_default, {}) }),
|
|
5140
|
+
/* @__PURE__ */ jsx36("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx36(VerticalDividerLine_default, {}) }),
|
|
5141
|
+
/* @__PURE__ */ jsx36("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ jsx36(
|
|
5142
|
+
TrueFalseActivityMaterialContent_default,
|
|
5143
|
+
{
|
|
5144
|
+
uniqueValue: JSON.stringify(data.contentMap),
|
|
5145
|
+
answer,
|
|
5146
|
+
materialMap: trueFalseMaterialMap,
|
|
5147
|
+
contentMap,
|
|
5148
|
+
checkCanAnswerQuestion: canAnswerQuestion,
|
|
5149
|
+
onChange: handleTrueFalseAnswerOnChange,
|
|
5150
|
+
isPreview,
|
|
5151
|
+
showCorrectAnswer
|
|
5152
|
+
}
|
|
5153
|
+
) })
|
|
5154
|
+
] });
|
|
5155
|
+
};
|
|
5156
|
+
var TrueFalseActivityContent_default = TrueFalseActivityContent;
|
|
5157
|
+
|
|
5158
|
+
// src/components/dividers/BlueVerticalDividerLine.tsx
|
|
5159
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5160
|
+
var BlueVerticalDividerLine = ({ opacity }) => {
|
|
5161
|
+
return /* @__PURE__ */ jsx37(
|
|
5162
|
+
"div",
|
|
5163
|
+
{
|
|
5164
|
+
className: `w-[2px] h-[40px] my-4 bg-catchup-blue ${opacity === "medium" ? "opacity-50" : ""}`
|
|
5165
|
+
}
|
|
5166
|
+
);
|
|
5167
|
+
};
|
|
5168
|
+
var BlueVerticalDividerLine_default = BlueVerticalDividerLine;
|
|
5169
|
+
|
|
5170
|
+
// src/utilization/StorageUtilization.ts
|
|
5171
|
+
var convertDataURLtoFile = (dataurl, filename) => {
|
|
5172
|
+
var arr = dataurl.split(","), mime = (arr[0].match(/:(.*?);/) || [])[1], bstr = atob(arr[arr.length - 1]), n = bstr.length, u8arr = new Uint8Array(n);
|
|
5173
|
+
while (n--) {
|
|
5174
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
5175
|
+
}
|
|
5176
|
+
return new File([u8arr], filename, { type: mime });
|
|
5177
|
+
};
|
|
5178
|
+
var retrieveDocumentTypeFromAcceptedFormat = (format) => {
|
|
5179
|
+
if (format === "application/pdf") {
|
|
5180
|
+
return "PDF";
|
|
5181
|
+
} else if (format === "image/jpeg" || format === "image/png" || format === "image/jpg") {
|
|
5182
|
+
return "IMAGE";
|
|
5183
|
+
} else if (format === "audio/mp3") {
|
|
5184
|
+
return "AUDIO";
|
|
5185
|
+
}
|
|
5186
|
+
};
|
|
5187
|
+
var retrieveDocumentTypeFromExtension = (format) => {
|
|
5188
|
+
if (format === "pdf") {
|
|
5189
|
+
return "PDF";
|
|
5190
|
+
} else if (format === "jpeg" || format === "png" || format === "jpg") {
|
|
5191
|
+
return "IMAGE";
|
|
5192
|
+
} else if (format === "mp3") {
|
|
5193
|
+
return "AUDIO";
|
|
5194
|
+
}
|
|
5195
|
+
};
|
|
632
5196
|
export {
|
|
633
5197
|
ApproveButton_default as ApproveButton,
|
|
634
5198
|
BaseImage_default as BaseImage,
|
|
635
5199
|
BaseLoading_default as BaseLoading,
|
|
5200
|
+
BlueVerticalDividerLine_default as BlueVerticalDividerLine,
|
|
636
5201
|
CancelButton_default as CancelButton,
|
|
637
5202
|
CreateButton_default as CreateButton,
|
|
638
5203
|
DeleteButton_default as DeleteButton,
|
|
5204
|
+
DividerLine_default as DividerLine,
|
|
5205
|
+
DropdownActivityContent_default as DropdownActivityContent,
|
|
5206
|
+
FillInTheBlanksActivityContent_default as FillInTheBlanksActivityContent,
|
|
5207
|
+
GroupingActivityContent_default as GroupingActivityContent,
|
|
5208
|
+
InputGroup_default as InputGroup,
|
|
5209
|
+
MCMAActivityContent_default as MCMAActivityContent,
|
|
5210
|
+
MCSAActivityContent_default as MCSAActivityContent,
|
|
5211
|
+
MatchingActivityContent_default as MatchingActivityContent,
|
|
5212
|
+
OpenEndedActivityContent_default as OpenEndedActivityContent,
|
|
5213
|
+
OrderingActivityContent_default as OrderingActivityContent,
|
|
639
5214
|
PrimaryButton_default as PrimaryButton,
|
|
640
|
-
SecondaryButton_default as SecondaryButton
|
|
5215
|
+
SecondaryButton_default as SecondaryButton,
|
|
5216
|
+
TrueFalseActivityContent_default as TrueFalseActivityContent,
|
|
5217
|
+
VerticalDividerLine_default as VerticalDividerLine,
|
|
5218
|
+
checkActivityAnswerState,
|
|
5219
|
+
checkIfAnswerIsEmpty,
|
|
5220
|
+
constructActivityAnswerMap,
|
|
5221
|
+
constructActivityAnswerStateList,
|
|
5222
|
+
constructActivityItemListWithAnswersForAI,
|
|
5223
|
+
constructActivityItemListWithSolutionForAI,
|
|
5224
|
+
constructInputWithSpecialExpressionList,
|
|
5225
|
+
convertDataURLtoFile,
|
|
5226
|
+
findBestFitActivity,
|
|
5227
|
+
getColorByIndex,
|
|
5228
|
+
i18n_default as i18n,
|
|
5229
|
+
ignoreMathematicalExpression,
|
|
5230
|
+
parseBodyMapFromData,
|
|
5231
|
+
parseContentMapFromData,
|
|
5232
|
+
parseMaterialMapFromData,
|
|
5233
|
+
retrieveActivityAnswerFromAnswerList,
|
|
5234
|
+
retrieveActivityTemplateDTOOptionList,
|
|
5235
|
+
retrieveClockTimeLeft,
|
|
5236
|
+
retrieveColorByScore,
|
|
5237
|
+
retrieveContentTypeOptionList,
|
|
5238
|
+
retrieveContestTypeOptionList,
|
|
5239
|
+
retrieveCoterieTypeFromStandardExamCoterieType,
|
|
5240
|
+
retrieveCurrentDefaultDataMap,
|
|
5241
|
+
retrieveDistintCoterieTypeFromCatchtivityApplicationDTO,
|
|
5242
|
+
retrieveDocumentTypeFromAcceptedFormat,
|
|
5243
|
+
retrieveDocumentTypeFromExtension,
|
|
5244
|
+
retrieveDurationInMinutesOptionList,
|
|
5245
|
+
retrieveDurationInSecondsOptionList,
|
|
5246
|
+
retrieveDurationTypeOptionList,
|
|
5247
|
+
retrieveEachTimeSpentInSeconds,
|
|
5248
|
+
retrieveFrequencyTypeOptionList,
|
|
5249
|
+
retrieveStandardExamCoterieTypeOptionListByStandardExamType,
|
|
5250
|
+
retrieveStandardExamTypeIcon,
|
|
5251
|
+
retrieveStandardExamTypeOptionList,
|
|
5252
|
+
retrieveStatusOptionList,
|
|
5253
|
+
retrieveTaxonomyGroupName,
|
|
5254
|
+
retrieveTaxonomyName,
|
|
5255
|
+
retrieveTaxonomyType,
|
|
5256
|
+
retrieveTotalTimeSpentInMinutes,
|
|
5257
|
+
retrieveTotalTimeSpentInSeconds,
|
|
5258
|
+
retrieveValidationRequirementList,
|
|
5259
|
+
shuffleArray,
|
|
5260
|
+
useScreenSize_default as useScreenSize
|
|
641
5261
|
};
|