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.
package/dist/index.js CHANGED
@@ -70,7 +70,11 @@ __export(src_exports, {
70
70
  QuizContent: () => QuizContent,
71
71
  QuizFooter: () => QuizFooter,
72
72
  QuizHeader: () => QuizHeader,
73
+ QuizListResultByMateria: () => QuizListResultByMateria,
73
74
  QuizQuestionList: () => QuizQuestionList,
75
+ QuizResultHeaderTitle: () => QuizResultHeaderTitle,
76
+ QuizResultPerformance: () => QuizResultPerformance,
77
+ QuizResultTitle: () => QuizResultTitle,
74
78
  QuizTitle: () => QuizTitle,
75
79
  Radio: () => Radio_default,
76
80
  RadioGroup: () => RadioGroup,
@@ -6288,6 +6292,9 @@ var useQuizStore = (0, import_zustand6.create)()(
6288
6292
  (set, get) => {
6289
6293
  let timerInterval = null;
6290
6294
  const startTimer = () => {
6295
+ if (get().isFinished) {
6296
+ return;
6297
+ }
6291
6298
  if (timerInterval) {
6292
6299
  clearInterval(timerInterval);
6293
6300
  }
@@ -6306,15 +6313,17 @@ var useQuizStore = (0, import_zustand6.create)()(
6306
6313
  // Initial State
6307
6314
  currentQuestionIndex: 0,
6308
6315
  selectedAnswers: {},
6309
- skippedQuestions: [],
6310
6316
  userAnswers: [],
6311
6317
  timeElapsed: 0,
6312
6318
  isStarted: false,
6313
6319
  isFinished: false,
6320
+ userId: "",
6314
6321
  // Setters
6315
- setBySimulado: (simulado) => set({ bySimulado: simulado }),
6316
- setByAtividade: (atividade) => set({ byAtividade: atividade }),
6317
- setByAula: (aula) => set({ byAula: aula }),
6322
+ setBySimulated: (simulado) => set({ bySimulated: simulado }),
6323
+ setByActivity: (atividade) => set({ byActivity: atividade }),
6324
+ setByQuestionary: (aula) => set({ byQuestionary: aula }),
6325
+ setUserId: (userId) => set({ userId }),
6326
+ getUserId: () => get().userId,
6318
6327
  // Navigation
6319
6328
  goToNextQuestion: () => {
6320
6329
  const { currentQuestionIndex, getTotalQuestions } = get();
@@ -6336,58 +6345,107 @@ var useQuizStore = (0, import_zustand6.create)()(
6336
6345
  set({ currentQuestionIndex: index });
6337
6346
  }
6338
6347
  },
6339
- // Quiz Actions
6348
+ getActiveQuiz: () => {
6349
+ const { bySimulated, byActivity, byQuestionary } = get();
6350
+ if (bySimulated)
6351
+ return { quiz: bySimulated, type: "bySimulated" };
6352
+ if (byActivity)
6353
+ return { quiz: byActivity, type: "byActivity" };
6354
+ if (byQuestionary)
6355
+ return { quiz: byQuestionary, type: "byQuestionary" };
6356
+ return null;
6357
+ },
6340
6358
  selectAnswer: (questionId, answerId) => {
6341
- const { selectedAnswers, skippedQuestions, addUserAnswer } = get();
6342
- const newSkippedQuestions = skippedQuestions.filter(
6343
- (id) => id !== questionId
6359
+ const { getActiveQuiz, userAnswers } = get();
6360
+ const activeQuiz = getActiveQuiz();
6361
+ if (!activeQuiz) return;
6362
+ const updatedQuestions = activeQuiz.quiz.questions.map(
6363
+ (question) => question.id === questionId ? { ...question, answerKey: answerId } : question
6364
+ );
6365
+ const updatedQuiz = {
6366
+ ...activeQuiz.quiz,
6367
+ questions: updatedQuestions
6368
+ };
6369
+ const activityId = activeQuiz.quiz.id;
6370
+ const userId = get().getUserId();
6371
+ if (!userId) {
6372
+ console.warn("selectAnswer called before userId is set");
6373
+ return;
6374
+ }
6375
+ const existingAnswerIndex = userAnswers.findIndex(
6376
+ (answer) => answer.questionId === questionId
6344
6377
  );
6378
+ const newUserAnswer = {
6379
+ questionId,
6380
+ activityId,
6381
+ userId,
6382
+ answer: answerId,
6383
+ optionId: answerId
6384
+ };
6385
+ let updatedUserAnswers;
6386
+ if (existingAnswerIndex !== -1) {
6387
+ updatedUserAnswers = [...userAnswers];
6388
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
6389
+ } else {
6390
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
6391
+ }
6345
6392
  set({
6346
- selectedAnswers: {
6347
- ...selectedAnswers,
6348
- [questionId]: answerId
6349
- },
6350
- skippedQuestions: newSkippedQuestions
6393
+ [activeQuiz.type]: updatedQuiz,
6394
+ userAnswers: updatedUserAnswers
6351
6395
  });
6352
- addUserAnswer(questionId, answerId);
6353
6396
  },
6354
6397
  skipQuestion: () => {
6355
- const { getCurrentQuestion, skippedQuestions, addUserAnswer } = get();
6398
+ const { getCurrentQuestion, userAnswers, getActiveQuiz } = get();
6356
6399
  const currentQuestion = getCurrentQuestion();
6400
+ const activeQuiz = getActiveQuiz();
6401
+ if (!activeQuiz) return;
6357
6402
  if (currentQuestion) {
6403
+ const activityId = activeQuiz.quiz.id;
6404
+ const userId = get().getUserId();
6405
+ const existingAnswerIndex = userAnswers.findIndex(
6406
+ (answer) => answer.questionId === currentQuestion.id
6407
+ );
6408
+ const newUserAnswer = {
6409
+ questionId: currentQuestion.id,
6410
+ activityId,
6411
+ userId,
6412
+ answer: null,
6413
+ optionId: null
6414
+ };
6415
+ let updatedUserAnswers;
6416
+ if (existingAnswerIndex !== -1) {
6417
+ updatedUserAnswers = [...userAnswers];
6418
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
6419
+ } else {
6420
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
6421
+ }
6358
6422
  set({
6359
- skippedQuestions: [...skippedQuestions, currentQuestion.id]
6423
+ userAnswers: updatedUserAnswers
6360
6424
  });
6361
- addUserAnswer(currentQuestion.id);
6362
6425
  }
6363
6426
  },
6364
6427
  addUserAnswer: (questionId, answerId) => {
6365
- const { userAnswers, bySimulado, byAtividade, byAula } = get();
6366
- const quiz = bySimulado || byAtividade || byAula;
6367
- const question = quiz?.questions.find((q) => q.id === questionId);
6368
- if (!question) return;
6428
+ const { getActiveQuiz, userAnswers } = get();
6429
+ const activeQuiz = getActiveQuiz();
6430
+ if (!activeQuiz) return;
6431
+ const activityId = activeQuiz.quiz.id;
6432
+ const userId = get().getUserId();
6369
6433
  const existingAnswerIndex = userAnswers.findIndex(
6370
- (answer) => answer.id === questionId
6434
+ (answer) => answer.questionId === questionId
6371
6435
  );
6436
+ const newUserAnswer = {
6437
+ questionId,
6438
+ activityId,
6439
+ userId,
6440
+ answer: answerId || null,
6441
+ optionId: answerId || null
6442
+ };
6372
6443
  if (existingAnswerIndex !== -1) {
6373
- const updatedAnswers = [...userAnswers];
6374
- updatedAnswers[existingAnswerIndex] = {
6375
- ...question,
6376
- answerKey: answerId || "",
6377
- isSkipped: !answerId
6378
- };
6379
- set({ userAnswers: updatedAnswers });
6444
+ const updatedUserAnswers = [...userAnswers];
6445
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
6446
+ set({ userAnswers: updatedUserAnswers });
6380
6447
  } else {
6381
- set({
6382
- userAnswers: [
6383
- ...userAnswers,
6384
- {
6385
- ...question,
6386
- answerKey: answerId || "",
6387
- isSkipped: !answerId
6388
- }
6389
- ]
6390
- });
6448
+ set({ userAnswers: [...userAnswers, newUserAnswer] });
6391
6449
  }
6392
6450
  },
6393
6451
  startQuiz: () => {
@@ -6403,11 +6461,11 @@ var useQuizStore = (0, import_zustand6.create)()(
6403
6461
  set({
6404
6462
  currentQuestionIndex: 0,
6405
6463
  selectedAnswers: {},
6406
- skippedQuestions: [],
6407
6464
  userAnswers: [],
6408
6465
  timeElapsed: 0,
6409
6466
  isStarted: false,
6410
- isFinished: false
6467
+ isFinished: false,
6468
+ userId: ""
6411
6469
  });
6412
6470
  },
6413
6471
  // Timer
@@ -6416,36 +6474,33 @@ var useQuizStore = (0, import_zustand6.create)()(
6416
6474
  stopTimer,
6417
6475
  // Getters
6418
6476
  getCurrentQuestion: () => {
6419
- const { bySimulado, byAtividade, byAula, currentQuestionIndex } = get();
6420
- const quiz = bySimulado || byAtividade || byAula;
6421
- if (!quiz) {
6477
+ const { currentQuestionIndex, getActiveQuiz } = get();
6478
+ const activeQuiz = getActiveQuiz();
6479
+ if (!activeQuiz) {
6422
6480
  return null;
6423
6481
  }
6424
- return quiz.questions[currentQuestionIndex];
6482
+ return activeQuiz.quiz.questions[currentQuestionIndex];
6425
6483
  },
6426
6484
  getTotalQuestions: () => {
6427
- const { bySimulado, byAtividade, byAula } = get();
6428
- const quiz = bySimulado || byAtividade || byAula;
6429
- return quiz?.questions?.length || 0;
6485
+ const { getActiveQuiz } = get();
6486
+ const activeQuiz = getActiveQuiz();
6487
+ return activeQuiz?.quiz?.questions?.length || 0;
6430
6488
  },
6431
6489
  getAnsweredQuestions: () => {
6432
- const { selectedAnswers } = get();
6433
- return Object.keys(selectedAnswers).length;
6490
+ const { userAnswers } = get();
6491
+ return userAnswers.filter((answer) => answer.answer !== null).length;
6434
6492
  },
6435
6493
  getUnansweredQuestions: () => {
6436
- const {
6437
- bySimulado,
6438
- byAtividade,
6439
- byAula,
6440
- selectedAnswers,
6441
- skippedQuestions
6442
- } = get();
6443
- const quiz = bySimulado || byAtividade || byAula;
6444
- if (!quiz) return [];
6494
+ const { getActiveQuiz, userAnswers } = get();
6495
+ const activeQuiz = getActiveQuiz();
6496
+ if (!activeQuiz) return [];
6445
6497
  const unansweredQuestions = [];
6446
- quiz.questions.forEach((question, index) => {
6447
- const isAnswered = question.id in selectedAnswers;
6448
- const isSkipped = skippedQuestions.includes(question.id);
6498
+ activeQuiz.quiz.questions.forEach((question, index) => {
6499
+ const userAnswer = userAnswers.find(
6500
+ (answer) => answer.questionId === question.id
6501
+ );
6502
+ const isAnswered = userAnswer && userAnswer.answer !== null;
6503
+ const isSkipped = userAnswer && userAnswer.answer === null;
6449
6504
  if (!isAnswered && !isSkipped) {
6450
6505
  unansweredQuestions.push(index + 1);
6451
6506
  }
@@ -6453,8 +6508,8 @@ var useQuizStore = (0, import_zustand6.create)()(
6453
6508
  return unansweredQuestions;
6454
6509
  },
6455
6510
  getSkippedQuestions: () => {
6456
- const { skippedQuestions } = get();
6457
- return skippedQuestions.length;
6511
+ const { userAnswers } = get();
6512
+ return userAnswers.filter((answer) => answer.answer === null).length;
6458
6513
  },
6459
6514
  getProgress: () => {
6460
6515
  const { getTotalQuestions, getAnsweredQuestions } = get();
@@ -6463,22 +6518,32 @@ var useQuizStore = (0, import_zustand6.create)()(
6463
6518
  return total > 0 ? answered / total * 100 : 0;
6464
6519
  },
6465
6520
  isQuestionAnswered: (questionId) => {
6466
- const { selectedAnswers } = get();
6467
- return questionId in selectedAnswers;
6521
+ const { userAnswers } = get();
6522
+ const userAnswer = userAnswers.find(
6523
+ (answer) => answer.questionId === questionId
6524
+ );
6525
+ return userAnswer ? userAnswer.answer !== null : false;
6468
6526
  },
6469
6527
  isQuestionSkipped: (questionId) => {
6470
- const { skippedQuestions } = get();
6471
- return skippedQuestions.includes(questionId);
6528
+ const { userAnswers } = get();
6529
+ const userAnswer = userAnswers.find(
6530
+ (answer) => answer.questionId === questionId
6531
+ );
6532
+ return userAnswer ? userAnswer.answer === null : false;
6472
6533
  },
6473
6534
  getCurrentAnswer: () => {
6474
- const { getCurrentQuestion, selectedAnswers } = get();
6535
+ const { getCurrentQuestion, userAnswers } = get();
6475
6536
  const currentQuestion = getCurrentQuestion();
6476
- return selectedAnswers[currentQuestion?.id || ""];
6537
+ if (!currentQuestion) return void 0;
6538
+ const userAnswer = userAnswers.find(
6539
+ (answer) => answer.questionId === currentQuestion.id
6540
+ );
6541
+ return userAnswer?.answer;
6477
6542
  },
6478
6543
  getQuizTitle: () => {
6479
- const { bySimulado, byAtividade, byAula } = get();
6480
- const quiz = bySimulado || byAtividade || byAula;
6481
- return quiz?.title || "Quiz";
6544
+ const { getActiveQuiz } = get();
6545
+ const activeQuiz = getActiveQuiz();
6546
+ return activeQuiz?.quiz?.title || "Quiz";
6482
6547
  },
6483
6548
  formatTime: (seconds) => {
6484
6549
  const minutes = Math.floor(seconds / 60);
@@ -6486,30 +6551,42 @@ var useQuizStore = (0, import_zustand6.create)()(
6486
6551
  return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
6487
6552
  },
6488
6553
  getUserAnswers: () => {
6489
- const { userAnswers } = get();
6490
- return userAnswers;
6554
+ const { getActiveQuiz, userAnswers } = get();
6555
+ const activeQuiz = getActiveQuiz();
6556
+ if (!activeQuiz) return [];
6557
+ return activeQuiz.quiz.questions.map((question) => {
6558
+ const userAnswer = userAnswers.find(
6559
+ (answer) => answer.questionId === question.id
6560
+ );
6561
+ return {
6562
+ ...question,
6563
+ isSkipped: userAnswer ? userAnswer.answer === null : false
6564
+ };
6565
+ });
6491
6566
  },
6492
6567
  getUnansweredQuestionsFromUserAnswers: () => {
6493
- const { bySimulado, byAtividade, byAula, userAnswers } = get();
6494
- const quiz = bySimulado || byAtividade || byAula;
6495
- if (!quiz) return [];
6568
+ const { getActiveQuiz, userAnswers } = get();
6569
+ const activeQuiz = getActiveQuiz();
6570
+ if (!activeQuiz) return [];
6496
6571
  const unansweredQuestions = [];
6497
- quiz.questions.forEach((question, index) => {
6572
+ activeQuiz.quiz.questions.forEach((question, index) => {
6498
6573
  const userAnswer = userAnswers.find(
6499
- (answer) => answer.id === question.id
6574
+ (answer) => answer.questionId === question.id
6500
6575
  );
6501
- if (!userAnswer || userAnswer.isSkipped) {
6576
+ const hasAnswer = userAnswer && userAnswer.answer !== null;
6577
+ const isSkipped = userAnswer && userAnswer.answer === null;
6578
+ if (!hasAnswer || isSkipped) {
6502
6579
  unansweredQuestions.push(index + 1);
6503
6580
  }
6504
6581
  });
6505
6582
  return unansweredQuestions;
6506
6583
  },
6507
6584
  getQuestionsGroupedBySubject: () => {
6508
- const { bySimulado, byAtividade, byAula } = get();
6509
- const quiz = bySimulado || byAtividade || byAula;
6510
- if (!quiz) return {};
6585
+ const { getActiveQuiz } = get();
6586
+ const activeQuiz = getActiveQuiz();
6587
+ if (!activeQuiz) return {};
6511
6588
  const groupedQuestions = {};
6512
- quiz.questions.forEach((question) => {
6589
+ activeQuiz.quiz.questions.forEach((question) => {
6513
6590
  const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
6514
6591
  if (!groupedQuestions[subjectId]) {
6515
6592
  groupedQuestions[subjectId] = [];
@@ -6517,6 +6594,31 @@ var useQuizStore = (0, import_zustand6.create)()(
6517
6594
  groupedQuestions[subjectId].push(question);
6518
6595
  });
6519
6596
  return groupedQuestions;
6597
+ },
6598
+ // New methods for userAnswers
6599
+ getUserAnswerByQuestionId: (questionId) => {
6600
+ const { userAnswers } = get();
6601
+ return userAnswers.find((answer) => answer.questionId === questionId) || null;
6602
+ },
6603
+ isQuestionAnsweredByUserAnswers: (questionId) => {
6604
+ const { userAnswers } = get();
6605
+ const answer = userAnswers.find(
6606
+ (answer2) => answer2.questionId === questionId
6607
+ );
6608
+ return answer ? answer.answer !== null : false;
6609
+ },
6610
+ getQuestionStatusFromUserAnswers: (questionId) => {
6611
+ const { userAnswers } = get();
6612
+ const answer = userAnswers.find(
6613
+ (answer2) => answer2.questionId === questionId
6614
+ );
6615
+ if (!answer) return "unanswered";
6616
+ if (answer.answer === null) return "skipped";
6617
+ return "answered";
6618
+ },
6619
+ getUserAnswersForActivity: () => {
6620
+ const { userAnswers } = get();
6621
+ return userAnswers;
6520
6622
  }
6521
6623
  };
6522
6624
  },
@@ -6542,6 +6644,26 @@ var Quiz = (0, import_react22.forwardRef)(({ children, className, ...props }, re
6542
6644
  }
6543
6645
  );
6544
6646
  });
6647
+ var QuizHeaderResult = (0, import_react22.forwardRef)(
6648
+ ({ className, ...props }, ref) => {
6649
+ const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
6650
+ const currentQuestion = getCurrentQuestion();
6651
+ const userAnswer = getCurrentAnswer();
6652
+ const isCorrect = userAnswer === currentQuestion?.correctOptionId;
6653
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6654
+ "div",
6655
+ {
6656
+ ref,
6657
+ className: `flex flex-row items-center gap-10 p-3.5 rounded-xl ${isCorrect ? "bg-success-background" : "bg-error-background"} ${className}`,
6658
+ ...props,
6659
+ children: [
6660
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
6661
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
6662
+ ]
6663
+ }
6664
+ );
6665
+ }
6666
+ );
6545
6667
  var QuizTitle = (0, import_react22.forwardRef)(
6546
6668
  ({ className, ...props }, ref) => {
6547
6669
  const {
@@ -6590,30 +6712,43 @@ var QuizContent = (0, import_react22.forwardRef)(({ type = "Alternativas", child
6590
6712
  "div",
6591
6713
  {
6592
6714
  ref,
6593
- className: `rounded-t-xl bg-background px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
6715
+ className: `rounded-t-xl px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
6594
6716
  ...props,
6595
6717
  children
6596
6718
  }
6597
6719
  )
6598
6720
  ] });
6599
6721
  });
6600
- var QuizAlternative = () => {
6722
+ var QuizAlternative = ({ variant = "default" }) => {
6601
6723
  const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
6602
6724
  const currentQuestion = getCurrentQuestion();
6603
6725
  const currentAnswer = getCurrentAnswer();
6604
- const alternatives = currentQuestion?.options?.map((option) => ({
6605
- label: option.option,
6606
- value: option.id
6607
- }));
6726
+ const alternatives = currentQuestion?.options?.map((option) => {
6727
+ let status = "neutral" /* NEUTRAL */;
6728
+ if (variant === "result") {
6729
+ if (option.id === currentQuestion.correctOptionId) {
6730
+ status = "correct" /* CORRECT */;
6731
+ } else if (currentAnswer === option.id && option.id !== currentQuestion.correctOptionId) {
6732
+ status = "incorrect" /* INCORRECT */;
6733
+ }
6734
+ }
6735
+ return {
6736
+ label: option.option,
6737
+ value: option.id,
6738
+ status
6739
+ };
6740
+ });
6608
6741
  if (!alternatives)
6609
6742
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { children: "N\xE3o h\xE1 Alternativas" }) });
6610
6743
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6611
6744
  AlternativesList,
6612
6745
  {
6746
+ mode: variant === "default" ? "interactive" : "readonly",
6613
6747
  name: `question-${currentQuestion?.id || "1"}`,
6614
- layout: "default",
6748
+ layout: "compact",
6615
6749
  alternatives,
6616
6750
  value: currentAnswer,
6751
+ selectedValue: currentAnswer,
6617
6752
  onValueChange: (value) => {
6618
6753
  if (currentQuestion) {
6619
6754
  selectAnswer(currentQuestion.id, value);
@@ -6630,18 +6765,11 @@ var QuizQuestionList = ({
6630
6765
  const {
6631
6766
  getQuestionsGroupedBySubject,
6632
6767
  goToQuestion,
6633
- isQuestionAnswered,
6634
- isQuestionSkipped
6768
+ getQuestionStatusFromUserAnswers
6635
6769
  } = useQuizStore();
6636
6770
  const groupedQuestions = getQuestionsGroupedBySubject();
6637
6771
  const getQuestionStatus = (questionId) => {
6638
- if (isQuestionSkipped(questionId)) {
6639
- return "skipped";
6640
- }
6641
- if (isQuestionAnswered(questionId)) {
6642
- return "answered";
6643
- }
6644
- return "unanswered";
6772
+ return getQuestionStatusFromUserAnswers(questionId);
6645
6773
  };
6646
6774
  const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
6647
6775
  (acc, [subjectId, questions]) => {
@@ -6665,8 +6793,8 @@ var QuizQuestionList = ({
6665
6793
  {}
6666
6794
  );
6667
6795
  const getQuestionIndex = (questionId) => {
6668
- const { bySimulado, byAtividade, byAula } = useQuizStore.getState();
6669
- const quiz = bySimulado ?? byAtividade ?? byAula;
6796
+ const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
6797
+ const quiz = bySimulated ?? byActivity ?? byQuestionary;
6670
6798
  if (!quiz) return 0;
6671
6799
  const index = quiz.questions.findIndex((q) => q.id === questionId);
6672
6800
  return index + 1;
@@ -6676,7 +6804,7 @@ var QuizQuestionList = ({
6676
6804
  case "answered":
6677
6805
  return "Respondida";
6678
6806
  case "skipped":
6679
- return "Pulada";
6807
+ return "N\xE3o respondida";
6680
6808
  default:
6681
6809
  return "Em branco";
6682
6810
  }
@@ -6717,14 +6845,14 @@ var QuizFooter = (0, import_react22.forwardRef)(({ className, onGoToSimulated, o
6717
6845
  getCurrentAnswer,
6718
6846
  skipQuestion,
6719
6847
  getCurrentQuestion,
6720
- isQuestionSkipped
6848
+ getQuestionStatusFromUserAnswers
6721
6849
  } = useQuizStore();
6722
6850
  const totalQuestions = getTotalQuestions();
6723
6851
  const isFirstQuestion = currentQuestionIndex === 0;
6724
6852
  const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
6725
6853
  const currentAnswer = getCurrentAnswer();
6726
6854
  const currentQuestion = getCurrentQuestion();
6727
- const isCurrentQuestionSkipped = currentQuestion ? isQuestionSkipped(currentQuestion.id) : false;
6855
+ const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
6728
6856
  const [alertDialogOpen, setAlertDialogOpen] = (0, import_react22.useState)(false);
6729
6857
  const [modalResultOpen, setModalResultOpen] = (0, import_react22.useState)(false);
6730
6858
  const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react22.useState)(false);
@@ -6914,6 +7042,223 @@ var QuizFooter = (0, import_react22.forwardRef)(({ className, onGoToSimulated, o
6914
7042
  )
6915
7043
  ] });
6916
7044
  });
7045
+ var QuizResultHeaderTitle = (0, import_react22.forwardRef)(({ className, ...props }, ref) => {
7046
+ const { bySimulated } = useQuizStore();
7047
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7048
+ "div",
7049
+ {
7050
+ ref,
7051
+ className: `flex flex-row pt-4 justify-between ${className}`,
7052
+ ...props,
7053
+ children: [
7054
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
7055
+ bySimulated && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
7056
+ ]
7057
+ }
7058
+ );
7059
+ });
7060
+ var QuizResultTitle = (0, import_react22.forwardRef)(({ className, ...props }, ref) => {
7061
+ const { getQuizTitle } = useQuizStore();
7062
+ const quizTitle = getQuizTitle();
7063
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7064
+ "p",
7065
+ {
7066
+ className: `pt-6 pb-4 text-text-950 font-bold text-lg ${className}`,
7067
+ ref,
7068
+ ...props,
7069
+ children: quizTitle
7070
+ }
7071
+ );
7072
+ });
7073
+ var QuizResultPerformance = (0, import_react22.forwardRef)(
7074
+ ({ ...props }, ref) => {
7075
+ const {
7076
+ getTotalQuestions,
7077
+ timeElapsed,
7078
+ formatTime,
7079
+ bySimulated,
7080
+ byActivity,
7081
+ byQuestionary
7082
+ } = useQuizStore();
7083
+ const totalQuestions = getTotalQuestions();
7084
+ const quiz = bySimulated || byActivity || byQuestionary;
7085
+ let correctAnswers = 0;
7086
+ let correctEasyAnswers = 0;
7087
+ let correctMediumAnswers = 0;
7088
+ let correctDifficultAnswers = 0;
7089
+ let totalEasyQuestions = 0;
7090
+ let totalMediumQuestions = 0;
7091
+ let totalDifficultQuestions = 0;
7092
+ if (quiz) {
7093
+ quiz.questions.forEach((question) => {
7094
+ const userAnswer = question.answerKey;
7095
+ const isCorrect = userAnswer && userAnswer === question.correctOptionId;
7096
+ if (isCorrect) {
7097
+ correctAnswers++;
7098
+ }
7099
+ if (question.difficulty === "FACIL" /* FACIL */) {
7100
+ totalEasyQuestions++;
7101
+ if (isCorrect) {
7102
+ correctEasyAnswers++;
7103
+ }
7104
+ } else if (question.difficulty === "MEDIO" /* MEDIO */) {
7105
+ totalMediumQuestions++;
7106
+ if (isCorrect) {
7107
+ correctMediumAnswers++;
7108
+ }
7109
+ } else if (question.difficulty === "DIFICIL" /* DIFICIL */) {
7110
+ totalDifficultQuestions++;
7111
+ if (isCorrect) {
7112
+ correctDifficultAnswers++;
7113
+ }
7114
+ }
7115
+ });
7116
+ }
7117
+ const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
7118
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7119
+ "div",
7120
+ {
7121
+ className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
7122
+ ref,
7123
+ ...props,
7124
+ children: [
7125
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "relative", children: [
7126
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7127
+ ProgressCircle_default,
7128
+ {
7129
+ size: "medium",
7130
+ variant: "green",
7131
+ value: percentage,
7132
+ showPercentage: false,
7133
+ label: ""
7134
+ }
7135
+ ),
7136
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
7137
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
7138
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
7139
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
7140
+ ] }),
7141
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
7142
+ correctAnswers,
7143
+ " de ",
7144
+ totalQuestions
7145
+ ] }),
7146
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
7147
+ ] })
7148
+ ] }),
7149
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
7150
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7151
+ ProgressBar_default,
7152
+ {
7153
+ className: "w-full",
7154
+ layout: "stacked",
7155
+ variant: "green",
7156
+ value: correctEasyAnswers,
7157
+ max: totalEasyQuestions,
7158
+ label: "F\xE1ceis",
7159
+ showHitCount: true,
7160
+ labelClassName: "text-base font-medium text-text-800 leading-none",
7161
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
7162
+ }
7163
+ ),
7164
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7165
+ ProgressBar_default,
7166
+ {
7167
+ className: "w-full",
7168
+ layout: "stacked",
7169
+ variant: "green",
7170
+ value: correctMediumAnswers,
7171
+ max: totalMediumQuestions,
7172
+ label: "M\xE9dias",
7173
+ showHitCount: true,
7174
+ labelClassName: "text-base font-medium text-text-800 leading-none",
7175
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
7176
+ }
7177
+ ),
7178
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7179
+ ProgressBar_default,
7180
+ {
7181
+ className: "w-full",
7182
+ layout: "stacked",
7183
+ variant: "green",
7184
+ value: correctDifficultAnswers,
7185
+ max: totalDifficultQuestions,
7186
+ label: "Dif\xEDceis",
7187
+ showHitCount: true,
7188
+ labelClassName: "text-base font-medium text-text-800 leading-none",
7189
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
7190
+ }
7191
+ )
7192
+ ] })
7193
+ ]
7194
+ }
7195
+ );
7196
+ }
7197
+ );
7198
+ var QuizListResult = (0, import_react22.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
7199
+ const { getQuestionsGroupedBySubject, isQuestionAnswered } = useQuizStore();
7200
+ const groupedQuestions = getQuestionsGroupedBySubject();
7201
+ const subjectsStats = Object.entries(groupedQuestions).map(
7202
+ ([subjectId, questions]) => {
7203
+ let correct = 0;
7204
+ let incorrect = 0;
7205
+ questions.forEach((question) => {
7206
+ if (isQuestionAnswered(question.id)) {
7207
+ const userAnswer = question.answerKey;
7208
+ if (userAnswer === question.correctOptionId) {
7209
+ correct++;
7210
+ } else {
7211
+ incorrect++;
7212
+ }
7213
+ }
7214
+ });
7215
+ return {
7216
+ subject: subjectId,
7217
+ correct,
7218
+ incorrect,
7219
+ total: questions.length
7220
+ };
7221
+ }
7222
+ );
7223
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { ref, className, ...props, children: [
7224
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
7225
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7226
+ CardResults,
7227
+ {
7228
+ onClick: () => onSubjectClick?.(subject.subject),
7229
+ className: "max-w-full",
7230
+ header: subject.subject,
7231
+ correct_answers: subject.correct,
7232
+ incorrect_answers: subject.incorrect,
7233
+ icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.Book, { size: 20 }),
7234
+ direction: "row"
7235
+ }
7236
+ ) }, subject.subject)) })
7237
+ ] });
7238
+ });
7239
+ var QuizListResultByMateria = ({
7240
+ subject,
7241
+ onQuestionClick
7242
+ }) => {
7243
+ const { getQuestionsGroupedBySubject } = useQuizStore();
7244
+ const groupedQuestions = getQuestionsGroupedBySubject();
7245
+ const answeredQuestions = groupedQuestions[subject] || [];
7246
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
7247
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
7248
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "flex flex-col ", children: [
7249
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
7250
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7251
+ CardStatus,
7252
+ {
7253
+ className: "max-w-full",
7254
+ header: `Quest\xE3o ${question.id}`,
7255
+ status: question.answerKey === question.correctOptionId ? "correct" : "incorrect",
7256
+ onClick: () => onQuestionClick?.(question)
7257
+ }
7258
+ ) }, question.id)) })
7259
+ ] })
7260
+ ] });
7261
+ };
6917
7262
  // Annotate the CommonJS export names for ESM import in node:
6918
7263
  0 && (module.exports = {
6919
7264
  Alert,
@@ -6966,7 +7311,11 @@ var QuizFooter = (0, import_react22.forwardRef)(({ className, onGoToSimulated, o
6966
7311
  QuizContent,
6967
7312
  QuizFooter,
6968
7313
  QuizHeader,
7314
+ QuizListResultByMateria,
6969
7315
  QuizQuestionList,
7316
+ QuizResultHeaderTitle,
7317
+ QuizResultPerformance,
7318
+ QuizResultTitle,
6970
7319
  QuizTitle,
6971
7320
  Radio,
6972
7321
  RadioGroup,