analytica-frontend-lib 1.1.24 → 1.1.26
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/Accordation/index.js +14 -2
- package/dist/Accordation/index.js.map +1 -1
- package/dist/Accordation/index.mjs +14 -2
- package/dist/Accordation/index.mjs.map +1 -1
- package/dist/Card/index.d.mts +1 -1
- package/dist/Card/index.d.ts +1 -1
- package/dist/Card/index.js +14 -2
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +14 -2
- package/dist/Card/index.mjs.map +1 -1
- package/dist/Quiz/index.js +102 -44
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +102 -44
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Quiz/useQuizStore/index.d.mts +2 -1
- package/dist/Quiz/useQuizStore/index.d.ts +2 -1
- package/dist/Quiz/useQuizStore/index.js +21 -8
- package/dist/Quiz/useQuizStore/index.js.map +1 -1
- package/dist/Quiz/useQuizStore/index.mjs +21 -8
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -1
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +103 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -44
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +8 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4560,6 +4560,18 @@ var CardResults = (0, import_react14.forwardRef)(
|
|
|
4560
4560
|
);
|
|
4561
4561
|
var CardStatus = (0, import_react14.forwardRef)(
|
|
4562
4562
|
({ header, className, status, label, ...props }, ref) => {
|
|
4563
|
+
const getLabelBadge = (status2) => {
|
|
4564
|
+
switch (status2) {
|
|
4565
|
+
case "correct":
|
|
4566
|
+
return "Correta";
|
|
4567
|
+
case "incorrect":
|
|
4568
|
+
return "Incorreta";
|
|
4569
|
+
case "unanswered":
|
|
4570
|
+
return "Em branco";
|
|
4571
|
+
default:
|
|
4572
|
+
return "Em branco";
|
|
4573
|
+
}
|
|
4574
|
+
};
|
|
4563
4575
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4564
4576
|
CardBase,
|
|
4565
4577
|
{
|
|
@@ -4578,8 +4590,8 @@ var CardStatus = (0, import_react14.forwardRef)(
|
|
|
4578
4590
|
action: status == "correct" ? "success" : "error",
|
|
4579
4591
|
variant: "solid",
|
|
4580
4592
|
size: "medium",
|
|
4581
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react12.CheckCircle, {}),
|
|
4582
|
-
children: status
|
|
4593
|
+
iconLeft: status == "correct" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react12.CheckCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react12.XCircle, {}),
|
|
4594
|
+
children: getLabelBadge(status)
|
|
4583
4595
|
}
|
|
4584
4596
|
),
|
|
4585
4597
|
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-text-800", children: label })
|
|
@@ -8064,6 +8076,7 @@ var ANSWER_STATUS = /* @__PURE__ */ ((ANSWER_STATUS2) => {
|
|
|
8064
8076
|
ANSWER_STATUS2["RESPOSTA_CORRETA"] = "RESPOSTA_CORRETA";
|
|
8065
8077
|
ANSWER_STATUS2["RESPOSTA_INCORRETA"] = "RESPOSTA_INCORRETA";
|
|
8066
8078
|
ANSWER_STATUS2["PENDENTE_AVALIACAO"] = "PENDENTE_AVALIACAO";
|
|
8079
|
+
ANSWER_STATUS2["NAO_RESPONDIDO"] = "NAO_RESPONDIDO";
|
|
8067
8080
|
return ANSWER_STATUS2;
|
|
8068
8081
|
})(ANSWER_STATUS || {});
|
|
8069
8082
|
var useQuizStore = (0, import_zustand7.create)()(
|
|
@@ -8558,15 +8571,27 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8558
8571
|
return userAnswer ? userAnswer.answerStatus : null;
|
|
8559
8572
|
},
|
|
8560
8573
|
getQuestionIndex: (questionId) => {
|
|
8561
|
-
const { questionsResult } = get();
|
|
8562
|
-
if (
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8574
|
+
const { questionsResult, variant } = get();
|
|
8575
|
+
if (variant == "result") {
|
|
8576
|
+
if (!questionsResult) return 0;
|
|
8577
|
+
let idx = questionsResult.answers.findIndex(
|
|
8578
|
+
(q) => q.questionId === questionId
|
|
8579
|
+
);
|
|
8580
|
+
if (idx === -1) {
|
|
8581
|
+
idx = questionsResult.answers.findIndex(
|
|
8582
|
+
(q) => q.id === questionId
|
|
8583
|
+
);
|
|
8584
|
+
}
|
|
8585
|
+
return idx !== -1 ? idx + 1 : 0;
|
|
8586
|
+
} else {
|
|
8587
|
+
const { getActiveQuiz } = get();
|
|
8588
|
+
const activeQuiz = getActiveQuiz();
|
|
8589
|
+
if (!activeQuiz) return 0;
|
|
8590
|
+
const idx = activeQuiz.quiz.questions.findIndex(
|
|
8591
|
+
(q) => q.id === questionId
|
|
8592
|
+
);
|
|
8593
|
+
return idx !== -1 ? idx + 1 : 0;
|
|
8568
8594
|
}
|
|
8569
|
-
return idx !== -1 ? idx + 1 : 0;
|
|
8570
8595
|
},
|
|
8571
8596
|
// Question Result
|
|
8572
8597
|
getQuestionResultByQuestionId: (questionId) => {
|
|
@@ -8635,33 +8660,55 @@ var Quiz = (0, import_react28.forwardRef)(({ children, className, variant = "def
|
|
|
8635
8660
|
var QuizHeaderResult = (0, import_react28.forwardRef)(
|
|
8636
8661
|
({ className, ...props }, ref) => {
|
|
8637
8662
|
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
8638
|
-
const [
|
|
8663
|
+
const [status, setStatus] = (0, import_react28.useState)(void 0);
|
|
8639
8664
|
(0, import_react28.useEffect)(() => {
|
|
8640
8665
|
const cq = getCurrentQuestion();
|
|
8641
8666
|
if (!cq) {
|
|
8642
|
-
|
|
8667
|
+
setStatus(void 0);
|
|
8643
8668
|
return;
|
|
8644
8669
|
}
|
|
8645
8670
|
const qr = getQuestionResultByQuestionId(cq.id);
|
|
8646
|
-
|
|
8671
|
+
setStatus(qr?.answerStatus);
|
|
8647
8672
|
}, [
|
|
8648
8673
|
getCurrentQuestion,
|
|
8649
8674
|
getQuestionResultByQuestionId,
|
|
8650
8675
|
getCurrentQuestion()?.id
|
|
8651
8676
|
]);
|
|
8677
|
+
const getClassesByAnswersStatus = () => {
|
|
8678
|
+
switch (status) {
|
|
8679
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
8680
|
+
return "bg-success-background";
|
|
8681
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
8682
|
+
return "bg-error-background";
|
|
8683
|
+
default:
|
|
8684
|
+
return "bg-error-background";
|
|
8685
|
+
}
|
|
8686
|
+
};
|
|
8687
|
+
const getLabelByAnswersStatus = () => {
|
|
8688
|
+
switch (status) {
|
|
8689
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
8690
|
+
return "\u{1F389} Parab\xE9ns!!";
|
|
8691
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
8692
|
+
return "N\xE3o foi dessa vez...";
|
|
8693
|
+
case "NAO_RESPONDIDO" /* NAO_RESPONDIDO */:
|
|
8694
|
+
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
8695
|
+
default:
|
|
8696
|
+
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
8697
|
+
}
|
|
8698
|
+
};
|
|
8652
8699
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
8653
8700
|
"div",
|
|
8654
8701
|
{
|
|
8655
8702
|
ref,
|
|
8656
8703
|
className: cn(
|
|
8657
8704
|
"flex flex-row items-center gap-10 p-3.5 rounded-xl mb-4",
|
|
8658
|
-
|
|
8705
|
+
getClassesByAnswersStatus(),
|
|
8659
8706
|
className
|
|
8660
8707
|
),
|
|
8661
8708
|
...props,
|
|
8662
8709
|
children: [
|
|
8663
8710
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
|
|
8664
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-700 text-md", children:
|
|
8711
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-700 text-md", children: getLabelByAnswersStatus() })
|
|
8665
8712
|
]
|
|
8666
8713
|
}
|
|
8667
8714
|
);
|
|
@@ -9489,35 +9536,38 @@ var QuizQuestionList = ({
|
|
|
9489
9536
|
case "answered":
|
|
9490
9537
|
return "Respondida";
|
|
9491
9538
|
case "skipped":
|
|
9492
|
-
return "
|
|
9539
|
+
return "Em branco";
|
|
9493
9540
|
default:
|
|
9494
9541
|
return "Em branco";
|
|
9495
9542
|
}
|
|
9496
9543
|
};
|
|
9497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.
|
|
9498
|
-
(
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "space-y-6 px-4 h-full", children: [
|
|
9545
|
+
Object.entries(filteredGroupedQuestions).length == 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex items-center justify-center text-gray-500 py-8 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-lg", children: "Nenhum resultado" }) }),
|
|
9546
|
+
Object.entries(filteredGroupedQuestions).map(
|
|
9547
|
+
([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("section", { className: "flex flex-col gap-2", children: [
|
|
9548
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
|
|
9549
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_phosphor_react20.BookOpen, { size: 17, className: "text-white" }) }),
|
|
9550
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-800 font-bold text-lg", children: questions?.[0]?.knowledgeMatrix?.[0]?.subject?.name ?? "Sem mat\xE9ria" })
|
|
9551
|
+
] }),
|
|
9552
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
|
|
9553
|
+
const status = getQuestionStatus(question.id);
|
|
9554
|
+
const questionNumber = getQuestionIndex(question.id);
|
|
9555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9556
|
+
CardStatus,
|
|
9557
|
+
{
|
|
9558
|
+
header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
|
|
9559
|
+
label: getStatusLabel(status),
|
|
9560
|
+
onClick: () => {
|
|
9561
|
+
goToQuestion(questionNumber - 1);
|
|
9562
|
+
onQuestionClick?.();
|
|
9563
|
+
}
|
|
9564
|
+
},
|
|
9565
|
+
question.id
|
|
9566
|
+
);
|
|
9567
|
+
}) })
|
|
9568
|
+
] }, subjectId)
|
|
9569
|
+
)
|
|
9570
|
+
] });
|
|
9521
9571
|
};
|
|
9522
9572
|
var QuizFooter = (0, import_react28.forwardRef)(
|
|
9523
9573
|
({
|
|
@@ -9551,7 +9601,7 @@ var QuizFooter = (0, import_react28.forwardRef)(
|
|
|
9551
9601
|
const [modalResultOpen, setModalResultOpen] = (0, import_react28.useState)(false);
|
|
9552
9602
|
const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react28.useState)(false);
|
|
9553
9603
|
const [modalResolutionOpen, setModalResolutionOpen] = (0, import_react28.useState)(false);
|
|
9554
|
-
const [filterType, setFilterType] = (0, import_react28.useState)(
|
|
9604
|
+
const [filterType, setFilterType] = (0, import_react28.useState)("all");
|
|
9555
9605
|
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
9556
9606
|
const allQuestions = getTotalQuestions();
|
|
9557
9607
|
const handleFinishQuiz = async () => {
|
|
@@ -9627,7 +9677,7 @@ var QuizFooter = (0, import_react28.forwardRef)(
|
|
|
9627
9677
|
}
|
|
9628
9678
|
)
|
|
9629
9679
|
] }),
|
|
9630
|
-
!isFirstQuestion && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9680
|
+
!isFirstQuestion && !isLastQuestion && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9631
9681
|
Button_default,
|
|
9632
9682
|
{
|
|
9633
9683
|
size: "small",
|
|
@@ -9739,7 +9789,14 @@ var QuizFooter = (0, import_react28.forwardRef)(
|
|
|
9739
9789
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
|
|
9740
9790
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
|
|
9741
9791
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
|
|
9742
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9792
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9793
|
+
SelectTrigger,
|
|
9794
|
+
{
|
|
9795
|
+
variant: "rounded",
|
|
9796
|
+
className: "max-w-[266px] min-w-[160px]",
|
|
9797
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" })
|
|
9798
|
+
}
|
|
9799
|
+
),
|
|
9743
9800
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(SelectContent, { children: [
|
|
9744
9801
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectItem, { value: "all", children: "Todas" }),
|
|
9745
9802
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
|
|
@@ -9747,7 +9804,7 @@ var QuizFooter = (0, import_react28.forwardRef)(
|
|
|
9747
9804
|
] })
|
|
9748
9805
|
] }) })
|
|
9749
9806
|
] }),
|
|
9750
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9807
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] lg:h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
9751
9808
|
QuizQuestionList,
|
|
9752
9809
|
{
|
|
9753
9810
|
filterType,
|
|
@@ -9989,6 +10046,8 @@ var QuizListResultByMateria = ({
|
|
|
9989
10046
|
return "correct";
|
|
9990
10047
|
if (question.answerStatus === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */)
|
|
9991
10048
|
return "incorrect";
|
|
10049
|
+
if (question.answerStatus === "NAO_RESPONDIDO" /* NAO_RESPONDIDO */)
|
|
10050
|
+
return "unanswered";
|
|
9992
10051
|
return void 0;
|
|
9993
10052
|
})(),
|
|
9994
10053
|
onClick: () => onQuestionClick?.(question)
|