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/Menu/index.d.mts +27 -1
- package/dist/Menu/index.d.ts +27 -1
- package/dist/Menu/index.js +42 -0
- package/dist/Menu/index.js.map +1 -1
- package/dist/Menu/index.mjs +43 -1
- package/dist/Menu/index.mjs.map +1 -1
- package/dist/MultipleChoice/index.js.map +1 -1
- package/dist/MultipleChoice/index.mjs.map +1 -1
- package/dist/Quiz/index.js +37 -30
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +37 -30
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Quiz/useQuizStore/index.d.mts +1 -0
- package/dist/Quiz/useQuizStore/index.d.ts +1 -0
- package/dist/Quiz/useQuizStore/index.js +9 -0
- package/dist/Quiz/useQuizStore/index.js.map +1 -1
- package/dist/Quiz/useQuizStore/index.mjs +9 -0
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -1
- package/dist/index.css +9 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +79 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -37
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +9 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6233,7 +6233,8 @@ import {
|
|
|
6233
6233
|
isValidElement as isValidElement5,
|
|
6234
6234
|
Children as Children5,
|
|
6235
6235
|
cloneElement as cloneElement5,
|
|
6236
|
-
useState as useState12
|
|
6236
|
+
useState as useState12,
|
|
6237
|
+
useCallback
|
|
6237
6238
|
} from "react";
|
|
6238
6239
|
import { CaretLeft as CaretLeft2, CaretRight as CaretRight3 } from "phosphor-react";
|
|
6239
6240
|
import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -6516,6 +6517,46 @@ var injectStore5 = (children, store) => Children5.map(children, (child) => {
|
|
|
6516
6517
|
...typedChild.props.children ? { children: injectStore5(typedChild.props.children, store) } : {}
|
|
6517
6518
|
});
|
|
6518
6519
|
});
|
|
6520
|
+
var Breadcrumb = forwardRef17(
|
|
6521
|
+
({ currentPage, parentPageName, onBackClick, className, ...props }, ref) => {
|
|
6522
|
+
const handleBackToParent = useCallback(() => {
|
|
6523
|
+
onBackClick();
|
|
6524
|
+
}, [onBackClick]);
|
|
6525
|
+
const breadcrumbClassName = `bg-transparent shadow-none !px-0 py-4 !-ml-2 ${typeof className === "string" ? className : ""}`;
|
|
6526
|
+
return /* @__PURE__ */ jsx33("div", { ref, ...props, children: /* @__PURE__ */ jsx33(
|
|
6527
|
+
Menu,
|
|
6528
|
+
{
|
|
6529
|
+
variant: "breadcrumb",
|
|
6530
|
+
defaultValue: "",
|
|
6531
|
+
className: breadcrumbClassName,
|
|
6532
|
+
children: /* @__PURE__ */ jsxs27(MenuContent, { variant: "breadcrumb", children: [
|
|
6533
|
+
/* @__PURE__ */ jsx33(
|
|
6534
|
+
MenuItem,
|
|
6535
|
+
{
|
|
6536
|
+
variant: "breadcrumb",
|
|
6537
|
+
value: parentPageName.toLowerCase(),
|
|
6538
|
+
onClick: handleBackToParent,
|
|
6539
|
+
separator: true,
|
|
6540
|
+
className: "text-text-600 underline cursor-pointer hover:text-text-950",
|
|
6541
|
+
children: parentPageName
|
|
6542
|
+
}
|
|
6543
|
+
),
|
|
6544
|
+
/* @__PURE__ */ jsx33(
|
|
6545
|
+
MenuItem,
|
|
6546
|
+
{
|
|
6547
|
+
variant: "breadcrumb",
|
|
6548
|
+
value: currentPage.toLowerCase(),
|
|
6549
|
+
className: "text-text-950 font-bold",
|
|
6550
|
+
disabled: true,
|
|
6551
|
+
children: currentPage
|
|
6552
|
+
}
|
|
6553
|
+
)
|
|
6554
|
+
] })
|
|
6555
|
+
}
|
|
6556
|
+
) });
|
|
6557
|
+
}
|
|
6558
|
+
);
|
|
6559
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
6519
6560
|
var Menu_default = Menu;
|
|
6520
6561
|
|
|
6521
6562
|
// src/components/Skeleton/Skeleton.tsx
|
|
@@ -6777,7 +6818,7 @@ import {
|
|
|
6777
6818
|
useContext,
|
|
6778
6819
|
useEffect as useEffect11,
|
|
6779
6820
|
useState as useState13,
|
|
6780
|
-
useCallback,
|
|
6821
|
+
useCallback as useCallback2,
|
|
6781
6822
|
useMemo as useMemo4
|
|
6782
6823
|
} from "react";
|
|
6783
6824
|
import { useLocation, Navigate } from "react-router-dom";
|
|
@@ -6797,7 +6838,7 @@ var AuthProvider = ({
|
|
|
6797
6838
|
isLoading: true,
|
|
6798
6839
|
...initialAuthState
|
|
6799
6840
|
});
|
|
6800
|
-
const checkAuth =
|
|
6841
|
+
const checkAuth = useCallback2(async () => {
|
|
6801
6842
|
try {
|
|
6802
6843
|
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
6803
6844
|
if (!checkAuthFn) {
|
|
@@ -6828,7 +6869,7 @@ var AuthProvider = ({
|
|
|
6828
6869
|
return false;
|
|
6829
6870
|
}
|
|
6830
6871
|
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
6831
|
-
const signOut =
|
|
6872
|
+
const signOut = useCallback2(() => {
|
|
6832
6873
|
if (signOutFn) {
|
|
6833
6874
|
signOutFn();
|
|
6834
6875
|
}
|
|
@@ -7075,7 +7116,7 @@ import {
|
|
|
7075
7116
|
useMemo as useMemo6,
|
|
7076
7117
|
useId as useId10,
|
|
7077
7118
|
useState as useState14,
|
|
7078
|
-
useCallback as
|
|
7119
|
+
useCallback as useCallback3,
|
|
7079
7120
|
useRef as useRef9
|
|
7080
7121
|
} from "react";
|
|
7081
7122
|
|
|
@@ -7550,6 +7591,15 @@ var useQuizStore = create7()(
|
|
|
7550
7591
|
(answer) => answer.questionId === questionId
|
|
7551
7592
|
);
|
|
7552
7593
|
return userAnswer ? userAnswer.answerStatus : null;
|
|
7594
|
+
},
|
|
7595
|
+
getQuestionIndex: (questionId) => {
|
|
7596
|
+
const { getActiveQuiz } = get();
|
|
7597
|
+
const activeQuiz = getActiveQuiz();
|
|
7598
|
+
if (!activeQuiz) return 0;
|
|
7599
|
+
const questionIndex = activeQuiz.quiz.questions.findIndex(
|
|
7600
|
+
(q) => q.id === questionId
|
|
7601
|
+
);
|
|
7602
|
+
return questionIndex + 1;
|
|
7553
7603
|
}
|
|
7554
7604
|
};
|
|
7555
7605
|
},
|
|
@@ -7787,7 +7837,7 @@ var QuizMultipleChoice = ({
|
|
|
7787
7837
|
}
|
|
7788
7838
|
return prevSelectedValuesRef.current;
|
|
7789
7839
|
}, [selectedValues, currentQuestion?.id]);
|
|
7790
|
-
const handleSelectedValues =
|
|
7840
|
+
const handleSelectedValues = useCallback3(
|
|
7791
7841
|
(values) => {
|
|
7792
7842
|
if (currentQuestion) {
|
|
7793
7843
|
selectMultipleAnswer(currentQuestion.id, values);
|
|
@@ -7845,7 +7895,7 @@ var QuizDissertative = ({
|
|
|
7845
7895
|
selectDissertativeAnswer(currentQuestion.id, value);
|
|
7846
7896
|
}
|
|
7847
7897
|
};
|
|
7848
|
-
const adjustTextareaHeight =
|
|
7898
|
+
const adjustTextareaHeight = useCallback3(() => {
|
|
7849
7899
|
if (textareaRef.current) {
|
|
7850
7900
|
textareaRef.current.style.height = "auto";
|
|
7851
7901
|
const scrollHeight = textareaRef.current.scrollHeight;
|
|
@@ -8392,7 +8442,8 @@ var QuizQuestionList = ({
|
|
|
8392
8442
|
const {
|
|
8393
8443
|
getQuestionsGroupedBySubject,
|
|
8394
8444
|
goToQuestion,
|
|
8395
|
-
getQuestionStatusFromUserAnswers
|
|
8445
|
+
getQuestionStatusFromUserAnswers,
|
|
8446
|
+
getQuestionIndex
|
|
8396
8447
|
} = useQuizStore();
|
|
8397
8448
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
8398
8449
|
const getQuestionStatus = (questionId) => {
|
|
@@ -8419,13 +8470,6 @@ var QuizQuestionList = ({
|
|
|
8419
8470
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8420
8471
|
{}
|
|
8421
8472
|
);
|
|
8422
|
-
const getQuestionIndex = (questionId) => {
|
|
8423
|
-
const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
|
|
8424
|
-
const quiz = bySimulated ?? byActivity ?? byQuestionary;
|
|
8425
|
-
if (!quiz) return 0;
|
|
8426
|
-
const index = quiz.questions.findIndex((q) => q.id === questionId);
|
|
8427
|
-
return index + 1;
|
|
8428
|
-
};
|
|
8429
8473
|
const getStatusLabel = (status) => {
|
|
8430
8474
|
switch (status) {
|
|
8431
8475
|
case "answered":
|
|
@@ -8763,9 +8807,7 @@ var QuizResultPerformance = forwardRef19(
|
|
|
8763
8807
|
if (quiz) {
|
|
8764
8808
|
quiz.questions.forEach((question) => {
|
|
8765
8809
|
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
8766
|
-
const
|
|
8767
|
-
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
8768
|
-
const isCorrect = userAnswer && userAnswer === isCorrectOption?.id;
|
|
8810
|
+
const isCorrect = userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
|
|
8769
8811
|
if (isCorrect) {
|
|
8770
8812
|
correctAnswers++;
|
|
8771
8813
|
}
|
|
@@ -8882,9 +8924,7 @@ var QuizListResult = forwardRef19(({ className, onSubjectClick, ...props }, ref)
|
|
|
8882
8924
|
questions.forEach((question) => {
|
|
8883
8925
|
if (isQuestionAnswered(question.id)) {
|
|
8884
8926
|
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
8885
|
-
|
|
8886
|
-
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
8887
|
-
if (userAnswer === isCorrectOption?.id) {
|
|
8927
|
+
if (userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */) {
|
|
8888
8928
|
correct++;
|
|
8889
8929
|
} else {
|
|
8890
8930
|
incorrect++;
|
|
@@ -8919,28 +8959,36 @@ var QuizListResultByMateria = ({
|
|
|
8919
8959
|
subject,
|
|
8920
8960
|
onQuestionClick
|
|
8921
8961
|
}) => {
|
|
8922
|
-
const {
|
|
8962
|
+
const {
|
|
8963
|
+
getQuestionsGroupedBySubject,
|
|
8964
|
+
getUserAnswerByQuestionId,
|
|
8965
|
+
getQuestionIndex
|
|
8966
|
+
} = useQuizStore();
|
|
8923
8967
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
8924
8968
|
const answeredQuestions = groupedQuestions[subject] || [];
|
|
8925
8969
|
return /* @__PURE__ */ jsxs30("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
|
|
8926
8970
|
/* @__PURE__ */ jsx37("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ jsx37("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
|
|
8927
8971
|
/* @__PURE__ */ jsxs30("section", { className: "flex flex-col ", children: [
|
|
8928
8972
|
/* @__PURE__ */ jsx37("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
|
|
8929
|
-
/* @__PURE__ */ jsx37("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) =>
|
|
8930
|
-
|
|
8931
|
-
{
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8973
|
+
/* @__PURE__ */ jsx37("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
|
|
8974
|
+
const questionIndex = getQuestionIndex(question.id);
|
|
8975
|
+
return /* @__PURE__ */ jsx37("li", { children: /* @__PURE__ */ jsx37(
|
|
8976
|
+
CardStatus,
|
|
8977
|
+
{
|
|
8978
|
+
className: "max-w-full",
|
|
8979
|
+
header: `Quest\xE3o ${questionIndex.toString().padStart(2, "0")}`,
|
|
8980
|
+
status: (() => {
|
|
8981
|
+
const userAnswer = getUserAnswerByQuestionId(question.id);
|
|
8982
|
+
if (userAnswer?.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */)
|
|
8983
|
+
return "correct";
|
|
8984
|
+
if (userAnswer?.answerStatus === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */)
|
|
8985
|
+
return "incorrect";
|
|
8986
|
+
return void 0;
|
|
8987
|
+
})(),
|
|
8988
|
+
onClick: () => onQuestionClick?.(question)
|
|
8989
|
+
}
|
|
8990
|
+
) }, question.id);
|
|
8991
|
+
}) })
|
|
8944
8992
|
] })
|
|
8945
8993
|
] });
|
|
8946
8994
|
};
|
|
@@ -8950,6 +8998,7 @@ export {
|
|
|
8950
8998
|
AlternativesList,
|
|
8951
8999
|
AuthProvider,
|
|
8952
9000
|
Badge_default as Badge,
|
|
9001
|
+
Breadcrumb,
|
|
8953
9002
|
Button_default as Button,
|
|
8954
9003
|
Calendar_default as Calendar,
|
|
8955
9004
|
CardAccordation,
|