@schoolio/player 1.4.5 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1322,7 +1322,9 @@ var defaultStyles = {
1322
1322
  option: {
1323
1323
  width: "100%",
1324
1324
  padding: "12px 16px",
1325
- border: "2px solid #e5e7eb",
1325
+ borderWidth: "2px",
1326
+ borderStyle: "solid",
1327
+ borderColor: "#e5e7eb",
1326
1328
  borderRadius: "8px",
1327
1329
  cursor: "pointer",
1328
1330
  transition: "all 0.2s ease",
@@ -1745,7 +1747,9 @@ function MatchingDragDrop({ leftItems, rightItems, currentMatches, correctMatche
1745
1747
  alignItems: "center",
1746
1748
  gap: "12px",
1747
1749
  padding: "12px 16px",
1748
- border: "2px dashed #e5e7eb",
1750
+ borderWidth: "2px",
1751
+ borderStyle: "dashed",
1752
+ borderColor: "#e5e7eb",
1749
1753
  borderRadius: "8px",
1750
1754
  backgroundColor: "#ffffff",
1751
1755
  minHeight: "56px",
@@ -1828,7 +1832,9 @@ function MatchingDragDrop({ leftItems, rightItems, currentMatches, correctMatche
1828
1832
  {
1829
1833
  style: {
1830
1834
  padding: "12px 16px",
1831
- border: "2px solid #e5e7eb",
1835
+ borderWidth: "2px",
1836
+ borderStyle: "solid",
1837
+ borderColor: "#e5e7eb",
1832
1838
  borderRadius: "8px",
1833
1839
  backgroundColor: "#ffffff",
1834
1840
  cursor: showFeedback ? "default" : "grab",
@@ -1929,6 +1935,7 @@ function QuizPlayer({
1929
1935
  const [showReportModal, setShowReportModal] = (0, import_react3.useState)(false);
1930
1936
  const [isReporting, setIsReporting] = (0, import_react3.useState)(false);
1931
1937
  const [reportComment, setReportComment] = (0, import_react3.useState)("");
1938
+ const [retryKey, setRetryKey] = (0, import_react3.useState)(0);
1932
1939
  const apiClient = (0, import_react3.useRef)(null);
1933
1940
  const timerRef = (0, import_react3.useRef)(null);
1934
1941
  const startTimeRef = (0, import_react3.useRef)(0);
@@ -2003,7 +2010,7 @@ function QuizPlayer({
2003
2010
  }
2004
2011
  }
2005
2012
  initialize();
2006
- }, [quizId, lessonId, assignLessonId, courseId, childId, parentId, forceNewAttempt]);
2013
+ }, [quizId, lessonId, assignLessonId, courseId, childId, parentId, forceNewAttempt, retryKey]);
2007
2014
  (0, import_react3.useEffect)(() => {
2008
2015
  if (timerStarted && !isCompleted && !errorCode) {
2009
2016
  startTimeRef.current = Date.now();
@@ -2277,6 +2284,38 @@ function QuizPlayer({
2277
2284
  setIsReporting(false);
2278
2285
  }
2279
2286
  }, [currentQuestion, apiClient, attempt, quiz, childId, parentId, lessonId, courseId, assignLessonId]);
2287
+ const handleRetryQuiz = (0, import_react3.useCallback)(() => {
2288
+ setCurrentQuestionIndex(0);
2289
+ setAnswers(/* @__PURE__ */ new Map());
2290
+ setAnswersDetail([]);
2291
+ setIsCompleted(false);
2292
+ setResult(null);
2293
+ setErrorCode(null);
2294
+ setShowIntro(true);
2295
+ setShowFeedback(false);
2296
+ setCurrentAnswerDetail(null);
2297
+ setTimerStarted(false);
2298
+ setElapsedSeconds(0);
2299
+ startTimeRef.current = 0;
2300
+ setExtraQuestions([]);
2301
+ setSkippedQuestionIds(/* @__PURE__ */ new Set());
2302
+ setAttempt(null);
2303
+ setShowResumeChoice(false);
2304
+ setHasExistingProgress(false);
2305
+ setExistingProgressCount(0);
2306
+ setIsSubmitting(false);
2307
+ setIsNavigating(false);
2308
+ setIsGeneratingExtra(false);
2309
+ setIsStartingFresh(false);
2310
+ setShowSkipModal(false);
2311
+ setIsSkipping(false);
2312
+ setSkipComment("");
2313
+ setSelectedSkipReason(null);
2314
+ setShowReportModal(false);
2315
+ setIsReporting(false);
2316
+ setReportComment("");
2317
+ setRetryKey((prev) => prev + 1);
2318
+ }, []);
2280
2319
  if (isLoading) {
2281
2320
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className, style: defaultStyles.container, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.loading, children: "Loading quiz..." }) });
2282
2321
  }
@@ -2440,6 +2479,16 @@ function QuizPlayer({
2440
2479
  opacity: 1;
2441
2480
  }
2442
2481
  }
2482
+ @keyframes buttonFadeIn {
2483
+ 0% {
2484
+ opacity: 0;
2485
+ transform: translateY(10px);
2486
+ }
2487
+ 100% {
2488
+ opacity: 1;
2489
+ transform: translateY(0);
2490
+ }
2491
+ }
2443
2492
  ` }),
2444
2493
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.results, children: [
2445
2494
  percentage >= 60 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.confettiContainer, children: confettiPieces.map((piece) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -2592,7 +2641,39 @@ function QuizPlayer({
2592
2641
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...defaultStyles.resultDetails, marginTop: "8px" }, children: [
2593
2642
  "Time: ",
2594
2643
  formatTime(result.timeSpentSeconds)
2595
- ] })
2644
+ ] }),
2645
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2646
+ "button",
2647
+ {
2648
+ style: {
2649
+ marginTop: "24px",
2650
+ padding: "14px 32px",
2651
+ fontSize: "16px",
2652
+ fontWeight: "600",
2653
+ color: "#7c3aed",
2654
+ background: "white",
2655
+ border: "2px solid #7c3aed",
2656
+ borderRadius: "12px",
2657
+ cursor: "pointer",
2658
+ transition: "all 0.2s ease",
2659
+ animation: "buttonFadeIn 0.5s ease-out 0.8s forwards",
2660
+ opacity: 0
2661
+ },
2662
+ onClick: handleRetryQuiz,
2663
+ onMouseOver: (e) => {
2664
+ e.currentTarget.style.background = "#7c3aed";
2665
+ e.currentTarget.style.color = "white";
2666
+ e.currentTarget.style.transform = "translateY(-2px)";
2667
+ },
2668
+ onMouseOut: (e) => {
2669
+ e.currentTarget.style.background = "white";
2670
+ e.currentTarget.style.color = "#7c3aed";
2671
+ e.currentTarget.style.transform = "translateY(0)";
2672
+ },
2673
+ "data-testid": "button-retry-quiz",
2674
+ children: "Try Again"
2675
+ }
2676
+ )
2596
2677
  ] }) })
2597
2678
  ] })
2598
2679
  ] });
@@ -2694,294 +2775,143 @@ function QuizPlayer({
2694
2775
  const remainingSlots = maxQuestions - totalQuestions;
2695
2776
  const questionsToAdd = Math.min(5, remainingSlots);
2696
2777
  const canAddMore = onGenerateMoreQuestions && remainingSlots > 0;
2697
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className, style: defaultStyles.container, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.mainLayout, children: [
2698
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.quizContent, children: [
2699
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.header, children: [
2700
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.title, children: quiz.title }),
2701
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.progress, children: [
2702
- "Question ",
2703
- currentQuestionIndex + 1,
2704
- " of ",
2705
- totalQuestions
2706
- ] }),
2707
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.progressBar, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...defaultStyles.progressFill, width: `${progressPercent}%` } }) })
2708
- ] }),
2709
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...defaultStyles.question, position: "relative", paddingBottom: "40px" }, children: [
2710
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.questionText, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: currentQuestion.question, inline: true, size: "md" }) }),
2711
- isExtraQuestion && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2712
- "button",
2713
- {
2714
- onClick: () => setShowSkipModal(true),
2715
- title: "Skip question",
2716
- style: {
2717
- position: "absolute",
2718
- bottom: "8px",
2719
- left: "0",
2720
- background: "transparent",
2721
- border: "none",
2722
- cursor: "pointer",
2723
- padding: "6px 10px",
2724
- borderRadius: "6px",
2725
- color: "#9ca3af",
2726
- display: "flex",
2727
- alignItems: "center",
2728
- justifyContent: "center",
2729
- gap: "4px",
2730
- fontSize: "12px",
2731
- opacity: 0.6,
2732
- transition: "opacity 0.2s, color 0.2s"
2733
- },
2734
- onMouseEnter: (e) => {
2735
- e.currentTarget.style.opacity = "1";
2736
- e.currentTarget.style.color = "#6b7280";
2737
- },
2738
- onMouseLeave: (e) => {
2739
- e.currentTarget.style.opacity = "0.6";
2740
- e.currentTarget.style.color = "#9ca3af";
2741
- },
2742
- "data-testid": "button-skip-question",
2743
- children: [
2744
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2745
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polygon", { points: "5 4 15 12 5 20 5 4" }),
2746
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "19", y1: "5", x2: "19", y2: "19" })
2747
- ] }),
2748
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Skip" })
2749
- ]
2778
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className, style: defaultStyles.container, children: [
2779
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
2780
+ .quiz-option:focus,
2781
+ .quiz-option:active,
2782
+ .quiz-option:focus-visible,
2783
+ .quiz-option:focus-within {
2784
+ outline: none !important;
2785
+ box-shadow: none !important;
2750
2786
  }
2751
- ),
2752
- !isExtraQuestion && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2753
- "button",
2754
- {
2755
- onClick: () => setShowReportModal(true),
2756
- title: "Report an issue with this question",
2757
- style: {
2758
- position: "absolute",
2759
- bottom: "8px",
2760
- left: "0",
2761
- background: "transparent",
2762
- border: "none",
2763
- cursor: "pointer",
2764
- padding: "6px 10px",
2765
- borderRadius: "6px",
2766
- color: "#9ca3af",
2767
- display: "flex",
2768
- alignItems: "center",
2769
- justifyContent: "center",
2770
- gap: "4px",
2771
- fontSize: "12px",
2772
- opacity: 0.6,
2773
- transition: "opacity 0.2s, color 0.2s"
2774
- },
2775
- onMouseEnter: (e) => {
2776
- e.currentTarget.style.opacity = "1";
2777
- e.currentTarget.style.color = "#ef4444";
2778
- },
2779
- onMouseLeave: (e) => {
2780
- e.currentTarget.style.opacity = "0.6";
2781
- e.currentTarget.style.color = "#9ca3af";
2782
- },
2783
- "data-testid": "button-report-question",
2784
- children: [
2785
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2786
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" }),
2787
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "4", y1: "22", x2: "4", y2: "15" })
2788
- ] }),
2789
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Report" })
2790
- ]
2791
- }
2792
- ),
2793
- (currentQuestion.type === "single" || currentQuestion.type === "true-false") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.options?.map((option, idx) => {
2794
- const isSelected = selectedAnswer === option;
2795
- const isCorrectOption = currentQuestion.correctAnswer === option;
2796
- let optionStyle = { ...defaultStyles.option };
2797
- if (showFeedback) {
2798
- if (isCorrectOption) {
2799
- optionStyle = { ...optionStyle, ...defaultStyles.optionCorrect };
2800
- } else if (isSelected && !isCorrectOption) {
2801
- optionStyle = { ...optionStyle, ...defaultStyles.optionIncorrect };
2802
- }
2803
- } else if (isSelected) {
2804
- optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
2787
+ .quiz-option {
2788
+ -webkit-tap-highlight-color: transparent;
2805
2789
  }
2806
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2807
- "div",
2790
+ ` }),
2791
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.mainLayout, children: [
2792
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.quizContent, children: [
2793
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.header, children: [
2794
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.title, children: quiz.title }),
2795
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.progress, children: [
2796
+ "Question ",
2797
+ currentQuestionIndex + 1,
2798
+ " of ",
2799
+ totalQuestions
2800
+ ] }),
2801
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.progressBar, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...defaultStyles.progressFill, width: `${progressPercent}%` } }) })
2802
+ ] }),
2803
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...defaultStyles.question, position: "relative", paddingBottom: "40px" }, children: [
2804
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.questionText, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: currentQuestion.question, inline: true, size: "md" }) }),
2805
+ currentQuestion.type === "multiple" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
2806
+ marginTop: "8px",
2807
+ marginBottom: "12px",
2808
+ display: "inline-block",
2809
+ padding: "4px 10px",
2810
+ backgroundColor: "rgba(139, 92, 246, 0.1)",
2811
+ color: "#7c3aed",
2812
+ fontSize: "13px",
2813
+ fontStyle: "italic",
2814
+ borderRadius: "4px"
2815
+ }, children: "Select all that apply" }),
2816
+ isExtraQuestion && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2817
+ "button",
2808
2818
  {
2819
+ onClick: () => setShowSkipModal(true),
2820
+ title: "Skip question",
2809
2821
  style: {
2810
- ...optionStyle,
2811
- cursor: showFeedback ? "default" : "pointer",
2822
+ position: "absolute",
2823
+ bottom: "8px",
2824
+ left: "0",
2825
+ background: "transparent",
2826
+ border: "none",
2827
+ cursor: "pointer",
2828
+ padding: "6px 10px",
2829
+ borderRadius: "6px",
2830
+ color: "#9ca3af",
2812
2831
  display: "flex",
2813
2832
  alignItems: "center",
2814
- gap: "8px"
2833
+ justifyContent: "center",
2834
+ gap: "4px",
2835
+ fontSize: "12px",
2836
+ opacity: 0.6,
2837
+ transition: "opacity 0.2s, color 0.2s"
2838
+ },
2839
+ onMouseEnter: (e) => {
2840
+ e.currentTarget.style.opacity = "1";
2841
+ e.currentTarget.style.color = "#6b7280";
2815
2842
  },
2816
- onClick: () => !showFeedback && handleAnswerChange(option),
2843
+ onMouseLeave: (e) => {
2844
+ e.currentTarget.style.opacity = "0.6";
2845
+ e.currentTarget.style.color = "#9ca3af";
2846
+ },
2847
+ "data-testid": "button-skip-question",
2817
2848
  children: [
2818
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: option, size: "sm" }) }),
2819
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2849
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2850
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polygon", { points: "5 4 15 12 5 20 5 4" }),
2851
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "19", y1: "5", x2: "19", y2: "19" })
2852
+ ] }),
2853
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Skip" })
2820
2854
  ]
2821
- },
2822
- idx
2823
- );
2824
- }) }),
2825
- currentQuestion.type === "multiple" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.options?.map((option, idx) => {
2826
- const selected = Array.isArray(selectedAnswer) && selectedAnswer.includes(option);
2827
- const correctAnswers = Array.isArray(currentQuestion.correctAnswer) ? currentQuestion.correctAnswer : currentQuestion.correctAnswer ? [currentQuestion.correctAnswer] : [];
2828
- const isCorrectOption = correctAnswers.includes(option);
2829
- let optionStyle = { ...defaultStyles.option };
2830
- if (showFeedback) {
2831
- if (isCorrectOption) {
2832
- optionStyle = { ...optionStyle, ...defaultStyles.optionCorrect };
2833
- } else if (selected && !isCorrectOption) {
2834
- optionStyle = { ...optionStyle, ...defaultStyles.optionIncorrect };
2835
2855
  }
2836
- } else if (selected) {
2837
- optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
2838
- }
2839
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2840
- "div",
2856
+ ),
2857
+ !isExtraQuestion && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2858
+ "button",
2841
2859
  {
2860
+ onClick: () => setShowReportModal(true),
2861
+ title: "Report an issue with this question",
2842
2862
  style: {
2843
- ...optionStyle,
2844
- cursor: showFeedback ? "default" : "pointer",
2863
+ position: "absolute",
2864
+ bottom: "8px",
2865
+ left: "0",
2866
+ background: "transparent",
2867
+ border: "none",
2868
+ cursor: "pointer",
2869
+ padding: "6px 10px",
2870
+ borderRadius: "6px",
2871
+ color: "#9ca3af",
2845
2872
  display: "flex",
2846
2873
  alignItems: "center",
2847
- gap: "8px"
2874
+ justifyContent: "center",
2875
+ gap: "4px",
2876
+ fontSize: "12px",
2877
+ opacity: 0.6,
2878
+ transition: "opacity 0.2s, color 0.2s"
2848
2879
  },
2849
- onClick: () => {
2850
- if (showFeedback) return;
2851
- const current = Array.isArray(selectedAnswer) ? selectedAnswer : [];
2852
- if (selected) {
2853
- handleAnswerChange(current.filter((o) => o !== option));
2854
- } else {
2855
- handleAnswerChange([...current, option]);
2856
- }
2880
+ onMouseEnter: (e) => {
2881
+ e.currentTarget.style.opacity = "1";
2882
+ e.currentTarget.style.color = "#ef4444";
2857
2883
  },
2884
+ onMouseLeave: (e) => {
2885
+ e.currentTarget.style.opacity = "0.6";
2886
+ e.currentTarget.style.color = "#9ca3af";
2887
+ },
2888
+ "data-testid": "button-report-question",
2858
2889
  children: [
2859
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: option, size: "sm" }) }),
2860
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2890
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2891
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" }),
2892
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "4", y1: "22", x2: "4", y2: "15" })
2893
+ ] }),
2894
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Report" })
2861
2895
  ]
2862
- },
2863
- idx
2864
- );
2865
- }) }),
2866
- (currentQuestion.type === "free" || currentQuestion.type === "essay") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2867
- "textarea",
2868
- {
2869
- style: { ...defaultStyles.input, minHeight: currentQuestion.type === "essay" ? "150px" : "60px" },
2870
- value: selectedAnswer || "",
2871
- onChange: (e) => handleAnswerChange(e.target.value),
2872
- placeholder: "Type your answer here...",
2873
- disabled: showFeedback
2874
- }
2875
- ),
2876
- currentQuestion.type === "fill" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.blanks?.map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2877
- "input",
2878
- {
2879
- style: defaultStyles.input,
2880
- value: (Array.isArray(selectedAnswer) ? selectedAnswer[idx] : "") || "",
2881
- onChange: (e) => {
2882
- const current = Array.isArray(selectedAnswer) ? [...selectedAnswer] : [];
2883
- current[idx] = e.target.value;
2884
- handleAnswerChange(current);
2885
- },
2886
- placeholder: `Blank ${idx + 1}`,
2887
- disabled: showFeedback
2888
- },
2889
- idx
2890
- )) }),
2891
- currentQuestion.type === "sorting" && currentQuestion.items && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2892
- SortingDragDrop,
2893
- {
2894
- items: currentQuestion.items,
2895
- currentOrder: Array.isArray(selectedAnswer) ? selectedAnswer : currentQuestion.items.map((_, i) => i),
2896
- correctOrder: currentQuestion.correctOrder,
2897
- showFeedback,
2898
- onOrderChange: handleAnswerChange
2899
- }
2900
- ),
2901
- currentQuestion.type === "matrix" && currentQuestion.leftItems && currentQuestion.rightItems && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2902
- MatchingDragDrop,
2903
- {
2904
- leftItems: currentQuestion.leftItems,
2905
- rightItems: currentQuestion.rightItems,
2906
- currentMatches: typeof selectedAnswer === "object" && selectedAnswer !== null && !Array.isArray(selectedAnswer) ? selectedAnswer : {},
2907
- correctMatches: currentQuestion.correctMatches,
2908
- showFeedback,
2909
- onMatchChange: handleAnswerChange
2910
- }
2911
- ),
2912
- currentQuestion.type === "assessment" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: (() => {
2913
- const scaleType = currentQuestion.scaleType || "likert";
2914
- if (scaleType === "yes-no") {
2915
- const options = ["Yes", "No"];
2916
- return options.map((option, idx) => {
2917
- const isSelected = selectedAnswer === option;
2918
- let optionStyle = { ...defaultStyles.option };
2919
- if (isSelected) {
2920
- optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
2921
- }
2922
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2923
- "div",
2924
- {
2925
- style: {
2926
- ...optionStyle,
2927
- cursor: showFeedback ? "default" : "pointer",
2928
- display: "flex",
2929
- alignItems: "center",
2930
- gap: "8px"
2931
- },
2932
- onClick: () => !showFeedback && handleAnswerChange(option),
2933
- "data-testid": `assessment-option-${option.toLowerCase()}`,
2934
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2935
- },
2936
- idx
2937
- );
2938
- });
2939
- }
2940
- if (scaleType === "rating") {
2941
- const min = currentQuestion.scaleMin || 1;
2942
- const max = currentQuestion.scaleMax || 5;
2943
- const ratings = Array.from({ length: max - min + 1 }, (_, i) => min + i);
2944
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "center" }, children: ratings.map((rating) => {
2945
- const isSelected = selectedAnswer === rating;
2946
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2947
- "button",
2948
- {
2949
- onClick: () => !showFeedback && handleAnswerChange(rating),
2950
- disabled: showFeedback,
2951
- style: {
2952
- width: "48px",
2953
- height: "48px",
2954
- borderRadius: "50%",
2955
- border: isSelected ? "2px solid #6721b0" : "2px solid #e5e7eb",
2956
- backgroundColor: isSelected ? "#f3e8ff" : "#ffffff",
2957
- cursor: showFeedback ? "not-allowed" : "pointer",
2958
- fontSize: "18px",
2959
- fontWeight: "600",
2960
- color: isSelected ? "#6721b0" : "#374151"
2961
- },
2962
- "data-testid": `assessment-rating-${rating}`,
2963
- children: rating
2964
- },
2965
- rating
2966
- );
2967
- }) });
2968
- }
2969
- const likertOptions = [
2970
- "Strongly Disagree",
2971
- "Disagree",
2972
- "Neutral",
2973
- "Agree",
2974
- "Strongly Agree"
2975
- ];
2976
- return likertOptions.map((option, idx) => {
2896
+ }
2897
+ ),
2898
+ (currentQuestion.type === "single" || currentQuestion.type === "true-false") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.options?.map((option, idx) => {
2977
2899
  const isSelected = selectedAnswer === option;
2900
+ const isCorrectOption = currentQuestion.correctAnswer === option;
2978
2901
  let optionStyle = { ...defaultStyles.option };
2979
- if (isSelected) {
2902
+ if (showFeedback) {
2903
+ if (isCorrectOption) {
2904
+ optionStyle = { ...optionStyle, ...defaultStyles.optionCorrect };
2905
+ } else if (isSelected && !isCorrectOption) {
2906
+ optionStyle = { ...optionStyle, ...defaultStyles.optionIncorrect };
2907
+ }
2908
+ } else if (isSelected) {
2980
2909
  optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
2981
2910
  }
2982
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2911
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2983
2912
  "div",
2984
2913
  {
2914
+ className: "quiz-option",
2985
2915
  style: {
2986
2916
  ...optionStyle,
2987
2917
  cursor: showFeedback ? "default" : "pointer",
@@ -2990,350 +2920,532 @@ function QuizPlayer({
2990
2920
  gap: "8px"
2991
2921
  },
2992
2922
  onClick: () => !showFeedback && handleAnswerChange(option),
2993
- "data-testid": `assessment-likert-${idx}`,
2994
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2923
+ children: [
2924
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: option, size: "sm" }) }),
2925
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2926
+ ]
2995
2927
  },
2996
2928
  idx
2997
2929
  );
2998
- });
2999
- })() }),
3000
- showFeedback && currentAnswerDetail && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3001
- ...defaultStyles.feedback,
3002
- ...currentQuestion.type === "assessment" ? defaultStyles.feedbackNeutral : currentAnswerDetail.isCorrect ? defaultStyles.feedbackCorrect : defaultStyles.feedbackIncorrect
3003
- }, children: [
3004
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3005
- ...defaultStyles.feedbackTitle,
3006
- ...currentQuestion.type === "assessment" ? defaultStyles.feedbackTitleNeutral : currentAnswerDetail.isCorrect ? defaultStyles.feedbackTitleCorrect : defaultStyles.feedbackTitleIncorrect
3007
- }, children: currentQuestion.type === "assessment" ? "\u2713 Response recorded" : currentAnswerDetail.isCorrect ? "\u2713 Correct!" : "\u2717 Incorrect" }),
3008
- currentQuestion.explanation && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.feedbackExplanation, children: currentQuestion.explanation })
3009
- ] })
3010
- ] }),
3011
- showSkipModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3012
- position: "fixed",
3013
- top: 0,
3014
- left: 0,
3015
- right: 0,
3016
- bottom: 0,
3017
- backgroundColor: "rgba(0, 0, 0, 0.5)",
3018
- display: "flex",
3019
- alignItems: "center",
3020
- justifyContent: "center",
3021
- zIndex: 1e3
3022
- }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3023
- backgroundColor: "#ffffff",
3024
- borderRadius: "12px",
3025
- padding: "24px",
3026
- maxWidth: "400px",
3027
- width: "90%",
3028
- boxShadow: "0 20px 40px rgba(0, 0, 0, 0.2)"
3029
- }, children: [
3030
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { style: { margin: "0 0 8px 0", fontSize: "18px", fontWeight: "600", color: "#1f2937" }, children: "Skip Question" }),
3031
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: "0 0 16px 0", fontSize: "14px", color: "#6b7280" }, children: "Help us improve by telling us why you're skipping this question." }),
3032
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "8px", marginBottom: "16px" }, children: [
3033
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3034
- "button",
3035
- {
3036
- onClick: () => setSelectedSkipReason("question_issue"),
3037
- disabled: isSkipping,
3038
- style: {
3039
- padding: "12px 16px",
3040
- borderRadius: "8px",
3041
- border: selectedSkipReason === "question_issue" ? "2px solid #8b5cf6" : "1px solid #e5e7eb",
3042
- backgroundColor: selectedSkipReason === "question_issue" ? "#f5f3ff" : "#f9fafb",
3043
- cursor: isSkipping ? "not-allowed" : "pointer",
3044
- fontSize: "14px",
3045
- fontWeight: "500",
3046
- color: "#374151",
3047
- textAlign: "left",
3048
- opacity: isSkipping ? 0.6 : 1
3049
- },
3050
- "data-testid": "button-skip-reason-issue",
3051
- children: "Question has an issue"
2930
+ }) }),
2931
+ currentQuestion.type === "multiple" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.options?.map((option, idx) => {
2932
+ const selected = Array.isArray(selectedAnswer) && selectedAnswer.includes(option);
2933
+ const correctAnswers = Array.isArray(currentQuestion.correctAnswer) ? currentQuestion.correctAnswer : currentQuestion.correctAnswer ? [currentQuestion.correctAnswer] : [];
2934
+ const isCorrectOption = correctAnswers.includes(option);
2935
+ let optionStyle = { ...defaultStyles.option };
2936
+ if (showFeedback) {
2937
+ if (isCorrectOption) {
2938
+ optionStyle = { ...optionStyle, ...defaultStyles.optionCorrect };
2939
+ } else if (selected && !isCorrectOption) {
2940
+ optionStyle = { ...optionStyle, ...defaultStyles.optionIncorrect };
2941
+ }
2942
+ } else if (selected) {
2943
+ optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
3052
2944
  }
3053
- ),
3054
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3055
- "button",
3056
- {
3057
- onClick: () => setSelectedSkipReason("dont_know"),
3058
- disabled: isSkipping,
3059
- style: {
3060
- padding: "12px 16px",
3061
- borderRadius: "8px",
3062
- border: selectedSkipReason === "dont_know" ? "2px solid #8b5cf6" : "1px solid #e5e7eb",
3063
- backgroundColor: selectedSkipReason === "dont_know" ? "#f5f3ff" : "#f9fafb",
3064
- cursor: isSkipping ? "not-allowed" : "pointer",
3065
- fontSize: "14px",
3066
- fontWeight: "500",
3067
- color: "#374151",
3068
- textAlign: "left",
3069
- opacity: isSkipping ? 0.6 : 1
2945
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2946
+ "div",
2947
+ {
2948
+ className: "quiz-option",
2949
+ style: {
2950
+ ...optionStyle,
2951
+ cursor: showFeedback ? "default" : "pointer",
2952
+ display: "flex",
2953
+ alignItems: "center",
2954
+ gap: "8px"
2955
+ },
2956
+ onClick: () => {
2957
+ if (showFeedback) return;
2958
+ const current = Array.isArray(selectedAnswer) ? selectedAnswer : [];
2959
+ if (selected) {
2960
+ handleAnswerChange(current.filter((o) => o !== option));
2961
+ } else {
2962
+ handleAnswerChange([...current, option]);
2963
+ }
2964
+ },
2965
+ children: [
2966
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: option, size: "sm" }) }),
2967
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2968
+ ]
3070
2969
  },
3071
- "data-testid": "button-skip-reason-dont-know",
3072
- children: "I don't know the answer"
3073
- }
3074
- )
3075
- ] }),
3076
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "16px" }, children: [
3077
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: { display: "block", fontSize: "13px", fontWeight: "500", color: "#374151", marginBottom: "6px" }, children: "Additional details (optional)" }),
3078
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2970
+ idx
2971
+ );
2972
+ }) }),
2973
+ (currentQuestion.type === "free" || currentQuestion.type === "essay") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3079
2974
  "textarea",
3080
2975
  {
3081
- value: skipComment,
3082
- onChange: (e) => setSkipComment(e.target.value.slice(0, 200)),
3083
- placeholder: "Tell us more about the issue...",
3084
- disabled: isSkipping,
3085
- style: {
3086
- width: "100%",
3087
- minHeight: "80px",
3088
- padding: "10px 12px",
3089
- borderRadius: "8px",
3090
- border: "1px solid #e5e7eb",
3091
- fontSize: "14px",
3092
- resize: "vertical",
3093
- fontFamily: "inherit",
3094
- boxSizing: "border-box"
3095
- },
3096
- "data-testid": "input-skip-comment"
2976
+ style: { ...defaultStyles.input, minHeight: currentQuestion.type === "essay" ? "150px" : "60px" },
2977
+ value: selectedAnswer || "",
2978
+ onChange: (e) => handleAnswerChange(e.target.value),
2979
+ placeholder: "Type your answer here...",
2980
+ disabled: showFeedback
3097
2981
  }
3098
2982
  ),
3099
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "12px", color: "#9ca3af", marginTop: "4px", textAlign: "right" }, children: [
3100
- skipComment.length,
3101
- "/200"
3102
- ] })
3103
- ] }),
3104
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "10px" }, children: [
3105
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3106
- "button",
2983
+ currentQuestion.type === "fill" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.blanks?.map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2984
+ "input",
3107
2985
  {
3108
- onClick: () => {
3109
- setShowSkipModal(false);
3110
- setSkipComment("");
3111
- setSelectedSkipReason(null);
2986
+ style: defaultStyles.input,
2987
+ value: (Array.isArray(selectedAnswer) ? selectedAnswer[idx] : "") || "",
2988
+ onChange: (e) => {
2989
+ const current = Array.isArray(selectedAnswer) ? [...selectedAnswer] : [];
2990
+ current[idx] = e.target.value;
2991
+ handleAnswerChange(current);
3112
2992
  },
3113
- style: {
3114
- flex: 1,
3115
- padding: "10px 16px",
3116
- borderRadius: "8px",
3117
- border: "1px solid #e5e7eb",
3118
- backgroundColor: "#ffffff",
3119
- cursor: "pointer",
3120
- fontSize: "14px",
3121
- fontWeight: "500",
3122
- color: "#6b7280"
3123
- },
3124
- "data-testid": "button-skip-cancel",
3125
- children: "Cancel"
3126
- }
3127
- ),
3128
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3129
- "button",
2993
+ placeholder: `Blank ${idx + 1}`,
2994
+ disabled: showFeedback
2995
+ },
2996
+ idx
2997
+ )) }),
2998
+ currentQuestion.type === "sorting" && currentQuestion.items && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2999
+ SortingDragDrop,
3130
3000
  {
3131
- onClick: () => selectedSkipReason && handleSkipQuestion(selectedSkipReason, skipComment),
3132
- disabled: isSkipping || !selectedSkipReason,
3133
- style: {
3134
- flex: 1,
3135
- padding: "10px 16px",
3136
- borderRadius: "8px",
3137
- border: "none",
3138
- backgroundColor: selectedSkipReason ? "#8b5cf6" : "#d1d5db",
3139
- cursor: isSkipping || !selectedSkipReason ? "not-allowed" : "pointer",
3140
- fontSize: "14px",
3141
- fontWeight: "500",
3142
- color: "#ffffff",
3143
- opacity: isSkipping ? 0.6 : 1
3144
- },
3145
- "data-testid": "button-skip-submit",
3146
- children: isSkipping ? "Skipping..." : "Skip Question"
3001
+ items: currentQuestion.items,
3002
+ currentOrder: Array.isArray(selectedAnswer) ? selectedAnswer : currentQuestion.items.map((_, i) => i),
3003
+ correctOrder: currentQuestion.correctOrder,
3004
+ showFeedback,
3005
+ onOrderChange: handleAnswerChange
3147
3006
  }
3148
- )
3149
- ] })
3150
- ] }) }),
3151
- showReportModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3152
- position: "fixed",
3153
- top: 0,
3154
- left: 0,
3155
- right: 0,
3156
- bottom: 0,
3157
- backgroundColor: "rgba(0, 0, 0, 0.5)",
3158
- display: "flex",
3159
- alignItems: "center",
3160
- justifyContent: "center",
3161
- zIndex: 1e3
3162
- }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3163
- backgroundColor: "#ffffff",
3164
- borderRadius: "12px",
3165
- padding: "24px",
3166
- maxWidth: "400px",
3167
- width: "90%",
3168
- boxShadow: "0 20px 40px rgba(0, 0, 0, 0.2)"
3169
- }, children: [
3170
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { style: { margin: "0 0 8px 0", fontSize: "18px", fontWeight: "600", color: "#1f2937" }, children: "Report Question" }),
3171
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: "0 0 16px 0", fontSize: "14px", color: "#6b7280" }, children: "What's wrong with this question?" }),
3172
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "16px" }, children: [
3173
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3174
- "textarea",
3007
+ ),
3008
+ currentQuestion.type === "matrix" && currentQuestion.leftItems && currentQuestion.rightItems && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3009
+ MatchingDragDrop,
3175
3010
  {
3176
- value: reportComment,
3177
- onChange: (e) => setReportComment(e.target.value.slice(0, 300)),
3178
- placeholder: "Describe the issue with this question...",
3179
- disabled: isReporting,
3180
- style: {
3181
- width: "100%",
3182
- minHeight: "120px",
3183
- padding: "10px 12px",
3184
- borderRadius: "8px",
3185
- border: "1px solid #e5e7eb",
3186
- fontSize: "14px",
3187
- resize: "vertical",
3188
- fontFamily: "inherit",
3189
- boxSizing: "border-box"
3190
- },
3191
- "data-testid": "input-report-comment"
3011
+ leftItems: currentQuestion.leftItems,
3012
+ rightItems: currentQuestion.rightItems,
3013
+ currentMatches: typeof selectedAnswer === "object" && selectedAnswer !== null && !Array.isArray(selectedAnswer) ? selectedAnswer : {},
3014
+ correctMatches: currentQuestion.correctMatches,
3015
+ showFeedback,
3016
+ onMatchChange: handleAnswerChange
3192
3017
  }
3193
3018
  ),
3194
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "12px", color: "#9ca3af", marginTop: "4px", textAlign: "right" }, children: [
3195
- reportComment.length,
3196
- "/300"
3019
+ currentQuestion.type === "assessment" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: (() => {
3020
+ const scaleType = currentQuestion.scaleType || "likert";
3021
+ if (scaleType === "yes-no") {
3022
+ const options = ["Yes", "No"];
3023
+ return options.map((option, idx) => {
3024
+ const isSelected = selectedAnswer === option;
3025
+ let optionStyle = { ...defaultStyles.option };
3026
+ if (isSelected) {
3027
+ optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
3028
+ }
3029
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3030
+ "div",
3031
+ {
3032
+ className: "quiz-option",
3033
+ style: {
3034
+ ...optionStyle,
3035
+ cursor: showFeedback ? "default" : "pointer",
3036
+ display: "flex",
3037
+ alignItems: "center",
3038
+ gap: "8px"
3039
+ },
3040
+ onClick: () => !showFeedback && handleAnswerChange(option),
3041
+ "data-testid": `assessment-option-${option.toLowerCase()}`,
3042
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
3043
+ },
3044
+ idx
3045
+ );
3046
+ });
3047
+ }
3048
+ if (scaleType === "rating") {
3049
+ const min = currentQuestion.scaleMin || 1;
3050
+ const max = currentQuestion.scaleMax || 5;
3051
+ const ratings = Array.from({ length: max - min + 1 }, (_, i) => min + i);
3052
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "center" }, children: ratings.map((rating) => {
3053
+ const isSelected = selectedAnswer === rating;
3054
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3055
+ "button",
3056
+ {
3057
+ className: "quiz-option",
3058
+ onClick: () => !showFeedback && handleAnswerChange(rating),
3059
+ disabled: showFeedback,
3060
+ style: {
3061
+ width: "48px",
3062
+ height: "48px",
3063
+ borderRadius: "50%",
3064
+ border: isSelected ? "2px solid #6721b0" : "2px solid #e5e7eb",
3065
+ backgroundColor: isSelected ? "#f3e8ff" : "#ffffff",
3066
+ cursor: showFeedback ? "not-allowed" : "pointer",
3067
+ fontSize: "18px",
3068
+ fontWeight: "600",
3069
+ color: isSelected ? "#6721b0" : "#374151",
3070
+ outline: "none"
3071
+ },
3072
+ "data-testid": `assessment-rating-${rating}`,
3073
+ children: rating
3074
+ },
3075
+ rating
3076
+ );
3077
+ }) });
3078
+ }
3079
+ const likertOptions = [
3080
+ "Strongly Disagree",
3081
+ "Disagree",
3082
+ "Neutral",
3083
+ "Agree",
3084
+ "Strongly Agree"
3085
+ ];
3086
+ return likertOptions.map((option, idx) => {
3087
+ const isSelected = selectedAnswer === option;
3088
+ let optionStyle = { ...defaultStyles.option };
3089
+ if (isSelected) {
3090
+ optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
3091
+ }
3092
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3093
+ "div",
3094
+ {
3095
+ className: "quiz-option",
3096
+ style: {
3097
+ ...optionStyle,
3098
+ cursor: showFeedback ? "default" : "pointer",
3099
+ display: "flex",
3100
+ alignItems: "center",
3101
+ gap: "8px"
3102
+ },
3103
+ onClick: () => !showFeedback && handleAnswerChange(option),
3104
+ "data-testid": `assessment-likert-${idx}`,
3105
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
3106
+ },
3107
+ idx
3108
+ );
3109
+ });
3110
+ })() }),
3111
+ showFeedback && currentAnswerDetail && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3112
+ ...defaultStyles.feedback,
3113
+ ...currentQuestion.type === "assessment" ? defaultStyles.feedbackNeutral : currentAnswerDetail.isCorrect ? defaultStyles.feedbackCorrect : defaultStyles.feedbackIncorrect
3114
+ }, children: [
3115
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3116
+ ...defaultStyles.feedbackTitle,
3117
+ ...currentQuestion.type === "assessment" ? defaultStyles.feedbackTitleNeutral : currentAnswerDetail.isCorrect ? defaultStyles.feedbackTitleCorrect : defaultStyles.feedbackTitleIncorrect
3118
+ }, children: currentQuestion.type === "assessment" ? "\u2713 Response recorded" : currentAnswerDetail.isCorrect ? "\u2713 Correct!" : "\u2717 Incorrect" }),
3119
+ currentQuestion.explanation && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.feedbackExplanation, children: currentQuestion.explanation })
3197
3120
  ] })
3198
3121
  ] }),
3199
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "10px" }, children: [
3200
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3122
+ showSkipModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3123
+ position: "fixed",
3124
+ top: 0,
3125
+ left: 0,
3126
+ right: 0,
3127
+ bottom: 0,
3128
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
3129
+ display: "flex",
3130
+ alignItems: "center",
3131
+ justifyContent: "center",
3132
+ zIndex: 1e3
3133
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3134
+ backgroundColor: "#ffffff",
3135
+ borderRadius: "12px",
3136
+ padding: "24px",
3137
+ maxWidth: "400px",
3138
+ width: "90%",
3139
+ boxShadow: "0 20px 40px rgba(0, 0, 0, 0.2)"
3140
+ }, children: [
3141
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { style: { margin: "0 0 8px 0", fontSize: "18px", fontWeight: "600", color: "#1f2937" }, children: "Skip Question" }),
3142
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: "0 0 16px 0", fontSize: "14px", color: "#6b7280" }, children: "Help us improve by telling us why you're skipping this question." }),
3143
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "8px", marginBottom: "16px" }, children: [
3144
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3145
+ "button",
3146
+ {
3147
+ onClick: () => setSelectedSkipReason("question_issue"),
3148
+ disabled: isSkipping,
3149
+ style: {
3150
+ padding: "12px 16px",
3151
+ borderRadius: "8px",
3152
+ border: selectedSkipReason === "question_issue" ? "2px solid #8b5cf6" : "1px solid #e5e7eb",
3153
+ backgroundColor: selectedSkipReason === "question_issue" ? "#f5f3ff" : "#f9fafb",
3154
+ cursor: isSkipping ? "not-allowed" : "pointer",
3155
+ fontSize: "14px",
3156
+ fontWeight: "500",
3157
+ color: "#374151",
3158
+ textAlign: "left",
3159
+ opacity: isSkipping ? 0.6 : 1
3160
+ },
3161
+ "data-testid": "button-skip-reason-issue",
3162
+ children: "Question has an issue"
3163
+ }
3164
+ ),
3165
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3166
+ "button",
3167
+ {
3168
+ onClick: () => setSelectedSkipReason("dont_know"),
3169
+ disabled: isSkipping,
3170
+ style: {
3171
+ padding: "12px 16px",
3172
+ borderRadius: "8px",
3173
+ border: selectedSkipReason === "dont_know" ? "2px solid #8b5cf6" : "1px solid #e5e7eb",
3174
+ backgroundColor: selectedSkipReason === "dont_know" ? "#f5f3ff" : "#f9fafb",
3175
+ cursor: isSkipping ? "not-allowed" : "pointer",
3176
+ fontSize: "14px",
3177
+ fontWeight: "500",
3178
+ color: "#374151",
3179
+ textAlign: "left",
3180
+ opacity: isSkipping ? 0.6 : 1
3181
+ },
3182
+ "data-testid": "button-skip-reason-dont-know",
3183
+ children: "I don't know the answer"
3184
+ }
3185
+ )
3186
+ ] }),
3187
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "16px" }, children: [
3188
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: { display: "block", fontSize: "13px", fontWeight: "500", color: "#374151", marginBottom: "6px" }, children: "Additional details (optional)" }),
3189
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3190
+ "textarea",
3191
+ {
3192
+ value: skipComment,
3193
+ onChange: (e) => setSkipComment(e.target.value.slice(0, 200)),
3194
+ placeholder: "Tell us more about the issue...",
3195
+ disabled: isSkipping,
3196
+ style: {
3197
+ width: "100%",
3198
+ minHeight: "80px",
3199
+ padding: "10px 12px",
3200
+ borderRadius: "8px",
3201
+ border: "1px solid #e5e7eb",
3202
+ fontSize: "14px",
3203
+ resize: "vertical",
3204
+ fontFamily: "inherit",
3205
+ boxSizing: "border-box"
3206
+ },
3207
+ "data-testid": "input-skip-comment"
3208
+ }
3209
+ ),
3210
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "12px", color: "#9ca3af", marginTop: "4px", textAlign: "right" }, children: [
3211
+ skipComment.length,
3212
+ "/200"
3213
+ ] })
3214
+ ] }),
3215
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "10px" }, children: [
3216
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3217
+ "button",
3218
+ {
3219
+ onClick: () => {
3220
+ setShowSkipModal(false);
3221
+ setSkipComment("");
3222
+ setSelectedSkipReason(null);
3223
+ },
3224
+ style: {
3225
+ flex: 1,
3226
+ padding: "10px 16px",
3227
+ borderRadius: "8px",
3228
+ border: "1px solid #e5e7eb",
3229
+ backgroundColor: "#ffffff",
3230
+ cursor: "pointer",
3231
+ fontSize: "14px",
3232
+ fontWeight: "500",
3233
+ color: "#6b7280"
3234
+ },
3235
+ "data-testid": "button-skip-cancel",
3236
+ children: "Cancel"
3237
+ }
3238
+ ),
3239
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3240
+ "button",
3241
+ {
3242
+ onClick: () => selectedSkipReason && handleSkipQuestion(selectedSkipReason, skipComment),
3243
+ disabled: isSkipping || !selectedSkipReason,
3244
+ style: {
3245
+ flex: 1,
3246
+ padding: "10px 16px",
3247
+ borderRadius: "8px",
3248
+ border: "none",
3249
+ backgroundColor: selectedSkipReason ? "#8b5cf6" : "#d1d5db",
3250
+ cursor: isSkipping || !selectedSkipReason ? "not-allowed" : "pointer",
3251
+ fontSize: "14px",
3252
+ fontWeight: "500",
3253
+ color: "#ffffff",
3254
+ opacity: isSkipping ? 0.6 : 1
3255
+ },
3256
+ "data-testid": "button-skip-submit",
3257
+ children: isSkipping ? "Skipping..." : "Skip Question"
3258
+ }
3259
+ )
3260
+ ] })
3261
+ ] }) }),
3262
+ showReportModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3263
+ position: "fixed",
3264
+ top: 0,
3265
+ left: 0,
3266
+ right: 0,
3267
+ bottom: 0,
3268
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
3269
+ display: "flex",
3270
+ alignItems: "center",
3271
+ justifyContent: "center",
3272
+ zIndex: 1e3
3273
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3274
+ backgroundColor: "#ffffff",
3275
+ borderRadius: "12px",
3276
+ padding: "24px",
3277
+ maxWidth: "400px",
3278
+ width: "90%",
3279
+ boxShadow: "0 20px 40px rgba(0, 0, 0, 0.2)"
3280
+ }, children: [
3281
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { style: { margin: "0 0 8px 0", fontSize: "18px", fontWeight: "600", color: "#1f2937" }, children: "Report Question" }),
3282
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: "0 0 16px 0", fontSize: "14px", color: "#6b7280" }, children: "What's wrong with this question?" }),
3283
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "16px" }, children: [
3284
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3285
+ "textarea",
3286
+ {
3287
+ value: reportComment,
3288
+ onChange: (e) => setReportComment(e.target.value.slice(0, 300)),
3289
+ placeholder: "Describe the issue with this question...",
3290
+ disabled: isReporting,
3291
+ style: {
3292
+ width: "100%",
3293
+ minHeight: "120px",
3294
+ padding: "10px 12px",
3295
+ borderRadius: "8px",
3296
+ border: "1px solid #e5e7eb",
3297
+ fontSize: "14px",
3298
+ resize: "vertical",
3299
+ fontFamily: "inherit",
3300
+ boxSizing: "border-box"
3301
+ },
3302
+ "data-testid": "input-report-comment"
3303
+ }
3304
+ ),
3305
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "12px", color: "#9ca3af", marginTop: "4px", textAlign: "right" }, children: [
3306
+ reportComment.length,
3307
+ "/300"
3308
+ ] })
3309
+ ] }),
3310
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "10px" }, children: [
3311
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3312
+ "button",
3313
+ {
3314
+ onClick: () => {
3315
+ setShowReportModal(false);
3316
+ setReportComment("");
3317
+ },
3318
+ style: {
3319
+ flex: 1,
3320
+ padding: "10px 16px",
3321
+ borderRadius: "8px",
3322
+ border: "1px solid #e5e7eb",
3323
+ backgroundColor: "#ffffff",
3324
+ cursor: "pointer",
3325
+ fontSize: "14px",
3326
+ fontWeight: "500",
3327
+ color: "#6b7280"
3328
+ },
3329
+ "data-testid": "button-report-cancel",
3330
+ children: "Cancel"
3331
+ }
3332
+ ),
3333
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3334
+ "button",
3335
+ {
3336
+ onClick: () => handleReportQuestion(reportComment),
3337
+ disabled: isReporting || !reportComment.trim(),
3338
+ style: {
3339
+ flex: 1,
3340
+ padding: "10px 16px",
3341
+ borderRadius: "8px",
3342
+ border: "none",
3343
+ backgroundColor: reportComment.trim() ? "#ef4444" : "#d1d5db",
3344
+ cursor: isReporting || !reportComment.trim() ? "not-allowed" : "pointer",
3345
+ fontSize: "14px",
3346
+ fontWeight: "500",
3347
+ color: "#ffffff",
3348
+ opacity: isReporting ? 0.6 : 1
3349
+ },
3350
+ "data-testid": "button-report-submit",
3351
+ children: isReporting ? "Reporting..." : "Report"
3352
+ }
3353
+ )
3354
+ ] })
3355
+ ] }) }),
3356
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.buttonsColumn, children: [
3357
+ showFeedback && isLastQuestion && canAddMore && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3201
3358
  "button",
3202
3359
  {
3203
- onClick: () => {
3204
- setShowReportModal(false);
3205
- setReportComment("");
3206
- },
3207
3360
  style: {
3208
- flex: 1,
3209
- padding: "10px 16px",
3210
- borderRadius: "8px",
3211
- border: "1px solid #e5e7eb",
3212
- backgroundColor: "#ffffff",
3213
- cursor: "pointer",
3214
- fontSize: "14px",
3215
- fontWeight: "500",
3216
- color: "#6b7280"
3361
+ ...defaultStyles.buttonAddMore,
3362
+ ...isGeneratingExtra ? defaultStyles.buttonAddMoreDisabled : {}
3217
3363
  },
3218
- "data-testid": "button-report-cancel",
3219
- children: "Cancel"
3364
+ onClick: handleAddMoreQuestions,
3365
+ disabled: isGeneratingExtra,
3366
+ "data-testid": "button-add-more-questions",
3367
+ children: isGeneratingExtra ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
3368
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }),
3369
+ "Generating Questions..."
3370
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
3371
+ "+ Add ",
3372
+ questionsToAdd,
3373
+ " More Question",
3374
+ questionsToAdd !== 1 ? "s" : ""
3375
+ ] })
3220
3376
  }
3221
3377
  ),
3222
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3223
- "button",
3224
- {
3225
- onClick: () => handleReportQuestion(reportComment),
3226
- disabled: isReporting || !reportComment.trim(),
3227
- style: {
3228
- flex: 1,
3229
- padding: "10px 16px",
3230
- borderRadius: "8px",
3231
- border: "none",
3232
- backgroundColor: reportComment.trim() ? "#ef4444" : "#d1d5db",
3233
- cursor: isReporting || !reportComment.trim() ? "not-allowed" : "pointer",
3234
- fontSize: "14px",
3235
- fontWeight: "500",
3236
- color: "#ffffff",
3237
- opacity: isReporting ? 0.6 : 1
3238
- },
3239
- "data-testid": "button-report-submit",
3240
- children: isReporting ? "Reporting..." : "Report"
3241
- }
3242
- )
3378
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...defaultStyles.buttons, justifyContent: "flex-end" }, children: showFeedback ? (
3379
+ // After viewing feedback
3380
+ isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3381
+ "button",
3382
+ {
3383
+ style: {
3384
+ ...defaultStyles.button,
3385
+ ...isSubmitting || isGeneratingExtra ? defaultStyles.buttonDisabled : defaultStyles.buttonPrimary
3386
+ },
3387
+ onClick: handleSubmit,
3388
+ disabled: isSubmitting || isGeneratingExtra,
3389
+ "data-testid": "button-submit-quiz",
3390
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }) : "Submit Quiz"
3391
+ }
3392
+ ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3393
+ "button",
3394
+ {
3395
+ style: {
3396
+ ...defaultStyles.button,
3397
+ ...defaultStyles.buttonPrimary
3398
+ },
3399
+ onClick: handleContinue,
3400
+ "data-testid": "button-continue",
3401
+ children: "Continue"
3402
+ }
3403
+ )
3404
+ ) : (
3405
+ // Before checking answer
3406
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3407
+ "button",
3408
+ {
3409
+ style: {
3410
+ ...defaultStyles.button,
3411
+ ...isNavigating || selectedAnswer === void 0 ? defaultStyles.buttonDisabled : defaultStyles.buttonPrimary
3412
+ },
3413
+ onClick: handleCheckAnswer,
3414
+ disabled: isNavigating || selectedAnswer === void 0,
3415
+ "data-testid": "button-check-answer",
3416
+ children: isNavigating ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }) : "Check Answer"
3417
+ }
3418
+ )
3419
+ ) })
3243
3420
  ] })
3244
- ] }) }),
3245
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.buttonsColumn, children: [
3246
- showFeedback && isLastQuestion && canAddMore && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3247
- "button",
3248
- {
3249
- style: {
3250
- ...defaultStyles.buttonAddMore,
3251
- ...isGeneratingExtra ? defaultStyles.buttonAddMoreDisabled : {}
3252
- },
3253
- onClick: handleAddMoreQuestions,
3254
- disabled: isGeneratingExtra,
3255
- "data-testid": "button-add-more-questions",
3256
- children: isGeneratingExtra ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
3257
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }),
3258
- "Generating Questions..."
3259
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
3260
- "+ Add ",
3261
- questionsToAdd,
3262
- " More Question",
3263
- questionsToAdd !== 1 ? "s" : ""
3264
- ] })
3265
- }
3266
- ),
3267
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...defaultStyles.buttons, justifyContent: "flex-end" }, children: showFeedback ? (
3268
- // After viewing feedback
3269
- isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3270
- "button",
3271
- {
3272
- style: {
3273
- ...defaultStyles.button,
3274
- ...isSubmitting || isGeneratingExtra ? defaultStyles.buttonDisabled : defaultStyles.buttonPrimary
3275
- },
3276
- onClick: handleSubmit,
3277
- disabled: isSubmitting || isGeneratingExtra,
3278
- "data-testid": "button-submit-quiz",
3279
- children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }) : "Submit Quiz"
3280
- }
3281
- ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3282
- "button",
3283
- {
3284
- style: {
3285
- ...defaultStyles.button,
3286
- ...defaultStyles.buttonPrimary
3287
- },
3288
- onClick: handleContinue,
3289
- "data-testid": "button-continue",
3290
- children: "Continue"
3291
- }
3292
- )
3293
- ) : (
3294
- // Before checking answer
3295
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3296
- "button",
3297
- {
3298
- style: {
3299
- ...defaultStyles.button,
3300
- ...isNavigating || selectedAnswer === void 0 ? defaultStyles.buttonDisabled : defaultStyles.buttonPrimary
3301
- },
3302
- onClick: handleCheckAnswer,
3303
- disabled: isNavigating || selectedAnswer === void 0,
3304
- "data-testid": "button-check-answer",
3305
- children: isNavigating ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }) : "Check Answer"
3306
- }
3307
- )
3308
- ) })
3309
- ] })
3310
- ] }),
3311
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.chatPanel, children: apiClient.current && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3312
- QuestionChatPanel,
3313
- {
3314
- apiClient: apiClient.current,
3315
- question: {
3316
- id: currentQuestion.id,
3317
- question: currentQuestion.question,
3318
- type: currentQuestion.type,
3319
- options: currentQuestion.options,
3320
- correctAnswer: currentQuestion.correctAnswer,
3321
- explanation: currentQuestion.explanation
3322
- },
3323
- quizId: quiz.id,
3324
- childId,
3325
- parentId,
3326
- lessonId,
3327
- courseId,
3328
- answerResult: showFeedback && currentAnswerDetail ? {
3329
- wasIncorrect: currentQuestion.type !== "assessment" && !currentAnswerDetail.isCorrect,
3330
- selectedAnswer: typeof selectedAnswer === "string" ? selectedAnswer : Array.isArray(selectedAnswer) ? selectedAnswer.join(", ") : void 0,
3331
- correctAnswer: typeof currentQuestion.correctAnswer === "string" ? currentQuestion.correctAnswer : Array.isArray(currentQuestion.correctAnswer) ? currentQuestion.correctAnswer.join(", ") : void 0,
3332
- explanation: currentQuestion.explanation
3333
- } : void 0
3334
- }
3335
- ) })
3336
- ] }) });
3421
+ ] }),
3422
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.chatPanel, children: apiClient.current && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3423
+ QuestionChatPanel,
3424
+ {
3425
+ apiClient: apiClient.current,
3426
+ question: {
3427
+ id: currentQuestion.id,
3428
+ question: currentQuestion.question,
3429
+ type: currentQuestion.type,
3430
+ options: currentQuestion.options,
3431
+ correctAnswer: currentQuestion.correctAnswer,
3432
+ explanation: currentQuestion.explanation
3433
+ },
3434
+ quizId: quiz.id,
3435
+ childId,
3436
+ parentId,
3437
+ lessonId,
3438
+ courseId,
3439
+ answerResult: showFeedback && currentAnswerDetail ? {
3440
+ wasIncorrect: currentQuestion.type !== "assessment" && !currentAnswerDetail.isCorrect,
3441
+ selectedAnswer: typeof selectedAnswer === "string" ? selectedAnswer : Array.isArray(selectedAnswer) ? selectedAnswer.join(", ") : void 0,
3442
+ correctAnswer: typeof currentQuestion.correctAnswer === "string" ? currentQuestion.correctAnswer : Array.isArray(currentQuestion.correctAnswer) ? currentQuestion.correctAnswer.join(", ") : void 0,
3443
+ explanation: currentQuestion.explanation
3444
+ } : void 0
3445
+ }
3446
+ ) })
3447
+ ] })
3448
+ ] });
3337
3449
  }
3338
3450
 
3339
3451
  // src/AttemptViewer.tsx
@@ -3481,7 +3593,12 @@ var defaultStyles2 = {
3481
3593
  marginTop: "12px",
3482
3594
  display: "flex",
3483
3595
  flexDirection: "column",
3484
- gap: "8px"
3596
+ gap: "8px",
3597
+ backgroundColor: "#ffffff",
3598
+ padding: "16px",
3599
+ borderRadius: "8px",
3600
+ border: "1px solid #e5e7eb",
3601
+ boxShadow: "0 1px 3px rgba(0, 0, 0, 0.05)"
3485
3602
  },
3486
3603
  chatMessage: {
3487
3604
  padding: "8px 12px",