@schoolio/player 1.4.5 → 1.4.6

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,132 @@ 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
+ isExtraQuestion && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2806
+ "button",
2808
2807
  {
2808
+ onClick: () => setShowSkipModal(true),
2809
+ title: "Skip question",
2809
2810
  style: {
2810
- ...optionStyle,
2811
- cursor: showFeedback ? "default" : "pointer",
2811
+ position: "absolute",
2812
+ bottom: "8px",
2813
+ left: "0",
2814
+ background: "transparent",
2815
+ border: "none",
2816
+ cursor: "pointer",
2817
+ padding: "6px 10px",
2818
+ borderRadius: "6px",
2819
+ color: "#9ca3af",
2812
2820
  display: "flex",
2813
2821
  alignItems: "center",
2814
- gap: "8px"
2822
+ justifyContent: "center",
2823
+ gap: "4px",
2824
+ fontSize: "12px",
2825
+ opacity: 0.6,
2826
+ transition: "opacity 0.2s, color 0.2s"
2827
+ },
2828
+ onMouseEnter: (e) => {
2829
+ e.currentTarget.style.opacity = "1";
2830
+ e.currentTarget.style.color = "#6b7280";
2815
2831
  },
2816
- onClick: () => !showFeedback && handleAnswerChange(option),
2832
+ onMouseLeave: (e) => {
2833
+ e.currentTarget.style.opacity = "0.6";
2834
+ e.currentTarget.style.color = "#9ca3af";
2835
+ },
2836
+ "data-testid": "button-skip-question",
2817
2837
  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 })
2838
+ /* @__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: [
2839
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polygon", { points: "5 4 15 12 5 20 5 4" }),
2840
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "19", y1: "5", x2: "19", y2: "19" })
2841
+ ] }),
2842
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Skip" })
2820
2843
  ]
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
2844
  }
2836
- } else if (selected) {
2837
- optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
2838
- }
2839
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2840
- "div",
2845
+ ),
2846
+ !isExtraQuestion && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2847
+ "button",
2841
2848
  {
2849
+ onClick: () => setShowReportModal(true),
2850
+ title: "Report an issue with this question",
2842
2851
  style: {
2843
- ...optionStyle,
2844
- cursor: showFeedback ? "default" : "pointer",
2852
+ position: "absolute",
2853
+ bottom: "8px",
2854
+ left: "0",
2855
+ background: "transparent",
2856
+ border: "none",
2857
+ cursor: "pointer",
2858
+ padding: "6px 10px",
2859
+ borderRadius: "6px",
2860
+ color: "#9ca3af",
2845
2861
  display: "flex",
2846
2862
  alignItems: "center",
2847
- gap: "8px"
2863
+ justifyContent: "center",
2864
+ gap: "4px",
2865
+ fontSize: "12px",
2866
+ opacity: 0.6,
2867
+ transition: "opacity 0.2s, color 0.2s"
2848
2868
  },
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
- }
2869
+ onMouseEnter: (e) => {
2870
+ e.currentTarget.style.opacity = "1";
2871
+ e.currentTarget.style.color = "#ef4444";
2857
2872
  },
2873
+ onMouseLeave: (e) => {
2874
+ e.currentTarget.style.opacity = "0.6";
2875
+ e.currentTarget.style.color = "#9ca3af";
2876
+ },
2877
+ "data-testid": "button-report-question",
2858
2878
  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 })
2879
+ /* @__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: [
2880
+ /* @__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" }),
2881
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "4", y1: "22", x2: "4", y2: "15" })
2882
+ ] }),
2883
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Report" })
2861
2884
  ]
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) => {
2885
+ }
2886
+ ),
2887
+ (currentQuestion.type === "single" || currentQuestion.type === "true-false") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.options?.map((option, idx) => {
2977
2888
  const isSelected = selectedAnswer === option;
2889
+ const isCorrectOption = currentQuestion.correctAnswer === option;
2978
2890
  let optionStyle = { ...defaultStyles.option };
2979
- if (isSelected) {
2891
+ if (showFeedback) {
2892
+ if (isCorrectOption) {
2893
+ optionStyle = { ...optionStyle, ...defaultStyles.optionCorrect };
2894
+ } else if (isSelected && !isCorrectOption) {
2895
+ optionStyle = { ...optionStyle, ...defaultStyles.optionIncorrect };
2896
+ }
2897
+ } else if (isSelected) {
2980
2898
  optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
2981
2899
  }
2982
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2900
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2983
2901
  "div",
2984
2902
  {
2903
+ className: "quiz-option",
2985
2904
  style: {
2986
2905
  ...optionStyle,
2987
2906
  cursor: showFeedback ? "default" : "pointer",
@@ -2990,350 +2909,532 @@ function QuizPlayer({
2990
2909
  gap: "8px"
2991
2910
  },
2992
2911
  onClick: () => !showFeedback && handleAnswerChange(option),
2993
- "data-testid": `assessment-likert-${idx}`,
2994
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2912
+ children: [
2913
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: option, size: "sm" }) }),
2914
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2915
+ ]
2995
2916
  },
2996
2917
  idx
2997
2918
  );
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"
2919
+ }) }),
2920
+ currentQuestion.type === "multiple" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.options?.map((option, idx) => {
2921
+ const selected = Array.isArray(selectedAnswer) && selectedAnswer.includes(option);
2922
+ const correctAnswers = Array.isArray(currentQuestion.correctAnswer) ? currentQuestion.correctAnswer : currentQuestion.correctAnswer ? [currentQuestion.correctAnswer] : [];
2923
+ const isCorrectOption = correctAnswers.includes(option);
2924
+ let optionStyle = { ...defaultStyles.option };
2925
+ if (showFeedback) {
2926
+ if (isCorrectOption) {
2927
+ optionStyle = { ...optionStyle, ...defaultStyles.optionCorrect };
2928
+ } else if (selected && !isCorrectOption) {
2929
+ optionStyle = { ...optionStyle, ...defaultStyles.optionIncorrect };
2930
+ }
2931
+ } else if (selected) {
2932
+ optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
3052
2933
  }
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
2934
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2935
+ "div",
2936
+ {
2937
+ className: "quiz-option",
2938
+ style: {
2939
+ ...optionStyle,
2940
+ cursor: showFeedback ? "default" : "pointer",
2941
+ display: "flex",
2942
+ alignItems: "center",
2943
+ gap: "8px"
2944
+ },
2945
+ onClick: () => {
2946
+ if (showFeedback) return;
2947
+ const current = Array.isArray(selectedAnswer) ? selectedAnswer : [];
2948
+ if (selected) {
2949
+ handleAnswerChange(current.filter((o) => o !== option));
2950
+ } else {
2951
+ handleAnswerChange([...current, option]);
2952
+ }
2953
+ },
2954
+ children: [
2955
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextToSpeech, { text: option, size: "sm" }) }),
2956
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
2957
+ ]
3070
2958
  },
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)(
2959
+ idx
2960
+ );
2961
+ }) }),
2962
+ (currentQuestion.type === "free" || currentQuestion.type === "essay") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3079
2963
  "textarea",
3080
2964
  {
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"
2965
+ style: { ...defaultStyles.input, minHeight: currentQuestion.type === "essay" ? "150px" : "60px" },
2966
+ value: selectedAnswer || "",
2967
+ onChange: (e) => handleAnswerChange(e.target.value),
2968
+ placeholder: "Type your answer here...",
2969
+ disabled: showFeedback
3097
2970
  }
3098
2971
  ),
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",
2972
+ currentQuestion.type === "fill" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: currentQuestion.blanks?.map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2973
+ "input",
3107
2974
  {
3108
- onClick: () => {
3109
- setShowSkipModal(false);
3110
- setSkipComment("");
3111
- setSelectedSkipReason(null);
2975
+ style: defaultStyles.input,
2976
+ value: (Array.isArray(selectedAnswer) ? selectedAnswer[idx] : "") || "",
2977
+ onChange: (e) => {
2978
+ const current = Array.isArray(selectedAnswer) ? [...selectedAnswer] : [];
2979
+ current[idx] = e.target.value;
2980
+ handleAnswerChange(current);
3112
2981
  },
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",
2982
+ placeholder: `Blank ${idx + 1}`,
2983
+ disabled: showFeedback
2984
+ },
2985
+ idx
2986
+ )) }),
2987
+ currentQuestion.type === "sorting" && currentQuestion.items && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2988
+ SortingDragDrop,
3130
2989
  {
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"
2990
+ items: currentQuestion.items,
2991
+ currentOrder: Array.isArray(selectedAnswer) ? selectedAnswer : currentQuestion.items.map((_, i) => i),
2992
+ correctOrder: currentQuestion.correctOrder,
2993
+ showFeedback,
2994
+ onOrderChange: handleAnswerChange
3147
2995
  }
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",
2996
+ ),
2997
+ currentQuestion.type === "matrix" && currentQuestion.leftItems && currentQuestion.rightItems && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2998
+ MatchingDragDrop,
3175
2999
  {
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"
3000
+ leftItems: currentQuestion.leftItems,
3001
+ rightItems: currentQuestion.rightItems,
3002
+ currentMatches: typeof selectedAnswer === "object" && selectedAnswer !== null && !Array.isArray(selectedAnswer) ? selectedAnswer : {},
3003
+ correctMatches: currentQuestion.correctMatches,
3004
+ showFeedback,
3005
+ onMatchChange: handleAnswerChange
3192
3006
  }
3193
3007
  ),
3194
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "12px", color: "#9ca3af", marginTop: "4px", textAlign: "right" }, children: [
3195
- reportComment.length,
3196
- "/300"
3008
+ currentQuestion.type === "assessment" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.options, children: (() => {
3009
+ const scaleType = currentQuestion.scaleType || "likert";
3010
+ if (scaleType === "yes-no") {
3011
+ const options = ["Yes", "No"];
3012
+ return options.map((option, idx) => {
3013
+ const isSelected = selectedAnswer === option;
3014
+ let optionStyle = { ...defaultStyles.option };
3015
+ if (isSelected) {
3016
+ optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
3017
+ }
3018
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3019
+ "div",
3020
+ {
3021
+ className: "quiz-option",
3022
+ style: {
3023
+ ...optionStyle,
3024
+ cursor: showFeedback ? "default" : "pointer",
3025
+ display: "flex",
3026
+ alignItems: "center",
3027
+ gap: "8px"
3028
+ },
3029
+ onClick: () => !showFeedback && handleAnswerChange(option),
3030
+ "data-testid": `assessment-option-${option.toLowerCase()}`,
3031
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
3032
+ },
3033
+ idx
3034
+ );
3035
+ });
3036
+ }
3037
+ if (scaleType === "rating") {
3038
+ const min = currentQuestion.scaleMin || 1;
3039
+ const max = currentQuestion.scaleMax || 5;
3040
+ const ratings = Array.from({ length: max - min + 1 }, (_, i) => min + i);
3041
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "center" }, children: ratings.map((rating) => {
3042
+ const isSelected = selectedAnswer === rating;
3043
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3044
+ "button",
3045
+ {
3046
+ className: "quiz-option",
3047
+ onClick: () => !showFeedback && handleAnswerChange(rating),
3048
+ disabled: showFeedback,
3049
+ style: {
3050
+ width: "48px",
3051
+ height: "48px",
3052
+ borderRadius: "50%",
3053
+ border: isSelected ? "2px solid #6721b0" : "2px solid #e5e7eb",
3054
+ backgroundColor: isSelected ? "#f3e8ff" : "#ffffff",
3055
+ cursor: showFeedback ? "not-allowed" : "pointer",
3056
+ fontSize: "18px",
3057
+ fontWeight: "600",
3058
+ color: isSelected ? "#6721b0" : "#374151",
3059
+ outline: "none"
3060
+ },
3061
+ "data-testid": `assessment-rating-${rating}`,
3062
+ children: rating
3063
+ },
3064
+ rating
3065
+ );
3066
+ }) });
3067
+ }
3068
+ const likertOptions = [
3069
+ "Strongly Disagree",
3070
+ "Disagree",
3071
+ "Neutral",
3072
+ "Agree",
3073
+ "Strongly Agree"
3074
+ ];
3075
+ return likertOptions.map((option, idx) => {
3076
+ const isSelected = selectedAnswer === option;
3077
+ let optionStyle = { ...defaultStyles.option };
3078
+ if (isSelected) {
3079
+ optionStyle = { ...optionStyle, ...defaultStyles.optionSelected };
3080
+ }
3081
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3082
+ "div",
3083
+ {
3084
+ className: "quiz-option",
3085
+ style: {
3086
+ ...optionStyle,
3087
+ cursor: showFeedback ? "default" : "pointer",
3088
+ display: "flex",
3089
+ alignItems: "center",
3090
+ gap: "8px"
3091
+ },
3092
+ onClick: () => !showFeedback && handleAnswerChange(option),
3093
+ "data-testid": `assessment-likert-${idx}`,
3094
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 }, children: option })
3095
+ },
3096
+ idx
3097
+ );
3098
+ });
3099
+ })() }),
3100
+ showFeedback && currentAnswerDetail && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3101
+ ...defaultStyles.feedback,
3102
+ ...currentQuestion.type === "assessment" ? defaultStyles.feedbackNeutral : currentAnswerDetail.isCorrect ? defaultStyles.feedbackCorrect : defaultStyles.feedbackIncorrect
3103
+ }, children: [
3104
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3105
+ ...defaultStyles.feedbackTitle,
3106
+ ...currentQuestion.type === "assessment" ? defaultStyles.feedbackTitleNeutral : currentAnswerDetail.isCorrect ? defaultStyles.feedbackTitleCorrect : defaultStyles.feedbackTitleIncorrect
3107
+ }, children: currentQuestion.type === "assessment" ? "\u2713 Response recorded" : currentAnswerDetail.isCorrect ? "\u2713 Correct!" : "\u2717 Incorrect" }),
3108
+ currentQuestion.explanation && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.feedbackExplanation, children: currentQuestion.explanation })
3197
3109
  ] })
3198
3110
  ] }),
3199
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "10px" }, children: [
3200
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3111
+ showSkipModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3112
+ position: "fixed",
3113
+ top: 0,
3114
+ left: 0,
3115
+ right: 0,
3116
+ bottom: 0,
3117
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
3118
+ display: "flex",
3119
+ alignItems: "center",
3120
+ justifyContent: "center",
3121
+ zIndex: 1e3
3122
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3123
+ backgroundColor: "#ffffff",
3124
+ borderRadius: "12px",
3125
+ padding: "24px",
3126
+ maxWidth: "400px",
3127
+ width: "90%",
3128
+ boxShadow: "0 20px 40px rgba(0, 0, 0, 0.2)"
3129
+ }, children: [
3130
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { style: { margin: "0 0 8px 0", fontSize: "18px", fontWeight: "600", color: "#1f2937" }, children: "Skip Question" }),
3131
+ /* @__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." }),
3132
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "8px", marginBottom: "16px" }, children: [
3133
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3134
+ "button",
3135
+ {
3136
+ onClick: () => setSelectedSkipReason("question_issue"),
3137
+ disabled: isSkipping,
3138
+ style: {
3139
+ padding: "12px 16px",
3140
+ borderRadius: "8px",
3141
+ border: selectedSkipReason === "question_issue" ? "2px solid #8b5cf6" : "1px solid #e5e7eb",
3142
+ backgroundColor: selectedSkipReason === "question_issue" ? "#f5f3ff" : "#f9fafb",
3143
+ cursor: isSkipping ? "not-allowed" : "pointer",
3144
+ fontSize: "14px",
3145
+ fontWeight: "500",
3146
+ color: "#374151",
3147
+ textAlign: "left",
3148
+ opacity: isSkipping ? 0.6 : 1
3149
+ },
3150
+ "data-testid": "button-skip-reason-issue",
3151
+ children: "Question has an issue"
3152
+ }
3153
+ ),
3154
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3155
+ "button",
3156
+ {
3157
+ onClick: () => setSelectedSkipReason("dont_know"),
3158
+ disabled: isSkipping,
3159
+ style: {
3160
+ padding: "12px 16px",
3161
+ borderRadius: "8px",
3162
+ border: selectedSkipReason === "dont_know" ? "2px solid #8b5cf6" : "1px solid #e5e7eb",
3163
+ backgroundColor: selectedSkipReason === "dont_know" ? "#f5f3ff" : "#f9fafb",
3164
+ cursor: isSkipping ? "not-allowed" : "pointer",
3165
+ fontSize: "14px",
3166
+ fontWeight: "500",
3167
+ color: "#374151",
3168
+ textAlign: "left",
3169
+ opacity: isSkipping ? 0.6 : 1
3170
+ },
3171
+ "data-testid": "button-skip-reason-dont-know",
3172
+ children: "I don't know the answer"
3173
+ }
3174
+ )
3175
+ ] }),
3176
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "16px" }, children: [
3177
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: { display: "block", fontSize: "13px", fontWeight: "500", color: "#374151", marginBottom: "6px" }, children: "Additional details (optional)" }),
3178
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3179
+ "textarea",
3180
+ {
3181
+ value: skipComment,
3182
+ onChange: (e) => setSkipComment(e.target.value.slice(0, 200)),
3183
+ placeholder: "Tell us more about the issue...",
3184
+ disabled: isSkipping,
3185
+ style: {
3186
+ width: "100%",
3187
+ minHeight: "80px",
3188
+ padding: "10px 12px",
3189
+ borderRadius: "8px",
3190
+ border: "1px solid #e5e7eb",
3191
+ fontSize: "14px",
3192
+ resize: "vertical",
3193
+ fontFamily: "inherit",
3194
+ boxSizing: "border-box"
3195
+ },
3196
+ "data-testid": "input-skip-comment"
3197
+ }
3198
+ ),
3199
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "12px", color: "#9ca3af", marginTop: "4px", textAlign: "right" }, children: [
3200
+ skipComment.length,
3201
+ "/200"
3202
+ ] })
3203
+ ] }),
3204
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "10px" }, children: [
3205
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3206
+ "button",
3207
+ {
3208
+ onClick: () => {
3209
+ setShowSkipModal(false);
3210
+ setSkipComment("");
3211
+ setSelectedSkipReason(null);
3212
+ },
3213
+ style: {
3214
+ flex: 1,
3215
+ padding: "10px 16px",
3216
+ borderRadius: "8px",
3217
+ border: "1px solid #e5e7eb",
3218
+ backgroundColor: "#ffffff",
3219
+ cursor: "pointer",
3220
+ fontSize: "14px",
3221
+ fontWeight: "500",
3222
+ color: "#6b7280"
3223
+ },
3224
+ "data-testid": "button-skip-cancel",
3225
+ children: "Cancel"
3226
+ }
3227
+ ),
3228
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3229
+ "button",
3230
+ {
3231
+ onClick: () => selectedSkipReason && handleSkipQuestion(selectedSkipReason, skipComment),
3232
+ disabled: isSkipping || !selectedSkipReason,
3233
+ style: {
3234
+ flex: 1,
3235
+ padding: "10px 16px",
3236
+ borderRadius: "8px",
3237
+ border: "none",
3238
+ backgroundColor: selectedSkipReason ? "#8b5cf6" : "#d1d5db",
3239
+ cursor: isSkipping || !selectedSkipReason ? "not-allowed" : "pointer",
3240
+ fontSize: "14px",
3241
+ fontWeight: "500",
3242
+ color: "#ffffff",
3243
+ opacity: isSkipping ? 0.6 : 1
3244
+ },
3245
+ "data-testid": "button-skip-submit",
3246
+ children: isSkipping ? "Skipping..." : "Skip Question"
3247
+ }
3248
+ )
3249
+ ] })
3250
+ ] }) }),
3251
+ showReportModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
3252
+ position: "fixed",
3253
+ top: 0,
3254
+ left: 0,
3255
+ right: 0,
3256
+ bottom: 0,
3257
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
3258
+ display: "flex",
3259
+ alignItems: "center",
3260
+ justifyContent: "center",
3261
+ zIndex: 1e3
3262
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
3263
+ backgroundColor: "#ffffff",
3264
+ borderRadius: "12px",
3265
+ padding: "24px",
3266
+ maxWidth: "400px",
3267
+ width: "90%",
3268
+ boxShadow: "0 20px 40px rgba(0, 0, 0, 0.2)"
3269
+ }, children: [
3270
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { style: { margin: "0 0 8px 0", fontSize: "18px", fontWeight: "600", color: "#1f2937" }, children: "Report Question" }),
3271
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: "0 0 16px 0", fontSize: "14px", color: "#6b7280" }, children: "What's wrong with this question?" }),
3272
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "16px" }, children: [
3273
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3274
+ "textarea",
3275
+ {
3276
+ value: reportComment,
3277
+ onChange: (e) => setReportComment(e.target.value.slice(0, 300)),
3278
+ placeholder: "Describe the issue with this question...",
3279
+ disabled: isReporting,
3280
+ style: {
3281
+ width: "100%",
3282
+ minHeight: "120px",
3283
+ padding: "10px 12px",
3284
+ borderRadius: "8px",
3285
+ border: "1px solid #e5e7eb",
3286
+ fontSize: "14px",
3287
+ resize: "vertical",
3288
+ fontFamily: "inherit",
3289
+ boxSizing: "border-box"
3290
+ },
3291
+ "data-testid": "input-report-comment"
3292
+ }
3293
+ ),
3294
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "12px", color: "#9ca3af", marginTop: "4px", textAlign: "right" }, children: [
3295
+ reportComment.length,
3296
+ "/300"
3297
+ ] })
3298
+ ] }),
3299
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "10px" }, children: [
3300
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3301
+ "button",
3302
+ {
3303
+ onClick: () => {
3304
+ setShowReportModal(false);
3305
+ setReportComment("");
3306
+ },
3307
+ style: {
3308
+ flex: 1,
3309
+ padding: "10px 16px",
3310
+ borderRadius: "8px",
3311
+ border: "1px solid #e5e7eb",
3312
+ backgroundColor: "#ffffff",
3313
+ cursor: "pointer",
3314
+ fontSize: "14px",
3315
+ fontWeight: "500",
3316
+ color: "#6b7280"
3317
+ },
3318
+ "data-testid": "button-report-cancel",
3319
+ children: "Cancel"
3320
+ }
3321
+ ),
3322
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3323
+ "button",
3324
+ {
3325
+ onClick: () => handleReportQuestion(reportComment),
3326
+ disabled: isReporting || !reportComment.trim(),
3327
+ style: {
3328
+ flex: 1,
3329
+ padding: "10px 16px",
3330
+ borderRadius: "8px",
3331
+ border: "none",
3332
+ backgroundColor: reportComment.trim() ? "#ef4444" : "#d1d5db",
3333
+ cursor: isReporting || !reportComment.trim() ? "not-allowed" : "pointer",
3334
+ fontSize: "14px",
3335
+ fontWeight: "500",
3336
+ color: "#ffffff",
3337
+ opacity: isReporting ? 0.6 : 1
3338
+ },
3339
+ "data-testid": "button-report-submit",
3340
+ children: isReporting ? "Reporting..." : "Report"
3341
+ }
3342
+ )
3343
+ ] })
3344
+ ] }) }),
3345
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: defaultStyles.buttonsColumn, children: [
3346
+ showFeedback && isLastQuestion && canAddMore && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3201
3347
  "button",
3202
3348
  {
3203
- onClick: () => {
3204
- setShowReportModal(false);
3205
- setReportComment("");
3206
- },
3207
3349
  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"
3350
+ ...defaultStyles.buttonAddMore,
3351
+ ...isGeneratingExtra ? defaultStyles.buttonAddMoreDisabled : {}
3217
3352
  },
3218
- "data-testid": "button-report-cancel",
3219
- children: "Cancel"
3353
+ onClick: handleAddMoreQuestions,
3354
+ disabled: isGeneratingExtra,
3355
+ "data-testid": "button-add-more-questions",
3356
+ children: isGeneratingExtra ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
3357
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }),
3358
+ "Generating Questions..."
3359
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
3360
+ "+ Add ",
3361
+ questionsToAdd,
3362
+ " More Question",
3363
+ questionsToAdd !== 1 ? "s" : ""
3364
+ ] })
3220
3365
  }
3221
3366
  ),
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
- )
3367
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...defaultStyles.buttons, justifyContent: "flex-end" }, children: showFeedback ? (
3368
+ // After viewing feedback
3369
+ isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3370
+ "button",
3371
+ {
3372
+ style: {
3373
+ ...defaultStyles.button,
3374
+ ...isSubmitting || isGeneratingExtra ? defaultStyles.buttonDisabled : defaultStyles.buttonPrimary
3375
+ },
3376
+ onClick: handleSubmit,
3377
+ disabled: isSubmitting || isGeneratingExtra,
3378
+ "data-testid": "button-submit-quiz",
3379
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }) : "Submit Quiz"
3380
+ }
3381
+ ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3382
+ "button",
3383
+ {
3384
+ style: {
3385
+ ...defaultStyles.button,
3386
+ ...defaultStyles.buttonPrimary
3387
+ },
3388
+ onClick: handleContinue,
3389
+ "data-testid": "button-continue",
3390
+ children: "Continue"
3391
+ }
3392
+ )
3393
+ ) : (
3394
+ // Before checking answer
3395
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3396
+ "button",
3397
+ {
3398
+ style: {
3399
+ ...defaultStyles.button,
3400
+ ...isNavigating || selectedAnswer === void 0 ? defaultStyles.buttonDisabled : defaultStyles.buttonPrimary
3401
+ },
3402
+ onClick: handleCheckAnswer,
3403
+ disabled: isNavigating || selectedAnswer === void 0,
3404
+ "data-testid": "button-check-answer",
3405
+ children: isNavigating ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, { size: 16, color: "#9ca3af" }) : "Check Answer"
3406
+ }
3407
+ )
3408
+ ) })
3243
3409
  ] })
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
- ] }) });
3410
+ ] }),
3411
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: defaultStyles.chatPanel, children: apiClient.current && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3412
+ QuestionChatPanel,
3413
+ {
3414
+ apiClient: apiClient.current,
3415
+ question: {
3416
+ id: currentQuestion.id,
3417
+ question: currentQuestion.question,
3418
+ type: currentQuestion.type,
3419
+ options: currentQuestion.options,
3420
+ correctAnswer: currentQuestion.correctAnswer,
3421
+ explanation: currentQuestion.explanation
3422
+ },
3423
+ quizId: quiz.id,
3424
+ childId,
3425
+ parentId,
3426
+ lessonId,
3427
+ courseId,
3428
+ answerResult: showFeedback && currentAnswerDetail ? {
3429
+ wasIncorrect: currentQuestion.type !== "assessment" && !currentAnswerDetail.isCorrect,
3430
+ selectedAnswer: typeof selectedAnswer === "string" ? selectedAnswer : Array.isArray(selectedAnswer) ? selectedAnswer.join(", ") : void 0,
3431
+ correctAnswer: typeof currentQuestion.correctAnswer === "string" ? currentQuestion.correctAnswer : Array.isArray(currentQuestion.correctAnswer) ? currentQuestion.correctAnswer.join(", ") : void 0,
3432
+ explanation: currentQuestion.explanation
3433
+ } : void 0
3434
+ }
3435
+ ) })
3436
+ ] })
3437
+ ] });
3337
3438
  }
3338
3439
 
3339
3440
  // src/AttemptViewer.tsx
@@ -3481,7 +3582,12 @@ var defaultStyles2 = {
3481
3582
  marginTop: "12px",
3482
3583
  display: "flex",
3483
3584
  flexDirection: "column",
3484
- gap: "8px"
3585
+ gap: "8px",
3586
+ backgroundColor: "#ffffff",
3587
+ padding: "16px",
3588
+ borderRadius: "8px",
3589
+ border: "1px solid #e5e7eb",
3590
+ boxShadow: "0 1px 3px rgba(0, 0, 0, 0.05)"
3485
3591
  },
3486
3592
  chatMessage: {
3487
3593
  padding: "8px 12px",