analytica-frontend-lib 1.1.0 → 1.1.2

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.d.mts CHANGED
@@ -32,7 +32,7 @@ export { MultipleChoiceList } from './MultipleChoice/index.mjs';
32
32
  export { default as IconRender } from './IconRender/index.mjs';
33
33
  export { default as DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, MenuLabel, ProfileMenuFooter, ProfileMenuHeader, ProfileMenuSection, ProfileMenuTrigger } from './DropdownMenu/index.mjs';
34
34
  export { default as Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './Select/index.mjs';
35
- export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.mjs';
35
+ export { Breadcrumb, default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.mjs';
36
36
  export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardSimulationHistory, CardStatus, CardTest, CardTopic } from './Card/index.mjs';
37
37
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.mjs';
38
38
  export { default as NotFound } from './NotFound/index.mjs';
package/dist/index.d.ts CHANGED
@@ -32,7 +32,7 @@ export { MultipleChoiceList } from './MultipleChoice/index.js';
32
32
  export { default as IconRender } from './IconRender/index.js';
33
33
  export { default as DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, MenuLabel, ProfileMenuFooter, ProfileMenuHeader, ProfileMenuSection, ProfileMenuTrigger } from './DropdownMenu/index.js';
34
34
  export { default as Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './Select/index.js';
35
- export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.js';
35
+ export { Breadcrumb, default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/index.js';
36
36
  export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardSimulationHistory, CardStatus, CardTest, CardTopic } from './Card/index.js';
37
37
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.js';
38
38
  export { default as NotFound } from './NotFound/index.js';
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ __export(src_exports, {
35
35
  AlternativesList: () => AlternativesList,
36
36
  AuthProvider: () => AuthProvider,
37
37
  Badge: () => Badge_default,
38
+ Breadcrumb: () => Breadcrumb,
38
39
  Button: () => Button_default,
39
40
  Calendar: () => Calendar_default,
40
41
  CardAccordation: () => CardAccordation,
@@ -6564,6 +6565,46 @@ var injectStore5 = (children, store) => import_react20.Children.map(children, (c
6564
6565
  ...typedChild.props.children ? { children: injectStore5(typedChild.props.children, store) } : {}
6565
6566
  });
6566
6567
  });
6568
+ var Breadcrumb = (0, import_react20.forwardRef)(
6569
+ ({ currentPage, parentPageName, onBackClick, className, ...props }, ref) => {
6570
+ const handleBackToParent = (0, import_react20.useCallback)(() => {
6571
+ onBackClick();
6572
+ }, [onBackClick]);
6573
+ const breadcrumbClassName = `bg-transparent shadow-none !px-0 py-4 !-ml-2 ${typeof className === "string" ? className : ""}`;
6574
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6575
+ Menu,
6576
+ {
6577
+ variant: "breadcrumb",
6578
+ defaultValue: "",
6579
+ className: breadcrumbClassName,
6580
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(MenuContent, { variant: "breadcrumb", children: [
6581
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6582
+ MenuItem,
6583
+ {
6584
+ variant: "breadcrumb",
6585
+ value: parentPageName.toLowerCase(),
6586
+ onClick: handleBackToParent,
6587
+ separator: true,
6588
+ className: "text-text-600 underline cursor-pointer hover:text-text-950",
6589
+ children: parentPageName
6590
+ }
6591
+ ),
6592
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6593
+ MenuItem,
6594
+ {
6595
+ variant: "breadcrumb",
6596
+ value: currentPage.toLowerCase(),
6597
+ className: "text-text-950 font-bold",
6598
+ disabled: true,
6599
+ children: currentPage
6600
+ }
6601
+ )
6602
+ ] })
6603
+ }
6604
+ ) });
6605
+ }
6606
+ );
6607
+ Breadcrumb.displayName = "Breadcrumb";
6567
6608
  var Menu_default = Menu;
6568
6609
 
6569
6610
  // src/components/Skeleton/Skeleton.tsx
@@ -7574,6 +7615,15 @@ var useQuizStore = (0, import_zustand7.create)()(
7574
7615
  (answer) => answer.questionId === questionId
7575
7616
  );
7576
7617
  return userAnswer ? userAnswer.answerStatus : null;
7618
+ },
7619
+ getQuestionIndex: (questionId) => {
7620
+ const { getActiveQuiz } = get();
7621
+ const activeQuiz = getActiveQuiz();
7622
+ if (!activeQuiz) return 0;
7623
+ const questionIndex = activeQuiz.quiz.questions.findIndex(
7624
+ (q) => q.id === questionId
7625
+ );
7626
+ return questionIndex + 1;
7577
7627
  }
7578
7628
  };
7579
7629
  },
@@ -8416,7 +8466,8 @@ var QuizQuestionList = ({
8416
8466
  const {
8417
8467
  getQuestionsGroupedBySubject,
8418
8468
  goToQuestion,
8419
- getQuestionStatusFromUserAnswers
8469
+ getQuestionStatusFromUserAnswers,
8470
+ getQuestionIndex
8420
8471
  } = useQuizStore();
8421
8472
  const groupedQuestions = getQuestionsGroupedBySubject();
8422
8473
  const getQuestionStatus = (questionId) => {
@@ -8443,13 +8494,6 @@ var QuizQuestionList = ({
8443
8494
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8444
8495
  {}
8445
8496
  );
8446
- const getQuestionIndex = (questionId) => {
8447
- const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
8448
- const quiz = bySimulated ?? byActivity ?? byQuestionary;
8449
- if (!quiz) return 0;
8450
- const index = quiz.questions.findIndex((q) => q.id === questionId);
8451
- return index + 1;
8452
- };
8453
8497
  const getStatusLabel = (status) => {
8454
8498
  switch (status) {
8455
8499
  case "answered":
@@ -8787,9 +8831,7 @@ var QuizResultPerformance = (0, import_react25.forwardRef)(
8787
8831
  if (quiz) {
8788
8832
  quiz.questions.forEach((question) => {
8789
8833
  const userAnswerItem = getUserAnswerByQuestionId(question.id);
8790
- const userAnswer = userAnswerItem?.optionId;
8791
- const isCorrectOption = question?.options.find((op) => op.isCorrect);
8792
- const isCorrect = userAnswer && userAnswer === isCorrectOption?.id;
8834
+ const isCorrect = userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
8793
8835
  if (isCorrect) {
8794
8836
  correctAnswers++;
8795
8837
  }
@@ -8906,9 +8948,7 @@ var QuizListResult = (0, import_react25.forwardRef)(({ className, onSubjectClick
8906
8948
  questions.forEach((question) => {
8907
8949
  if (isQuestionAnswered(question.id)) {
8908
8950
  const userAnswerItem = getUserAnswerByQuestionId(question.id);
8909
- const userAnswer = userAnswerItem?.optionId;
8910
- const isCorrectOption = question?.options.find((op) => op.isCorrect);
8911
- if (userAnswer === isCorrectOption?.id) {
8951
+ if (userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */) {
8912
8952
  correct++;
8913
8953
  } else {
8914
8954
  incorrect++;
@@ -8943,28 +8983,36 @@ var QuizListResultByMateria = ({
8943
8983
  subject,
8944
8984
  onQuestionClick
8945
8985
  }) => {
8946
- const { getQuestionsGroupedBySubject, getUserAnswerByQuestionId } = useQuizStore();
8986
+ const {
8987
+ getQuestionsGroupedBySubject,
8988
+ getUserAnswerByQuestionId,
8989
+ getQuestionIndex
8990
+ } = useQuizStore();
8947
8991
  const groupedQuestions = getQuestionsGroupedBySubject();
8948
8992
  const answeredQuestions = groupedQuestions[subject] || [];
8949
8993
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
8950
8994
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
8951
8995
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("section", { className: "flex flex-col ", children: [
8952
8996
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
8953
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8954
- CardStatus,
8955
- {
8956
- className: "max-w-full",
8957
- header: `Quest\xE3o ${question.id}`,
8958
- status: (() => {
8959
- const userAnswer = getUserAnswerByQuestionId(question.id);
8960
- const isCorrectOption = question?.options.find(
8961
- (op) => op.isCorrect
8962
- );
8963
- return userAnswer && userAnswer.optionId === isCorrectOption?.id ? "correct" : "incorrect";
8964
- })(),
8965
- onClick: () => onQuestionClick?.(question)
8966
- }
8967
- ) }, question.id)) })
8997
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
8998
+ const questionIndex = getQuestionIndex(question.id);
8999
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
9000
+ CardStatus,
9001
+ {
9002
+ className: "max-w-full",
9003
+ header: `Quest\xE3o ${questionIndex.toString().padStart(2, "0")}`,
9004
+ status: (() => {
9005
+ const userAnswer = getUserAnswerByQuestionId(question.id);
9006
+ if (userAnswer?.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */)
9007
+ return "correct";
9008
+ if (userAnswer?.answerStatus === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */)
9009
+ return "incorrect";
9010
+ return void 0;
9011
+ })(),
9012
+ onClick: () => onQuestionClick?.(question)
9013
+ }
9014
+ ) }, question.id);
9015
+ }) })
8968
9016
  ] })
8969
9017
  ] });
8970
9018
  };
@@ -8975,6 +9023,7 @@ var QuizListResultByMateria = ({
8975
9023
  AlternativesList,
8976
9024
  AuthProvider,
8977
9025
  Badge,
9026
+ Breadcrumb,
8978
9027
  Button,
8979
9028
  Calendar,
8980
9029
  CardAccordation,