analytica-frontend-lib 1.1.65 → 1.1.66

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.mjs CHANGED
@@ -5013,10 +5013,36 @@ var CardStatus = forwardRef12(
5013
5013
  return "Incorreta";
5014
5014
  case "unanswered":
5015
5015
  return "Em branco";
5016
+ case "pending":
5017
+ return "Avalia\xE7\xE3o pendente";
5016
5018
  default:
5017
5019
  return "Em branco";
5018
5020
  }
5019
5021
  };
5022
+ const getIconBadge = (status2) => {
5023
+ switch (status2) {
5024
+ case "correct":
5025
+ return /* @__PURE__ */ jsx31(CheckCircle3, {});
5026
+ case "incorrect":
5027
+ return /* @__PURE__ */ jsx31(XCircle2, {});
5028
+ case "pending":
5029
+ return /* @__PURE__ */ jsx31(Clock, {});
5030
+ default:
5031
+ return /* @__PURE__ */ jsx31(XCircle2, {});
5032
+ }
5033
+ };
5034
+ const getActionBadge = (status2) => {
5035
+ switch (status2) {
5036
+ case "correct":
5037
+ return "success";
5038
+ case "incorrect":
5039
+ return "error";
5040
+ case "pending":
5041
+ return "info";
5042
+ default:
5043
+ return "info";
5044
+ }
5045
+ };
5020
5046
  return /* @__PURE__ */ jsx31(
5021
5047
  CardBase,
5022
5048
  {
@@ -5032,10 +5058,10 @@ var CardStatus = forwardRef12(
5032
5058
  status && /* @__PURE__ */ jsx31(
5033
5059
  Badge_default,
5034
5060
  {
5035
- action: status == "correct" ? "success" : "error",
5061
+ action: getActionBadge(status),
5036
5062
  variant: "solid",
5037
5063
  size: "medium",
5038
- iconLeft: status == "correct" ? /* @__PURE__ */ jsx31(CheckCircle3, {}) : /* @__PURE__ */ jsx31(XCircle2, {}),
5064
+ iconLeft: getIconBadge(status),
5039
5065
  children: getLabelBadge(status)
5040
5066
  }
5041
5067
  ),
@@ -8739,7 +8765,7 @@ var QUIZ_TYPE = /* @__PURE__ */ ((QUIZ_TYPE2) => {
8739
8765
  var QUESTION_TYPE = /* @__PURE__ */ ((QUESTION_TYPE2) => {
8740
8766
  QUESTION_TYPE2["ALTERNATIVA"] = "ALTERNATIVA";
8741
8767
  QUESTION_TYPE2["DISSERTATIVA"] = "DISSERTATIVA";
8742
- QUESTION_TYPE2["MULTIPLA_CHOICE"] = "MULTIPLA_CHOICE";
8768
+ QUESTION_TYPE2["MULTIPLA_ESCOLHA"] = "MULTIPLA_ESCOLHA";
8743
8769
  QUESTION_TYPE2["VERDADEIRO_FALSO"] = "VERDADEIRO_FALSO";
8744
8770
  QUESTION_TYPE2["LIGAR_PONTOS"] = "LIGAR_PONTOS";
8745
8771
  QUESTION_TYPE2["PREENCHER"] = "PREENCHER";
@@ -10219,7 +10245,7 @@ var QuizContent = forwardRef20(({ paddingBottom }) => {
10219
10245
  const currentQuestion = getCurrentQuestion();
10220
10246
  const questionComponents = {
10221
10247
  ["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
10222
- ["MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */]: QuizMultipleChoice,
10248
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: QuizMultipleChoice,
10223
10249
  ["DISSERTATIVA" /* DISSERTATIVA */]: QuizDissertative,
10224
10250
  ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: QuizTrueOrFalse,
10225
10251
  ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: QuizConnectDots,
@@ -10760,7 +10786,7 @@ var QuizHeaderResult = forwardRef21(
10760
10786
  );
10761
10787
  }
10762
10788
  );
10763
- var QuizResultHeaderTitle = forwardRef21(({ className, ...props }, ref) => {
10789
+ var QuizResultHeaderTitle = forwardRef21(({ className, showBadge = true, ...props }, ref) => {
10764
10790
  const { quiz } = useQuizStore();
10765
10791
  return /* @__PURE__ */ jsxs36(
10766
10792
  "div",
@@ -10770,7 +10796,7 @@ var QuizResultHeaderTitle = forwardRef21(({ className, ...props }, ref) => {
10770
10796
  ...props,
10771
10797
  children: [
10772
10798
  /* @__PURE__ */ jsx49("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
10773
- /* @__PURE__ */ jsx49(QuizBadge, { subtype: quiz?.subtype || void 0 })
10799
+ showBadge && /* @__PURE__ */ jsx49(QuizBadge, { subtype: quiz?.subtype || void 0 })
10774
10800
  ]
10775
10801
  }
10776
10802
  );
@@ -10788,131 +10814,133 @@ var QuizResultTitle = forwardRef21(({ className, ...props }, ref) => {
10788
10814
  }
10789
10815
  );
10790
10816
  });
10791
- var QuizResultPerformance = forwardRef21(
10792
- ({ ...props }, ref) => {
10793
- const {
10794
- getTotalQuestions,
10795
- formatTime: formatTime2,
10796
- getQuestionResultStatistics,
10797
- getQuestionResult
10798
- } = useQuizStore();
10799
- const totalQuestions = getTotalQuestions();
10800
- const questionResult = getQuestionResult();
10801
- let correctAnswers = 0;
10802
- let correctEasyAnswers = 0;
10803
- let correctMediumAnswers = 0;
10804
- let correctDifficultAnswers = 0;
10805
- let totalEasyQuestions = 0;
10806
- let totalMediumQuestions = 0;
10807
- let totalDifficultQuestions = 0;
10808
- if (questionResult) {
10809
- questionResult.answers.forEach((answer) => {
10810
- const isCorrect = answer.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
10817
+ var QuizResultPerformance = forwardRef21(({ showDetails = true, ...props }, ref) => {
10818
+ const {
10819
+ getTotalQuestions,
10820
+ formatTime: formatTime2,
10821
+ getQuestionResultStatistics,
10822
+ getQuestionResult
10823
+ } = useQuizStore();
10824
+ const totalQuestions = getTotalQuestions();
10825
+ const questionResult = getQuestionResult();
10826
+ let correctAnswers = 0;
10827
+ let correctEasyAnswers = 0;
10828
+ let correctMediumAnswers = 0;
10829
+ let correctDifficultAnswers = 0;
10830
+ let totalEasyQuestions = 0;
10831
+ let totalMediumQuestions = 0;
10832
+ let totalDifficultQuestions = 0;
10833
+ if (questionResult) {
10834
+ questionResult.answers.forEach((answer) => {
10835
+ const isCorrect = answer.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
10836
+ if (isCorrect) {
10837
+ correctAnswers++;
10838
+ }
10839
+ if (answer.difficultyLevel === "FACIL" /* FACIL */) {
10840
+ totalEasyQuestions++;
10811
10841
  if (isCorrect) {
10812
- correctAnswers++;
10842
+ correctEasyAnswers++;
10813
10843
  }
10814
- if (answer.difficultyLevel === "FACIL" /* FACIL */) {
10815
- totalEasyQuestions++;
10816
- if (isCorrect) {
10817
- correctEasyAnswers++;
10818
- }
10819
- } else if (answer.difficultyLevel === "MEDIO" /* MEDIO */) {
10820
- totalMediumQuestions++;
10821
- if (isCorrect) {
10822
- correctMediumAnswers++;
10823
- }
10824
- } else if (answer.difficultyLevel === "DIFICIL" /* DIFICIL */) {
10825
- totalDifficultQuestions++;
10826
- if (isCorrect) {
10827
- correctDifficultAnswers++;
10828
- }
10844
+ } else if (answer.difficultyLevel === "MEDIO" /* MEDIO */) {
10845
+ totalMediumQuestions++;
10846
+ if (isCorrect) {
10847
+ correctMediumAnswers++;
10848
+ }
10849
+ } else if (answer.difficultyLevel === "DIFICIL" /* DIFICIL */) {
10850
+ totalDifficultQuestions++;
10851
+ if (isCorrect) {
10852
+ correctDifficultAnswers++;
10829
10853
  }
10830
- });
10831
- }
10832
- const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
10833
- return /* @__PURE__ */ jsxs36(
10834
- "div",
10835
- {
10836
- className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
10837
- ref,
10838
- ...props,
10839
- children: [
10840
- /* @__PURE__ */ jsxs36("div", { className: "relative", children: [
10841
- /* @__PURE__ */ jsx49(
10842
- ProgressCircle_default,
10843
- {
10844
- size: "medium",
10845
- variant: "green",
10846
- value: percentage,
10847
- showPercentage: false,
10848
- label: ""
10849
- }
10850
- ),
10851
- /* @__PURE__ */ jsxs36("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
10852
- /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-1 mb-1", children: [
10853
- /* @__PURE__ */ jsx49(Clock3, { size: 12, weight: "regular", className: "text-text-800" }),
10854
- /* @__PURE__ */ jsx49("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(
10855
- (getQuestionResultStatistics()?.timeSpent ?? 0) * 60
10856
- ) })
10857
- ] }),
10858
- /* @__PURE__ */ jsxs36("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
10859
- getQuestionResultStatistics()?.correctAnswers ?? "--",
10860
- " de",
10861
- " ",
10862
- totalQuestions
10863
- ] }),
10864
- /* @__PURE__ */ jsx49("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
10865
- ] })
10866
- ] }),
10867
- /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-4 w-full", children: [
10868
- /* @__PURE__ */ jsx49(
10869
- ProgressBar_default,
10870
- {
10871
- className: "w-full",
10872
- layout: "stacked",
10873
- variant: "green",
10874
- value: correctEasyAnswers,
10875
- max: totalEasyQuestions,
10876
- label: "F\xE1ceis",
10877
- showHitCount: true,
10878
- labelClassName: "text-base font-medium text-text-800 leading-none",
10879
- percentageClassName: "text-xs font-medium leading-[14px] text-right"
10880
- }
10881
- ),
10882
- /* @__PURE__ */ jsx49(
10883
- ProgressBar_default,
10884
- {
10885
- className: "w-full",
10886
- layout: "stacked",
10887
- variant: "green",
10888
- value: correctMediumAnswers,
10889
- max: totalMediumQuestions,
10890
- label: "M\xE9dias",
10891
- showHitCount: true,
10892
- labelClassName: "text-base font-medium text-text-800 leading-none",
10893
- percentageClassName: "text-xs font-medium leading-[14px] text-right"
10894
- }
10895
- ),
10896
- /* @__PURE__ */ jsx49(
10897
- ProgressBar_default,
10898
- {
10899
- className: "w-full",
10900
- layout: "stacked",
10901
- variant: "green",
10902
- value: correctDifficultAnswers,
10903
- max: totalDifficultQuestions,
10904
- label: "Dif\xEDceis",
10905
- showHitCount: true,
10906
- labelClassName: "text-base font-medium text-text-800 leading-none",
10907
- percentageClassName: "text-xs font-medium leading-[14px] text-right"
10908
- }
10909
- )
10910
- ] })
10911
- ]
10912
10854
  }
10913
- );
10855
+ });
10914
10856
  }
10915
- );
10857
+ const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
10858
+ const classesJustifyBetween = showDetails ? "justify-between" : "justify-center";
10859
+ return /* @__PURE__ */ jsxs36(
10860
+ "div",
10861
+ {
10862
+ className: cn(
10863
+ "flex flex-row gap-6 p-6 rounded-xl bg-background",
10864
+ classesJustifyBetween
10865
+ ),
10866
+ ref,
10867
+ ...props,
10868
+ children: [
10869
+ /* @__PURE__ */ jsxs36("div", { className: "relative", children: [
10870
+ /* @__PURE__ */ jsx49(
10871
+ ProgressCircle_default,
10872
+ {
10873
+ size: "medium",
10874
+ variant: "green",
10875
+ value: percentage,
10876
+ showPercentage: false,
10877
+ label: ""
10878
+ }
10879
+ ),
10880
+ /* @__PURE__ */ jsxs36("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
10881
+ showDetails && /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-1 mb-1", children: [
10882
+ /* @__PURE__ */ jsx49(Clock3, { size: 12, weight: "regular", className: "text-text-800" }),
10883
+ /* @__PURE__ */ jsx49("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(
10884
+ (getQuestionResultStatistics()?.timeSpent ?? 0) * 60
10885
+ ) })
10886
+ ] }),
10887
+ /* @__PURE__ */ jsxs36("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
10888
+ getQuestionResultStatistics()?.correctAnswers ?? "--",
10889
+ " de",
10890
+ " ",
10891
+ totalQuestions
10892
+ ] }),
10893
+ /* @__PURE__ */ jsx49("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
10894
+ ] })
10895
+ ] }),
10896
+ showDetails && /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-4 w-full", children: [
10897
+ /* @__PURE__ */ jsx49(
10898
+ ProgressBar_default,
10899
+ {
10900
+ className: "w-full",
10901
+ layout: "stacked",
10902
+ variant: "green",
10903
+ value: correctEasyAnswers,
10904
+ max: totalEasyQuestions,
10905
+ label: "F\xE1ceis",
10906
+ showHitCount: true,
10907
+ labelClassName: "text-base font-medium text-text-800 leading-none",
10908
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
10909
+ }
10910
+ ),
10911
+ /* @__PURE__ */ jsx49(
10912
+ ProgressBar_default,
10913
+ {
10914
+ className: "w-full",
10915
+ layout: "stacked",
10916
+ variant: "green",
10917
+ value: correctMediumAnswers,
10918
+ max: totalMediumQuestions,
10919
+ label: "M\xE9dias",
10920
+ showHitCount: true,
10921
+ labelClassName: "text-base font-medium text-text-800 leading-none",
10922
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
10923
+ }
10924
+ ),
10925
+ /* @__PURE__ */ jsx49(
10926
+ ProgressBar_default,
10927
+ {
10928
+ className: "w-full",
10929
+ layout: "stacked",
10930
+ variant: "green",
10931
+ value: correctDifficultAnswers,
10932
+ max: totalDifficultQuestions,
10933
+ label: "Dif\xEDceis",
10934
+ showHitCount: true,
10935
+ labelClassName: "text-base font-medium text-text-800 leading-none",
10936
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
10937
+ }
10938
+ )
10939
+ ] })
10940
+ ]
10941
+ }
10942
+ );
10943
+ });
10916
10944
  var QuizListResult = forwardRef21(({ className, onSubjectClick, ...props }, ref) => {
10917
10945
  const { getQuestionsGroupedBySubject } = useQuizStore();
10918
10946
  const groupedQuestions = getQuestionsGroupedBySubject();
@@ -10964,11 +10992,12 @@ var QuizListResultByMateria = ({
10964
10992
  const { getQuestionsGroupedBySubject, getQuestionIndex } = useQuizStore();
10965
10993
  const groupedQuestions = getQuestionsGroupedBySubject();
10966
10994
  const answeredQuestions = groupedQuestions[subject] || [];
10995
+ const formattedQuestions = subject == "all" ? Object.values(groupedQuestions).flat() : answeredQuestions;
10967
10996
  return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col", children: [
10968
10997
  /* @__PURE__ */ jsx49("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ jsx49("p", { className: "text-text-950 font-bold text-2xl", children: answeredQuestions?.[0]?.knowledgeMatrix?.[0]?.subject?.name ?? "Sem mat\xE9ria" }) }),
10969
10998
  /* @__PURE__ */ jsxs36("section", { className: "flex flex-col ", children: [
10970
10999
  /* @__PURE__ */ jsx49("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
10971
- /* @__PURE__ */ jsx49("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
11000
+ /* @__PURE__ */ jsx49("ul", { className: "flex flex-col gap-2 pt-4", children: formattedQuestions.map((question) => {
10972
11001
  const questionIndex = getQuestionIndex(
10973
11002
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10974
11003
  question.questionId ?? question.id
@@ -10985,6 +11014,8 @@ var QuizListResultByMateria = ({
10985
11014
  return "incorrect";
10986
11015
  if (question.answerStatus === "NAO_RESPONDIDO" /* NAO_RESPONDIDO */)
10987
11016
  return "unanswered";
11017
+ if (question.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */)
11018
+ return "pending";
10988
11019
  return void 0;
10989
11020
  })(),
10990
11021
  onClick: () => onQuestionClick?.(question)