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.
@@ -4870,26 +4870,65 @@ var QuizTitle = forwardRef10(
4870
4870
  formatTime,
4871
4871
  isStarted
4872
4872
  } = useQuizStore();
4873
+ const [showExitConfirmation, setShowExitConfirmation] = useState7(false);
4873
4874
  const totalQuestions = getTotalQuestions();
4874
4875
  const quizTitle = getQuizTitle();
4875
- return /* @__PURE__ */ jsxs15(
4876
- "div",
4877
- {
4878
- ref,
4879
- className: cn(
4880
- "flex flex-row justify-center items-center relative p-2",
4881
- className
4882
- ),
4883
- ...props,
4884
- children: [
4885
- /* @__PURE__ */ jsxs15("span", { className: "flex flex-col gap-2 text-center", children: [
4886
- /* @__PURE__ */ jsx18("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
4887
- /* @__PURE__ */ jsx18("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
4888
- ] }),
4889
- /* @__PURE__ */ jsx18("span", { className: "absolute right-2", children: /* @__PURE__ */ jsx18(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx18(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
4890
- ]
4876
+ const handleBackClick = () => {
4877
+ if (isStarted) {
4878
+ setShowExitConfirmation(true);
4879
+ } else {
4880
+ window.history.back();
4891
4881
  }
4892
- );
4882
+ };
4883
+ const handleConfirmExit = () => {
4884
+ setShowExitConfirmation(false);
4885
+ window.history.back();
4886
+ };
4887
+ const handleCancelExit = () => {
4888
+ setShowExitConfirmation(false);
4889
+ };
4890
+ return /* @__PURE__ */ jsxs15(Fragment6, { children: [
4891
+ /* @__PURE__ */ jsxs15(
4892
+ "div",
4893
+ {
4894
+ ref,
4895
+ className: cn(
4896
+ "flex flex-row justify-between items-center relative p-2",
4897
+ className
4898
+ ),
4899
+ ...props,
4900
+ children: [
4901
+ /* @__PURE__ */ jsx18(
4902
+ IconButton_default,
4903
+ {
4904
+ icon: /* @__PURE__ */ jsx18(CaretLeft, { size: 24 }),
4905
+ size: "md",
4906
+ "aria-label": "Voltar",
4907
+ onClick: handleBackClick
4908
+ }
4909
+ ),
4910
+ /* @__PURE__ */ jsxs15("span", { className: "flex flex-col gap-2 text-center", children: [
4911
+ /* @__PURE__ */ jsx18("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
4912
+ /* @__PURE__ */ jsx18("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
4913
+ ] }),
4914
+ /* @__PURE__ */ jsx18("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ jsx18(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx18(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
4915
+ ]
4916
+ }
4917
+ ),
4918
+ /* @__PURE__ */ jsx18(
4919
+ AlertDialog,
4920
+ {
4921
+ isOpen: showExitConfirmation,
4922
+ onChangeOpen: setShowExitConfirmation,
4923
+ title: "Deseja sair?",
4924
+ description: "Se voc\xEA sair do simulado agora, todas as respostas ser\xE3o perdidas.",
4925
+ cancelButtonLabel: "Voltar e revisar",
4926
+ submitButtonLabel: "Sair Mesmo Assim",
4927
+ onSubmit: handleConfirmExit,
4928
+ onCancel: handleCancelExit
4929
+ }
4930
+ )
4931
+ ] });
4893
4932
  }
4894
4933
  );
4895
4934
  var QuizSubTitle = forwardRef10(
@@ -5973,17 +6012,21 @@ var QuizFooter = forwardRef10(
5973
6012
  ] });
5974
6013
  }
5975
6014
  );
5976
- var QuizBadge = ({ subtype }) => {
6015
+ var QuizBadge = ({
6016
+ subtype
6017
+ }) => {
5977
6018
  switch (subtype) {
5978
- case "PROVA":
5979
- return /* @__PURE__ */ jsx18(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Prova" });
5980
- case "ENEM":
5981
- return /* @__PURE__ */ jsx18(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Enem" });
5982
- case "VESTIBULAR":
5983
- return /* @__PURE__ */ jsx18(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Vestibular" });
5984
- case "SIMULADO":
5985
- case null:
5986
- return /* @__PURE__ */ jsx18(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Simulado" });
6019
+ case "PROVA" /* PROVA */:
6020
+ return /* @__PURE__ */ jsx18(Badge_default, { variant: "examsOutlined", action: "exam2", "data-testid": "quiz-badge", children: "Prova" });
6021
+ case "ENEM_PROVA_1" /* ENEM_PROVA_1 */:
6022
+ case "ENEM_PROVA_2" /* ENEM_PROVA_2 */:
6023
+ return /* @__PURE__ */ jsx18(Badge_default, { variant: "examsOutlined", action: "exam1", "data-testid": "quiz-badge", children: "Enem" });
6024
+ case "VESTIBULAR" /* VESTIBULAR */:
6025
+ return /* @__PURE__ */ jsx18(Badge_default, { variant: "examsOutlined", action: "exam4", "data-testid": "quiz-badge", children: "Vestibular" });
6026
+ case "SIMULADO" /* SIMULADO */:
6027
+ case "SIMULADAO" /* SIMULADAO */:
6028
+ case void 0:
6029
+ return /* @__PURE__ */ jsx18(Badge_default, { variant: "examsOutlined", action: "exam3", "data-testid": "quiz-badge", children: "Simulad\xE3o" });
5987
6030
  default:
5988
6031
  return /* @__PURE__ */ jsx18(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
5989
6032
  }
@@ -5999,7 +6042,7 @@ var QuizResultHeaderTitle = forwardRef10(({ className, ...props }, ref) => {
5999
6042
  ...props,
6000
6043
  children: [
6001
6044
  /* @__PURE__ */ jsx18("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
6002
- /* @__PURE__ */ jsx18(QuizBadge, { subtype: activeQuiz?.quiz.subtype || null })
6045
+ /* @__PURE__ */ jsx18(QuizBadge, { subtype: activeQuiz?.quiz.subtype || void 0 })
6003
6046
  ]
6004
6047
  }
6005
6048
  );