analytica-frontend-lib 1.1.65 → 1.1.67

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
@@ -2885,7 +2885,7 @@ var Search = (0, import_react14.forwardRef)(
2885
2885
  ref,
2886
2886
  id: inputId,
2887
2887
  type: "text",
2888
- className: `w-full py-0 px-4 pl-10 ${showClearButton ? "pr-10" : "pr-4"} font-normal text-text-900 focus:outline-primary-950 border rounded-full bg-primary border-border-300 focus:border-2 focus:border-primary-950 h-10 placeholder:text-text-600 ${getInputStateClasses(disabled, readOnly)} ${className}`,
2888
+ className: `w-full py-0 px-4 pl-10 ${showClearButton ? "pr-10" : "pr-4"} font-normal text-text-900 focus:outline-primary-950 border rounded-full bg-background focus:bg-primary-50 border-border-300 focus:border-2 focus:border-primary-950 h-10 placeholder:text-text-600 ${getInputStateClasses(disabled, readOnly)} ${className}`,
2889
2889
  value,
2890
2890
  onChange: handleInputChange,
2891
2891
  disabled,
@@ -5109,10 +5109,36 @@ var CardStatus = (0, import_react17.forwardRef)(
5109
5109
  return "Incorreta";
5110
5110
  case "unanswered":
5111
5111
  return "Em branco";
5112
+ case "pending":
5113
+ return "Avalia\xE7\xE3o pendente";
5112
5114
  default:
5113
5115
  return "Em branco";
5114
5116
  }
5115
5117
  };
5118
+ const getIconBadge = (status2) => {
5119
+ switch (status2) {
5120
+ case "correct":
5121
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react13.CheckCircle, {});
5122
+ case "incorrect":
5123
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react13.XCircle, {});
5124
+ case "pending":
5125
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react13.Clock, {});
5126
+ default:
5127
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react13.XCircle, {});
5128
+ }
5129
+ };
5130
+ const getActionBadge = (status2) => {
5131
+ switch (status2) {
5132
+ case "correct":
5133
+ return "success";
5134
+ case "incorrect":
5135
+ return "error";
5136
+ case "pending":
5137
+ return "info";
5138
+ default:
5139
+ return "info";
5140
+ }
5141
+ };
5116
5142
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5117
5143
  CardBase,
5118
5144
  {
@@ -5128,10 +5154,10 @@ var CardStatus = (0, import_react17.forwardRef)(
5128
5154
  status && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5129
5155
  Badge_default,
5130
5156
  {
5131
- action: status == "correct" ? "success" : "error",
5157
+ action: getActionBadge(status),
5132
5158
  variant: "solid",
5133
5159
  size: "medium",
5134
- iconLeft: status == "correct" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react13.CheckCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react13.XCircle, {}),
5160
+ iconLeft: getIconBadge(status),
5135
5161
  children: getLabelBadge(status)
5136
5162
  }
5137
5163
  ),
@@ -8773,7 +8799,7 @@ var QUIZ_TYPE = /* @__PURE__ */ ((QUIZ_TYPE2) => {
8773
8799
  var QUESTION_TYPE = /* @__PURE__ */ ((QUESTION_TYPE2) => {
8774
8800
  QUESTION_TYPE2["ALTERNATIVA"] = "ALTERNATIVA";
8775
8801
  QUESTION_TYPE2["DISSERTATIVA"] = "DISSERTATIVA";
8776
- QUESTION_TYPE2["MULTIPLA_CHOICE"] = "MULTIPLA_CHOICE";
8802
+ QUESTION_TYPE2["MULTIPLA_ESCOLHA"] = "MULTIPLA_ESCOLHA";
8777
8803
  QUESTION_TYPE2["VERDADEIRO_FALSO"] = "VERDADEIRO_FALSO";
8778
8804
  QUESTION_TYPE2["LIGAR_PONTOS"] = "LIGAR_PONTOS";
8779
8805
  QUESTION_TYPE2["PREENCHER"] = "PREENCHER";
@@ -10245,7 +10271,7 @@ var QuizContent = (0, import_react32.forwardRef)(({ paddingBottom }) => {
10245
10271
  const currentQuestion = getCurrentQuestion();
10246
10272
  const questionComponents = {
10247
10273
  ["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
10248
- ["MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */]: QuizMultipleChoice,
10274
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: QuizMultipleChoice,
10249
10275
  ["DISSERTATIVA" /* DISSERTATIVA */]: QuizDissertative,
10250
10276
  ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: QuizTrueOrFalse,
10251
10277
  ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: QuizConnectDots,
@@ -10786,7 +10812,7 @@ var QuizHeaderResult = (0, import_react33.forwardRef)(
10786
10812
  );
10787
10813
  }
10788
10814
  );
10789
- var QuizResultHeaderTitle = (0, import_react33.forwardRef)(({ className, ...props }, ref) => {
10815
+ var QuizResultHeaderTitle = (0, import_react33.forwardRef)(({ className, showBadge = true, ...props }, ref) => {
10790
10816
  const { quiz } = useQuizStore();
10791
10817
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10792
10818
  "div",
@@ -10796,7 +10822,7 @@ var QuizResultHeaderTitle = (0, import_react33.forwardRef)(({ className, ...prop
10796
10822
  ...props,
10797
10823
  children: [
10798
10824
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
10799
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(QuizBadge, { subtype: quiz?.subtype || void 0 })
10825
+ showBadge && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(QuizBadge, { subtype: quiz?.subtype || void 0 })
10800
10826
  ]
10801
10827
  }
10802
10828
  );
@@ -10814,131 +10840,133 @@ var QuizResultTitle = (0, import_react33.forwardRef)(({ className, ...props }, r
10814
10840
  }
10815
10841
  );
10816
10842
  });
10817
- var QuizResultPerformance = (0, import_react33.forwardRef)(
10818
- ({ ...props }, ref) => {
10819
- const {
10820
- getTotalQuestions,
10821
- formatTime: formatTime2,
10822
- getQuestionResultStatistics,
10823
- getQuestionResult
10824
- } = useQuizStore();
10825
- const totalQuestions = getTotalQuestions();
10826
- const questionResult = getQuestionResult();
10827
- let correctAnswers = 0;
10828
- let correctEasyAnswers = 0;
10829
- let correctMediumAnswers = 0;
10830
- let correctDifficultAnswers = 0;
10831
- let totalEasyQuestions = 0;
10832
- let totalMediumQuestions = 0;
10833
- let totalDifficultQuestions = 0;
10834
- if (questionResult) {
10835
- questionResult.answers.forEach((answer) => {
10836
- const isCorrect = answer.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
10843
+ var QuizResultPerformance = (0, import_react33.forwardRef)(({ showDetails = true, ...props }, ref) => {
10844
+ const {
10845
+ getTotalQuestions,
10846
+ formatTime: formatTime2,
10847
+ getQuestionResultStatistics,
10848
+ getQuestionResult
10849
+ } = useQuizStore();
10850
+ const totalQuestions = getTotalQuestions();
10851
+ const questionResult = getQuestionResult();
10852
+ let correctAnswers = 0;
10853
+ let correctEasyAnswers = 0;
10854
+ let correctMediumAnswers = 0;
10855
+ let correctDifficultAnswers = 0;
10856
+ let totalEasyQuestions = 0;
10857
+ let totalMediumQuestions = 0;
10858
+ let totalDifficultQuestions = 0;
10859
+ if (questionResult) {
10860
+ questionResult.answers.forEach((answer) => {
10861
+ const isCorrect = answer.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
10862
+ if (isCorrect) {
10863
+ correctAnswers++;
10864
+ }
10865
+ if (answer.difficultyLevel === "FACIL" /* FACIL */) {
10866
+ totalEasyQuestions++;
10837
10867
  if (isCorrect) {
10838
- correctAnswers++;
10868
+ correctEasyAnswers++;
10839
10869
  }
10840
- if (answer.difficultyLevel === "FACIL" /* FACIL */) {
10841
- totalEasyQuestions++;
10842
- if (isCorrect) {
10843
- correctEasyAnswers++;
10844
- }
10845
- } else if (answer.difficultyLevel === "MEDIO" /* MEDIO */) {
10846
- totalMediumQuestions++;
10847
- if (isCorrect) {
10848
- correctMediumAnswers++;
10849
- }
10850
- } else if (answer.difficultyLevel === "DIFICIL" /* DIFICIL */) {
10851
- totalDifficultQuestions++;
10852
- if (isCorrect) {
10853
- correctDifficultAnswers++;
10854
- }
10870
+ } else if (answer.difficultyLevel === "MEDIO" /* MEDIO */) {
10871
+ totalMediumQuestions++;
10872
+ if (isCorrect) {
10873
+ correctMediumAnswers++;
10874
+ }
10875
+ } else if (answer.difficultyLevel === "DIFICIL" /* DIFICIL */) {
10876
+ totalDifficultQuestions++;
10877
+ if (isCorrect) {
10878
+ correctDifficultAnswers++;
10855
10879
  }
10856
- });
10857
- }
10858
- const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
10859
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10860
- "div",
10861
- {
10862
- className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
10863
- ref,
10864
- ...props,
10865
- children: [
10866
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative", children: [
10867
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10868
- ProgressCircle_default,
10869
- {
10870
- size: "medium",
10871
- variant: "green",
10872
- value: percentage,
10873
- showPercentage: false,
10874
- label: ""
10875
- }
10876
- ),
10877
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
10878
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
10879
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_phosphor_react24.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
10880
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(
10881
- (getQuestionResultStatistics()?.timeSpent ?? 0) * 60
10882
- ) })
10883
- ] }),
10884
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
10885
- getQuestionResultStatistics()?.correctAnswers ?? "--",
10886
- " de",
10887
- " ",
10888
- totalQuestions
10889
- ] }),
10890
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
10891
- ] })
10892
- ] }),
10893
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
10894
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10895
- ProgressBar_default,
10896
- {
10897
- className: "w-full",
10898
- layout: "stacked",
10899
- variant: "green",
10900
- value: correctEasyAnswers,
10901
- max: totalEasyQuestions,
10902
- label: "F\xE1ceis",
10903
- showHitCount: true,
10904
- labelClassName: "text-base font-medium text-text-800 leading-none",
10905
- percentageClassName: "text-xs font-medium leading-[14px] text-right"
10906
- }
10907
- ),
10908
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10909
- ProgressBar_default,
10910
- {
10911
- className: "w-full",
10912
- layout: "stacked",
10913
- variant: "green",
10914
- value: correctMediumAnswers,
10915
- max: totalMediumQuestions,
10916
- label: "M\xE9dias",
10917
- showHitCount: true,
10918
- labelClassName: "text-base font-medium text-text-800 leading-none",
10919
- percentageClassName: "text-xs font-medium leading-[14px] text-right"
10920
- }
10921
- ),
10922
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10923
- ProgressBar_default,
10924
- {
10925
- className: "w-full",
10926
- layout: "stacked",
10927
- variant: "green",
10928
- value: correctDifficultAnswers,
10929
- max: totalDifficultQuestions,
10930
- label: "Dif\xEDceis",
10931
- showHitCount: true,
10932
- labelClassName: "text-base font-medium text-text-800 leading-none",
10933
- percentageClassName: "text-xs font-medium leading-[14px] text-right"
10934
- }
10935
- )
10936
- ] })
10937
- ]
10938
10880
  }
10939
- );
10881
+ });
10940
10882
  }
10941
- );
10883
+ const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
10884
+ const classesJustifyBetween = showDetails ? "justify-between" : "justify-center";
10885
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
10886
+ "div",
10887
+ {
10888
+ className: cn(
10889
+ "flex flex-row gap-6 p-6 rounded-xl bg-background",
10890
+ classesJustifyBetween
10891
+ ),
10892
+ ref,
10893
+ ...props,
10894
+ children: [
10895
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative", children: [
10896
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10897
+ ProgressCircle_default,
10898
+ {
10899
+ size: "medium",
10900
+ variant: "green",
10901
+ value: percentage,
10902
+ showPercentage: false,
10903
+ label: ""
10904
+ }
10905
+ ),
10906
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
10907
+ showDetails && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
10908
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_phosphor_react24.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
10909
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(
10910
+ (getQuestionResultStatistics()?.timeSpent ?? 0) * 60
10911
+ ) })
10912
+ ] }),
10913
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
10914
+ getQuestionResultStatistics()?.correctAnswers ?? "--",
10915
+ " de",
10916
+ " ",
10917
+ totalQuestions
10918
+ ] }),
10919
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
10920
+ ] })
10921
+ ] }),
10922
+ showDetails && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
10923
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10924
+ ProgressBar_default,
10925
+ {
10926
+ className: "w-full",
10927
+ layout: "stacked",
10928
+ variant: "green",
10929
+ value: correctEasyAnswers,
10930
+ max: totalEasyQuestions,
10931
+ label: "F\xE1ceis",
10932
+ showHitCount: true,
10933
+ labelClassName: "text-base font-medium text-text-800 leading-none",
10934
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
10935
+ }
10936
+ ),
10937
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10938
+ ProgressBar_default,
10939
+ {
10940
+ className: "w-full",
10941
+ layout: "stacked",
10942
+ variant: "green",
10943
+ value: correctMediumAnswers,
10944
+ max: totalMediumQuestions,
10945
+ label: "M\xE9dias",
10946
+ showHitCount: true,
10947
+ labelClassName: "text-base font-medium text-text-800 leading-none",
10948
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
10949
+ }
10950
+ ),
10951
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10952
+ ProgressBar_default,
10953
+ {
10954
+ className: "w-full",
10955
+ layout: "stacked",
10956
+ variant: "green",
10957
+ value: correctDifficultAnswers,
10958
+ max: totalDifficultQuestions,
10959
+ label: "Dif\xEDceis",
10960
+ showHitCount: true,
10961
+ labelClassName: "text-base font-medium text-text-800 leading-none",
10962
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
10963
+ }
10964
+ )
10965
+ ] })
10966
+ ]
10967
+ }
10968
+ );
10969
+ });
10942
10970
  var QuizListResult = (0, import_react33.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
10943
10971
  const { getQuestionsGroupedBySubject } = useQuizStore();
10944
10972
  const groupedQuestions = getQuestionsGroupedBySubject();
@@ -10990,11 +11018,12 @@ var QuizListResultByMateria = ({
10990
11018
  const { getQuestionsGroupedBySubject, getQuestionIndex } = useQuizStore();
10991
11019
  const groupedQuestions = getQuestionsGroupedBySubject();
10992
11020
  const answeredQuestions = groupedQuestions[subject] || [];
11021
+ const formattedQuestions = subject == "all" ? Object.values(groupedQuestions).flat() : answeredQuestions;
10993
11022
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col", children: [
10994
11023
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: answeredQuestions?.[0]?.knowledgeMatrix?.[0]?.subject?.name ?? "Sem mat\xE9ria" }) }),
10995
11024
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: "flex flex-col ", children: [
10996
11025
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
10997
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
11026
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: formattedQuestions.map((question) => {
10998
11027
  const questionIndex = getQuestionIndex(
10999
11028
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11000
11029
  question.questionId ?? question.id
@@ -11011,6 +11040,8 @@ var QuizListResultByMateria = ({
11011
11040
  return "incorrect";
11012
11041
  if (question.answerStatus === "NAO_RESPONDIDO" /* NAO_RESPONDIDO */)
11013
11042
  return "unanswered";
11043
+ if (question.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */)
11044
+ return "pending";
11014
11045
  return void 0;
11015
11046
  })(),
11016
11047
  onClick: () => onQuestionClick?.(question)