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