analytica-frontend-lib 1.0.83 → 1.0.84

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.
@@ -4,7 +4,8 @@ import {
4
4
  CaretRight as CaretRight2,
5
5
  Clock as Clock2,
6
6
  SquaresFour,
7
- BookOpen
7
+ BookOpen,
8
+ Book
8
9
  } from "phosphor-react";
9
10
 
10
11
  // src/components/Badge/Badge.tsx
@@ -879,6 +880,9 @@ var useQuizStore = create2()(
879
880
  (set, get) => {
880
881
  let timerInterval = null;
881
882
  const startTimer = () => {
883
+ if (get().isFinished) {
884
+ return;
885
+ }
882
886
  if (timerInterval) {
883
887
  clearInterval(timerInterval);
884
888
  }
@@ -897,15 +901,17 @@ var useQuizStore = create2()(
897
901
  // Initial State
898
902
  currentQuestionIndex: 0,
899
903
  selectedAnswers: {},
900
- skippedQuestions: [],
901
904
  userAnswers: [],
902
905
  timeElapsed: 0,
903
906
  isStarted: false,
904
907
  isFinished: false,
908
+ userId: "",
905
909
  // Setters
906
- setBySimulado: (simulado) => set({ bySimulado: simulado }),
907
- setByAtividade: (atividade) => set({ byAtividade: atividade }),
908
- setByAula: (aula) => set({ byAula: aula }),
910
+ setBySimulated: (simulado) => set({ bySimulated: simulado }),
911
+ setByActivity: (atividade) => set({ byActivity: atividade }),
912
+ setByQuestionary: (aula) => set({ byQuestionary: aula }),
913
+ setUserId: (userId) => set({ userId }),
914
+ getUserId: () => get().userId,
909
915
  // Navigation
910
916
  goToNextQuestion: () => {
911
917
  const { currentQuestionIndex, getTotalQuestions } = get();
@@ -927,58 +933,107 @@ var useQuizStore = create2()(
927
933
  set({ currentQuestionIndex: index });
928
934
  }
929
935
  },
930
- // Quiz Actions
936
+ getActiveQuiz: () => {
937
+ const { bySimulated, byActivity, byQuestionary } = get();
938
+ if (bySimulated)
939
+ return { quiz: bySimulated, type: "bySimulated" };
940
+ if (byActivity)
941
+ return { quiz: byActivity, type: "byActivity" };
942
+ if (byQuestionary)
943
+ return { quiz: byQuestionary, type: "byQuestionary" };
944
+ return null;
945
+ },
931
946
  selectAnswer: (questionId, answerId) => {
932
- const { selectedAnswers, skippedQuestions, addUserAnswer } = get();
933
- const newSkippedQuestions = skippedQuestions.filter(
934
- (id) => id !== questionId
947
+ const { getActiveQuiz, userAnswers } = get();
948
+ const activeQuiz = getActiveQuiz();
949
+ if (!activeQuiz) return;
950
+ const updatedQuestions = activeQuiz.quiz.questions.map(
951
+ (question) => question.id === questionId ? { ...question, answerKey: answerId } : question
935
952
  );
953
+ const updatedQuiz = {
954
+ ...activeQuiz.quiz,
955
+ questions: updatedQuestions
956
+ };
957
+ const activityId = activeQuiz.quiz.id;
958
+ const userId = get().getUserId();
959
+ if (!userId) {
960
+ console.warn("selectAnswer called before userId is set");
961
+ return;
962
+ }
963
+ const existingAnswerIndex = userAnswers.findIndex(
964
+ (answer) => answer.questionId === questionId
965
+ );
966
+ const newUserAnswer = {
967
+ questionId,
968
+ activityId,
969
+ userId,
970
+ answer: answerId,
971
+ optionId: answerId
972
+ };
973
+ let updatedUserAnswers;
974
+ if (existingAnswerIndex !== -1) {
975
+ updatedUserAnswers = [...userAnswers];
976
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
977
+ } else {
978
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
979
+ }
936
980
  set({
937
- selectedAnswers: {
938
- ...selectedAnswers,
939
- [questionId]: answerId
940
- },
941
- skippedQuestions: newSkippedQuestions
981
+ [activeQuiz.type]: updatedQuiz,
982
+ userAnswers: updatedUserAnswers
942
983
  });
943
- addUserAnswer(questionId, answerId);
944
984
  },
945
985
  skipQuestion: () => {
946
- const { getCurrentQuestion, skippedQuestions, addUserAnswer } = get();
986
+ const { getCurrentQuestion, userAnswers, getActiveQuiz } = get();
947
987
  const currentQuestion = getCurrentQuestion();
988
+ const activeQuiz = getActiveQuiz();
989
+ if (!activeQuiz) return;
948
990
  if (currentQuestion) {
991
+ const activityId = activeQuiz.quiz.id;
992
+ const userId = get().getUserId();
993
+ const existingAnswerIndex = userAnswers.findIndex(
994
+ (answer) => answer.questionId === currentQuestion.id
995
+ );
996
+ const newUserAnswer = {
997
+ questionId: currentQuestion.id,
998
+ activityId,
999
+ userId,
1000
+ answer: null,
1001
+ optionId: null
1002
+ };
1003
+ let updatedUserAnswers;
1004
+ if (existingAnswerIndex !== -1) {
1005
+ updatedUserAnswers = [...userAnswers];
1006
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
1007
+ } else {
1008
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
1009
+ }
949
1010
  set({
950
- skippedQuestions: [...skippedQuestions, currentQuestion.id]
1011
+ userAnswers: updatedUserAnswers
951
1012
  });
952
- addUserAnswer(currentQuestion.id);
953
1013
  }
954
1014
  },
955
1015
  addUserAnswer: (questionId, answerId) => {
956
- const { userAnswers, bySimulado, byAtividade, byAula } = get();
957
- const quiz = bySimulado || byAtividade || byAula;
958
- const question = quiz?.questions.find((q) => q.id === questionId);
959
- if (!question) return;
1016
+ const { getActiveQuiz, userAnswers } = get();
1017
+ const activeQuiz = getActiveQuiz();
1018
+ if (!activeQuiz) return;
1019
+ const activityId = activeQuiz.quiz.id;
1020
+ const userId = get().getUserId();
960
1021
  const existingAnswerIndex = userAnswers.findIndex(
961
- (answer) => answer.id === questionId
1022
+ (answer) => answer.questionId === questionId
962
1023
  );
1024
+ const newUserAnswer = {
1025
+ questionId,
1026
+ activityId,
1027
+ userId,
1028
+ answer: answerId || null,
1029
+ optionId: answerId || null
1030
+ };
963
1031
  if (existingAnswerIndex !== -1) {
964
- const updatedAnswers = [...userAnswers];
965
- updatedAnswers[existingAnswerIndex] = {
966
- ...question,
967
- answerKey: answerId || "",
968
- isSkipped: !answerId
969
- };
970
- set({ userAnswers: updatedAnswers });
1032
+ const updatedUserAnswers = [...userAnswers];
1033
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
1034
+ set({ userAnswers: updatedUserAnswers });
971
1035
  } else {
972
- set({
973
- userAnswers: [
974
- ...userAnswers,
975
- {
976
- ...question,
977
- answerKey: answerId || "",
978
- isSkipped: !answerId
979
- }
980
- ]
981
- });
1036
+ set({ userAnswers: [...userAnswers, newUserAnswer] });
982
1037
  }
983
1038
  },
984
1039
  startQuiz: () => {
@@ -994,11 +1049,11 @@ var useQuizStore = create2()(
994
1049
  set({
995
1050
  currentQuestionIndex: 0,
996
1051
  selectedAnswers: {},
997
- skippedQuestions: [],
998
1052
  userAnswers: [],
999
1053
  timeElapsed: 0,
1000
1054
  isStarted: false,
1001
- isFinished: false
1055
+ isFinished: false,
1056
+ userId: ""
1002
1057
  });
1003
1058
  },
1004
1059
  // Timer
@@ -1007,36 +1062,33 @@ var useQuizStore = create2()(
1007
1062
  stopTimer,
1008
1063
  // Getters
1009
1064
  getCurrentQuestion: () => {
1010
- const { bySimulado, byAtividade, byAula, currentQuestionIndex } = get();
1011
- const quiz = bySimulado || byAtividade || byAula;
1012
- if (!quiz) {
1065
+ const { currentQuestionIndex, getActiveQuiz } = get();
1066
+ const activeQuiz = getActiveQuiz();
1067
+ if (!activeQuiz) {
1013
1068
  return null;
1014
1069
  }
1015
- return quiz.questions[currentQuestionIndex];
1070
+ return activeQuiz.quiz.questions[currentQuestionIndex];
1016
1071
  },
1017
1072
  getTotalQuestions: () => {
1018
- const { bySimulado, byAtividade, byAula } = get();
1019
- const quiz = bySimulado || byAtividade || byAula;
1020
- return quiz?.questions?.length || 0;
1073
+ const { getActiveQuiz } = get();
1074
+ const activeQuiz = getActiveQuiz();
1075
+ return activeQuiz?.quiz?.questions?.length || 0;
1021
1076
  },
1022
1077
  getAnsweredQuestions: () => {
1023
- const { selectedAnswers } = get();
1024
- return Object.keys(selectedAnswers).length;
1078
+ const { userAnswers } = get();
1079
+ return userAnswers.filter((answer) => answer.answer !== null).length;
1025
1080
  },
1026
1081
  getUnansweredQuestions: () => {
1027
- const {
1028
- bySimulado,
1029
- byAtividade,
1030
- byAula,
1031
- selectedAnswers,
1032
- skippedQuestions
1033
- } = get();
1034
- const quiz = bySimulado || byAtividade || byAula;
1035
- if (!quiz) return [];
1082
+ const { getActiveQuiz, userAnswers } = get();
1083
+ const activeQuiz = getActiveQuiz();
1084
+ if (!activeQuiz) return [];
1036
1085
  const unansweredQuestions = [];
1037
- quiz.questions.forEach((question, index) => {
1038
- const isAnswered = question.id in selectedAnswers;
1039
- const isSkipped = skippedQuestions.includes(question.id);
1086
+ activeQuiz.quiz.questions.forEach((question, index) => {
1087
+ const userAnswer = userAnswers.find(
1088
+ (answer) => answer.questionId === question.id
1089
+ );
1090
+ const isAnswered = userAnswer && userAnswer.answer !== null;
1091
+ const isSkipped = userAnswer && userAnswer.answer === null;
1040
1092
  if (!isAnswered && !isSkipped) {
1041
1093
  unansweredQuestions.push(index + 1);
1042
1094
  }
@@ -1044,8 +1096,8 @@ var useQuizStore = create2()(
1044
1096
  return unansweredQuestions;
1045
1097
  },
1046
1098
  getSkippedQuestions: () => {
1047
- const { skippedQuestions } = get();
1048
- return skippedQuestions.length;
1099
+ const { userAnswers } = get();
1100
+ return userAnswers.filter((answer) => answer.answer === null).length;
1049
1101
  },
1050
1102
  getProgress: () => {
1051
1103
  const { getTotalQuestions, getAnsweredQuestions } = get();
@@ -1054,22 +1106,32 @@ var useQuizStore = create2()(
1054
1106
  return total > 0 ? answered / total * 100 : 0;
1055
1107
  },
1056
1108
  isQuestionAnswered: (questionId) => {
1057
- const { selectedAnswers } = get();
1058
- return questionId in selectedAnswers;
1109
+ const { userAnswers } = get();
1110
+ const userAnswer = userAnswers.find(
1111
+ (answer) => answer.questionId === questionId
1112
+ );
1113
+ return userAnswer ? userAnswer.answer !== null : false;
1059
1114
  },
1060
1115
  isQuestionSkipped: (questionId) => {
1061
- const { skippedQuestions } = get();
1062
- return skippedQuestions.includes(questionId);
1116
+ const { userAnswers } = get();
1117
+ const userAnswer = userAnswers.find(
1118
+ (answer) => answer.questionId === questionId
1119
+ );
1120
+ return userAnswer ? userAnswer.answer === null : false;
1063
1121
  },
1064
1122
  getCurrentAnswer: () => {
1065
- const { getCurrentQuestion, selectedAnswers } = get();
1123
+ const { getCurrentQuestion, userAnswers } = get();
1066
1124
  const currentQuestion = getCurrentQuestion();
1067
- return selectedAnswers[currentQuestion?.id || ""];
1125
+ if (!currentQuestion) return void 0;
1126
+ const userAnswer = userAnswers.find(
1127
+ (answer) => answer.questionId === currentQuestion.id
1128
+ );
1129
+ return userAnswer?.answer;
1068
1130
  },
1069
1131
  getQuizTitle: () => {
1070
- const { bySimulado, byAtividade, byAula } = get();
1071
- const quiz = bySimulado || byAtividade || byAula;
1072
- return quiz?.title || "Quiz";
1132
+ const { getActiveQuiz } = get();
1133
+ const activeQuiz = getActiveQuiz();
1134
+ return activeQuiz?.quiz?.title || "Quiz";
1073
1135
  },
1074
1136
  formatTime: (seconds) => {
1075
1137
  const minutes = Math.floor(seconds / 60);
@@ -1077,30 +1139,42 @@ var useQuizStore = create2()(
1077
1139
  return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
1078
1140
  },
1079
1141
  getUserAnswers: () => {
1080
- const { userAnswers } = get();
1081
- return userAnswers;
1142
+ const { getActiveQuiz, userAnswers } = get();
1143
+ const activeQuiz = getActiveQuiz();
1144
+ if (!activeQuiz) return [];
1145
+ return activeQuiz.quiz.questions.map((question) => {
1146
+ const userAnswer = userAnswers.find(
1147
+ (answer) => answer.questionId === question.id
1148
+ );
1149
+ return {
1150
+ ...question,
1151
+ isSkipped: userAnswer ? userAnswer.answer === null : false
1152
+ };
1153
+ });
1082
1154
  },
1083
1155
  getUnansweredQuestionsFromUserAnswers: () => {
1084
- const { bySimulado, byAtividade, byAula, userAnswers } = get();
1085
- const quiz = bySimulado || byAtividade || byAula;
1086
- if (!quiz) return [];
1156
+ const { getActiveQuiz, userAnswers } = get();
1157
+ const activeQuiz = getActiveQuiz();
1158
+ if (!activeQuiz) return [];
1087
1159
  const unansweredQuestions = [];
1088
- quiz.questions.forEach((question, index) => {
1160
+ activeQuiz.quiz.questions.forEach((question, index) => {
1089
1161
  const userAnswer = userAnswers.find(
1090
- (answer) => answer.id === question.id
1162
+ (answer) => answer.questionId === question.id
1091
1163
  );
1092
- if (!userAnswer || userAnswer.isSkipped) {
1164
+ const hasAnswer = userAnswer && userAnswer.answer !== null;
1165
+ const isSkipped = userAnswer && userAnswer.answer === null;
1166
+ if (!hasAnswer || isSkipped) {
1093
1167
  unansweredQuestions.push(index + 1);
1094
1168
  }
1095
1169
  });
1096
1170
  return unansweredQuestions;
1097
1171
  },
1098
1172
  getQuestionsGroupedBySubject: () => {
1099
- const { bySimulado, byAtividade, byAula } = get();
1100
- const quiz = bySimulado || byAtividade || byAula;
1101
- if (!quiz) return {};
1173
+ const { getActiveQuiz } = get();
1174
+ const activeQuiz = getActiveQuiz();
1175
+ if (!activeQuiz) return {};
1102
1176
  const groupedQuestions = {};
1103
- quiz.questions.forEach((question) => {
1177
+ activeQuiz.quiz.questions.forEach((question) => {
1104
1178
  const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
1105
1179
  if (!groupedQuestions[subjectId]) {
1106
1180
  groupedQuestions[subjectId] = [];
@@ -1108,6 +1182,31 @@ var useQuizStore = create2()(
1108
1182
  groupedQuestions[subjectId].push(question);
1109
1183
  });
1110
1184
  return groupedQuestions;
1185
+ },
1186
+ // New methods for userAnswers
1187
+ getUserAnswerByQuestionId: (questionId) => {
1188
+ const { userAnswers } = get();
1189
+ return userAnswers.find((answer) => answer.questionId === questionId) || null;
1190
+ },
1191
+ isQuestionAnsweredByUserAnswers: (questionId) => {
1192
+ const { userAnswers } = get();
1193
+ const answer = userAnswers.find(
1194
+ (answer2) => answer2.questionId === questionId
1195
+ );
1196
+ return answer ? answer.answer !== null : false;
1197
+ },
1198
+ getQuestionStatusFromUserAnswers: (questionId) => {
1199
+ const { userAnswers } = get();
1200
+ const answer = userAnswers.find(
1201
+ (answer2) => answer2.questionId === questionId
1202
+ );
1203
+ if (!answer) return "unanswered";
1204
+ if (answer.answer === null) return "skipped";
1205
+ return "answered";
1206
+ },
1207
+ getUserAnswersForActivity: () => {
1208
+ const { userAnswers } = get();
1209
+ return userAnswers;
1111
1210
  }
1112
1211
  };
1113
1212
  },
@@ -3276,10 +3375,180 @@ var CardSimulationHistory = forwardRef6(({ data, onSimulationClick, className, .
3276
3375
  );
3277
3376
  });
3278
3377
 
3378
+ // src/components/ProgressCircle/ProgressCircle.tsx
3379
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3380
+ var SIZE_CLASSES8 = {
3381
+ small: {
3382
+ container: "w-[90px] h-[90px]",
3383
+ // 90px circle from design specs
3384
+ strokeWidth: 4,
3385
+ // 4px stroke width - matches ProgressBar small (h-1)
3386
+ textSize: "2xl",
3387
+ // 24px for percentage (font-size: 24px)
3388
+ textWeight: "medium",
3389
+ // font-weight: 500
3390
+ labelSize: "2xs",
3391
+ // Will be overridden with custom 8px in className
3392
+ labelWeight: "bold",
3393
+ // font-weight: 700
3394
+ spacing: "gap-0",
3395
+ // Reduced gap between percentage and label for better spacing
3396
+ contentWidth: "max-w-[50px]"
3397
+ // Reduced width to fit text inside circle
3398
+ },
3399
+ medium: {
3400
+ container: "w-[152px] h-[152px]",
3401
+ // 151.67px ≈ 152px circle from design specs
3402
+ strokeWidth: 8,
3403
+ // 8px stroke width - matches ProgressBar medium (h-2)
3404
+ textSize: "2xl",
3405
+ // 24px for percentage (font-size: 24px)
3406
+ textWeight: "medium",
3407
+ // font-weight: 500
3408
+ labelSize: "xs",
3409
+ // 12px for status label (font-size: 12px)
3410
+ labelWeight: "medium",
3411
+ // font-weight: 500 (changed from bold)
3412
+ spacing: "gap-1",
3413
+ // 4px gap between percentage and label
3414
+ contentWidth: "max-w-[90px]"
3415
+ // Reduced width to fit text inside circle
3416
+ }
3417
+ };
3418
+ var VARIANT_CLASSES3 = {
3419
+ blue: {
3420
+ background: "stroke-primary-100",
3421
+ // Light blue background (#BBDCF7)
3422
+ fill: "stroke-primary-700",
3423
+ // Blue for activity progress (#2271C4)
3424
+ textColor: "text-primary-700",
3425
+ // Blue text color (#2271C4)
3426
+ labelColor: "text-text-700"
3427
+ // Gray text for label (#525252)
3428
+ },
3429
+ green: {
3430
+ background: "stroke-background-300",
3431
+ // Gray background (#D5D4D4 - matches design)
3432
+ fill: "stroke-success-200",
3433
+ // Green for performance (#84D3A2 - matches design)
3434
+ textColor: "text-text-800",
3435
+ // Dark gray text (#404040 - matches design)
3436
+ labelColor: "text-text-600"
3437
+ // Medium gray text for label (#737373 - matches design)
3438
+ }
3439
+ };
3440
+ var ProgressCircle = ({
3441
+ value,
3442
+ max = 100,
3443
+ size = "small",
3444
+ variant = "blue",
3445
+ label,
3446
+ showPercentage = true,
3447
+ className = "",
3448
+ labelClassName = "",
3449
+ percentageClassName = ""
3450
+ }) => {
3451
+ const safeValue = isNaN(value) ? 0 : value;
3452
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
3453
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
3454
+ const sizeClasses = SIZE_CLASSES8[size];
3455
+ const variantClasses = VARIANT_CLASSES3[variant];
3456
+ const radius = size === "small" ? 37 : 64;
3457
+ const circumference = 2 * Math.PI * radius;
3458
+ const strokeDashoffset = circumference - percentage / 100 * circumference;
3459
+ const center = size === "small" ? 45 : 76;
3460
+ const svgSize = size === "small" ? 90 : 152;
3461
+ return /* @__PURE__ */ jsxs10(
3462
+ "div",
3463
+ {
3464
+ className: `relative flex flex-col items-center justify-center ${sizeClasses.container} rounded-lg ${className}`,
3465
+ children: [
3466
+ /* @__PURE__ */ jsxs10(
3467
+ "svg",
3468
+ {
3469
+ className: "absolute inset-0 transform -rotate-90",
3470
+ width: svgSize,
3471
+ height: svgSize,
3472
+ viewBox: `0 0 ${svgSize} ${svgSize}`,
3473
+ "aria-hidden": "true",
3474
+ children: [
3475
+ /* @__PURE__ */ jsx12(
3476
+ "circle",
3477
+ {
3478
+ cx: center,
3479
+ cy: center,
3480
+ r: radius,
3481
+ fill: "none",
3482
+ strokeWidth: sizeClasses.strokeWidth,
3483
+ className: `${variantClasses.background} rounded-lg`
3484
+ }
3485
+ ),
3486
+ /* @__PURE__ */ jsx12(
3487
+ "circle",
3488
+ {
3489
+ cx: center,
3490
+ cy: center,
3491
+ r: radius,
3492
+ fill: "none",
3493
+ strokeWidth: sizeClasses.strokeWidth,
3494
+ strokeLinecap: "round",
3495
+ strokeDasharray: circumference,
3496
+ strokeDashoffset,
3497
+ className: `${variantClasses.fill} transition-all duration-500 ease-out shadow-soft-shadow-3 rounded-lg`
3498
+ }
3499
+ )
3500
+ ]
3501
+ }
3502
+ ),
3503
+ /* @__PURE__ */ jsx12(
3504
+ "progress",
3505
+ {
3506
+ value: clampedValue,
3507
+ max,
3508
+ "aria-label": typeof label === "string" ? label : "Progress",
3509
+ className: "absolute opacity-0 w-0 h-0"
3510
+ }
3511
+ ),
3512
+ /* @__PURE__ */ jsxs10(
3513
+ "div",
3514
+ {
3515
+ className: `relative z-10 flex flex-col items-center justify-center ${sizeClasses.spacing} ${sizeClasses.contentWidth}`,
3516
+ children: [
3517
+ showPercentage && /* @__PURE__ */ jsxs10(
3518
+ Text_default,
3519
+ {
3520
+ size: sizeClasses.textSize,
3521
+ weight: sizeClasses.textWeight,
3522
+ className: `text-center w-full ${variantClasses.textColor} ${percentageClassName}`,
3523
+ children: [
3524
+ Math.round(percentage),
3525
+ "%"
3526
+ ]
3527
+ }
3528
+ ),
3529
+ label && /* @__PURE__ */ jsx12(
3530
+ Text_default,
3531
+ {
3532
+ as: "span",
3533
+ size: sizeClasses.labelSize,
3534
+ weight: sizeClasses.labelWeight,
3535
+ className: `${variantClasses.labelColor} text-center uppercase tracking-wide truncate w-full ${size === "small" ? "text-[8px] leading-[9px]" : ""} ${labelClassName}`,
3536
+ children: label
3537
+ }
3538
+ )
3539
+ ]
3540
+ }
3541
+ )
3542
+ ]
3543
+ }
3544
+ );
3545
+ };
3546
+ var ProgressCircle_default = ProgressCircle;
3547
+
3279
3548
  // src/components/Quiz/Quiz.tsx
3280
- import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3549
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3281
3550
  var Quiz = forwardRef7(({ children, className, ...props }, ref) => {
3282
- return /* @__PURE__ */ jsx12(
3551
+ return /* @__PURE__ */ jsx13(
3283
3552
  "div",
3284
3553
  {
3285
3554
  ref,
@@ -3289,6 +3558,26 @@ var Quiz = forwardRef7(({ children, className, ...props }, ref) => {
3289
3558
  }
3290
3559
  );
3291
3560
  });
3561
+ var QuizHeaderResult = forwardRef7(
3562
+ ({ className, ...props }, ref) => {
3563
+ const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
3564
+ const currentQuestion = getCurrentQuestion();
3565
+ const userAnswer = getCurrentAnswer();
3566
+ const isCorrect = userAnswer === currentQuestion?.correctOptionId;
3567
+ return /* @__PURE__ */ jsxs11(
3568
+ "div",
3569
+ {
3570
+ ref,
3571
+ className: `flex flex-row items-center gap-10 p-3.5 rounded-xl ${isCorrect ? "bg-success-background" : "bg-error-background"} ${className}`,
3572
+ ...props,
3573
+ children: [
3574
+ /* @__PURE__ */ jsx13("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
3575
+ /* @__PURE__ */ jsx13("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
3576
+ ]
3577
+ }
3578
+ );
3579
+ }
3580
+ );
3292
3581
  var QuizTitle = forwardRef7(
3293
3582
  ({ className, ...props }, ref) => {
3294
3583
  const {
@@ -3301,18 +3590,18 @@ var QuizTitle = forwardRef7(
3301
3590
  } = useQuizStore();
3302
3591
  const totalQuestions = getTotalQuestions();
3303
3592
  const quizTitle = getQuizTitle();
3304
- return /* @__PURE__ */ jsxs10(
3593
+ return /* @__PURE__ */ jsxs11(
3305
3594
  "div",
3306
3595
  {
3307
3596
  ref,
3308
3597
  className: `flex flex-row justify-center items-center relative p-2 ${className}`,
3309
3598
  ...props,
3310
3599
  children: [
3311
- /* @__PURE__ */ jsxs10("span", { className: "flex flex-col gap-2 text-center", children: [
3312
- /* @__PURE__ */ jsx12("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
3313
- /* @__PURE__ */ jsx12("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
3600
+ /* @__PURE__ */ jsxs11("span", { className: "flex flex-col gap-2 text-center", children: [
3601
+ /* @__PURE__ */ jsx13("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
3602
+ /* @__PURE__ */ jsx13("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
3314
3603
  ] }),
3315
- /* @__PURE__ */ jsx12("span", { className: "absolute right-2", children: /* @__PURE__ */ jsx12(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx12(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
3604
+ /* @__PURE__ */ jsx13("span", { className: "absolute right-2", children: /* @__PURE__ */ jsx13(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx13(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
3316
3605
  ]
3317
3606
  }
3318
3607
  );
@@ -3321,7 +3610,7 @@ var QuizTitle = forwardRef7(
3321
3610
  var QuizHeader = () => {
3322
3611
  const { getCurrentQuestion } = useQuizStore();
3323
3612
  const currentQuestion = getCurrentQuestion();
3324
- return /* @__PURE__ */ jsx12(
3613
+ return /* @__PURE__ */ jsx13(
3325
3614
  HeaderAlternative,
3326
3615
  {
3327
3616
  title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
@@ -3331,36 +3620,49 @@ var QuizHeader = () => {
3331
3620
  );
3332
3621
  };
3333
3622
  var QuizContent = forwardRef7(({ type = "Alternativas", children, className, ...props }, ref) => {
3334
- return /* @__PURE__ */ jsxs10(Fragment6, { children: [
3335
- /* @__PURE__ */ jsx12("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx12("p", { className: "font-bold text-lg text-text-950", children: type }) }),
3336
- /* @__PURE__ */ jsx12(
3623
+ return /* @__PURE__ */ jsxs11(Fragment6, { children: [
3624
+ /* @__PURE__ */ jsx13("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx13("p", { className: "font-bold text-lg text-text-950", children: type }) }),
3625
+ /* @__PURE__ */ jsx13(
3337
3626
  "div",
3338
3627
  {
3339
3628
  ref,
3340
- className: `rounded-t-xl bg-background px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
3629
+ className: `rounded-t-xl px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
3341
3630
  ...props,
3342
3631
  children
3343
3632
  }
3344
3633
  )
3345
3634
  ] });
3346
3635
  });
3347
- var QuizAlternative = () => {
3636
+ var QuizAlternative = ({ variant = "default" }) => {
3348
3637
  const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
3349
3638
  const currentQuestion = getCurrentQuestion();
3350
3639
  const currentAnswer = getCurrentAnswer();
3351
- const alternatives = currentQuestion?.options?.map((option) => ({
3352
- label: option.option,
3353
- value: option.id
3354
- }));
3640
+ const alternatives = currentQuestion?.options?.map((option) => {
3641
+ let status = "neutral" /* NEUTRAL */;
3642
+ if (variant === "result") {
3643
+ if (option.id === currentQuestion.correctOptionId) {
3644
+ status = "correct" /* CORRECT */;
3645
+ } else if (currentAnswer === option.id && option.id !== currentQuestion.correctOptionId) {
3646
+ status = "incorrect" /* INCORRECT */;
3647
+ }
3648
+ }
3649
+ return {
3650
+ label: option.option,
3651
+ value: option.id,
3652
+ status
3653
+ };
3654
+ });
3355
3655
  if (!alternatives)
3356
- return /* @__PURE__ */ jsx12("div", { children: /* @__PURE__ */ jsx12("p", { children: "N\xE3o h\xE1 Alternativas" }) });
3357
- return /* @__PURE__ */ jsx12("div", { className: "space-y-4", children: /* @__PURE__ */ jsx12(
3656
+ return /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13("p", { children: "N\xE3o h\xE1 Alternativas" }) });
3657
+ return /* @__PURE__ */ jsx13("div", { className: "space-y-4", children: /* @__PURE__ */ jsx13(
3358
3658
  AlternativesList,
3359
3659
  {
3660
+ mode: variant === "default" ? "interactive" : "readonly",
3360
3661
  name: `question-${currentQuestion?.id || "1"}`,
3361
- layout: "default",
3662
+ layout: "compact",
3362
3663
  alternatives,
3363
3664
  value: currentAnswer,
3665
+ selectedValue: currentAnswer,
3364
3666
  onValueChange: (value) => {
3365
3667
  if (currentQuestion) {
3366
3668
  selectAnswer(currentQuestion.id, value);
@@ -3377,18 +3679,11 @@ var QuizQuestionList = ({
3377
3679
  const {
3378
3680
  getQuestionsGroupedBySubject,
3379
3681
  goToQuestion,
3380
- isQuestionAnswered,
3381
- isQuestionSkipped
3682
+ getQuestionStatusFromUserAnswers
3382
3683
  } = useQuizStore();
3383
3684
  const groupedQuestions = getQuestionsGroupedBySubject();
3384
3685
  const getQuestionStatus = (questionId) => {
3385
- if (isQuestionSkipped(questionId)) {
3386
- return "skipped";
3387
- }
3388
- if (isQuestionAnswered(questionId)) {
3389
- return "answered";
3390
- }
3391
- return "unanswered";
3686
+ return getQuestionStatusFromUserAnswers(questionId);
3392
3687
  };
3393
3688
  const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
3394
3689
  (acc, [subjectId, questions]) => {
@@ -3412,8 +3707,8 @@ var QuizQuestionList = ({
3412
3707
  {}
3413
3708
  );
3414
3709
  const getQuestionIndex = (questionId) => {
3415
- const { bySimulado, byAtividade, byAula } = useQuizStore.getState();
3416
- const quiz = bySimulado ?? byAtividade ?? byAula;
3710
+ const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
3711
+ const quiz = bySimulated ?? byActivity ?? byQuestionary;
3417
3712
  if (!quiz) return 0;
3418
3713
  const index = quiz.questions.findIndex((q) => q.id === questionId);
3419
3714
  return index + 1;
@@ -3423,21 +3718,21 @@ var QuizQuestionList = ({
3423
3718
  case "answered":
3424
3719
  return "Respondida";
3425
3720
  case "skipped":
3426
- return "Pulada";
3721
+ return "N\xE3o respondida";
3427
3722
  default:
3428
3723
  return "Em branco";
3429
3724
  }
3430
3725
  };
3431
- return /* @__PURE__ */ jsx12("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
3432
- ([subjectId, questions]) => /* @__PURE__ */ jsxs10("section", { className: "flex flex-col gap-2", children: [
3433
- /* @__PURE__ */ jsxs10("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
3434
- /* @__PURE__ */ jsx12("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ jsx12(BookOpen, { size: 17, className: "text-white" }) }),
3435
- /* @__PURE__ */ jsx12("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
3726
+ return /* @__PURE__ */ jsx13("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
3727
+ ([subjectId, questions]) => /* @__PURE__ */ jsxs11("section", { className: "flex flex-col gap-2", children: [
3728
+ /* @__PURE__ */ jsxs11("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
3729
+ /* @__PURE__ */ jsx13("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ jsx13(BookOpen, { size: 17, className: "text-white" }) }),
3730
+ /* @__PURE__ */ jsx13("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
3436
3731
  ] }),
3437
- /* @__PURE__ */ jsx12("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
3732
+ /* @__PURE__ */ jsx13("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
3438
3733
  const status = getQuestionStatus(question.id);
3439
3734
  const questionNumber = getQuestionIndex(question.id);
3440
- return /* @__PURE__ */ jsx12(
3735
+ return /* @__PURE__ */ jsx13(
3441
3736
  CardStatus,
3442
3737
  {
3443
3738
  header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
@@ -3464,14 +3759,14 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3464
3759
  getCurrentAnswer,
3465
3760
  skipQuestion,
3466
3761
  getCurrentQuestion,
3467
- isQuestionSkipped
3762
+ getQuestionStatusFromUserAnswers
3468
3763
  } = useQuizStore();
3469
3764
  const totalQuestions = getTotalQuestions();
3470
3765
  const isFirstQuestion = currentQuestionIndex === 0;
3471
3766
  const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
3472
3767
  const currentAnswer = getCurrentAnswer();
3473
3768
  const currentQuestion = getCurrentQuestion();
3474
- const isCurrentQuestionSkipped = currentQuestion ? isQuestionSkipped(currentQuestion.id) : false;
3769
+ const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
3475
3770
  const [alertDialogOpen, setAlertDialogOpen] = useState4(false);
3476
3771
  const [modalResultOpen, setModalResultOpen] = useState4(false);
3477
3772
  const [modalNavigateOpen, setModalNavigateOpen] = useState4(false);
@@ -3479,24 +3774,24 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3479
3774
  const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
3480
3775
  const userAnswers = getUserAnswers();
3481
3776
  const allQuestions = getTotalQuestions();
3482
- return /* @__PURE__ */ jsxs10(Fragment6, { children: [
3483
- /* @__PURE__ */ jsxs10(
3777
+ return /* @__PURE__ */ jsxs11(Fragment6, { children: [
3778
+ /* @__PURE__ */ jsxs11(
3484
3779
  "footer",
3485
3780
  {
3486
3781
  ref,
3487
3782
  className: `w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center ${className}`,
3488
3783
  ...props,
3489
3784
  children: [
3490
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-row items-center gap-1", children: [
3491
- /* @__PURE__ */ jsx12(
3785
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-row items-center gap-1", children: [
3786
+ /* @__PURE__ */ jsx13(
3492
3787
  IconButton_default,
3493
3788
  {
3494
- icon: /* @__PURE__ */ jsx12(SquaresFour, { size: 24, className: "text-text-950" }),
3789
+ icon: /* @__PURE__ */ jsx13(SquaresFour, { size: 24, className: "text-text-950" }),
3495
3790
  size: "md",
3496
3791
  onClick: () => setModalNavigateOpen(true)
3497
3792
  }
3498
3793
  ),
3499
- isFirstQuestion ? /* @__PURE__ */ jsx12(
3794
+ isFirstQuestion ? /* @__PURE__ */ jsx13(
3500
3795
  Button_default,
3501
3796
  {
3502
3797
  variant: "outline",
@@ -3507,13 +3802,13 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3507
3802
  },
3508
3803
  children: "Pular"
3509
3804
  }
3510
- ) : /* @__PURE__ */ jsx12(
3805
+ ) : /* @__PURE__ */ jsx13(
3511
3806
  Button_default,
3512
3807
  {
3513
3808
  size: "medium",
3514
3809
  variant: "link",
3515
3810
  action: "primary",
3516
- iconLeft: /* @__PURE__ */ jsx12(CaretLeft, { size: 18 }),
3811
+ iconLeft: /* @__PURE__ */ jsx13(CaretLeft, { size: 18 }),
3517
3812
  onClick: () => {
3518
3813
  goToPreviousQuestion();
3519
3814
  },
@@ -3521,7 +3816,7 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3521
3816
  }
3522
3817
  )
3523
3818
  ] }),
3524
- !isFirstQuestion && /* @__PURE__ */ jsx12(
3819
+ !isFirstQuestion && /* @__PURE__ */ jsx13(
3525
3820
  Button_default,
3526
3821
  {
3527
3822
  size: "small",
@@ -3534,7 +3829,7 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3534
3829
  children: "Pular"
3535
3830
  }
3536
3831
  ),
3537
- isLastQuestion ? /* @__PURE__ */ jsx12(
3832
+ isLastQuestion ? /* @__PURE__ */ jsx13(
3538
3833
  Button_default,
3539
3834
  {
3540
3835
  size: "medium",
@@ -3550,13 +3845,13 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3550
3845
  },
3551
3846
  children: "Finalizar"
3552
3847
  }
3553
- ) : /* @__PURE__ */ jsx12(
3848
+ ) : /* @__PURE__ */ jsx13(
3554
3849
  Button_default,
3555
3850
  {
3556
3851
  size: "medium",
3557
3852
  variant: "link",
3558
3853
  action: "primary",
3559
- iconRight: /* @__PURE__ */ jsx12(CaretRight2, { size: 18 }),
3854
+ iconRight: /* @__PURE__ */ jsx13(CaretRight2, { size: 18 }),
3560
3855
  disabled: !currentAnswer && !isCurrentQuestionSkipped,
3561
3856
  onClick: () => {
3562
3857
  goToNextQuestion();
@@ -3567,7 +3862,7 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3567
3862
  ]
3568
3863
  }
3569
3864
  ),
3570
- /* @__PURE__ */ jsx12(
3865
+ /* @__PURE__ */ jsx13(
3571
3866
  AlertDialog,
3572
3867
  {
3573
3868
  isOpen: alertDialogOpen,
@@ -3581,7 +3876,7 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3581
3876
  }
3582
3877
  }
3583
3878
  ),
3584
- /* @__PURE__ */ jsx12(
3879
+ /* @__PURE__ */ jsx13(
3585
3880
  Modal_default,
3586
3881
  {
3587
3882
  isOpen: modalResultOpen,
@@ -3591,8 +3886,8 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3591
3886
  closeOnEscape: false,
3592
3887
  hideCloseButton: true,
3593
3888
  size: "md",
3594
- children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
3595
- /* @__PURE__ */ jsx12(
3889
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
3890
+ /* @__PURE__ */ jsx13(
3596
3891
  "img",
3597
3892
  {
3598
3893
  src: simulated_result_default,
@@ -3600,9 +3895,9 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3600
3895
  className: "w-[282px] h-auto object-cover"
3601
3896
  }
3602
3897
  ),
3603
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 text-center", children: [
3604
- /* @__PURE__ */ jsx12("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
3605
- /* @__PURE__ */ jsxs10("p", { className: "text-text-500 font-sm", children: [
3898
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 text-center", children: [
3899
+ /* @__PURE__ */ jsx13("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
3900
+ /* @__PURE__ */ jsxs11("p", { className: "text-text-500 font-sm", children: [
3606
3901
  "Voc\xEA acertou",
3607
3902
  " ",
3608
3903
  userAnswers.filter(
@@ -3614,8 +3909,8 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3614
3909
  " quest\xF5es."
3615
3910
  ] })
3616
3911
  ] }),
3617
- /* @__PURE__ */ jsxs10("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
3618
- /* @__PURE__ */ jsx12(
3912
+ /* @__PURE__ */ jsxs11("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
3913
+ /* @__PURE__ */ jsx13(
3619
3914
  Button_default,
3620
3915
  {
3621
3916
  variant: "outline",
@@ -3625,31 +3920,31 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3625
3920
  children: "Ir para simulados"
3626
3921
  }
3627
3922
  ),
3628
- /* @__PURE__ */ jsx12(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
3923
+ /* @__PURE__ */ jsx13(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
3629
3924
  ] })
3630
3925
  ] })
3631
3926
  }
3632
3927
  ),
3633
- /* @__PURE__ */ jsx12(
3928
+ /* @__PURE__ */ jsx13(
3634
3929
  Modal_default,
3635
3930
  {
3636
3931
  isOpen: modalNavigateOpen,
3637
3932
  onClose: () => setModalNavigateOpen(false),
3638
3933
  title: "Quest\xF5es",
3639
3934
  size: "lg",
3640
- children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col w-full h-full", children: [
3641
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
3642
- /* @__PURE__ */ jsx12("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
3643
- /* @__PURE__ */ jsx12("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs10(Select_default, { value: filterType, onValueChange: setFilterType, children: [
3644
- /* @__PURE__ */ jsx12(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ jsx12(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
3645
- /* @__PURE__ */ jsxs10(SelectContent, { children: [
3646
- /* @__PURE__ */ jsx12(SelectItem, { value: "all", children: "Todas" }),
3647
- /* @__PURE__ */ jsx12(SelectItem, { value: "unanswered", children: "Em branco" }),
3648
- /* @__PURE__ */ jsx12(SelectItem, { value: "answered", children: "Respondidas" })
3935
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col w-full h-full", children: [
3936
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
3937
+ /* @__PURE__ */ jsx13("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
3938
+ /* @__PURE__ */ jsx13("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs11(Select_default, { value: filterType, onValueChange: setFilterType, children: [
3939
+ /* @__PURE__ */ jsx13(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ jsx13(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
3940
+ /* @__PURE__ */ jsxs11(SelectContent, { children: [
3941
+ /* @__PURE__ */ jsx13(SelectItem, { value: "all", children: "Todas" }),
3942
+ /* @__PURE__ */ jsx13(SelectItem, { value: "unanswered", children: "Em branco" }),
3943
+ /* @__PURE__ */ jsx13(SelectItem, { value: "answered", children: "Respondidas" })
3649
3944
  ] })
3650
3945
  ] }) })
3651
3946
  ] }),
3652
- /* @__PURE__ */ jsx12("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx12(
3947
+ /* @__PURE__ */ jsx13("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx13(
3653
3948
  QuizQuestionList,
3654
3949
  {
3655
3950
  filterType,
@@ -3661,13 +3956,236 @@ var QuizFooter = forwardRef7(({ className, onGoToSimulated, onDetailResult, ...p
3661
3956
  )
3662
3957
  ] });
3663
3958
  });
3959
+ var QuizResultHeaderTitle = forwardRef7(({ className, ...props }, ref) => {
3960
+ const { bySimulated } = useQuizStore();
3961
+ return /* @__PURE__ */ jsxs11(
3962
+ "div",
3963
+ {
3964
+ ref,
3965
+ className: `flex flex-row pt-4 justify-between ${className}`,
3966
+ ...props,
3967
+ children: [
3968
+ /* @__PURE__ */ jsx13("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
3969
+ bySimulated && /* @__PURE__ */ jsx13(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
3970
+ ]
3971
+ }
3972
+ );
3973
+ });
3974
+ var QuizResultTitle = forwardRef7(({ className, ...props }, ref) => {
3975
+ const { getQuizTitle } = useQuizStore();
3976
+ const quizTitle = getQuizTitle();
3977
+ return /* @__PURE__ */ jsx13(
3978
+ "p",
3979
+ {
3980
+ className: `pt-6 pb-4 text-text-950 font-bold text-lg ${className}`,
3981
+ ref,
3982
+ ...props,
3983
+ children: quizTitle
3984
+ }
3985
+ );
3986
+ });
3987
+ var QuizResultPerformance = forwardRef7(
3988
+ ({ ...props }, ref) => {
3989
+ const {
3990
+ getTotalQuestions,
3991
+ timeElapsed,
3992
+ formatTime,
3993
+ bySimulated,
3994
+ byActivity,
3995
+ byQuestionary
3996
+ } = useQuizStore();
3997
+ const totalQuestions = getTotalQuestions();
3998
+ const quiz = bySimulated || byActivity || byQuestionary;
3999
+ let correctAnswers = 0;
4000
+ let correctEasyAnswers = 0;
4001
+ let correctMediumAnswers = 0;
4002
+ let correctDifficultAnswers = 0;
4003
+ let totalEasyQuestions = 0;
4004
+ let totalMediumQuestions = 0;
4005
+ let totalDifficultQuestions = 0;
4006
+ if (quiz) {
4007
+ quiz.questions.forEach((question) => {
4008
+ const userAnswer = question.answerKey;
4009
+ const isCorrect = userAnswer && userAnswer === question.correctOptionId;
4010
+ if (isCorrect) {
4011
+ correctAnswers++;
4012
+ }
4013
+ if (question.difficulty === "FACIL" /* FACIL */) {
4014
+ totalEasyQuestions++;
4015
+ if (isCorrect) {
4016
+ correctEasyAnswers++;
4017
+ }
4018
+ } else if (question.difficulty === "MEDIO" /* MEDIO */) {
4019
+ totalMediumQuestions++;
4020
+ if (isCorrect) {
4021
+ correctMediumAnswers++;
4022
+ }
4023
+ } else if (question.difficulty === "DIFICIL" /* DIFICIL */) {
4024
+ totalDifficultQuestions++;
4025
+ if (isCorrect) {
4026
+ correctDifficultAnswers++;
4027
+ }
4028
+ }
4029
+ });
4030
+ }
4031
+ const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
4032
+ return /* @__PURE__ */ jsxs11(
4033
+ "div",
4034
+ {
4035
+ className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
4036
+ ref,
4037
+ ...props,
4038
+ children: [
4039
+ /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
4040
+ /* @__PURE__ */ jsx13(
4041
+ ProgressCircle_default,
4042
+ {
4043
+ size: "medium",
4044
+ variant: "green",
4045
+ value: percentage,
4046
+ showPercentage: false,
4047
+ label: ""
4048
+ }
4049
+ ),
4050
+ /* @__PURE__ */ jsxs11("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
4051
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 mb-1", children: [
4052
+ /* @__PURE__ */ jsx13(Clock2, { size: 12, weight: "regular", className: "text-text-800" }),
4053
+ /* @__PURE__ */ jsx13("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
4054
+ ] }),
4055
+ /* @__PURE__ */ jsxs11("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
4056
+ correctAnswers,
4057
+ " de ",
4058
+ totalQuestions
4059
+ ] }),
4060
+ /* @__PURE__ */ jsx13("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
4061
+ ] })
4062
+ ] }),
4063
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-4 w-full", children: [
4064
+ /* @__PURE__ */ jsx13(
4065
+ ProgressBar_default,
4066
+ {
4067
+ className: "w-full",
4068
+ layout: "stacked",
4069
+ variant: "green",
4070
+ value: correctEasyAnswers,
4071
+ max: totalEasyQuestions,
4072
+ label: "F\xE1ceis",
4073
+ showHitCount: true,
4074
+ labelClassName: "text-base font-medium text-text-800 leading-none",
4075
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
4076
+ }
4077
+ ),
4078
+ /* @__PURE__ */ jsx13(
4079
+ ProgressBar_default,
4080
+ {
4081
+ className: "w-full",
4082
+ layout: "stacked",
4083
+ variant: "green",
4084
+ value: correctMediumAnswers,
4085
+ max: totalMediumQuestions,
4086
+ label: "M\xE9dias",
4087
+ showHitCount: true,
4088
+ labelClassName: "text-base font-medium text-text-800 leading-none",
4089
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
4090
+ }
4091
+ ),
4092
+ /* @__PURE__ */ jsx13(
4093
+ ProgressBar_default,
4094
+ {
4095
+ className: "w-full",
4096
+ layout: "stacked",
4097
+ variant: "green",
4098
+ value: correctDifficultAnswers,
4099
+ max: totalDifficultQuestions,
4100
+ label: "Dif\xEDceis",
4101
+ showHitCount: true,
4102
+ labelClassName: "text-base font-medium text-text-800 leading-none",
4103
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
4104
+ }
4105
+ )
4106
+ ] })
4107
+ ]
4108
+ }
4109
+ );
4110
+ }
4111
+ );
4112
+ var QuizListResult = forwardRef7(({ className, onSubjectClick, ...props }, ref) => {
4113
+ const { getQuestionsGroupedBySubject, isQuestionAnswered } = useQuizStore();
4114
+ const groupedQuestions = getQuestionsGroupedBySubject();
4115
+ const subjectsStats = Object.entries(groupedQuestions).map(
4116
+ ([subjectId, questions]) => {
4117
+ let correct = 0;
4118
+ let incorrect = 0;
4119
+ questions.forEach((question) => {
4120
+ if (isQuestionAnswered(question.id)) {
4121
+ const userAnswer = question.answerKey;
4122
+ if (userAnswer === question.correctOptionId) {
4123
+ correct++;
4124
+ } else {
4125
+ incorrect++;
4126
+ }
4127
+ }
4128
+ });
4129
+ return {
4130
+ subject: subjectId,
4131
+ correct,
4132
+ incorrect,
4133
+ total: questions.length
4134
+ };
4135
+ }
4136
+ );
4137
+ return /* @__PURE__ */ jsxs11("section", { ref, className, ...props, children: [
4138
+ /* @__PURE__ */ jsx13("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
4139
+ /* @__PURE__ */ jsx13("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsx13(
4140
+ CardResults,
4141
+ {
4142
+ onClick: () => onSubjectClick?.(subject.subject),
4143
+ className: "max-w-full",
4144
+ header: subject.subject,
4145
+ correct_answers: subject.correct,
4146
+ incorrect_answers: subject.incorrect,
4147
+ icon: /* @__PURE__ */ jsx13(Book, { size: 20 }),
4148
+ direction: "row"
4149
+ }
4150
+ ) }, subject.subject)) })
4151
+ ] });
4152
+ });
4153
+ var QuizListResultByMateria = ({
4154
+ subject,
4155
+ onQuestionClick
4156
+ }) => {
4157
+ const { getQuestionsGroupedBySubject } = useQuizStore();
4158
+ const groupedQuestions = getQuestionsGroupedBySubject();
4159
+ const answeredQuestions = groupedQuestions[subject] || [];
4160
+ return /* @__PURE__ */ jsxs11("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
4161
+ /* @__PURE__ */ jsx13("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ jsx13("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
4162
+ /* @__PURE__ */ jsxs11("section", { className: "flex flex-col ", children: [
4163
+ /* @__PURE__ */ jsx13("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
4164
+ /* @__PURE__ */ jsx13("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsx13(
4165
+ CardStatus,
4166
+ {
4167
+ className: "max-w-full",
4168
+ header: `Quest\xE3o ${question.id}`,
4169
+ status: question.answerKey === question.correctOptionId ? "correct" : "incorrect",
4170
+ onClick: () => onQuestionClick?.(question)
4171
+ }
4172
+ ) }, question.id)) })
4173
+ ] })
4174
+ ] });
4175
+ };
3664
4176
  export {
3665
4177
  Quiz,
3666
4178
  QuizAlternative,
3667
4179
  QuizContent,
3668
4180
  QuizFooter,
3669
4181
  QuizHeader,
4182
+ QuizHeaderResult,
4183
+ QuizListResult,
4184
+ QuizListResultByMateria,
3670
4185
  QuizQuestionList,
4186
+ QuizResultHeaderTitle,
4187
+ QuizResultPerformance,
4188
+ QuizResultTitle,
3671
4189
  QuizTitle
3672
4190
  };
3673
4191
  //# sourceMappingURL=index.mjs.map