performanceresultscreens 0.0.43 → 0.0.44
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/components/Molecules/PerformanceScreen/PreformanceResultScreen.js +24 -13
- package/dist/components/Molecules/PerformanceScreen/PreformanceResultScreen.js.map +1 -1
- package/dist/components/Molecules/PerformanceScreen/PreformanceResultScreen.stories.js +2 -2
- package/dist/components/Molecules/PerformanceScreen/PreformanceResultScreen.stories.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Molecules/PerformanceScreen/PreformanceResultScreenSkeleton.d.ts +0 -6
- package/dist/components/Molecules/PerformanceScreen/PreformanceResultScreenSkeleton.js +0 -12
- package/dist/components/Molecules/PerformanceScreen/PreformanceResultScreenSkeleton.js.map +0 -1
- package/dist/components/Molecules/RecapNode/FlashcardNode.d.ts +0 -0
- package/dist/components/Molecules/RecapNode/FlashcardNode.js +0 -2
- package/dist/components/Molecules/RecapNode/FlashcardNode.js.map +0 -1
- package/dist/components/Molecules/RecapNode/Node.d.ts +0 -3
- package/dist/components/Molecules/RecapNode/Node.js +0 -60
- package/dist/components/Molecules/RecapNode/Node.js.map +0 -1
- package/dist/components/Molecules/RecapNode/Node.stories.d.ts +0 -10
- package/dist/components/Molecules/RecapNode/Node.stories.js +0 -117
- package/dist/components/Molecules/RecapNode/Node.stories.js.map +0 -1
- package/dist/components/Molecules/RecapNode/Node.styles.d.ts +0 -11
- package/dist/components/Molecules/RecapNode/Node.styles.js +0 -53
- package/dist/components/Molecules/RecapNode/Node.styles.js.map +0 -1
- package/dist/components/Molecules/Revision/Revision.d.ts +0 -2
- package/dist/components/Molecules/Revision/Revision.js +0 -201
- package/dist/components/Molecules/Revision/Revision.js.map +0 -1
- package/dist/components/Molecules/optionLayouts/Scq.d.ts +0 -2
- package/dist/components/Molecules/optionLayouts/Scq.js +0 -427
- package/dist/components/Molecules/optionLayouts/Scq.js.map +0 -1
- package/dist/components/Molecules/optionLayouts/Scqnew.d.ts +0 -2
- package/dist/components/Molecules/optionLayouts/Scqnew.js +0 -491
- package/dist/components/Molecules/optionLayouts/Scqnew.js.map +0 -1
- package/dist/components/Molecules/questionLayouts/AnswerLayoutnew.d.ts +0 -1
- package/dist/components/Molecules/questionLayouts/AnswerLayoutnew.js +0 -61
- package/dist/components/Molecules/questionLayouts/AnswerLayoutnew.js.map +0 -1
- package/dist/components/Molecules/questionLayouts/AnswerView.d.ts +0 -1
- package/dist/components/Molecules/questionLayouts/AnswerView.js +0 -66
- package/dist/components/Molecules/questionLayouts/AnswerView.js.map +0 -1
- package/dist/components/Molecules/questionLayouts/Question.styles.d.ts +0 -115
- package/dist/components/Molecules/questionLayouts/Question.styles.js +0 -119
- package/dist/components/Molecules/questionLayouts/Question.styles.js.map +0 -1
- package/dist/components/Molecules/questionLayouts/QuestionLayoutnew.d.ts +0 -2
- package/dist/components/Molecules/questionLayouts/QuestionLayoutnew.js +0 -285
- package/dist/components/Molecules/questionLayouts/QuestionLayoutnew.js.map +0 -1
- package/dist/components/Molecules/questionLayouts/QuestionView.d.ts +0 -2
- package/dist/components/Molecules/questionLayouts/QuestionView.js +0 -106
- package/dist/components/Molecules/questionLayouts/QuestionView.js.map +0 -1
- package/dist/components/Organisms/D3Graphs/Reactflow.d.ts +0 -1
- package/dist/components/Organisms/D3Graphs/Reactflow.js +0 -244
- package/dist/components/Organisms/D3Graphs/Reactflow.js.map +0 -1
- package/dist/components/Organisms/FlashCardNode/AccordionChildItem.d.ts +0 -1
- package/dist/components/Organisms/FlashCardNode/AccordionChildItem.js +0 -37
- package/dist/components/Organisms/FlashCardNode/AccordionChildItem.js.map +0 -1
- package/dist/components/Organisms/RecapGraph/FlashCardNode.d.ts +0 -3
- package/dist/components/Organisms/RecapGraph/FlashCardNode.js +0 -48
- package/dist/components/Organisms/RecapGraph/FlashCardNode.js.map +0 -1
- package/dist/components/Organisms/RecapGraph/IconBar.d.ts +0 -5
- package/dist/components/Organisms/RecapGraph/IconBar.js +0 -19
- package/dist/components/Organisms/RecapGraph/IconBar.js.map +0 -1
- package/dist/components/Organisms/RecapGraph/NodeHandles.d.ts +0 -4
- package/dist/components/Organisms/RecapGraph/NodeHandles.js +0 -21
- package/dist/components/Organisms/RecapGraph/NodeHandles.js.map +0 -1
- package/dist/components/Organisms/StudentEditor/components/EditorComponent.d.ts +0 -5
- package/dist/components/Organisms/StudentEditor/components/EditorComponent.js +0 -124
- package/dist/components/Organisms/StudentEditor/components/EditorComponent.js.map +0 -1
- package/dist/utils/revision-utils.d.ts +0 -13
- package/dist/utils/revision-utils.js +0 -90
- package/dist/utils/revision-utils.js.map +0 -1
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RevisionView = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("@chakra-ui/react");
|
|
9
|
-
const icons_1 = require("@chakra-ui/icons");
|
|
10
|
-
const react_2 = require("react");
|
|
11
|
-
const CustomButton_1 = __importDefault(require("../../Atoms/CustomButton/CustomButton"));
|
|
12
|
-
const ChatPresenter_1 = __importDefault(require("../../Organisms/ReviewComponent/ChatPresenter"));
|
|
13
|
-
const TextEditor_1 = __importDefault(require("../../Organisms/StudentEditor/components/TextEditor"));
|
|
14
|
-
const DescriptiveLabel_1 = __importDefault(require("../Descriptive/DescriptiveLabel"));
|
|
15
|
-
const presentationModes_1 = require("../../../utils/presentationModes");
|
|
16
|
-
const QuestionsLayout_1 = require("../questionLayouts/QuestionsLayout");
|
|
17
|
-
const style = {
|
|
18
|
-
showAnswerBtn: (isDisabled) => ({
|
|
19
|
-
bg: isDisabled ? "#F5F5F5" : "transparent",
|
|
20
|
-
border: isDisabled ? "1px solid #E0E0E0" : "1px solid #5F4DC7",
|
|
21
|
-
color: isDisabled ? "#BDBDBD" : "var(--Primary-Default, #5F4DC7)",
|
|
22
|
-
textAlign: "center",
|
|
23
|
-
fontFamily: "Poppins",
|
|
24
|
-
fontSize: "var(--Font-Size-button-sm, 14px)",
|
|
25
|
-
fontWeight: "500",
|
|
26
|
-
lineHeight: "var(--Line-Height-body-sm, 20px)",
|
|
27
|
-
borderRadius: "6px",
|
|
28
|
-
display: "flex",
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
justifyContent: "center",
|
|
31
|
-
gap: "8px",
|
|
32
|
-
opacity: isDisabled ? 0.5 : 1,
|
|
33
|
-
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
36
|
-
// ============= UTILITY FUNCTIONS =============
|
|
37
|
-
const parsedUserAnswer = (userAnswer) => {
|
|
38
|
-
if (!userAnswer)
|
|
39
|
-
return null;
|
|
40
|
-
if (typeof userAnswer === "object") {
|
|
41
|
-
return userAnswer;
|
|
42
|
-
}
|
|
43
|
-
if (typeof userAnswer === "string") {
|
|
44
|
-
try {
|
|
45
|
-
return JSON.parse(userAnswer);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.error("Failed to parse userAnswer:", error);
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
};
|
|
54
|
-
const shouldShowEditorInRevision = (isRevision, parsedAnswer) => {
|
|
55
|
-
if (!isRevision)
|
|
56
|
-
return false;
|
|
57
|
-
const responseType = parsedAnswer?.response_type;
|
|
58
|
-
return (responseType !== presentationModes_1.RevisionEvaluationStates.Answered &&
|
|
59
|
-
responseType !== presentationModes_1.RevisionEvaluationStates.Viewed);
|
|
60
|
-
};
|
|
61
|
-
const hasUserAnsweredInRevision = (isRevision, presentationConfig) => {
|
|
62
|
-
return isRevision && presentationConfig?.UserAnswered;
|
|
63
|
-
};
|
|
64
|
-
const isAnswerViewedInRevision = (isRevision, presentationConfig) => {
|
|
65
|
-
return isRevision && presentationConfig?.IsViewed;
|
|
66
|
-
};
|
|
67
|
-
// ============= SUB COMPONENTS =============
|
|
68
|
-
/**
|
|
69
|
-
* RevisionEditorSection - Handles editor display for unanswered questions
|
|
70
|
-
*/
|
|
71
|
-
const RevisionEditorSection = ({ showEditor, editorData, setEditorData, isEditorDisabled, isOCREnabled, addImageRender, qindex, questionObject, isMobile, isRevision, commonProps, onAnswerSubmit, }) => {
|
|
72
|
-
if (!showEditor)
|
|
73
|
-
return null;
|
|
74
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { position: "relative", opacity: isEditorDisabled ? 0.5 : 1, pointerEvents: isEditorDisabled ? "none" : "auto", mt: "20px", children: (0, jsx_runtime_1.jsx)(TextEditor_1.default, { data: editorData, handleChange: (data) => setEditorData(data), onSubmit: async (data, images) => {
|
|
75
|
-
if (onAnswerSubmit) {
|
|
76
|
-
await onAnswerSubmit(data, images);
|
|
77
|
-
setEditorData("");
|
|
78
|
-
}
|
|
79
|
-
}, icons: {
|
|
80
|
-
submit: commonProps?.icons?.SubmitImg,
|
|
81
|
-
formula: commonProps?.icons?.Formula,
|
|
82
|
-
shift: commonProps?.icons?.Shift,
|
|
83
|
-
}, addImageRender: isOCREnabled && addImageRender(qindex, questionObject), isDisabled: isEditorDisabled, height: "500px", isRevision: isRevision, isMobile: isMobile, disablePaste: true, tutorMode: true }) }));
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* RevisionAnsweredSection - Shows chat presenter for answered questions
|
|
87
|
-
*/
|
|
88
|
-
const RevisionAnsweredSection = ({ presentationConfig, currentQuestion, history, commonProps, isStudent, isEditorDisabled, isRevision, isRevisionBasedQuestion, }) => {
|
|
89
|
-
if (!hasUserAnsweredInRevision(isRevision, presentationConfig))
|
|
90
|
-
return null;
|
|
91
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { mt: "20px", children: (0, jsx_runtime_1.jsx)(ChatPresenter_1.default, { showCoversation: true, isDescriptiveAnswer: true, question: currentQuestion, commonProps: commonProps, isStudent: isStudent, assistantInfo: history, tutor_mode: !isEditorDisabled, isRevision: isRevision, isRevisionBasedQuestion: isRevisionBasedQuestion }) }));
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* RevisionViewedSection - Shows sample answer for viewed questions
|
|
95
|
-
*/
|
|
96
|
-
const RevisionViewedSection = ({ presentationConfig, currentQuestion, commonProps, history, isStudent, isEditorDisabled, isRevision, questionObject }) => {
|
|
97
|
-
if (!isAnswerViewedInRevision(isRevision, presentationConfig))
|
|
98
|
-
return null;
|
|
99
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { mt: "20px", children: (0, jsx_runtime_1.jsx)(ChatPresenter_1.default, { showCoversation: true, isDescriptiveAnswer: true, question: questionObject, commonProps: commonProps, isStudent: isStudent, assistantInfo: history, tutor_mode: !isEditorDisabled, isRevision: isRevision, isViewed: true }) }));
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* RevisionAnswerToggleButton - Show/Hide answer button
|
|
103
|
-
*/
|
|
104
|
-
const RevisionAnswerToggleButton = ({ presentationConfig, currentQuestion, isRevision, showanswer, isEditorDisabled, handleToggleAnswer, }) => {
|
|
105
|
-
if (!presentationConfig?.ShowAnswerButton)
|
|
106
|
-
return null;
|
|
107
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", justify: "space-between", w: "100%", mt: "25px", gap: "12px", children: [(0, jsx_runtime_1.jsx)(DescriptiveLabel_1.default, { questionType: currentQuestion?.question_type, isRevision: isRevision }), (0, jsx_runtime_1.jsx)(react_1.Box, { flex: "1", borderBottom: "1px dashed gray" }), (0, jsx_runtime_1.jsx)(CustomButton_1.default, { label: (0, jsx_runtime_1.jsxs)(react_1.Flex, { alignItems: "center", gap: "8px", children: [showanswer ? "Hide Answer" : "Show Answer", showanswer ? (0, jsx_runtime_1.jsx)(icons_1.ChevronUpIcon, {}) : (0, jsx_runtime_1.jsx)(icons_1.ChevronDownIcon, {})] }), customStyles: style?.showAnswerBtn(isEditorDisabled), handleClick: handleToggleAnswer })] }));
|
|
108
|
-
};
|
|
109
|
-
// ============= MAIN COMPONENT =============
|
|
110
|
-
/**
|
|
111
|
-
* RevisionView component - Main revision mode UI orchestrator
|
|
112
|
-
*/
|
|
113
|
-
const RevisionView = (props = {}) => {
|
|
114
|
-
const { isRevision, isRevisionBasedQuestion, onToggleAnswer, qindex, tutorMode, isOCREnabled, addImageRender, isMobile, questionObject, isStudent, commonProps, userAnswer, history, onAnswerSubmit, tutor_mode, presenterLogic, isReviewScreen } = props;
|
|
115
|
-
const [editorData, setEditorData] = (0, react_2.useState)("");
|
|
116
|
-
const parsedAnswer = parsedUserAnswer(userAnswer);
|
|
117
|
-
const [currentQuestion, setCurrentQuestion] = (0, react_2.useState)({});
|
|
118
|
-
const [showanswer, setShowAnswer] = (0, react_2.useState)(() => {
|
|
119
|
-
return parsedAnswer?.response_type === presentationModes_1.RevisionEvaluationStates.Viewed;
|
|
120
|
-
});
|
|
121
|
-
(0, react_2.useEffect)(() => {
|
|
122
|
-
let quesObj = questionObject;
|
|
123
|
-
setCurrentQuestion({
|
|
124
|
-
...quesObj,
|
|
125
|
-
history: history,
|
|
126
|
-
tutor_mode: tutor_mode,
|
|
127
|
-
});
|
|
128
|
-
}, [questionObject, history]);
|
|
129
|
-
const isEditorDisabled = false;
|
|
130
|
-
// Get revision mode
|
|
131
|
-
const revisionMode = (0, react_2.useMemo)(() => {
|
|
132
|
-
if (isRevision) {
|
|
133
|
-
return (0, presentationModes_1.getPresentationModeBasedOnTask)(presentationModes_1.presentationModes.Revision);
|
|
134
|
-
}
|
|
135
|
-
}, [isRevision]);
|
|
136
|
-
(0, react_2.useEffect)(() => {
|
|
137
|
-
if (parsedAnswer?.response_type === presentationModes_1.RevisionEvaluationStates.Viewed) {
|
|
138
|
-
setShowAnswer(true);
|
|
139
|
-
}
|
|
140
|
-
}, [parsedAnswer]);
|
|
141
|
-
// Get presentation configuration based on revision state
|
|
142
|
-
const presentationConfig = (0, react_2.useMemo)(() => {
|
|
143
|
-
if (!isRevision)
|
|
144
|
-
return null;
|
|
145
|
-
const responseType = parsedAnswer?.response_type;
|
|
146
|
-
const hasHistory = props?.history?.length > 0;
|
|
147
|
-
// Answered with history available
|
|
148
|
-
if (responseType === presentationModes_1.RevisionEvaluationStates.Answered) {
|
|
149
|
-
return revisionMode.Answered;
|
|
150
|
-
}
|
|
151
|
-
// User has viewed the answer - use Viewed config but make IsViewed toggleable
|
|
152
|
-
if (responseType === presentationModes_1.RevisionEvaluationStates.Viewed) {
|
|
153
|
-
return {
|
|
154
|
-
...revisionMode.Viewed,
|
|
155
|
-
IsViewed: showanswer,
|
|
156
|
-
UserAnswered: false,
|
|
157
|
-
ShowAnswerButton: true, // Always show toggle button
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
// Default: not answered yet - CAN show editor
|
|
161
|
-
return {
|
|
162
|
-
...revisionMode.NotAnswered,
|
|
163
|
-
ShowAnswerButton: true,
|
|
164
|
-
IsViewed: showanswer,
|
|
165
|
-
};
|
|
166
|
-
}, [isRevision, parsedAnswer, showanswer, props?.history, revisionMode]);
|
|
167
|
-
// Handle answer toggle with proper logic
|
|
168
|
-
const handleToggleAnswer = (0, react_2.useCallback)(async () => {
|
|
169
|
-
if (isEditorDisabled) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
const hasViewedResponse = parsedAnswer?.response_type === presentationModes_1.RevisionEvaluationStates.Viewed;
|
|
173
|
-
if (hasViewedResponse) {
|
|
174
|
-
setShowAnswer(!showanswer);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
try {
|
|
178
|
-
if (onToggleAnswer) {
|
|
179
|
-
const result = await onToggleAnswer(qindex);
|
|
180
|
-
if (result?.success) {
|
|
181
|
-
setShowAnswer(true);
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
console.error("❌ Failed to toggle answer - API call failed");
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
console.error("❌ Error toggling answer:", error);
|
|
190
|
-
// Don't show answer on error
|
|
191
|
-
}
|
|
192
|
-
}, [showanswer, parsedAnswer, onToggleAnswer]);
|
|
193
|
-
// Show editor only when appropriate
|
|
194
|
-
const showEditor = shouldShowEditorInRevision(isRevision, parsedAnswer);
|
|
195
|
-
if (!isRevision)
|
|
196
|
-
return null;
|
|
197
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Box, { children: [(0, jsx_runtime_1.jsx)(QuestionsLayout_1.QuestionsLayout, { questionIndex: qindex, presenterLogic: presenterLogic, isFromParentApp: false, tutor_mode: tutor_mode, isRevision: isRevision, onToggleAnswer: onToggleAnswer, qindex: qindex, isMobile: isMobile, isRevisionBasedQuestion: isRevisionBasedQuestion, tutorMode: tutorMode, questionObject: questionObject, isOCREnabled: isOCREnabled, addImageRender: addImageRender, userAnswer: userAnswer, history: history, onAnswerSubmit: onAnswerSubmit, commonProps: commonProps, isReviewScreen: isReviewScreen, showDiscussLabel: false, hideVin: true }), (0, jsx_runtime_1.jsx)(RevisionEditorSection, { showEditor: showEditor, editorData: editorData, setEditorData: setEditorData, isEditorDisabled: isEditorDisabled, isOCREnabled: isOCREnabled, addImageRender: addImageRender, qindex: qindex, questionObject: questionObject, isMobile: isMobile, commonProps: commonProps, onAnswerSubmit: onAnswerSubmit, isRevision: isRevision }), (0, jsx_runtime_1.jsx)(RevisionAnsweredSection, { presentationConfig: presentationConfig, currentQuestion: currentQuestion, history: history, commonProps: commonProps, isStudent: isStudent, isEditorDisabled: isEditorDisabled, isRevision: isRevision, isRevisionBasedQuestion: isRevisionBasedQuestion }), (0, jsx_runtime_1.jsx)(RevisionViewedSection, { presentationConfig: presentationConfig, currentQuestion: currentQuestion, commonProps: commonProps, history: history, isStudent: isStudent, isEditorDisabled: isEditorDisabled, isRevision: isRevision, questionObject: questionObject }), (0, jsx_runtime_1.jsx)(RevisionAnswerToggleButton, { presentationConfig: presentationConfig, currentQuestion: currentQuestion, isRevision: isRevision, showanswer: showanswer, isEditorDisabled: isEditorDisabled, handleToggleAnswer: handleToggleAnswer })] }));
|
|
198
|
-
};
|
|
199
|
-
exports.RevisionView = RevisionView;
|
|
200
|
-
exports.default = exports.RevisionView;
|
|
201
|
-
//# sourceMappingURL=Revision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Revision.js","sourceRoot":"","sources":["../../../../src/components/Molecules/Revision/Revision.jsx"],"names":[],"mappings":";;;;;;;AAAA,4CAA6C;AAC7C,4CAAkE;AAClE,iCAAkE;AAClE,yFAAiE;AACjE,kGAA0E;AAC1E,qGAA6E;AAC7E,uFAA+D;AAC/D,wEAA+H;AAC/H,wEAAqE;AAErE,MAAM,KAAK,GAAG;IACZ,aAAa,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC9B,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;QAC1C,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB;QAC9D,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iCAAiC;QACjE,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,kCAAkC;QAC5C,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,kCAAkC;QAC9C,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,EAAE,KAAK;QACV,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;KAC/C,CAAC;CAC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ACpB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,GAC9B,EAGF,uBAAC,0BAA0B,IACzB,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,GACtC,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AApMW,QAAA,YAAY,gBAoMvB;AAEF,kBAAe,oBAAY,CAAC"}
|
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
|
-
const common_utils_1 = require("../../../utils/common-utils");
|
|
32
|
-
const presentationModes_1 = require("../../../utils/presentationModes");
|
|
33
|
-
const react_usestateref_1 = __importDefault(require("react-usestateref"));
|
|
34
|
-
const LearningPathUtils_1 = require("../../../utils/LearningPathUtils");
|
|
35
|
-
const tutor_utils_1 = require("../../../utils/tutor-utils");
|
|
36
|
-
const imageModal_1 = __importDefault(require("../../Atoms/imageModal"));
|
|
37
|
-
const crypto_1 = require("../../../utils/crypto");
|
|
38
|
-
const react_2 = require("@chakra-ui/react");
|
|
39
|
-
const ScqComponent = (props) => {
|
|
40
|
-
const { options, userAnswer, onAnswerSubmitted: propOnAnswerSubmitted, handleAnswerChange, option_image_details, currentQuestion, taskType, answer, isDontAllow, isStandaloneWithSubjectMapping, isStandalone, isFactual, styles, icons, presenterLogic, isComprehension, setLayoutType, modifiedOptions,
|
|
41
|
-
// passphrase,
|
|
42
|
-
displayedQues, isReviewScreen } = props;
|
|
43
|
-
const [windowWidth, setWindowWidth] = (0, react_1.useState)(typeof window !== "undefined" ? window.innerWidth : 1024);
|
|
44
|
-
const [value, setValue] = (0, react_1.useState)(isReviewScreen
|
|
45
|
-
? undefined
|
|
46
|
-
: (0, common_utils_1.isNotEmptyOrNull)(userAnswer) // First approach: initialize with extracted answer
|
|
47
|
-
? (0, common_utils_1.extractGivenAnswers)(userAnswer)?.[0]
|
|
48
|
-
: "");
|
|
49
|
-
const [selectedIndex, setSelectedIndex] = (0, react_1.useState)();
|
|
50
|
-
const [optionsData, setOptionsData] = (0, react_1.useState)(isReviewScreen ? [] : options);
|
|
51
|
-
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
52
|
-
const [imageIndex, setImageIndex] = (0, react_1.useState)();
|
|
53
|
-
const [onAnswerSubmitted, setOnAnswerSubmitted, onAnswerSubmittedRef] = (0, react_usestateref_1.default)(propOnAnswerSubmitted
|
|
54
|
-
? propOnAnswerSubmitted
|
|
55
|
-
: (0, common_utils_1.isNotEmptyOrNull)(userAnswer)
|
|
56
|
-
? true
|
|
57
|
-
: false);
|
|
58
|
-
const [presentationMode, setPresentationMode] = (0, react_1.useState)((0, presentationModes_1.getPresentationModeBasedOnTask)(currentQuestion?.factual === true
|
|
59
|
-
? LearningPathUtils_1.taskTypes?.factualMode
|
|
60
|
-
: isReviewScreen
|
|
61
|
-
? LearningPathUtils_1.taskTypes?.reviewMode
|
|
62
|
-
: isFactual
|
|
63
|
-
? LearningPathUtils_1.taskTypes?.assessment
|
|
64
|
-
: isStandalone || isStandaloneWithSubjectMapping
|
|
65
|
-
? LearningPathUtils_1.taskTypes?.standalone
|
|
66
|
-
: taskType));
|
|
67
|
-
// Hashing states
|
|
68
|
-
const [hashedOptions, setHashedOptions] = (0, react_1.useState)({});
|
|
69
|
-
const [isHashingComplete, setIsHashingComplete] = (0, react_1.useState)(isReviewScreen);
|
|
70
|
-
(0, react_1.useEffect)(() => {
|
|
71
|
-
if (isReviewScreen) {
|
|
72
|
-
let answerValue = (0, common_utils_1.isNotEmptyOrNull)(userAnswer)
|
|
73
|
-
? (0, common_utils_1.handleRemoveExtraSpaceInBubbles)((0, common_utils_1.extractGivenAnswers)(userAnswer)?.[0])
|
|
74
|
-
: "";
|
|
75
|
-
setValue(answerValue);
|
|
76
|
-
setOptionsData(options.map((item) => (0, common_utils_1.handleRemoveExtraSpaceInBubbles)(item)));
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
setOptionsData(options);
|
|
80
|
-
if (value && options) {
|
|
81
|
-
const index = options.findIndex((opt) => opt === value);
|
|
82
|
-
setSelectedIndex(index !== -1 ? index : undefined);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}, [options, userAnswer, isReviewScreen]);
|
|
86
|
-
// Hashing effect
|
|
87
|
-
(0, react_1.useEffect)(() => {
|
|
88
|
-
if (isReviewScreen)
|
|
89
|
-
return;
|
|
90
|
-
const computeHashedOptions = async () => {
|
|
91
|
-
if (!optionsData.length)
|
|
92
|
-
return;
|
|
93
|
-
const hashed = {};
|
|
94
|
-
for (let i = 0; i < optionsData.length; i++) {
|
|
95
|
-
const item = optionsData[i];
|
|
96
|
-
let data = await ((0, common_utils_1.isNotEmptyOrNull)(currentQuestion?.answers_index_hashed_keys)
|
|
97
|
-
? (0, crypto_1.answers_index_hashed_keys)(currentQuestion?.uuid + common_utils_1.passphrase + i)
|
|
98
|
-
: (0, common_utils_1.isNotEmptyOrNull)(currentQuestion?.answers_key)
|
|
99
|
-
? (0, crypto_1.answerEncryptText)(currentQuestion?.options_layout?.[i])
|
|
100
|
-
: item);
|
|
101
|
-
hashed[i] = data;
|
|
102
|
-
}
|
|
103
|
-
setHashedOptions(hashed);
|
|
104
|
-
setIsHashingComplete(true);
|
|
105
|
-
};
|
|
106
|
-
computeHashedOptions();
|
|
107
|
-
}, [
|
|
108
|
-
optionsData,
|
|
109
|
-
currentQuestion?.uuid,
|
|
110
|
-
currentQuestion?.answers_index_hashed_keys,
|
|
111
|
-
currentQuestion?.answers_key,
|
|
112
|
-
isReviewScreen
|
|
113
|
-
]);
|
|
114
|
-
// Get hashed option function
|
|
115
|
-
const getHashedOption = (0, react_1.useCallback)((item, position) => {
|
|
116
|
-
if (!isHashingComplete)
|
|
117
|
-
return item;
|
|
118
|
-
return hashedOptions[position] || item;
|
|
119
|
-
}, [hashedOptions, isHashingComplete]);
|
|
120
|
-
const handleOnChange = (0, react_1.useCallback)((item, index) => {
|
|
121
|
-
setValue(item);
|
|
122
|
-
setSelectedIndex(index);
|
|
123
|
-
if (isReviewScreen) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
let selectedAnswer = getHashedOption(item, index);
|
|
128
|
-
handleAnswerChange({
|
|
129
|
-
selectedItem: item,
|
|
130
|
-
selectedHashedIndexAnswer: selectedAnswer,
|
|
131
|
-
selectedIndex: index,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}, [getHashedOption, handleAnswerChange]);
|
|
135
|
-
const openImage = (0, react_1.useCallback)((index) => {
|
|
136
|
-
setImageIndex(index);
|
|
137
|
-
setIsOpen(true);
|
|
138
|
-
}, []);
|
|
139
|
-
const handleClose = (0, react_1.useCallback)(() => {
|
|
140
|
-
setIsOpen(false);
|
|
141
|
-
}, []);
|
|
142
|
-
(0, react_1.useEffect)(() => {
|
|
143
|
-
if (!propOnAnswerSubmitted)
|
|
144
|
-
return;
|
|
145
|
-
setOnAnswerSubmitted(propOnAnswerSubmitted);
|
|
146
|
-
if (!isReviewScreen) {
|
|
147
|
-
const selectedAnswer = getHashedOption(value, selectedIndex);
|
|
148
|
-
setValue(selectedAnswer);
|
|
149
|
-
}
|
|
150
|
-
}, [
|
|
151
|
-
propOnAnswerSubmitted,
|
|
152
|
-
getHashedOption,
|
|
153
|
-
value,
|
|
154
|
-
selectedIndex,
|
|
155
|
-
isReviewScreen,
|
|
156
|
-
]);
|
|
157
|
-
(0, react_1.useEffect)(() => {
|
|
158
|
-
const handleResize = () => setWindowWidth(window.innerWidth);
|
|
159
|
-
window.addEventListener("resize", handleResize);
|
|
160
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
161
|
-
}, []);
|
|
162
|
-
let isStudent = presenterLogic?.isStudent === common_utils_1.reviewUserRoles?.STUDENT;
|
|
163
|
-
// Screen configuration
|
|
164
|
-
const screenConfig = (0, react_1.useMemo)(() => {
|
|
165
|
-
if (windowWidth >= 1536)
|
|
166
|
-
return {
|
|
167
|
-
characterCount: isComprehension ? 20 : 30,
|
|
168
|
-
screenSize: "desktop",
|
|
169
|
-
};
|
|
170
|
-
if (windowWidth >= 1400)
|
|
171
|
-
return {
|
|
172
|
-
characterCount: isComprehension ? 20 : 30,
|
|
173
|
-
screenSize: "desktop",
|
|
174
|
-
};
|
|
175
|
-
if (windowWidth >= 1280)
|
|
176
|
-
return {
|
|
177
|
-
characterCount: isComprehension ? 18 : 24,
|
|
178
|
-
screenSize: "desktop",
|
|
179
|
-
};
|
|
180
|
-
if (windowWidth >= 1100)
|
|
181
|
-
return {
|
|
182
|
-
characterCount: isComprehension ? 16 : 20,
|
|
183
|
-
screenSize: "desktop",
|
|
184
|
-
};
|
|
185
|
-
if (windowWidth >= 992)
|
|
186
|
-
return {
|
|
187
|
-
characterCount: isComprehension ? 10 : 14,
|
|
188
|
-
screenSize: "desktop",
|
|
189
|
-
};
|
|
190
|
-
if (windowWidth >= 768)
|
|
191
|
-
return {
|
|
192
|
-
characterCount: isComprehension ? 10 : 12,
|
|
193
|
-
screenSize: "tablet",
|
|
194
|
-
};
|
|
195
|
-
return { characterCount: 6, screenSize: "mobile" };
|
|
196
|
-
}, [windowWidth]);
|
|
197
|
-
const stringLengthAnalysis = (0, react_1.useMemo)(() => {
|
|
198
|
-
const { characterCount } = screenConfig;
|
|
199
|
-
return {
|
|
200
|
-
hasLongStrings: (0, common_utils_1.hasLongString)(options, characterCount),
|
|
201
|
-
hasVeryLongStrings: (0, common_utils_1.hasLongString)(options, characterCount + 2),
|
|
202
|
-
};
|
|
203
|
-
}, [screenConfig, options]);
|
|
204
|
-
const layoutType = (0, react_1.useMemo)(() => {
|
|
205
|
-
const { screenSize } = screenConfig;
|
|
206
|
-
const { hasLongStrings, hasVeryLongStrings } = stringLengthAnalysis;
|
|
207
|
-
if (option_image_details?.length > 0) {
|
|
208
|
-
if (screenSize === "mobile")
|
|
209
|
-
return "column";
|
|
210
|
-
return "twoRows";
|
|
211
|
-
}
|
|
212
|
-
if (screenSize === "mobile")
|
|
213
|
-
return "column";
|
|
214
|
-
if (screenSize === "tablet")
|
|
215
|
-
return hasLongStrings ? "column" : "twoRows";
|
|
216
|
-
if (screenSize === "desktop") {
|
|
217
|
-
if (hasVeryLongStrings)
|
|
218
|
-
return "column";
|
|
219
|
-
if (hasLongStrings)
|
|
220
|
-
return "twoRows";
|
|
221
|
-
return "row";
|
|
222
|
-
}
|
|
223
|
-
return "row";
|
|
224
|
-
}, [screenConfig, stringLengthAnalysis, option_image_details]);
|
|
225
|
-
(0, react_1.useEffect)(() => {
|
|
226
|
-
setLayoutType?.(layoutType);
|
|
227
|
-
}, [layoutType, setLayoutType]);
|
|
228
|
-
const getAnswerStyle = (0, react_1.useCallback)((item, value, answerSubmitted, imagesList, currentQuestion, index, isReviewScreen) => {
|
|
229
|
-
let hashedItem;
|
|
230
|
-
let hashedValue;
|
|
231
|
-
if (isReviewScreen) {
|
|
232
|
-
if ((0, common_utils_1.isNotEmptyOrNull)(currentQuestion?.answers_index_hashed_keys)) {
|
|
233
|
-
hashedItem = (0, crypto_1.answers_index_hashed_keys)(currentQuestion?.uuid + common_utils_1.passphrase + index);
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
hashedItem = item;
|
|
237
|
-
}
|
|
238
|
-
hashedValue = value;
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
hashedItem = getHashedOption(item, index);
|
|
242
|
-
hashedValue = value
|
|
243
|
-
? getHashedOption(value, optionsData.indexOf(value))
|
|
244
|
-
: value;
|
|
245
|
-
}
|
|
246
|
-
const hasImages = imagesList?.length > 0;
|
|
247
|
-
if (!answerSubmitted) {
|
|
248
|
-
if (hashedItem === hashedValue) {
|
|
249
|
-
return hasImages ? "scq-card-selected" : "scq-card-selected-noimage";
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
return hasImages ? "scq-card" : "scq-card-noimage";
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
const isCorrectAnswer = isReviewScreen
|
|
256
|
-
? (0, common_utils_1.isNotEmptyOrNull)(currentQuestion?.answers_index_hashed_keys)
|
|
257
|
-
? hashedItem === currentQuestion?.answers_index_hashed_keys?.[0]
|
|
258
|
-
: hashedItem === answer?.[0]
|
|
259
|
-
: hashedItem === answer?.[0];
|
|
260
|
-
const isUserSelection = hashedItem === hashedValue;
|
|
261
|
-
const shouldShowCorrectFeedback = presentationMode.DisplayCorrectAnswerInstantly ||
|
|
262
|
-
(presentationMode.DisplayCorrectAnswerAfterNextClick &&
|
|
263
|
-
currentQuestion?.showGreen);
|
|
264
|
-
const shouldShowWrongFeedback = presentationMode.DisplayWrongAnswerInstantly ||
|
|
265
|
-
(presentationMode.DisplayWrongAnswerAfterNextClick &&
|
|
266
|
-
currentQuestion?.showRed);
|
|
267
|
-
const isAnswerNotSubmitted = currentQuestion?.factual === true
|
|
268
|
-
? displayedQues?.[index]?.isSubmitted !== true
|
|
269
|
-
: !answerSubmitted;
|
|
270
|
-
if (isAnswerNotSubmitted && !isReviewScreen) {
|
|
271
|
-
if (hashedItem === hashedValue) {
|
|
272
|
-
return hasImages ? "scq-card-selected" : "scq-card-selected-noimage";
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
return hasImages ? "scq-card" : "scq-card-noimage";
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (isCorrectAnswer) {
|
|
279
|
-
if (shouldShowCorrectFeedback) {
|
|
280
|
-
return hasImages ? "scq-card-correct" : "scq-card-correct-noimage";
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
if (isUserSelection) {
|
|
284
|
-
if (isReviewScreen) {
|
|
285
|
-
return hasImages ? "scq-card-selected" : "scq-card-selected-noimage";
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
return taskType === LearningPathUtils_1.taskTypes.assessment || isFactual
|
|
289
|
-
? hasImages ? "scq-card-selected" : "scq-card-selected-noimage"
|
|
290
|
-
: hasImages
|
|
291
|
-
? "scq-card-selected"
|
|
292
|
-
: "scq-card-selected-noimage";
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
return hasImages ? "scq-card" : "scq-card-noimage";
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (isUserSelection) {
|
|
301
|
-
if (shouldShowWrongFeedback) {
|
|
302
|
-
return hasImages ? "scq-card-wrong" : "scq-card-wrong-noimage";
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
return isReviewScreen
|
|
306
|
-
? hasImages
|
|
307
|
-
? "scq-card-selected"
|
|
308
|
-
: "scq-card-selected-noimage"
|
|
309
|
-
: taskType === LearningPathUtils_1.taskTypes.assessment || isFactual
|
|
310
|
-
? hasImages
|
|
311
|
-
? "scq-card-selected"
|
|
312
|
-
: "scq-card-selected-noimage"
|
|
313
|
-
: hasImages
|
|
314
|
-
? "scq-card-selected"
|
|
315
|
-
: "scq-card-selected-noimage";
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return hasImages ? "scq-card" : "scq-card-noimage";
|
|
319
|
-
}, [
|
|
320
|
-
getHashedOption,
|
|
321
|
-
optionsData,
|
|
322
|
-
crypto_1.answers_index_hashed_keys,
|
|
323
|
-
presentationMode,
|
|
324
|
-
answer,
|
|
325
|
-
answer,
|
|
326
|
-
taskType,
|
|
327
|
-
isFactual,
|
|
328
|
-
common_utils_1.passphrase,
|
|
329
|
-
]);
|
|
330
|
-
const renderSingleOption = (0, react_1.useCallback)((optionContent, idx, isColumn = false) => {
|
|
331
|
-
const label = (0, common_utils_1.getCharacterFromNumber)(idx);
|
|
332
|
-
const answerStyle = getAnswerStyle(optionContent, value, onAnswerSubmittedRef.current, option_image_details, currentQuestion, idx, isReviewScreen);
|
|
333
|
-
const correctAnswer = answerStyle === "scq-card-correct" ||
|
|
334
|
-
answerStyle === "scq-card-correct-noimage";
|
|
335
|
-
const wrongAnswer = answerStyle === "scq-card-wrong" ||
|
|
336
|
-
answerStyle === "scq-card-wrong-noimage";
|
|
337
|
-
const isSelected = optionContent === value;
|
|
338
|
-
const isCorrectAnswerShown = optionContent === answer?.[0];
|
|
339
|
-
const allowClick = !onAnswerSubmittedRef.current && !isDontAllow;
|
|
340
|
-
const textColor = correctAnswer || wrongAnswer
|
|
341
|
-
? { color: "black" }
|
|
342
|
-
: isSelected && (taskType === LearningPathUtils_1.taskTypes.assessment || isFactual)
|
|
343
|
-
? { color: "white" }
|
|
344
|
-
: {};
|
|
345
|
-
const getTextClass = () => {
|
|
346
|
-
if (taskType === LearningPathUtils_1.taskTypes.assessment || isFactual) {
|
|
347
|
-
if (!onAnswerSubmittedRef.current)
|
|
348
|
-
return isSelected ? "scq-text-selected" : "scq-text";
|
|
349
|
-
return isSelected || isCorrectAnswerShown
|
|
350
|
-
? "scq-text-selected"
|
|
351
|
-
: "scq-text";
|
|
352
|
-
}
|
|
353
|
-
return isSelected ||
|
|
354
|
-
(isCorrectAnswerShown &&
|
|
355
|
-
presentationMode.DisplayCorrectAnswerAfterNextClick &&
|
|
356
|
-
currentQuestion?.showGreen)
|
|
357
|
-
? "scq-text-selected"
|
|
358
|
-
: "scq-text";
|
|
359
|
-
};
|
|
360
|
-
const imageBlock = option_image_details?.length > 0 &&
|
|
361
|
-
option_image_details[idx] && ((0, jsx_runtime_1.jsx)(react_2.Box, { className: styles.optionImage, children: (0, jsx_runtime_1.jsx)(react_2.Image, { src: option_image_details[idx]?.url, onClick: () => openImage(idx), alt: `Image ${idx}`, className: styles["scq-image"], style: { cursor: "pointer" } }) }));
|
|
362
|
-
if (isStudent || !isReviewScreen) {
|
|
363
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { className: [
|
|
364
|
-
styles.optionContainer,
|
|
365
|
-
isColumn && styles.columnOptions,
|
|
366
|
-
layoutType === "twoRows" &&
|
|
367
|
-
option_image_details?.length === 0 &&
|
|
368
|
-
styles.twoRowOptions,
|
|
369
|
-
isComprehension && styles.comprehensionOptionContainer,
|
|
370
|
-
styles[answerStyle],
|
|
371
|
-
]
|
|
372
|
-
.filter(Boolean)
|
|
373
|
-
.join(" "), onClick: () => allowClick && handleOnChange(optionContent), style: {
|
|
374
|
-
cursor: allowClick ? "pointer" : "default",
|
|
375
|
-
pointerEvents: isDontAllow ? "none" : "auto",
|
|
376
|
-
}, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { className: styles.optionContainerLeft, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { className: styles.character, children: label }), (0, jsx_runtime_1.jsxs)(react_2.Box, { className: `${styles.optionDetails} ${styles[getTextClass()]}`, style: textColor, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { children: (0, tutor_utils_1.renderContent)(modifiedOptions?.[idx] || optionContent) }), imageBlock] })] }), (0, jsx_runtime_1.jsx)(react_2.Box, { className: styles.optionContainerRight, children: (0, jsx_runtime_1.jsx)(react_2.Image, { className: `${styles.answerIndicator} ${correctAnswer || wrongAnswer
|
|
377
|
-
? styles.answerIndicatorActive
|
|
378
|
-
: ""}`, src: correctAnswer ? icons.CheckmarkCircle : icons.closeCircle, alt: correctAnswer ? "Correct" : "Wrong" }) })] }, idx));
|
|
379
|
-
}
|
|
380
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Box, { className: `${styles[answerStyle]} ${layoutType === "twoRows" && option_image_details?.length === 0
|
|
381
|
-
? styles.twoRowOptions
|
|
382
|
-
: ""}`, onClick: () => allowClick && handleOnChange(optionContent), style: {
|
|
383
|
-
cursor: allowClick ? "pointer" : "default",
|
|
384
|
-
pointerEvents: isDontAllow ? "none" : "auto",
|
|
385
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { borderRadius: "50%", padding: "8px", color: "#F1F1F1", display: "flex", justifyContent: "center", alignItems: "center", h: "28px", bgColor: correctAnswer ? "#456125" : "#414141", borderColor: correctAnswer ? "#456125" : "#414141", borderWidth: "1px", children: (0, jsx_runtime_1.jsx)(react_2.Text, { as: "b", fontSize: "14px", fontFamily: "Inter, sans-serif", children: label }) }), (0, jsx_runtime_1.jsxs)("div", { className: styles["scq-content"], children: [(0, jsx_runtime_1.jsx)(react_2.Text, { className: styles[getTextClass()], color: correctAnswer || wrongAnswer ? "white" : "", children: (0, tutor_utils_1.renderContent)(optionContent) }), imageBlock] })] }) }, idx));
|
|
386
|
-
}, [
|
|
387
|
-
value,
|
|
388
|
-
getAnswerStyle,
|
|
389
|
-
onAnswerSubmittedRef,
|
|
390
|
-
handleOnChange,
|
|
391
|
-
openImage,
|
|
392
|
-
presentationMode,
|
|
393
|
-
isReviewScreen,
|
|
394
|
-
isFactual,
|
|
395
|
-
layoutType,
|
|
396
|
-
]);
|
|
397
|
-
const renderedOptions = (0, react_1.useMemo)(() => {
|
|
398
|
-
if (!options?.length)
|
|
399
|
-
return null;
|
|
400
|
-
if (layoutType === "twoRows") {
|
|
401
|
-
const rows = [];
|
|
402
|
-
for (let i = 0; i < options?.length; i += 2) {
|
|
403
|
-
rows.push(options?.slice(i, i + 2));
|
|
404
|
-
}
|
|
405
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Box, { className: styles?.twoRowsWrapper, children: rows.map((row, rowIndex) => ((0, jsx_runtime_1.jsx)(react_2.Box, { className: styles?.rowContainer, children: row.map((optionContent, idx) => {
|
|
406
|
-
const actualIndex = rowIndex * 2 + idx;
|
|
407
|
-
return ((0, jsx_runtime_1.jsx)(react_2.Box, { children: renderSingleOption(optionContent, actualIndex, false) }, actualIndex));
|
|
408
|
-
}) }, rowIndex))) }));
|
|
409
|
-
}
|
|
410
|
-
return options.map((optionContent, idx) => renderSingleOption(optionContent, idx, layoutType === "column"));
|
|
411
|
-
}, [options, layoutType, renderSingleOption, styles]);
|
|
412
|
-
const wrapperClasses = (0, react_1.useMemo)(() => {
|
|
413
|
-
const classes = [styles?.optionsWrapper];
|
|
414
|
-
if (layoutType === "column")
|
|
415
|
-
classes.push(styles?.columnWrapper);
|
|
416
|
-
if (layoutType === "twoRows")
|
|
417
|
-
classes.push(styles?.twoRowsContainer);
|
|
418
|
-
return classes.join(" ");
|
|
419
|
-
}, [layoutType, styles]);
|
|
420
|
-
// Show loading while hashing is in progress
|
|
421
|
-
if (!isHashingComplete) {
|
|
422
|
-
return (0, jsx_runtime_1.jsx)(react_2.Box, { children: "Loading options..." });
|
|
423
|
-
}
|
|
424
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Box, { style: isDontAllow ? { pointerEvents: "none" } : {}, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { className: wrapperClasses, children: renderedOptions }), isOpen && ((0, jsx_runtime_1.jsx)(imageModal_1.default, { isOpen: isOpen, handleClose: handleClose, url: option_image_details?.[imageIndex]?.url }, Math.random()))] }));
|
|
425
|
-
};
|
|
426
|
-
exports.default = ScqComponent;
|
|
427
|
-
//# sourceMappingURL=Scq.js.map
|