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/Quiz/index.mjs
CHANGED
|
@@ -1438,15 +1438,27 @@ var useQuizStore = create2()(
|
|
|
1438
1438
|
return userAnswer ? userAnswer.answerStatus : null;
|
|
1439
1439
|
},
|
|
1440
1440
|
getQuestionIndex: (questionId) => {
|
|
1441
|
-
const { questionsResult } = get();
|
|
1442
|
-
if (
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1441
|
+
const { questionsResult, variant } = get();
|
|
1442
|
+
if (variant == "result") {
|
|
1443
|
+
if (!questionsResult) return 0;
|
|
1444
|
+
let idx = questionsResult.answers.findIndex(
|
|
1445
|
+
(q) => q.questionId === questionId
|
|
1446
|
+
);
|
|
1447
|
+
if (idx === -1) {
|
|
1448
|
+
idx = questionsResult.answers.findIndex(
|
|
1449
|
+
(q) => q.id === questionId
|
|
1450
|
+
);
|
|
1451
|
+
}
|
|
1452
|
+
return idx !== -1 ? idx + 1 : 0;
|
|
1453
|
+
} else {
|
|
1454
|
+
const { getActiveQuiz } = get();
|
|
1455
|
+
const activeQuiz = getActiveQuiz();
|
|
1456
|
+
if (!activeQuiz) return 0;
|
|
1457
|
+
const idx = activeQuiz.quiz.questions.findIndex(
|
|
1458
|
+
(q) => q.id === questionId
|
|
1459
|
+
);
|
|
1460
|
+
return idx !== -1 ? idx + 1 : 0;
|
|
1448
1461
|
}
|
|
1449
|
-
return idx !== -1 ? idx + 1 : 0;
|
|
1450
1462
|
},
|
|
1451
1463
|
// Question Result
|
|
1452
1464
|
getQuestionResultByQuestionId: (questionId) => {
|
|
@@ -3066,6 +3078,18 @@ var CardResults = forwardRef6(
|
|
|
3066
3078
|
);
|
|
3067
3079
|
var CardStatus = forwardRef6(
|
|
3068
3080
|
({ header, className, status, label, ...props }, ref) => {
|
|
3081
|
+
const getLabelBadge = (status2) => {
|
|
3082
|
+
switch (status2) {
|
|
3083
|
+
case "correct":
|
|
3084
|
+
return "Correta";
|
|
3085
|
+
case "incorrect":
|
|
3086
|
+
return "Incorreta";
|
|
3087
|
+
case "unanswered":
|
|
3088
|
+
return "Em branco";
|
|
3089
|
+
default:
|
|
3090
|
+
return "Em branco";
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3069
3093
|
return /* @__PURE__ */ jsx11(
|
|
3070
3094
|
CardBase,
|
|
3071
3095
|
{
|
|
@@ -3084,8 +3108,8 @@ var CardStatus = forwardRef6(
|
|
|
3084
3108
|
action: status == "correct" ? "success" : "error",
|
|
3085
3109
|
variant: "solid",
|
|
3086
3110
|
size: "medium",
|
|
3087
|
-
iconLeft: /* @__PURE__ */ jsx11(CheckCircle2, {}),
|
|
3088
|
-
children: status
|
|
3111
|
+
iconLeft: status == "correct" ? /* @__PURE__ */ jsx11(CheckCircle2, {}) : /* @__PURE__ */ jsx11(XCircle2, {}),
|
|
3112
|
+
children: getLabelBadge(status)
|
|
3089
3113
|
}
|
|
3090
3114
|
),
|
|
3091
3115
|
label && /* @__PURE__ */ jsx11("p", { className: "text-sm text-text-800", children: label })
|
|
@@ -4617,33 +4641,55 @@ var Quiz = forwardRef10(({ children, className, variant = "default", ...props },
|
|
|
4617
4641
|
var QuizHeaderResult = forwardRef10(
|
|
4618
4642
|
({ className, ...props }, ref) => {
|
|
4619
4643
|
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
4620
|
-
const [
|
|
4644
|
+
const [status, setStatus] = useState7(void 0);
|
|
4621
4645
|
useEffect7(() => {
|
|
4622
4646
|
const cq = getCurrentQuestion();
|
|
4623
4647
|
if (!cq) {
|
|
4624
|
-
|
|
4648
|
+
setStatus(void 0);
|
|
4625
4649
|
return;
|
|
4626
4650
|
}
|
|
4627
4651
|
const qr = getQuestionResultByQuestionId(cq.id);
|
|
4628
|
-
|
|
4652
|
+
setStatus(qr?.answerStatus);
|
|
4629
4653
|
}, [
|
|
4630
4654
|
getCurrentQuestion,
|
|
4631
4655
|
getQuestionResultByQuestionId,
|
|
4632
4656
|
getCurrentQuestion()?.id
|
|
4633
4657
|
]);
|
|
4658
|
+
const getClassesByAnswersStatus = () => {
|
|
4659
|
+
switch (status) {
|
|
4660
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
4661
|
+
return "bg-success-background";
|
|
4662
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
4663
|
+
return "bg-error-background";
|
|
4664
|
+
default:
|
|
4665
|
+
return "bg-error-background";
|
|
4666
|
+
}
|
|
4667
|
+
};
|
|
4668
|
+
const getLabelByAnswersStatus = () => {
|
|
4669
|
+
switch (status) {
|
|
4670
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
4671
|
+
return "\u{1F389} Parab\xE9ns!!";
|
|
4672
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
4673
|
+
return "N\xE3o foi dessa vez...";
|
|
4674
|
+
case "NAO_RESPONDIDO" /* NAO_RESPONDIDO */:
|
|
4675
|
+
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
4676
|
+
default:
|
|
4677
|
+
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
4678
|
+
}
|
|
4679
|
+
};
|
|
4634
4680
|
return /* @__PURE__ */ jsxs14(
|
|
4635
4681
|
"div",
|
|
4636
4682
|
{
|
|
4637
4683
|
ref,
|
|
4638
4684
|
className: cn(
|
|
4639
4685
|
"flex flex-row items-center gap-10 p-3.5 rounded-xl mb-4",
|
|
4640
|
-
|
|
4686
|
+
getClassesByAnswersStatus(),
|
|
4641
4687
|
className
|
|
4642
4688
|
),
|
|
4643
4689
|
...props,
|
|
4644
4690
|
children: [
|
|
4645
4691
|
/* @__PURE__ */ jsx17("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
|
|
4646
|
-
/* @__PURE__ */ jsx17("p", { className: "text-text-700 text-md", children:
|
|
4692
|
+
/* @__PURE__ */ jsx17("p", { className: "text-text-700 text-md", children: getLabelByAnswersStatus() })
|
|
4647
4693
|
]
|
|
4648
4694
|
}
|
|
4649
4695
|
);
|
|
@@ -5471,35 +5517,38 @@ var QuizQuestionList = ({
|
|
|
5471
5517
|
case "answered":
|
|
5472
5518
|
return "Respondida";
|
|
5473
5519
|
case "skipped":
|
|
5474
|
-
return "
|
|
5520
|
+
return "Em branco";
|
|
5475
5521
|
default:
|
|
5476
5522
|
return "Em branco";
|
|
5477
5523
|
}
|
|
5478
5524
|
};
|
|
5479
|
-
return /* @__PURE__ */
|
|
5480
|
-
(
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
/* @__PURE__ */
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5525
|
+
return /* @__PURE__ */ jsxs14("div", { className: "space-y-6 px-4 h-full", children: [
|
|
5526
|
+
Object.entries(filteredGroupedQuestions).length == 0 && /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center text-gray-500 py-8 h-full", children: /* @__PURE__ */ jsx17("p", { className: "text-lg", children: "Nenhum resultado" }) }),
|
|
5527
|
+
Object.entries(filteredGroupedQuestions).map(
|
|
5528
|
+
([subjectId, questions]) => /* @__PURE__ */ jsxs14("section", { className: "flex flex-col gap-2", children: [
|
|
5529
|
+
/* @__PURE__ */ jsxs14("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
|
|
5530
|
+
/* @__PURE__ */ jsx17("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ jsx17(BookOpen, { size: 17, className: "text-white" }) }),
|
|
5531
|
+
/* @__PURE__ */ jsx17("p", { className: "text-text-800 font-bold text-lg", children: questions?.[0]?.knowledgeMatrix?.[0]?.subject?.name ?? "Sem mat\xE9ria" })
|
|
5532
|
+
] }),
|
|
5533
|
+
/* @__PURE__ */ jsx17("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
|
|
5534
|
+
const status = getQuestionStatus(question.id);
|
|
5535
|
+
const questionNumber = getQuestionIndex(question.id);
|
|
5536
|
+
return /* @__PURE__ */ jsx17(
|
|
5537
|
+
CardStatus,
|
|
5538
|
+
{
|
|
5539
|
+
header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
|
|
5540
|
+
label: getStatusLabel(status),
|
|
5541
|
+
onClick: () => {
|
|
5542
|
+
goToQuestion(questionNumber - 1);
|
|
5543
|
+
onQuestionClick?.();
|
|
5544
|
+
}
|
|
5545
|
+
},
|
|
5546
|
+
question.id
|
|
5547
|
+
);
|
|
5548
|
+
}) })
|
|
5549
|
+
] }, subjectId)
|
|
5550
|
+
)
|
|
5551
|
+
] });
|
|
5503
5552
|
};
|
|
5504
5553
|
var QuizFooter = forwardRef10(
|
|
5505
5554
|
({
|
|
@@ -5533,7 +5582,7 @@ var QuizFooter = forwardRef10(
|
|
|
5533
5582
|
const [modalResultOpen, setModalResultOpen] = useState7(false);
|
|
5534
5583
|
const [modalNavigateOpen, setModalNavigateOpen] = useState7(false);
|
|
5535
5584
|
const [modalResolutionOpen, setModalResolutionOpen] = useState7(false);
|
|
5536
|
-
const [filterType, setFilterType] = useState7(
|
|
5585
|
+
const [filterType, setFilterType] = useState7("all");
|
|
5537
5586
|
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
5538
5587
|
const allQuestions = getTotalQuestions();
|
|
5539
5588
|
const handleFinishQuiz = async () => {
|
|
@@ -5609,7 +5658,7 @@ var QuizFooter = forwardRef10(
|
|
|
5609
5658
|
}
|
|
5610
5659
|
)
|
|
5611
5660
|
] }),
|
|
5612
|
-
!isFirstQuestion && /* @__PURE__ */ jsx17(
|
|
5661
|
+
!isFirstQuestion && !isLastQuestion && /* @__PURE__ */ jsx17(
|
|
5613
5662
|
Button_default,
|
|
5614
5663
|
{
|
|
5615
5664
|
size: "small",
|
|
@@ -5721,7 +5770,14 @@ var QuizFooter = forwardRef10(
|
|
|
5721
5770
|
/* @__PURE__ */ jsxs14("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
|
|
5722
5771
|
/* @__PURE__ */ jsx17("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
|
|
5723
5772
|
/* @__PURE__ */ jsx17("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs14(Select_default, { value: filterType, onValueChange: setFilterType, children: [
|
|
5724
|
-
/* @__PURE__ */ jsx17(
|
|
5773
|
+
/* @__PURE__ */ jsx17(
|
|
5774
|
+
SelectTrigger,
|
|
5775
|
+
{
|
|
5776
|
+
variant: "rounded",
|
|
5777
|
+
className: "max-w-[266px] min-w-[160px]",
|
|
5778
|
+
children: /* @__PURE__ */ jsx17(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" })
|
|
5779
|
+
}
|
|
5780
|
+
),
|
|
5725
5781
|
/* @__PURE__ */ jsxs14(SelectContent, { children: [
|
|
5726
5782
|
/* @__PURE__ */ jsx17(SelectItem, { value: "all", children: "Todas" }),
|
|
5727
5783
|
/* @__PURE__ */ jsx17(SelectItem, { value: "unanswered", children: "Em branco" }),
|
|
@@ -5729,7 +5785,7 @@ var QuizFooter = forwardRef10(
|
|
|
5729
5785
|
] })
|
|
5730
5786
|
] }) })
|
|
5731
5787
|
] }),
|
|
5732
|
-
/* @__PURE__ */ jsx17("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx17(
|
|
5788
|
+
/* @__PURE__ */ jsx17("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__ */ jsx17(
|
|
5733
5789
|
QuizQuestionList,
|
|
5734
5790
|
{
|
|
5735
5791
|
filterType,
|
|
@@ -5971,6 +6027,8 @@ var QuizListResultByMateria = ({
|
|
|
5971
6027
|
return "correct";
|
|
5972
6028
|
if (question.answerStatus === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */)
|
|
5973
6029
|
return "incorrect";
|
|
6030
|
+
if (question.answerStatus === "NAO_RESPONDIDO" /* NAO_RESPONDIDO */)
|
|
6031
|
+
return "unanswered";
|
|
5974
6032
|
return void 0;
|
|
5975
6033
|
})(),
|
|
5976
6034
|
onClick: () => onQuestionClick?.(question)
|