questionlayoutrefactoring 0.0.86 → 0.0.89

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.
@@ -37,59 +37,13 @@ const imageModal_1 = __importDefault(require("../../Atoms/imageModal"));
37
37
  const crypto_1 = require("../../../utils/crypto");
38
38
  const react_2 = require("@chakra-ui/react");
39
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, displayedQues, isReviewScreen } = props;
41
- const questionId = currentQuestion?.uuid;
42
- const DEBUG = true;
43
- // Debug utility functions
44
- const setActiveQuestion = () => {
45
- sessionStorage.setItem("activeDebugQuestion", questionId);
46
- };
47
- const log = (title, data = {}) => {
48
- if (!DEBUG)
49
- return;
50
- const activeQuestion = sessionStorage.getItem("activeDebugQuestion");
51
- if (activeQuestion && activeQuestion !== questionId)
52
- return;
53
- console.group(`%c[Q: ${questionId}] ${title}`, "color: #4CAF50; font-weight: bold; font-size: 12px;");
54
- console.table(data);
55
- console.groupEnd();
56
- };
57
- const logStyle = (optionIdx, styleData) => {
58
- const activeQuestion = sessionStorage.getItem("activeDebugQuestion");
59
- if (activeQuestion && activeQuestion !== questionId)
60
- return;
61
- console.group(`%c[Q: ${questionId}] Style Applied - Option ${optionIdx}`, "color: #2196F3; font-weight: bold; font-size: 12px;");
62
- console.table(styleData);
63
- console.groupEnd();
64
- };
65
- const logAnswerStyleDecision = (optionIdx, decisionData) => {
66
- const activeQuestion = sessionStorage.getItem("activeDebugQuestion");
67
- if (activeQuestion && activeQuestion !== questionId)
68
- return;
69
- console.group(`%c[Q: ${questionId}] Answer Style Decision - Option ${optionIdx}`, "color: #FF9800; font-weight: bold; font-size: 13px; background-color: #fff3e0; padding: 4px 8px;");
70
- console.table(decisionData);
71
- console.groupEnd();
72
- };
73
- const logHashingProcess = (data) => {
74
- const activeQuestion = sessionStorage.getItem("activeDebugQuestion");
75
- if (activeQuestion && activeQuestion !== questionId)
76
- return;
77
- console.group(`%c[Q: ${questionId}] Hashing Process`, "color: #9C27B0; font-weight: bold; font-size: 12px;");
78
- console.table(data);
79
- console.groupEnd();
80
- };
81
- const logRenderCycle = (data) => {
82
- const activeQuestion = sessionStorage.getItem("activeDebugQuestion");
83
- if (activeQuestion && activeQuestion !== questionId)
84
- return;
85
- console.group(`%c[Q: ${questionId}] Render Cycle`, "color: #E91E63; font-weight: bold; font-size: 12px;");
86
- console.table(data);
87
- console.groupEnd();
88
- };
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;
89
43
  const [windowWidth, setWindowWidth] = (0, react_1.useState)(typeof window !== "undefined" ? window.innerWidth : 1024);
90
44
  const [value, setValue] = (0, react_1.useState)(isReviewScreen
91
45
  ? undefined
92
- : (0, common_utils_1.isNotEmptyOrNull)(userAnswer)
46
+ : (0, common_utils_1.isNotEmptyOrNull)(userAnswer) // First approach: initialize with extracted answer
93
47
  ? (0, common_utils_1.extractGivenAnswers)(userAnswer)?.[0]
94
48
  : "");
95
49
  const [selectedIndex, setSelectedIndex] = (0, react_1.useState)();
@@ -110,19 +64,9 @@ const ScqComponent = (props) => {
110
64
  : isStandalone || isStandaloneWithSubjectMapping
111
65
  ? LearningPathUtils_1.taskTypes?.standalone
112
66
  : taskType));
67
+ // Hashing states
113
68
  const [hashedOptions, setHashedOptions] = (0, react_1.useState)({});
114
69
  const [isHashingComplete, setIsHashingComplete] = (0, react_1.useState)(isReviewScreen);
115
- // Initialize
116
- (0, react_1.useEffect)(() => {
117
- setActiveQuestion();
118
- log("Component Initialized", {
119
- questionId,
120
- isReviewScreen,
121
- userAnswer,
122
- taskType,
123
- isFactual,
124
- });
125
- }, []);
126
70
  (0, react_1.useEffect)(() => {
127
71
  if (isReviewScreen) {
128
72
  let answerValue = (0, common_utils_1.isNotEmptyOrNull)(userAnswer)
@@ -130,21 +74,12 @@ const ScqComponent = (props) => {
130
74
  : "";
131
75
  setValue(answerValue);
132
76
  setOptionsData(options.map((item) => (0, common_utils_1.handleRemoveExtraSpaceInBubbles)(item)));
133
- log("Review Screen Setup", {
134
- answerValue,
135
- optionsCount: options.length,
136
- });
137
77
  }
138
78
  else {
139
79
  setOptionsData(options);
140
80
  if (value && options) {
141
81
  const index = options.findIndex((opt) => opt === value);
142
82
  setSelectedIndex(index !== -1 ? index : undefined);
143
- log("Options Data Updated", {
144
- selectedIndex: index !== -1 ? index : undefined,
145
- selectedValue: value,
146
- optionsCount: options.length,
147
- });
148
83
  }
149
84
  }
150
85
  }, [options, userAnswer, isReviewScreen]);
@@ -153,16 +88,8 @@ const ScqComponent = (props) => {
153
88
  if (isReviewScreen)
154
89
  return;
155
90
  const computeHashedOptions = async () => {
156
- if (!optionsData.length) {
157
- log("Hashing Skipped - No Options", {});
91
+ if (!optionsData.length)
158
92
  return;
159
- }
160
- logHashingProcess({
161
- startTime: new Date().toISOString(),
162
- optionsCount: optionsData.length,
163
- hasAnswersIndexHashedKeys: (0, common_utils_1.isNotEmptyOrNull)(currentQuestion?.answers_index_hashed_keys),
164
- hasAnswersKey: (0, common_utils_1.isNotEmptyOrNull)(currentQuestion?.answers_key),
165
- });
166
93
  const hashed = {};
167
94
  for (let i = 0; i < optionsData.length; i++) {
168
95
  const item = optionsData[i];
@@ -172,17 +99,9 @@ const ScqComponent = (props) => {
172
99
  ? (0, crypto_1.answerEncryptText)(currentQuestion?.options_layout?.[i])
173
100
  : item);
174
101
  hashed[i] = data;
175
- logHashingProcess({
176
- optionIndex: i,
177
- original: item.substring(0, 50),
178
- hashed: String(data).substring(0, 50),
179
- });
180
102
  }
181
103
  setHashedOptions(hashed);
182
104
  setIsHashingComplete(true);
183
- log("Hashing Complete", {
184
- totalOptionsHashed: Object.keys(hashed).length,
185
- });
186
105
  };
187
106
  computeHashedOptions();
188
107
  }, [
@@ -190,8 +109,9 @@ const ScqComponent = (props) => {
190
109
  currentQuestion?.uuid,
191
110
  currentQuestion?.answers_index_hashed_keys,
192
111
  currentQuestion?.answers_key,
193
- isReviewScreen,
112
+ isReviewScreen
194
113
  ]);
114
+ // Get hashed option function
195
115
  const getHashedOption = (0, react_1.useCallback)((item, position) => {
196
116
  if (!isHashingComplete)
197
117
  return item;
@@ -200,36 +120,24 @@ const ScqComponent = (props) => {
200
120
  const handleOnChange = (0, react_1.useCallback)((item, index) => {
201
121
  setValue(item);
202
122
  setSelectedIndex(index);
203
- log("Option Selected", {
204
- selectedOption: item.substring(0, 50),
205
- selectedIndex: index,
206
- isReviewScreen,
207
- });
208
123
  if (isReviewScreen) {
209
124
  return;
210
125
  }
211
126
  else {
212
127
  let selectedAnswer = getHashedOption(item, index);
213
- log("Answer Change Triggered", {
214
- selectedItem: item.substring(0, 50),
215
- selectedHashedIndexAnswer: String(selectedAnswer).substring(0, 50),
216
- selectedIndex: index,
217
- });
218
128
  handleAnswerChange({
219
129
  selectedItem: item,
220
130
  selectedHashedIndexAnswer: selectedAnswer,
221
131
  selectedIndex: index,
222
132
  });
223
133
  }
224
- }, [getHashedOption, handleAnswerChange, isReviewScreen]);
134
+ }, [getHashedOption, handleAnswerChange]);
225
135
  const openImage = (0, react_1.useCallback)((index) => {
226
136
  setImageIndex(index);
227
137
  setIsOpen(true);
228
- log("Image Opened", { imageIndex: index });
229
138
  }, []);
230
139
  const handleClose = (0, react_1.useCallback)(() => {
231
140
  setIsOpen(false);
232
- log("Image Closed", {});
233
141
  }, []);
234
142
  (0, react_1.useEffect)(() => {
235
143
  if (!propOnAnswerSubmitted)
@@ -238,40 +146,54 @@ const ScqComponent = (props) => {
238
146
  if (!isReviewScreen) {
239
147
  const selectedAnswer = getHashedOption(value, selectedIndex);
240
148
  setValue(selectedAnswer);
241
- log("Answer Submitted", {
242
- submittedValue: String(selectedAnswer).substring(0, 50),
243
- selectedIndex,
244
- });
245
149
  }
246
- }, [propOnAnswerSubmitted, getHashedOption, value, selectedIndex, isReviewScreen]);
150
+ }, [
151
+ propOnAnswerSubmitted,
152
+ getHashedOption,
153
+ value,
154
+ selectedIndex,
155
+ isReviewScreen,
156
+ ]);
247
157
  (0, react_1.useEffect)(() => {
248
- const handleResize = () => {
249
- setWindowWidth(window.innerWidth);
250
- log("Window Resized", { newWidth: window.innerWidth });
251
- };
158
+ const handleResize = () => setWindowWidth(window.innerWidth);
252
159
  window.addEventListener("resize", handleResize);
253
160
  return () => window.removeEventListener("resize", handleResize);
254
161
  }, []);
255
162
  let isStudent = presenterLogic?.isStudent === common_utils_1.reviewUserRoles?.STUDENT;
163
+ // Screen configuration
256
164
  const screenConfig = (0, react_1.useMemo)(() => {
257
- let config;
258
165
  if (windowWidth >= 1536)
259
- config = { characterCount: isComprehension ? 20 : 30, screenSize: "desktop" };
260
- else if (windowWidth >= 1400)
261
- config = { characterCount: isComprehension ? 20 : 30, screenSize: "desktop" };
262
- else if (windowWidth >= 1280)
263
- config = { characterCount: isComprehension ? 18 : 24, screenSize: "desktop" };
264
- else if (windowWidth >= 1100)
265
- config = { characterCount: isComprehension ? 16 : 20, screenSize: "desktop" };
266
- else if (windowWidth >= 992)
267
- config = { characterCount: isComprehension ? 10 : 14, screenSize: "desktop" };
268
- else if (windowWidth >= 768)
269
- config = { characterCount: isComprehension ? 10 : 12, screenSize: "tablet" };
270
- else
271
- config = { characterCount: 6, screenSize: "mobile" };
272
- log("Screen Config", { windowWidth, ...config });
273
- return config;
274
- }, [windowWidth, isComprehension]);
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]);
275
197
  const stringLengthAnalysis = (0, react_1.useMemo)(() => {
276
198
  const { characterCount } = screenConfig;
277
199
  return {
@@ -282,35 +204,23 @@ const ScqComponent = (props) => {
282
204
  const layoutType = (0, react_1.useMemo)(() => {
283
205
  const { screenSize } = screenConfig;
284
206
  const { hasLongStrings, hasVeryLongStrings } = stringLengthAnalysis;
285
- let type;
286
207
  if (option_image_details?.length > 0) {
287
- type = screenSize === "mobile" ? "column" : "twoRows";
288
- }
289
- else if (screenSize === "mobile") {
290
- type = "column";
208
+ if (screenSize === "mobile")
209
+ return "column";
210
+ return "twoRows";
291
211
  }
292
- else if (screenSize === "tablet") {
293
- type = hasLongStrings ? "column" : "twoRows";
294
- }
295
- else if (screenSize === "desktop") {
212
+ if (screenSize === "mobile")
213
+ return "column";
214
+ if (screenSize === "tablet")
215
+ return hasLongStrings ? "column" : "twoRows";
216
+ if (screenSize === "desktop") {
296
217
  if (hasVeryLongStrings)
297
- type = "column";
298
- else if (hasLongStrings)
299
- type = "twoRows";
300
- else
301
- type = "row";
302
- }
303
- else {
304
- type = "row";
218
+ return "column";
219
+ if (hasLongStrings)
220
+ return "twoRows";
221
+ return "row";
305
222
  }
306
- log("Layout Type Determined", {
307
- layoutType: type,
308
- screenSize,
309
- hasLongStrings,
310
- hasVeryLongStrings,
311
- hasImages: option_image_details?.length > 0,
312
- });
313
- return type;
223
+ return "row";
314
224
  }, [screenConfig, stringLengthAnalysis, option_image_details]);
315
225
  (0, react_1.useEffect)(() => {
316
226
  setLayoutType?.(layoutType);
@@ -335,16 +245,12 @@ const ScqComponent = (props) => {
335
245
  }
336
246
  const hasImages = imagesList?.length > 0;
337
247
  if (!answerSubmitted) {
338
- const style = hashedItem === hashedValue
339
- ? hasImages ? "scq-card-selected" : "scq-card-selected-noimage"
340
- : hasImages ? "scq-card" : "scq-card-noimage";
341
- logAnswerStyleDecision(index, {
342
- stage: "beforeSubmit",
343
- answerSubmitted: false,
344
- isSelected: hashedItem === hashedValue,
345
- style,
346
- });
347
- return style;
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
+ }
348
254
  }
349
255
  const isCorrectAnswer = isReviewScreen
350
256
  ? (0, common_utils_1.isNotEmptyOrNull)(currentQuestion?.answers_index_hashed_keys)
@@ -362,99 +268,64 @@ const ScqComponent = (props) => {
362
268
  ? displayedQues?.[index]?.isSubmitted !== true
363
269
  : !answerSubmitted;
364
270
  if (isAnswerNotSubmitted && !isReviewScreen) {
365
- const style = hashedItem === hashedValue
366
- ? hasImages ? "scq-card-selected" : "scq-card-selected-noimage"
367
- : hasImages ? "scq-card" : "scq-card-noimage";
368
- logAnswerStyleDecision(index, {
369
- stage: "answerNotSubmitted",
370
- isSelected: hashedItem === hashedValue,
371
- style,
372
- });
373
- return style;
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
+ }
374
277
  }
375
278
  if (isCorrectAnswer) {
376
279
  if (shouldShowCorrectFeedback) {
377
- const style = hasImages ? "scq-card-correct" : "scq-card-correct-noimage";
378
- logAnswerStyleDecision(index, {
379
- stage: "correctAnswerShow",
380
- isCorrect: true,
381
- shouldShowFeedback: true,
382
- style,
383
- });
384
- return style;
280
+ return hasImages ? "scq-card-correct" : "scq-card-correct-noimage";
385
281
  }
386
282
  else {
387
283
  if (isUserSelection) {
388
- const style = isReviewScreen
389
- ? hasImages ? "scq-card-selected" : "scq-card-selected-noimage"
390
- : taskType === LearningPathUtils_1.taskTypes.assessment || isFactual
391
- ? hasImages ? "scq-card" : "scq-card-noimage"
392
- : hasImages ? "scq-card-selected" : "scq-card-selected-noimage";
393
- logAnswerStyleDecision(index, {
394
- stage: "correctButNoFeedback",
395
- isCorrect: true,
396
- isUserSelection: true,
397
- isReviewScreen,
398
- style,
399
- });
400
- return style;
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
+ }
401
294
  }
402
295
  else {
403
- const style = hasImages ? "scq-card" : "scq-card-noimage";
404
- logAnswerStyleDecision(index, {
405
- stage: "correctButNotSelected",
406
- isCorrect: true,
407
- isUserSelection: false,
408
- style,
409
- });
410
- return style;
296
+ return hasImages ? "scq-card" : "scq-card-noimage";
411
297
  }
412
298
  }
413
299
  }
414
300
  if (isUserSelection) {
415
301
  if (shouldShowWrongFeedback) {
416
- const style = hasImages ? "scq-card-wrong" : "scq-card-wrong-noimage";
417
- logAnswerStyleDecision(index, {
418
- stage: "wrongAnswerShow",
419
- isUserSelection: true,
420
- shouldShowFeedback: true,
421
- style,
422
- });
423
- return style;
302
+ return hasImages ? "scq-card-wrong" : "scq-card-wrong-noimage";
424
303
  }
425
304
  else {
426
- const style = isReviewScreen
427
- ? hasImages ? "scq-card-selected" : "scq-card-selected-noimage"
305
+ return isReviewScreen
306
+ ? hasImages
307
+ ? "scq-card-selected"
308
+ : "scq-card-selected-noimage"
428
309
  : taskType === LearningPathUtils_1.taskTypes.assessment || isFactual
429
- ? hasImages ? "scq-card-selected" : "scq-card-selected-noimage"
430
- : hasImages ? "scq-card-selected" : "scq-card-selected-noimage";
431
- logAnswerStyleDecision(index, {
432
- stage: "wrongButNoFeedback",
433
- isUserSelection: true,
434
- shouldShowFeedback: false,
435
- style,
436
- });
437
- return style;
310
+ ? hasImages
311
+ ? "scq-card-selected"
312
+ : "scq-card-selected-noimage"
313
+ : hasImages
314
+ ? "scq-card-selected"
315
+ : "scq-card-selected-noimage";
438
316
  }
439
317
  }
440
- const style = hasImages ? "scq-card" : "scq-card-noimage";
441
- logAnswerStyleDecision(index, {
442
- stage: "default",
443
- style,
444
- });
445
- return style;
318
+ return hasImages ? "scq-card" : "scq-card-noimage";
446
319
  }, [
447
320
  getHashedOption,
448
321
  optionsData,
449
322
  crypto_1.answers_index_hashed_keys,
450
323
  presentationMode,
451
324
  answer,
325
+ answer,
452
326
  taskType,
453
327
  isFactual,
454
328
  common_utils_1.passphrase,
455
- isReviewScreen,
456
- displayedQues,
457
- currentQuestion,
458
329
  ]);
459
330
  const renderSingleOption = (0, react_1.useCallback)((optionContent, idx, isColumn = false) => {
460
331
  const label = (0, common_utils_1.getCharacterFromNumber)(idx);
@@ -488,14 +359,6 @@ const ScqComponent = (props) => {
488
359
  };
489
360
  const imageBlock = option_image_details?.length > 0 &&
490
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" } }) }));
491
- logStyle(idx, {
492
- answerStyle,
493
- isSelected,
494
- isCorrectAnswerShown,
495
- allowClick,
496
- textClass: getTextClass(),
497
- hasImages: !!imageBlock,
498
- });
499
362
  if (isStudent || !isReviewScreen) {
500
363
  return ((0, jsx_runtime_1.jsxs)(react_2.Box, { className: [
501
364
  styles.optionContainer,
@@ -507,7 +370,7 @@ const ScqComponent = (props) => {
507
370
  styles[answerStyle],
508
371
  ]
509
372
  .filter(Boolean)
510
- .join(" "), onClick: () => allowClick && handleOnChange(optionContent, idx), style: {
373
+ .join(" "), onClick: () => allowClick && handleOnChange(optionContent), style: {
511
374
  cursor: allowClick ? "pointer" : "default",
512
375
  pointerEvents: isDontAllow ? "none" : "auto",
513
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
@@ -516,7 +379,7 @@ const ScqComponent = (props) => {
516
379
  }
517
380
  return ((0, jsx_runtime_1.jsx)(react_2.Box, { className: `${styles[answerStyle]} ${layoutType === "twoRows" && option_image_details?.length === 0
518
381
  ? styles.twoRowOptions
519
- : ""}`, onClick: () => allowClick && handleOnChange(optionContent, idx), style: {
382
+ : ""}`, onClick: () => allowClick && handleOnChange(optionContent), style: {
520
383
  cursor: allowClick ? "pointer" : "default",
521
384
  pointerEvents: isDontAllow ? "none" : "auto",
522
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));
@@ -530,41 +393,20 @@ const ScqComponent = (props) => {
530
393
  isReviewScreen,
531
394
  isFactual,
532
395
  layoutType,
533
- icons,
534
- styles,
535
- modifiedOptions,
536
- option_image_details,
537
- taskType,
538
- currentQuestion,
539
- isStudent,
540
- isDontAllow,
541
- isComprehension,
542
396
  ]);
543
397
  const renderedOptions = (0, react_1.useMemo)(() => {
544
- if (!options?.length) {
545
- logRenderCycle({ status: "noOptions" });
398
+ if (!options?.length)
546
399
  return null;
547
- }
548
400
  if (layoutType === "twoRows") {
549
401
  const rows = [];
550
402
  for (let i = 0; i < options?.length; i += 2) {
551
403
  rows.push(options?.slice(i, i + 2));
552
404
  }
553
- logRenderCycle({
554
- layoutType: "twoRows",
555
- totalRows: rows.length,
556
- optionsPerRow: 2,
557
- });
558
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) => {
559
406
  const actualIndex = rowIndex * 2 + idx;
560
407
  return ((0, jsx_runtime_1.jsx)(react_2.Box, { children: renderSingleOption(optionContent, actualIndex, false) }, actualIndex));
561
408
  }) }, rowIndex))) }));
562
409
  }
563
- logRenderCycle({
564
- layoutType,
565
- isColumn: layoutType === "column",
566
- totalOptions: options.length,
567
- });
568
410
  return options.map((optionContent, idx) => renderSingleOption(optionContent, idx, layoutType === "column"));
569
411
  }, [options, layoutType, renderSingleOption, styles]);
570
412
  const wrapperClasses = (0, react_1.useMemo)(() => {
@@ -573,20 +415,12 @@ const ScqComponent = (props) => {
573
415
  classes.push(styles?.columnWrapper);
574
416
  if (layoutType === "twoRows")
575
417
  classes.push(styles?.twoRowsContainer);
576
- const finalClasses = classes.join(" ");
577
- log("Wrapper Classes", { classes: finalClasses });
578
- return finalClasses;
418
+ return classes.join(" ");
579
419
  }, [layoutType, styles]);
420
+ // Show loading while hashing is in progress
580
421
  if (!isHashingComplete) {
581
- log("Hashing In Progress", { isHashingComplete: false });
582
422
  return (0, jsx_runtime_1.jsx)(react_2.Box, { children: "Loading options..." });
583
423
  }
584
- log("Component Rendered", {
585
- optionsCount: options?.length,
586
- layoutType,
587
- isReviewScreen,
588
- isStudent,
589
- });
590
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()))] }));
591
425
  };
592
426
  exports.default = ScqComponent;