analytica-frontend-lib 1.1.34 → 1.1.35

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
@@ -107,6 +107,7 @@ __export(src_exports, {
107
107
  Radio: () => Radio_default,
108
108
  RadioGroup: () => RadioGroup,
109
109
  RadioGroupItem: () => RadioGroupItem,
110
+ SUBTYPE_ENUM: () => SUBTYPE_ENUM,
110
111
  Search: () => Search_default,
111
112
  Select: () => Select_default,
112
113
  SelectContent: () => SelectContent,
@@ -8082,6 +8083,15 @@ var ANSWER_STATUS = /* @__PURE__ */ ((ANSWER_STATUS2) => {
8082
8083
  ANSWER_STATUS2["NAO_RESPONDIDO"] = "NAO_RESPONDIDO";
8083
8084
  return ANSWER_STATUS2;
8084
8085
  })(ANSWER_STATUS || {});
8086
+ var SUBTYPE_ENUM = /* @__PURE__ */ ((SUBTYPE_ENUM2) => {
8087
+ SUBTYPE_ENUM2["PROVA"] = "PROVA";
8088
+ SUBTYPE_ENUM2["ENEM_PROVA_1"] = "ENEM_PROVA_1";
8089
+ SUBTYPE_ENUM2["ENEM_PROVA_2"] = "ENEM_PROVA_2";
8090
+ SUBTYPE_ENUM2["VESTIBULAR"] = "VESTIBULAR";
8091
+ SUBTYPE_ENUM2["SIMULADO"] = "SIMULADO";
8092
+ SUBTYPE_ENUM2["SIMULADAO"] = "SIMULADAO";
8093
+ return SUBTYPE_ENUM2;
8094
+ })(SUBTYPE_ENUM || {});
8085
8095
  var MINUTE_INTERVAL_MS = 6e4;
8086
8096
  var useQuizStore = (0, import_zustand7.create)()(
8087
8097
  (0, import_middleware.devtools)(
@@ -8767,26 +8777,65 @@ var QuizTitle = (0, import_react28.forwardRef)(
8767
8777
  formatTime: formatTime2,
8768
8778
  isStarted
8769
8779
  } = useQuizStore();
8780
+ const [showExitConfirmation, setShowExitConfirmation] = (0, import_react28.useState)(false);
8770
8781
  const totalQuestions = getTotalQuestions();
8771
8782
  const quizTitle = getQuizTitle();
8772
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
8773
- "div",
8774
- {
8775
- ref,
8776
- className: cn(
8777
- "flex flex-row justify-center items-center relative p-2",
8778
- className
8779
- ),
8780
- ...props,
8781
- children: [
8782
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
8783
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
8784
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
8785
- ] }),
8786
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "absolute right-2", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_phosphor_react20.Clock, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
8787
- ]
8783
+ const handleBackClick = () => {
8784
+ if (isStarted) {
8785
+ setShowExitConfirmation(true);
8786
+ } else {
8787
+ window.history.back();
8788
8788
  }
8789
- );
8789
+ };
8790
+ const handleConfirmExit = () => {
8791
+ setShowExitConfirmation(false);
8792
+ window.history.back();
8793
+ };
8794
+ const handleCancelExit = () => {
8795
+ setShowExitConfirmation(false);
8796
+ };
8797
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
8798
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
8799
+ "div",
8800
+ {
8801
+ ref,
8802
+ className: cn(
8803
+ "flex flex-row justify-between items-center relative p-2",
8804
+ className
8805
+ ),
8806
+ ...props,
8807
+ children: [
8808
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8809
+ IconButton_default,
8810
+ {
8811
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_phosphor_react20.CaretLeft, { size: 24 }),
8812
+ size: "md",
8813
+ "aria-label": "Voltar",
8814
+ onClick: handleBackClick
8815
+ }
8816
+ ),
8817
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
8818
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
8819
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
8820
+ ] }),
8821
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_phosphor_react20.Clock, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
8822
+ ]
8823
+ }
8824
+ ),
8825
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8826
+ AlertDialog,
8827
+ {
8828
+ isOpen: showExitConfirmation,
8829
+ onChangeOpen: setShowExitConfirmation,
8830
+ title: "Deseja sair?",
8831
+ description: "Se voc\xEA sair do simulado agora, todas as respostas ser\xE3o perdidas.",
8832
+ cancelButtonLabel: "Voltar e revisar",
8833
+ submitButtonLabel: "Sair Mesmo Assim",
8834
+ onSubmit: handleConfirmExit,
8835
+ onCancel: handleCancelExit
8836
+ }
8837
+ )
8838
+ ] });
8790
8839
  }
8791
8840
  );
8792
8841
  var QuizSubTitle = (0, import_react28.forwardRef)(
@@ -9870,17 +9919,21 @@ var QuizFooter = (0, import_react28.forwardRef)(
9870
9919
  ] });
9871
9920
  }
9872
9921
  );
9873
- var QuizBadge = ({ subtype }) => {
9922
+ var QuizBadge = ({
9923
+ subtype
9924
+ }) => {
9874
9925
  switch (subtype) {
9875
- case "PROVA":
9876
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Prova" });
9877
- case "ENEM":
9878
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Enem" });
9879
- case "VESTIBULAR":
9880
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Vestibular" });
9881
- case "SIMULADO":
9882
- case null:
9883
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Simulado" });
9926
+ case "PROVA" /* PROVA */:
9927
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "examsOutlined", action: "exam2", "data-testid": "quiz-badge", children: "Prova" });
9928
+ case "ENEM_PROVA_1" /* ENEM_PROVA_1 */:
9929
+ case "ENEM_PROVA_2" /* ENEM_PROVA_2 */:
9930
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "examsOutlined", action: "exam1", "data-testid": "quiz-badge", children: "Enem" });
9931
+ case "VESTIBULAR" /* VESTIBULAR */:
9932
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "examsOutlined", action: "exam4", "data-testid": "quiz-badge", children: "Vestibular" });
9933
+ case "SIMULADO" /* SIMULADO */:
9934
+ case "SIMULADAO" /* SIMULADAO */:
9935
+ case void 0:
9936
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "examsOutlined", action: "exam3", "data-testid": "quiz-badge", children: "Simulad\xE3o" });
9884
9937
  default:
9885
9938
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
9886
9939
  }
@@ -9896,7 +9949,7 @@ var QuizResultHeaderTitle = (0, import_react28.forwardRef)(({ className, ...prop
9896
9949
  ...props,
9897
9950
  children: [
9898
9951
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
9899
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuizBadge, { subtype: activeQuiz?.quiz.subtype || null })
9952
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuizBadge, { subtype: activeQuiz?.quiz.subtype || void 0 })
9900
9953
  ]
9901
9954
  }
9902
9955
  );
@@ -10427,6 +10480,7 @@ var NotificationCard_default = NotificationCard;
10427
10480
  Radio,
10428
10481
  RadioGroup,
10429
10482
  RadioGroupItem,
10483
+ SUBTYPE_ENUM,
10430
10484
  Search,
10431
10485
  Select,
10432
10486
  SelectContent,