analytica-frontend-lib 1.0.85 → 1.0.87
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 +0 -1
- package/dist/Accordation/index.mjs +0 -1
- package/dist/Alert/index.js +0 -1
- package/dist/Alert/index.mjs +0 -1
- package/dist/AlertDialog/index.js +0 -1
- package/dist/AlertDialog/index.mjs +0 -1
- package/dist/Alternative/index.js +0 -1
- package/dist/Alternative/index.mjs +0 -1
- package/dist/Auth/AuthProvider/index.js +0 -1
- package/dist/Auth/AuthProvider/index.mjs +0 -1
- package/dist/Auth/ProtectedRoute/index.js +0 -1
- package/dist/Auth/ProtectedRoute/index.mjs +0 -1
- package/dist/Auth/PublicRoute/index.js +0 -1
- package/dist/Auth/PublicRoute/index.mjs +0 -1
- package/dist/Auth/getRootDomain/index.js +0 -1
- package/dist/Auth/getRootDomain/index.mjs +0 -1
- package/dist/Auth/index.js +0 -1
- package/dist/Auth/index.mjs +0 -1
- package/dist/Auth/useApiConfig/index.js +0 -1
- package/dist/Auth/useApiConfig/index.mjs +0 -1
- package/dist/Auth/useAuth/index.js +0 -1
- package/dist/Auth/useAuth/index.mjs +0 -1
- package/dist/Auth/useAuthGuard/index.js +0 -1
- package/dist/Auth/useAuthGuard/index.mjs +0 -1
- package/dist/Auth/useRouteAuth/index.js +0 -1
- package/dist/Auth/useRouteAuth/index.mjs +0 -1
- package/dist/Auth/useUrlAuthentication/index.js +0 -1
- package/dist/Auth/useUrlAuthentication/index.mjs +0 -1
- package/dist/Auth/withAuth/index.js +0 -1
- package/dist/Auth/withAuth/index.mjs +0 -1
- package/dist/Auth/zustandAuthAdapter/index.js +0 -1
- package/dist/Auth/zustandAuthAdapter/index.mjs +0 -1
- package/dist/Badge/index.js +0 -1
- package/dist/Badge/index.mjs +0 -1
- package/dist/Button/index.js +0 -1
- package/dist/Button/index.mjs +0 -1
- package/dist/Calendar/index.js +0 -1
- package/dist/Calendar/index.mjs +0 -1
- package/dist/Card/index.js +0 -1
- package/dist/Card/index.mjs +0 -1
- package/dist/CheckBox/index.js +0 -1
- package/dist/CheckBox/index.mjs +0 -1
- package/dist/Chips/index.js +0 -1
- package/dist/Chips/index.mjs +0 -1
- package/dist/Divider/index.js +0 -1
- package/dist/Divider/index.mjs +0 -1
- package/dist/DropdownMenu/index.js +0 -1
- package/dist/DropdownMenu/index.mjs +0 -1
- package/dist/IconButton/index.js +0 -1
- package/dist/IconButton/index.mjs +0 -1
- package/dist/IconRoundedButton/index.js +0 -1
- package/dist/IconRoundedButton/index.mjs +0 -1
- package/dist/Input/index.js +0 -1
- package/dist/Input/index.mjs +0 -1
- package/dist/Menu/index.js +0 -1
- package/dist/Menu/index.mjs +0 -1
- package/dist/Modal/index.js +0 -1
- package/dist/Modal/index.mjs +0 -1
- package/dist/MultipleChoice/index.js +660 -0
- package/dist/MultipleChoice/index.mjs +647 -0
- package/dist/NavButton/index.js +0 -1
- package/dist/NavButton/index.mjs +0 -1
- package/dist/NotFound/index.js +0 -1
- package/dist/NotFound/index.mjs +0 -1
- package/dist/ProgressBar/index.js +0 -1
- package/dist/ProgressBar/index.mjs +0 -1
- package/dist/ProgressCircle/index.js +0 -1
- package/dist/ProgressCircle/index.mjs +0 -1
- package/dist/Quiz/index.js +957 -298
- package/dist/Quiz/index.mjs +974 -297
- package/dist/Quiz/useQuizStore/index.js +79 -35
- package/dist/Quiz/useQuizStore/index.mjs +79 -35
- package/dist/Radio/index.js +0 -1
- package/dist/Radio/index.mjs +0 -1
- package/dist/Select/index.js +2 -3
- package/dist/Select/index.mjs +2 -3
- package/dist/SelectionButton/index.js +0 -1
- package/dist/SelectionButton/index.mjs +0 -1
- package/dist/Skeleton/index.js +0 -1
- package/dist/Skeleton/index.mjs +0 -1
- package/dist/Stepper/index.js +0 -1
- package/dist/Stepper/index.mjs +0 -1
- package/dist/Table/index.js +0 -1
- package/dist/Table/index.mjs +0 -1
- package/dist/Text/index.js +0 -1
- package/dist/Text/index.mjs +0 -1
- package/dist/TextArea/index.js +0 -1
- package/dist/TextArea/index.mjs +0 -1
- package/dist/Toast/ToastStore/index.js +0 -1
- package/dist/Toast/ToastStore/index.mjs +0 -1
- package/dist/Toast/Toaster/index.js +0 -1
- package/dist/Toast/Toaster/index.mjs +0 -1
- package/dist/Toast/index.js +0 -1
- package/dist/Toast/index.mjs +0 -1
- package/dist/index.css +46 -1
- package/dist/index.js +1399 -937
- package/dist/index.mjs +1340 -868
- package/dist/styles.css +46 -1
- package/package.json +4 -2
- package/dist/Accordation/index.d.mts +0 -12
- package/dist/Accordation/index.d.ts +0 -12
- package/dist/Accordation/index.js.map +0 -1
- package/dist/Accordation/index.mjs.map +0 -1
- package/dist/Alert/index.d.mts +0 -13
- package/dist/Alert/index.d.ts +0 -13
- package/dist/Alert/index.js.map +0 -1
- package/dist/Alert/index.mjs.map +0 -1
- package/dist/AlertDialog/index.d.mts +0 -36
- package/dist/AlertDialog/index.d.ts +0 -36
- package/dist/AlertDialog/index.js.map +0 -1
- package/dist/AlertDialog/index.mjs.map +0 -1
- package/dist/Alternative/index.d.mts +0 -81
- package/dist/Alternative/index.d.ts +0 -81
- package/dist/Alternative/index.js.map +0 -1
- package/dist/Alternative/index.mjs.map +0 -1
- package/dist/Auth/AuthProvider/index.d.mts +0 -3
- package/dist/Auth/AuthProvider/index.d.ts +0 -3
- package/dist/Auth/AuthProvider/index.js.map +0 -1
- package/dist/Auth/AuthProvider/index.mjs.map +0 -1
- package/dist/Auth/ProtectedRoute/index.d.mts +0 -3
- package/dist/Auth/ProtectedRoute/index.d.ts +0 -3
- package/dist/Auth/ProtectedRoute/index.js.map +0 -1
- package/dist/Auth/ProtectedRoute/index.mjs.map +0 -1
- package/dist/Auth/PublicRoute/index.d.mts +0 -3
- package/dist/Auth/PublicRoute/index.d.ts +0 -3
- package/dist/Auth/PublicRoute/index.js.map +0 -1
- package/dist/Auth/PublicRoute/index.mjs.map +0 -1
- package/dist/Auth/getRootDomain/index.d.mts +0 -3
- package/dist/Auth/getRootDomain/index.d.ts +0 -3
- package/dist/Auth/getRootDomain/index.js.map +0 -1
- package/dist/Auth/getRootDomain/index.mjs.map +0 -1
- package/dist/Auth/index.d.mts +0 -312
- package/dist/Auth/index.d.ts +0 -312
- package/dist/Auth/index.js.map +0 -1
- package/dist/Auth/index.mjs.map +0 -1
- package/dist/Auth/useApiConfig/index.d.mts +0 -43
- package/dist/Auth/useApiConfig/index.d.ts +0 -43
- package/dist/Auth/useApiConfig/index.js.map +0 -1
- package/dist/Auth/useApiConfig/index.mjs.map +0 -1
- package/dist/Auth/useAuth/index.d.mts +0 -3
- package/dist/Auth/useAuth/index.d.ts +0 -3
- package/dist/Auth/useAuth/index.js.map +0 -1
- package/dist/Auth/useAuth/index.mjs.map +0 -1
- package/dist/Auth/useAuthGuard/index.d.mts +0 -3
- package/dist/Auth/useAuthGuard/index.d.ts +0 -3
- package/dist/Auth/useAuthGuard/index.js.map +0 -1
- package/dist/Auth/useAuthGuard/index.mjs.map +0 -1
- package/dist/Auth/useRouteAuth/index.d.mts +0 -3
- package/dist/Auth/useRouteAuth/index.d.ts +0 -3
- package/dist/Auth/useRouteAuth/index.js.map +0 -1
- package/dist/Auth/useRouteAuth/index.mjs.map +0 -1
- package/dist/Auth/useUrlAuthentication/index.d.mts +0 -58
- package/dist/Auth/useUrlAuthentication/index.d.ts +0 -58
- package/dist/Auth/useUrlAuthentication/index.js.map +0 -1
- package/dist/Auth/useUrlAuthentication/index.mjs.map +0 -1
- package/dist/Auth/withAuth/index.d.mts +0 -3
- package/dist/Auth/withAuth/index.d.ts +0 -3
- package/dist/Auth/withAuth/index.js.map +0 -1
- package/dist/Auth/withAuth/index.mjs.map +0 -1
- package/dist/Auth/zustandAuthAdapter/index.d.mts +0 -75
- package/dist/Auth/zustandAuthAdapter/index.d.ts +0 -75
- package/dist/Auth/zustandAuthAdapter/index.js.map +0 -1
- package/dist/Auth/zustandAuthAdapter/index.mjs.map +0 -1
- package/dist/Badge/index.d.mts +0 -46
- package/dist/Badge/index.d.ts +0 -46
- package/dist/Badge/index.js.map +0 -1
- package/dist/Badge/index.mjs.map +0 -1
- package/dist/Button/index.d.mts +0 -45
- package/dist/Button/index.d.ts +0 -45
- package/dist/Button/index.js.map +0 -1
- package/dist/Button/index.mjs.map +0 -1
- package/dist/Calendar/index.d.mts +0 -60
- package/dist/Calendar/index.d.ts +0 -60
- package/dist/Calendar/index.js.map +0 -1
- package/dist/Calendar/index.mjs.map +0 -1
- package/dist/Card/index.d.mts +0 -150
- package/dist/Card/index.d.ts +0 -150
- package/dist/Card/index.js.map +0 -1
- package/dist/Card/index.mjs.map +0 -1
- package/dist/CheckBox/index.d.mts +0 -74
- package/dist/CheckBox/index.d.ts +0 -74
- package/dist/CheckBox/index.js.map +0 -1
- package/dist/CheckBox/index.mjs.map +0 -1
- package/dist/Chips/index.d.mts +0 -41
- package/dist/Chips/index.d.ts +0 -41
- package/dist/Chips/index.js.map +0 -1
- package/dist/Chips/index.mjs.map +0 -1
- package/dist/Divider/index.d.mts +0 -32
- package/dist/Divider/index.d.ts +0 -32
- package/dist/Divider/index.js.map +0 -1
- package/dist/Divider/index.mjs.map +0 -1
- package/dist/DropdownMenu/index.d.mts +0 -68
- package/dist/DropdownMenu/index.d.ts +0 -68
- package/dist/DropdownMenu/index.js.map +0 -1
- package/dist/DropdownMenu/index.mjs.map +0 -1
- package/dist/IconButton/index.d.mts +0 -76
- package/dist/IconButton/index.d.ts +0 -76
- package/dist/IconButton/index.js.map +0 -1
- package/dist/IconButton/index.mjs.map +0 -1
- package/dist/IconRoundedButton/index.d.mts +0 -34
- package/dist/IconRoundedButton/index.d.ts +0 -34
- package/dist/IconRoundedButton/index.js.map +0 -1
- package/dist/IconRoundedButton/index.mjs.map +0 -1
- package/dist/Input/index.d.mts +0 -27
- package/dist/Input/index.d.ts +0 -27
- package/dist/Input/index.js.map +0 -1
- package/dist/Input/index.mjs.map +0 -1
- package/dist/Menu/index.d.mts +0 -48
- package/dist/Menu/index.d.ts +0 -48
- package/dist/Menu/index.js.map +0 -1
- package/dist/Menu/index.mjs.map +0 -1
- package/dist/Modal/index.d.mts +0 -66
- package/dist/Modal/index.d.ts +0 -66
- package/dist/Modal/index.js.map +0 -1
- package/dist/Modal/index.mjs.map +0 -1
- package/dist/NavButton/index.d.mts +0 -57
- package/dist/NavButton/index.d.ts +0 -57
- package/dist/NavButton/index.js.map +0 -1
- package/dist/NavButton/index.mjs.map +0 -1
- package/dist/NotFound/index.d.mts +0 -58
- package/dist/NotFound/index.d.ts +0 -58
- package/dist/NotFound/index.js.map +0 -1
- package/dist/NotFound/index.mjs.map +0 -1
- package/dist/ProgressBar/index.d.mts +0 -95
- package/dist/ProgressBar/index.d.ts +0 -95
- package/dist/ProgressBar/index.js.map +0 -1
- package/dist/ProgressBar/index.mjs.map +0 -1
- package/dist/ProgressCircle/index.d.mts +0 -60
- package/dist/ProgressCircle/index.d.ts +0 -60
- package/dist/ProgressCircle/index.js.map +0 -1
- package/dist/ProgressCircle/index.mjs.map +0 -1
- package/dist/Quiz/index.d.mts +0 -52
- package/dist/Quiz/index.d.ts +0 -52
- package/dist/Quiz/index.js.map +0 -1
- package/dist/Quiz/index.mjs.map +0 -1
- package/dist/Quiz/useQuizStore/index.d.mts +0 -140
- package/dist/Quiz/useQuizStore/index.d.ts +0 -140
- package/dist/Quiz/useQuizStore/index.js.map +0 -1
- package/dist/Quiz/useQuizStore/index.mjs.map +0 -1
- package/dist/Radio/index.d.mts +0 -203
- package/dist/Radio/index.d.ts +0 -203
- package/dist/Radio/index.js.map +0 -1
- package/dist/Radio/index.mjs.map +0 -1
- package/dist/Select/index.d.mts +0 -58
- package/dist/Select/index.d.ts +0 -58
- package/dist/Select/index.js.map +0 -1
- package/dist/Select/index.mjs.map +0 -1
- package/dist/SelectionButton/index.d.mts +0 -57
- package/dist/SelectionButton/index.d.ts +0 -57
- package/dist/SelectionButton/index.js.map +0 -1
- package/dist/SelectionButton/index.mjs.map +0 -1
- package/dist/Skeleton/index.d.mts +0 -40
- package/dist/Skeleton/index.d.ts +0 -40
- package/dist/Skeleton/index.js.map +0 -1
- package/dist/Skeleton/index.mjs.map +0 -1
- package/dist/Stepper/index.d.mts +0 -169
- package/dist/Stepper/index.d.ts +0 -169
- package/dist/Stepper/index.js.map +0 -1
- package/dist/Stepper/index.mjs.map +0 -1
- package/dist/Table/index.d.mts +0 -17
- package/dist/Table/index.d.ts +0 -17
- package/dist/Table/index.js.map +0 -1
- package/dist/Table/index.mjs.map +0 -1
- package/dist/Text/index.d.mts +0 -58
- package/dist/Text/index.d.ts +0 -58
- package/dist/Text/index.js.map +0 -1
- package/dist/Text/index.mjs.map +0 -1
- package/dist/TextArea/index.d.mts +0 -70
- package/dist/TextArea/index.d.ts +0 -70
- package/dist/TextArea/index.js.map +0 -1
- package/dist/TextArea/index.mjs.map +0 -1
- package/dist/Toast/ToastStore/index.d.mts +0 -19
- package/dist/Toast/ToastStore/index.d.ts +0 -19
- package/dist/Toast/ToastStore/index.js.map +0 -1
- package/dist/Toast/ToastStore/index.mjs.map +0 -1
- package/dist/Toast/Toaster/index.d.mts +0 -16
- package/dist/Toast/Toaster/index.d.ts +0 -16
- package/dist/Toast/Toaster/index.js.map +0 -1
- package/dist/Toast/Toaster/index.mjs.map +0 -1
- package/dist/Toast/index.d.mts +0 -17
- package/dist/Toast/index.d.ts +0 -17
- package/dist/Toast/index.js.map +0 -1
- package/dist/Toast/index.mjs.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/index.d.mts +0 -41
- package/dist/index.d.ts +0 -41
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/styles.css.map +0 -1
- package/dist/styles.d.mts +0 -2
- package/dist/styles.d.ts +0 -2
package/dist/Quiz/index.mjs
CHANGED
|
@@ -931,7 +931,14 @@ IconButton.displayName = "IconButton";
|
|
|
931
931
|
var IconButton_default = IconButton;
|
|
932
932
|
|
|
933
933
|
// src/components/Quiz/Quiz.tsx
|
|
934
|
-
import {
|
|
934
|
+
import {
|
|
935
|
+
forwardRef as forwardRef9,
|
|
936
|
+
useEffect as useEffect7,
|
|
937
|
+
useMemo,
|
|
938
|
+
useState as useState6,
|
|
939
|
+
useCallback,
|
|
940
|
+
useRef as useRef5
|
|
941
|
+
} from "react";
|
|
935
942
|
|
|
936
943
|
// src/components/Quiz/useQuizStore.ts
|
|
937
944
|
import { create as create2 } from "zustand";
|
|
@@ -972,6 +979,7 @@ var useQuizStore = create2()(
|
|
|
972
979
|
setByActivity: (atividade) => set({ byActivity: atividade }),
|
|
973
980
|
setByQuestionary: (aula) => set({ byQuestionary: aula }),
|
|
974
981
|
setUserId: (userId) => set({ userId }),
|
|
982
|
+
setUserAnswers: (userAnswers) => set({ userAnswers }),
|
|
975
983
|
getUserId: () => get().userId,
|
|
976
984
|
// Navigation
|
|
977
985
|
goToNextQuestion: () => {
|
|
@@ -1008,16 +1016,9 @@ var useQuizStore = create2()(
|
|
|
1008
1016
|
const { getActiveQuiz, userAnswers } = get();
|
|
1009
1017
|
const activeQuiz = getActiveQuiz();
|
|
1010
1018
|
if (!activeQuiz) return;
|
|
1011
|
-
const updatedQuestions = activeQuiz.quiz.questions.map(
|
|
1012
|
-
(question) => question.id === questionId ? { ...question, answerKey: answerId } : question
|
|
1013
|
-
);
|
|
1014
|
-
const updatedQuiz = {
|
|
1015
|
-
...activeQuiz.quiz,
|
|
1016
|
-
questions: updatedQuestions
|
|
1017
|
-
};
|
|
1018
1019
|
const activityId = activeQuiz.quiz.id;
|
|
1019
1020
|
const userId = get().getUserId();
|
|
1020
|
-
if (!userId) {
|
|
1021
|
+
if (!userId || userId === "") {
|
|
1021
1022
|
console.warn("selectAnswer called before userId is set");
|
|
1022
1023
|
return;
|
|
1023
1024
|
}
|
|
@@ -1028,7 +1029,7 @@ var useQuizStore = create2()(
|
|
|
1028
1029
|
questionId,
|
|
1029
1030
|
activityId,
|
|
1030
1031
|
userId,
|
|
1031
|
-
answer:
|
|
1032
|
+
answer: null,
|
|
1032
1033
|
optionId: answerId
|
|
1033
1034
|
};
|
|
1034
1035
|
let updatedUserAnswers;
|
|
@@ -1039,7 +1040,36 @@ var useQuizStore = create2()(
|
|
|
1039
1040
|
updatedUserAnswers = [...userAnswers, newUserAnswer];
|
|
1040
1041
|
}
|
|
1041
1042
|
set({
|
|
1042
|
-
|
|
1043
|
+
userAnswers: updatedUserAnswers
|
|
1044
|
+
});
|
|
1045
|
+
},
|
|
1046
|
+
selectMultipleAnswer: (questionId, answerIds) => {
|
|
1047
|
+
const { getActiveQuiz, userAnswers } = get();
|
|
1048
|
+
const activeQuiz = getActiveQuiz();
|
|
1049
|
+
if (!activeQuiz) return;
|
|
1050
|
+
const activityId = activeQuiz.quiz.id;
|
|
1051
|
+
const userId = get().getUserId();
|
|
1052
|
+
if (!userId || userId === "") {
|
|
1053
|
+
console.warn("selectMultipleAnswer called before userId is set");
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
const filteredUserAnswers = userAnswers.filter(
|
|
1057
|
+
(answer) => answer.questionId !== questionId
|
|
1058
|
+
);
|
|
1059
|
+
const newUserAnswers = answerIds.map(
|
|
1060
|
+
(answerId) => ({
|
|
1061
|
+
questionId,
|
|
1062
|
+
activityId,
|
|
1063
|
+
userId,
|
|
1064
|
+
answer: null,
|
|
1065
|
+
optionId: answerId
|
|
1066
|
+
})
|
|
1067
|
+
);
|
|
1068
|
+
const updatedUserAnswers = [
|
|
1069
|
+
...filteredUserAnswers,
|
|
1070
|
+
...newUserAnswers
|
|
1071
|
+
];
|
|
1072
|
+
set({
|
|
1043
1073
|
userAnswers: updatedUserAnswers
|
|
1044
1074
|
});
|
|
1045
1075
|
},
|
|
@@ -1051,6 +1081,10 @@ var useQuizStore = create2()(
|
|
|
1051
1081
|
if (currentQuestion) {
|
|
1052
1082
|
const activityId = activeQuiz.quiz.id;
|
|
1053
1083
|
const userId = get().getUserId();
|
|
1084
|
+
if (!userId || userId === "") {
|
|
1085
|
+
console.warn("skipQuestion called before userId is set");
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1054
1088
|
const existingAnswerIndex = userAnswers.findIndex(
|
|
1055
1089
|
(answer) => answer.questionId === currentQuestion.id
|
|
1056
1090
|
);
|
|
@@ -1079,6 +1113,10 @@ var useQuizStore = create2()(
|
|
|
1079
1113
|
if (!activeQuiz) return;
|
|
1080
1114
|
const activityId = activeQuiz.quiz.id;
|
|
1081
1115
|
const userId = get().getUserId();
|
|
1116
|
+
if (!userId || userId === "") {
|
|
1117
|
+
console.warn("addUserAnswer called before userId is set");
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1082
1120
|
const existingAnswerIndex = userAnswers.findIndex(
|
|
1083
1121
|
(answer) => answer.questionId === questionId
|
|
1084
1122
|
);
|
|
@@ -1086,7 +1124,7 @@ var useQuizStore = create2()(
|
|
|
1086
1124
|
questionId,
|
|
1087
1125
|
activityId,
|
|
1088
1126
|
userId,
|
|
1089
|
-
answer:
|
|
1127
|
+
answer: null,
|
|
1090
1128
|
optionId: answerId || null
|
|
1091
1129
|
};
|
|
1092
1130
|
if (existingAnswerIndex !== -1) {
|
|
@@ -1137,7 +1175,7 @@ var useQuizStore = create2()(
|
|
|
1137
1175
|
},
|
|
1138
1176
|
getAnsweredQuestions: () => {
|
|
1139
1177
|
const { userAnswers } = get();
|
|
1140
|
-
return userAnswers.filter((answer) => answer.
|
|
1178
|
+
return userAnswers.filter((answer) => answer.optionId !== null).length;
|
|
1141
1179
|
},
|
|
1142
1180
|
getUnansweredQuestions: () => {
|
|
1143
1181
|
const { getActiveQuiz, userAnswers } = get();
|
|
@@ -1148,8 +1186,8 @@ var useQuizStore = create2()(
|
|
|
1148
1186
|
const userAnswer = userAnswers.find(
|
|
1149
1187
|
(answer) => answer.questionId === question.id
|
|
1150
1188
|
);
|
|
1151
|
-
const isAnswered = userAnswer && userAnswer.
|
|
1152
|
-
const isSkipped = userAnswer && userAnswer.
|
|
1189
|
+
const isAnswered = userAnswer && userAnswer.optionId !== null;
|
|
1190
|
+
const isSkipped = userAnswer && userAnswer.optionId === null;
|
|
1153
1191
|
if (!isAnswered && !isSkipped) {
|
|
1154
1192
|
unansweredQuestions.push(index + 1);
|
|
1155
1193
|
}
|
|
@@ -1158,7 +1196,7 @@ var useQuizStore = create2()(
|
|
|
1158
1196
|
},
|
|
1159
1197
|
getSkippedQuestions: () => {
|
|
1160
1198
|
const { userAnswers } = get();
|
|
1161
|
-
return userAnswers.filter((answer) => answer.
|
|
1199
|
+
return userAnswers.filter((answer) => answer.optionId === null).length;
|
|
1162
1200
|
},
|
|
1163
1201
|
getProgress: () => {
|
|
1164
1202
|
const { getTotalQuestions, getAnsweredQuestions } = get();
|
|
@@ -1171,14 +1209,14 @@ var useQuizStore = create2()(
|
|
|
1171
1209
|
const userAnswer = userAnswers.find(
|
|
1172
1210
|
(answer) => answer.questionId === questionId
|
|
1173
1211
|
);
|
|
1174
|
-
return userAnswer ? userAnswer.
|
|
1212
|
+
return userAnswer ? userAnswer.optionId !== null : false;
|
|
1175
1213
|
},
|
|
1176
1214
|
isQuestionSkipped: (questionId) => {
|
|
1177
1215
|
const { userAnswers } = get();
|
|
1178
1216
|
const userAnswer = userAnswers.find(
|
|
1179
1217
|
(answer) => answer.questionId === questionId
|
|
1180
1218
|
);
|
|
1181
|
-
return userAnswer ? userAnswer.
|
|
1219
|
+
return userAnswer ? userAnswer.optionId === null : false;
|
|
1182
1220
|
},
|
|
1183
1221
|
getCurrentAnswer: () => {
|
|
1184
1222
|
const { getCurrentQuestion, userAnswers } = get();
|
|
@@ -1187,7 +1225,16 @@ var useQuizStore = create2()(
|
|
|
1187
1225
|
const userAnswer = userAnswers.find(
|
|
1188
1226
|
(answer) => answer.questionId === currentQuestion.id
|
|
1189
1227
|
);
|
|
1190
|
-
return userAnswer?.
|
|
1228
|
+
return userAnswer?.optionId;
|
|
1229
|
+
},
|
|
1230
|
+
getAllCurrentAnswer: () => {
|
|
1231
|
+
const { getCurrentQuestion, userAnswers } = get();
|
|
1232
|
+
const currentQuestion = getCurrentQuestion();
|
|
1233
|
+
if (!currentQuestion) return void 0;
|
|
1234
|
+
const userAnswer = userAnswers.filter(
|
|
1235
|
+
(answer) => answer.questionId === currentQuestion.id
|
|
1236
|
+
);
|
|
1237
|
+
return userAnswer;
|
|
1191
1238
|
},
|
|
1192
1239
|
getQuizTitle: () => {
|
|
1193
1240
|
const { getActiveQuiz } = get();
|
|
@@ -1200,18 +1247,8 @@ var useQuizStore = create2()(
|
|
|
1200
1247
|
return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
|
|
1201
1248
|
},
|
|
1202
1249
|
getUserAnswers: () => {
|
|
1203
|
-
const {
|
|
1204
|
-
|
|
1205
|
-
if (!activeQuiz) return [];
|
|
1206
|
-
return activeQuiz.quiz.questions.map((question) => {
|
|
1207
|
-
const userAnswer = userAnswers.find(
|
|
1208
|
-
(answer) => answer.questionId === question.id
|
|
1209
|
-
);
|
|
1210
|
-
return {
|
|
1211
|
-
...question,
|
|
1212
|
-
isSkipped: userAnswer ? userAnswer.answer === null : false
|
|
1213
|
-
};
|
|
1214
|
-
});
|
|
1250
|
+
const { userAnswers } = get();
|
|
1251
|
+
return userAnswers;
|
|
1215
1252
|
},
|
|
1216
1253
|
getUnansweredQuestionsFromUserAnswers: () => {
|
|
1217
1254
|
const { getActiveQuiz, userAnswers } = get();
|
|
@@ -1222,8 +1259,8 @@ var useQuizStore = create2()(
|
|
|
1222
1259
|
const userAnswer = userAnswers.find(
|
|
1223
1260
|
(answer) => answer.questionId === question.id
|
|
1224
1261
|
);
|
|
1225
|
-
const hasAnswer = userAnswer && userAnswer.
|
|
1226
|
-
const isSkipped = userAnswer && userAnswer.
|
|
1262
|
+
const hasAnswer = userAnswer && userAnswer.optionId !== null;
|
|
1263
|
+
const isSkipped = userAnswer && userAnswer.optionId === null;
|
|
1227
1264
|
if (!hasAnswer || isSkipped) {
|
|
1228
1265
|
unansweredQuestions.push(index + 1);
|
|
1229
1266
|
}
|
|
@@ -1254,7 +1291,7 @@ var useQuizStore = create2()(
|
|
|
1254
1291
|
const answer = userAnswers.find(
|
|
1255
1292
|
(answer2) => answer2.questionId === questionId
|
|
1256
1293
|
);
|
|
1257
|
-
return answer ? answer.
|
|
1294
|
+
return answer ? answer.optionId !== null : false;
|
|
1258
1295
|
},
|
|
1259
1296
|
getQuestionStatusFromUserAnswers: (questionId) => {
|
|
1260
1297
|
const { userAnswers } = get();
|
|
@@ -1262,12 +1299,27 @@ var useQuizStore = create2()(
|
|
|
1262
1299
|
(answer2) => answer2.questionId === questionId
|
|
1263
1300
|
);
|
|
1264
1301
|
if (!answer) return "unanswered";
|
|
1265
|
-
if (answer.
|
|
1302
|
+
if (answer.optionId === null) return "skipped";
|
|
1266
1303
|
return "answered";
|
|
1267
1304
|
},
|
|
1268
1305
|
getUserAnswersForActivity: () => {
|
|
1269
1306
|
const { userAnswers } = get();
|
|
1270
1307
|
return userAnswers;
|
|
1308
|
+
},
|
|
1309
|
+
setCurrentQuestion: (question) => {
|
|
1310
|
+
const { getActiveQuiz } = get();
|
|
1311
|
+
const activeQuiz = getActiveQuiz();
|
|
1312
|
+
if (!activeQuiz) return;
|
|
1313
|
+
const questionIndex = activeQuiz.quiz.questions.findIndex(
|
|
1314
|
+
(q) => q.id === question.id
|
|
1315
|
+
);
|
|
1316
|
+
if (questionIndex === -1) {
|
|
1317
|
+
console.warn(
|
|
1318
|
+
`Question with id "${question.id}" not found in active quiz`
|
|
1319
|
+
);
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
set({ currentQuestionIndex: questionIndex });
|
|
1271
1323
|
}
|
|
1272
1324
|
};
|
|
1273
1325
|
},
|
|
@@ -1783,7 +1835,7 @@ var SelectContent = forwardRef5(
|
|
|
1783
1835
|
role: "menu",
|
|
1784
1836
|
ref,
|
|
1785
1837
|
className: cn(
|
|
1786
|
-
"bg-
|
|
1838
|
+
"bg-secondary z-50 min-w-[210px] overflow-hidden rounded-md border p-1 shadow-md border-border-100",
|
|
1787
1839
|
getPositionClasses(),
|
|
1788
1840
|
className
|
|
1789
1841
|
),
|
|
@@ -1828,7 +1880,7 @@ var SelectItem = forwardRef5(
|
|
|
1828
1880
|
"aria-disabled": disabled,
|
|
1829
1881
|
ref,
|
|
1830
1882
|
className: `
|
|
1831
|
-
focus-visible:bg-background-50
|
|
1883
|
+
bg-secondary focus-visible:bg-background-50
|
|
1832
1884
|
relative flex select-none items-center gap-2 rounded-sm p-3 outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
|
|
1833
1885
|
${className}
|
|
1834
1886
|
${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
@@ -3718,10 +3770,496 @@ var ProgressCircle = ({
|
|
|
3718
3770
|
};
|
|
3719
3771
|
var ProgressCircle_default = ProgressCircle;
|
|
3720
3772
|
|
|
3773
|
+
// src/components/MultipleChoice/MultipleChoice.tsx
|
|
3774
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
3775
|
+
|
|
3776
|
+
// src/components/CheckBox/CheckboxList.tsx
|
|
3777
|
+
import {
|
|
3778
|
+
forwardRef as forwardRef8,
|
|
3779
|
+
useId as useId5,
|
|
3780
|
+
useEffect as useEffect5,
|
|
3781
|
+
useRef as useRef4,
|
|
3782
|
+
Children as Children3,
|
|
3783
|
+
cloneElement as cloneElement3,
|
|
3784
|
+
isValidElement as isValidElement3
|
|
3785
|
+
} from "react";
|
|
3786
|
+
import { create as create4, useStore as useStore3 } from "zustand";
|
|
3787
|
+
|
|
3788
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
3789
|
+
import {
|
|
3790
|
+
forwardRef as forwardRef7,
|
|
3791
|
+
useState as useState4,
|
|
3792
|
+
useId as useId4
|
|
3793
|
+
} from "react";
|
|
3794
|
+
import { Check as Check2, Minus } from "phosphor-react";
|
|
3795
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3796
|
+
var SIZE_CLASSES9 = {
|
|
3797
|
+
small: {
|
|
3798
|
+
checkbox: "w-4 h-4",
|
|
3799
|
+
// 16px x 16px
|
|
3800
|
+
textSize: "sm",
|
|
3801
|
+
spacing: "gap-1.5",
|
|
3802
|
+
// 6px
|
|
3803
|
+
borderWidth: "border-2",
|
|
3804
|
+
iconSize: 14,
|
|
3805
|
+
// pixels for Phosphor icons
|
|
3806
|
+
labelHeight: "h-[21px]"
|
|
3807
|
+
},
|
|
3808
|
+
medium: {
|
|
3809
|
+
checkbox: "w-5 h-5",
|
|
3810
|
+
// 20px x 20px
|
|
3811
|
+
textSize: "md",
|
|
3812
|
+
spacing: "gap-2",
|
|
3813
|
+
// 8px
|
|
3814
|
+
borderWidth: "border-2",
|
|
3815
|
+
iconSize: 16,
|
|
3816
|
+
// pixels for Phosphor icons
|
|
3817
|
+
labelHeight: "h-6"
|
|
3818
|
+
},
|
|
3819
|
+
large: {
|
|
3820
|
+
checkbox: "w-6 h-6",
|
|
3821
|
+
// 24px x 24px
|
|
3822
|
+
textSize: "lg",
|
|
3823
|
+
spacing: "gap-2",
|
|
3824
|
+
// 8px
|
|
3825
|
+
borderWidth: "border-[3px]",
|
|
3826
|
+
// 3px border
|
|
3827
|
+
iconSize: 20,
|
|
3828
|
+
// pixels for Phosphor icons
|
|
3829
|
+
labelHeight: "h-[27px]"
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
3833
|
+
var STATE_CLASSES2 = {
|
|
3834
|
+
default: {
|
|
3835
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
3836
|
+
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
3837
|
+
},
|
|
3838
|
+
hovered: {
|
|
3839
|
+
unchecked: "border-border-500 bg-background",
|
|
3840
|
+
checked: "border-primary-800 bg-primary-800 text-text"
|
|
3841
|
+
},
|
|
3842
|
+
focused: {
|
|
3843
|
+
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
3844
|
+
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
3845
|
+
},
|
|
3846
|
+
invalid: {
|
|
3847
|
+
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
3848
|
+
checked: "border-error-700 bg-primary-950 text-text"
|
|
3849
|
+
},
|
|
3850
|
+
disabled: {
|
|
3851
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
3852
|
+
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
3853
|
+
}
|
|
3854
|
+
};
|
|
3855
|
+
var CheckBox = forwardRef7(
|
|
3856
|
+
({
|
|
3857
|
+
label,
|
|
3858
|
+
size = "medium",
|
|
3859
|
+
state = "default",
|
|
3860
|
+
indeterminate = false,
|
|
3861
|
+
errorMessage,
|
|
3862
|
+
helperText,
|
|
3863
|
+
className = "",
|
|
3864
|
+
labelClassName = "",
|
|
3865
|
+
checked: checkedProp,
|
|
3866
|
+
disabled,
|
|
3867
|
+
id,
|
|
3868
|
+
onChange,
|
|
3869
|
+
...props
|
|
3870
|
+
}, ref) => {
|
|
3871
|
+
const generatedId = useId4();
|
|
3872
|
+
const inputId = id ?? `checkbox-${generatedId}`;
|
|
3873
|
+
const [internalChecked, setInternalChecked] = useState4(false);
|
|
3874
|
+
const isControlled = checkedProp !== void 0;
|
|
3875
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
3876
|
+
const handleChange = (event) => {
|
|
3877
|
+
if (!isControlled) {
|
|
3878
|
+
setInternalChecked(event.target.checked);
|
|
3879
|
+
}
|
|
3880
|
+
onChange?.(event);
|
|
3881
|
+
};
|
|
3882
|
+
const currentState = disabled ? "disabled" : state;
|
|
3883
|
+
const sizeClasses = SIZE_CLASSES9[size];
|
|
3884
|
+
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
3885
|
+
const stylingClasses = STATE_CLASSES2[currentState][checkVariant];
|
|
3886
|
+
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
3887
|
+
const checkboxClasses = cn(
|
|
3888
|
+
BASE_CHECKBOX_CLASSES,
|
|
3889
|
+
sizeClasses.checkbox,
|
|
3890
|
+
borderWidthClass,
|
|
3891
|
+
stylingClasses,
|
|
3892
|
+
className
|
|
3893
|
+
);
|
|
3894
|
+
const renderIcon = () => {
|
|
3895
|
+
if (indeterminate) {
|
|
3896
|
+
return /* @__PURE__ */ jsx13(
|
|
3897
|
+
Minus,
|
|
3898
|
+
{
|
|
3899
|
+
size: sizeClasses.iconSize,
|
|
3900
|
+
weight: "bold",
|
|
3901
|
+
color: "currentColor"
|
|
3902
|
+
}
|
|
3903
|
+
);
|
|
3904
|
+
}
|
|
3905
|
+
if (checked) {
|
|
3906
|
+
return /* @__PURE__ */ jsx13(
|
|
3907
|
+
Check2,
|
|
3908
|
+
{
|
|
3909
|
+
size: sizeClasses.iconSize,
|
|
3910
|
+
weight: "bold",
|
|
3911
|
+
color: "currentColor"
|
|
3912
|
+
}
|
|
3913
|
+
);
|
|
3914
|
+
}
|
|
3915
|
+
return null;
|
|
3916
|
+
};
|
|
3917
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col", children: [
|
|
3918
|
+
/* @__PURE__ */ jsxs11(
|
|
3919
|
+
"div",
|
|
3920
|
+
{
|
|
3921
|
+
className: cn(
|
|
3922
|
+
"flex flex-row items-center",
|
|
3923
|
+
sizeClasses.spacing,
|
|
3924
|
+
disabled ? "opacity-40" : ""
|
|
3925
|
+
),
|
|
3926
|
+
children: [
|
|
3927
|
+
/* @__PURE__ */ jsx13(
|
|
3928
|
+
"input",
|
|
3929
|
+
{
|
|
3930
|
+
ref,
|
|
3931
|
+
type: "checkbox",
|
|
3932
|
+
id: inputId,
|
|
3933
|
+
checked,
|
|
3934
|
+
disabled,
|
|
3935
|
+
onChange: handleChange,
|
|
3936
|
+
className: "sr-only",
|
|
3937
|
+
...props
|
|
3938
|
+
}
|
|
3939
|
+
),
|
|
3940
|
+
/* @__PURE__ */ jsx13("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
3941
|
+
label && /* @__PURE__ */ jsx13(
|
|
3942
|
+
"div",
|
|
3943
|
+
{
|
|
3944
|
+
className: cn(
|
|
3945
|
+
"flex flex-row items-center",
|
|
3946
|
+
sizeClasses.labelHeight
|
|
3947
|
+
),
|
|
3948
|
+
children: /* @__PURE__ */ jsx13(
|
|
3949
|
+
Text_default,
|
|
3950
|
+
{
|
|
3951
|
+
as: "label",
|
|
3952
|
+
htmlFor: inputId,
|
|
3953
|
+
size: sizeClasses.textSize,
|
|
3954
|
+
weight: "normal",
|
|
3955
|
+
className: cn(
|
|
3956
|
+
"cursor-pointer select-none leading-[150%] flex items-center font-roboto",
|
|
3957
|
+
labelClassName
|
|
3958
|
+
),
|
|
3959
|
+
children: label
|
|
3960
|
+
}
|
|
3961
|
+
)
|
|
3962
|
+
}
|
|
3963
|
+
)
|
|
3964
|
+
]
|
|
3965
|
+
}
|
|
3966
|
+
),
|
|
3967
|
+
errorMessage && /* @__PURE__ */ jsx13(
|
|
3968
|
+
Text_default,
|
|
3969
|
+
{
|
|
3970
|
+
size: "sm",
|
|
3971
|
+
weight: "normal",
|
|
3972
|
+
className: "mt-1.5",
|
|
3973
|
+
color: "text-error-600",
|
|
3974
|
+
children: errorMessage
|
|
3975
|
+
}
|
|
3976
|
+
),
|
|
3977
|
+
helperText && !errorMessage && /* @__PURE__ */ jsx13(
|
|
3978
|
+
Text_default,
|
|
3979
|
+
{
|
|
3980
|
+
size: "sm",
|
|
3981
|
+
weight: "normal",
|
|
3982
|
+
className: "mt-1.5",
|
|
3983
|
+
color: "text-text-500",
|
|
3984
|
+
children: helperText
|
|
3985
|
+
}
|
|
3986
|
+
)
|
|
3987
|
+
] });
|
|
3988
|
+
}
|
|
3989
|
+
);
|
|
3990
|
+
CheckBox.displayName = "CheckBox";
|
|
3991
|
+
var CheckBox_default = CheckBox;
|
|
3992
|
+
|
|
3993
|
+
// src/components/CheckBox/CheckboxList.tsx
|
|
3994
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
3995
|
+
var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => create4((set, get) => ({
|
|
3996
|
+
values: defaultValues,
|
|
3997
|
+
setValues: (values) => {
|
|
3998
|
+
if (!get().disabled) {
|
|
3999
|
+
set({ values });
|
|
4000
|
+
get().onValuesChange?.(values);
|
|
4001
|
+
}
|
|
4002
|
+
},
|
|
4003
|
+
toggleValue: (value) => {
|
|
4004
|
+
if (!get().disabled) {
|
|
4005
|
+
const currentValues = get().values;
|
|
4006
|
+
const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
|
|
4007
|
+
set({ values: newValues });
|
|
4008
|
+
get().onValuesChange?.(newValues);
|
|
4009
|
+
}
|
|
4010
|
+
},
|
|
4011
|
+
onValuesChange,
|
|
4012
|
+
disabled,
|
|
4013
|
+
name
|
|
4014
|
+
}));
|
|
4015
|
+
var useCheckboxListStore = (externalStore) => {
|
|
4016
|
+
if (!externalStore) {
|
|
4017
|
+
throw new Error("CheckboxListItem must be used within a CheckboxList");
|
|
4018
|
+
}
|
|
4019
|
+
return externalStore;
|
|
4020
|
+
};
|
|
4021
|
+
var injectStore3 = (children, store) => Children3.map(children, (child) => {
|
|
4022
|
+
if (!isValidElement3(child)) return child;
|
|
4023
|
+
const typedChild = child;
|
|
4024
|
+
const shouldInject = typedChild.type === CheckboxListItem;
|
|
4025
|
+
return cloneElement3(typedChild, {
|
|
4026
|
+
...shouldInject ? { store } : {},
|
|
4027
|
+
...typedChild.props.children ? { children: injectStore3(typedChild.props.children, store) } : {}
|
|
4028
|
+
});
|
|
4029
|
+
});
|
|
4030
|
+
var CheckboxList = forwardRef8(
|
|
4031
|
+
({
|
|
4032
|
+
values: propValues,
|
|
4033
|
+
defaultValues = [],
|
|
4034
|
+
onValuesChange,
|
|
4035
|
+
name: propName,
|
|
4036
|
+
disabled = false,
|
|
4037
|
+
className = "",
|
|
4038
|
+
children,
|
|
4039
|
+
...props
|
|
4040
|
+
}, ref) => {
|
|
4041
|
+
const generatedId = useId5();
|
|
4042
|
+
const name = propName || `checkbox-list-${generatedId}`;
|
|
4043
|
+
const storeRef = useRef4(null);
|
|
4044
|
+
storeRef.current ??= createCheckboxListStore(
|
|
4045
|
+
name,
|
|
4046
|
+
defaultValues,
|
|
4047
|
+
disabled,
|
|
4048
|
+
onValuesChange
|
|
4049
|
+
);
|
|
4050
|
+
const store = storeRef.current;
|
|
4051
|
+
const { setValues } = useStore3(store, (s) => s);
|
|
4052
|
+
useEffect5(() => {
|
|
4053
|
+
const currentValues = store.getState().values;
|
|
4054
|
+
if (currentValues.length > 0 && onValuesChange) {
|
|
4055
|
+
onValuesChange(currentValues);
|
|
4056
|
+
}
|
|
4057
|
+
}, []);
|
|
4058
|
+
useEffect5(() => {
|
|
4059
|
+
if (propValues !== void 0) {
|
|
4060
|
+
setValues(propValues);
|
|
4061
|
+
}
|
|
4062
|
+
}, [propValues, setValues]);
|
|
4063
|
+
useEffect5(() => {
|
|
4064
|
+
store.setState({ disabled });
|
|
4065
|
+
}, [disabled, store]);
|
|
4066
|
+
return /* @__PURE__ */ jsx14(
|
|
4067
|
+
"div",
|
|
4068
|
+
{
|
|
4069
|
+
ref,
|
|
4070
|
+
className: cn("flex flex-col gap-2 w-full", className),
|
|
4071
|
+
"aria-label": name,
|
|
4072
|
+
...props,
|
|
4073
|
+
children: injectStore3(children, store)
|
|
4074
|
+
}
|
|
4075
|
+
);
|
|
4076
|
+
}
|
|
4077
|
+
);
|
|
4078
|
+
CheckboxList.displayName = "CheckboxList";
|
|
4079
|
+
var CheckboxListItem = forwardRef8(
|
|
4080
|
+
({
|
|
4081
|
+
value,
|
|
4082
|
+
store: externalStore,
|
|
4083
|
+
disabled: itemDisabled,
|
|
4084
|
+
size = "medium",
|
|
4085
|
+
state = "default",
|
|
4086
|
+
className = "",
|
|
4087
|
+
id,
|
|
4088
|
+
...props
|
|
4089
|
+
}, ref) => {
|
|
4090
|
+
const store = useCheckboxListStore(externalStore);
|
|
4091
|
+
const {
|
|
4092
|
+
values: groupValues,
|
|
4093
|
+
toggleValue,
|
|
4094
|
+
disabled: groupDisabled,
|
|
4095
|
+
name
|
|
4096
|
+
} = useStore3(store);
|
|
4097
|
+
const generatedId = useId5();
|
|
4098
|
+
const inputId = id ?? `checkbox-item-${generatedId}`;
|
|
4099
|
+
const isChecked = groupValues.includes(value);
|
|
4100
|
+
const isDisabled = groupDisabled || itemDisabled;
|
|
4101
|
+
const currentState = isDisabled ? "disabled" : state;
|
|
4102
|
+
return /* @__PURE__ */ jsx14(
|
|
4103
|
+
CheckBox_default,
|
|
4104
|
+
{
|
|
4105
|
+
ref,
|
|
4106
|
+
id: inputId,
|
|
4107
|
+
name,
|
|
4108
|
+
value,
|
|
4109
|
+
checked: isChecked,
|
|
4110
|
+
disabled: isDisabled,
|
|
4111
|
+
size,
|
|
4112
|
+
state: currentState,
|
|
4113
|
+
className,
|
|
4114
|
+
onChange: () => {
|
|
4115
|
+
if (!isDisabled) {
|
|
4116
|
+
toggleValue(value);
|
|
4117
|
+
}
|
|
4118
|
+
},
|
|
4119
|
+
...props
|
|
4120
|
+
}
|
|
4121
|
+
);
|
|
4122
|
+
}
|
|
4123
|
+
);
|
|
4124
|
+
CheckboxListItem.displayName = "CheckboxListItem";
|
|
4125
|
+
var CheckboxList_default = CheckboxList;
|
|
4126
|
+
|
|
4127
|
+
// src/components/MultipleChoice/MultipleChoice.tsx
|
|
4128
|
+
import { CheckCircle as CheckCircle3, XCircle as XCircle3, Check as Check3 } from "phosphor-react";
|
|
4129
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4130
|
+
var MultipleChoiceList = ({
|
|
4131
|
+
disabled = false,
|
|
4132
|
+
className = "",
|
|
4133
|
+
choices,
|
|
4134
|
+
name,
|
|
4135
|
+
selectedValues,
|
|
4136
|
+
onHandleSelectedValues,
|
|
4137
|
+
mode = "interactive"
|
|
4138
|
+
}) => {
|
|
4139
|
+
const [actualValue, setActualValue] = useState5(selectedValues);
|
|
4140
|
+
useEffect6(() => {
|
|
4141
|
+
setActualValue(selectedValues);
|
|
4142
|
+
}, [selectedValues]);
|
|
4143
|
+
const getStatusBadge = (status) => {
|
|
4144
|
+
switch (status) {
|
|
4145
|
+
case "correct":
|
|
4146
|
+
return /* @__PURE__ */ jsx15(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ jsx15(CheckCircle3, {}), children: "Resposta correta" });
|
|
4147
|
+
case "incorrect":
|
|
4148
|
+
return /* @__PURE__ */ jsx15(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ jsx15(XCircle3, {}), children: "Resposta incorreta" });
|
|
4149
|
+
default:
|
|
4150
|
+
return null;
|
|
4151
|
+
}
|
|
4152
|
+
};
|
|
4153
|
+
const getStatusStyles = (status) => {
|
|
4154
|
+
switch (status) {
|
|
4155
|
+
case "correct":
|
|
4156
|
+
return "bg-success-background border-success-300";
|
|
4157
|
+
case "incorrect":
|
|
4158
|
+
return "bg-error-background border-error-300";
|
|
4159
|
+
default:
|
|
4160
|
+
return `bg-background border-border-100`;
|
|
4161
|
+
}
|
|
4162
|
+
};
|
|
4163
|
+
const renderVisualCheckbox = (isSelected, isDisabled) => {
|
|
4164
|
+
const checkboxClasses = cn(
|
|
4165
|
+
"w-5 h-5 rounded border-2 cursor-default transition-all duration-200 flex items-center justify-center",
|
|
4166
|
+
isSelected ? "border-primary-950 bg-primary-950 text-text" : "border-border-400 bg-background",
|
|
4167
|
+
isDisabled && "opacity-40 cursor-not-allowed"
|
|
4168
|
+
);
|
|
4169
|
+
return /* @__PURE__ */ jsx15("div", { className: checkboxClasses, children: isSelected && /* @__PURE__ */ jsx15(Check3, { size: 16, weight: "bold" }) });
|
|
4170
|
+
};
|
|
4171
|
+
if (mode === "readonly") {
|
|
4172
|
+
return /* @__PURE__ */ jsx15("div", { className: cn("flex flex-col gap-2", className), children: choices.map((choice, i) => {
|
|
4173
|
+
const isSelected = actualValue?.includes(choice.value) || false;
|
|
4174
|
+
const statusStyles = getStatusStyles(choice.status);
|
|
4175
|
+
const statusBadge = getStatusBadge(choice.status);
|
|
4176
|
+
return /* @__PURE__ */ jsxs12(
|
|
4177
|
+
"div",
|
|
4178
|
+
{
|
|
4179
|
+
className: cn(
|
|
4180
|
+
"flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
|
|
4181
|
+
statusStyles,
|
|
4182
|
+
choice.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
4183
|
+
),
|
|
4184
|
+
children: [
|
|
4185
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
4186
|
+
renderVisualCheckbox(isSelected, choice.disabled || disabled),
|
|
4187
|
+
/* @__PURE__ */ jsx15(
|
|
4188
|
+
"span",
|
|
4189
|
+
{
|
|
4190
|
+
className: cn(
|
|
4191
|
+
"flex-1",
|
|
4192
|
+
isSelected || choice.status && choice.status != "neutral" ? "text-text-950" : "text-text-600",
|
|
4193
|
+
choice.disabled || disabled ? "cursor-not-allowed" : "cursor-default"
|
|
4194
|
+
),
|
|
4195
|
+
children: choice.label
|
|
4196
|
+
}
|
|
4197
|
+
)
|
|
4198
|
+
] }),
|
|
4199
|
+
statusBadge && /* @__PURE__ */ jsx15("div", { className: "flex-shrink-0", children: statusBadge })
|
|
4200
|
+
]
|
|
4201
|
+
},
|
|
4202
|
+
`readonly-${choice.value}-${i}`
|
|
4203
|
+
);
|
|
4204
|
+
}) });
|
|
4205
|
+
}
|
|
4206
|
+
return /* @__PURE__ */ jsx15(
|
|
4207
|
+
"div",
|
|
4208
|
+
{
|
|
4209
|
+
className: cn(
|
|
4210
|
+
"flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
|
|
4211
|
+
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
4212
|
+
className
|
|
4213
|
+
),
|
|
4214
|
+
children: /* @__PURE__ */ jsx15(
|
|
4215
|
+
CheckboxList_default,
|
|
4216
|
+
{
|
|
4217
|
+
name,
|
|
4218
|
+
values: actualValue,
|
|
4219
|
+
onValuesChange: (v) => {
|
|
4220
|
+
setActualValue(v);
|
|
4221
|
+
onHandleSelectedValues?.(v);
|
|
4222
|
+
},
|
|
4223
|
+
disabled,
|
|
4224
|
+
children: choices.map((choice, i) => /* @__PURE__ */ jsxs12(
|
|
4225
|
+
"div",
|
|
4226
|
+
{
|
|
4227
|
+
className: "flex flex-row gap-2 items-center",
|
|
4228
|
+
children: [
|
|
4229
|
+
/* @__PURE__ */ jsx15(
|
|
4230
|
+
CheckboxListItem,
|
|
4231
|
+
{
|
|
4232
|
+
value: choice.value,
|
|
4233
|
+
id: `interactive-${choice.value}-${i}`,
|
|
4234
|
+
disabled: choice.disabled || disabled
|
|
4235
|
+
}
|
|
4236
|
+
),
|
|
4237
|
+
/* @__PURE__ */ jsx15(
|
|
4238
|
+
"label",
|
|
4239
|
+
{
|
|
4240
|
+
htmlFor: `interactive-${choice.value}-${i}`,
|
|
4241
|
+
className: cn(
|
|
4242
|
+
"flex-1",
|
|
4243
|
+
actualValue?.includes(choice.value) ? "text-text-950" : "text-text-600",
|
|
4244
|
+
choice.disabled || disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
4245
|
+
),
|
|
4246
|
+
children: choice.label
|
|
4247
|
+
}
|
|
4248
|
+
)
|
|
4249
|
+
]
|
|
4250
|
+
},
|
|
4251
|
+
`interactive-${choice.value}-${i}`
|
|
4252
|
+
))
|
|
4253
|
+
}
|
|
4254
|
+
)
|
|
4255
|
+
}
|
|
4256
|
+
);
|
|
4257
|
+
};
|
|
4258
|
+
|
|
3721
4259
|
// src/components/Quiz/Quiz.tsx
|
|
3722
|
-
import { Fragment as Fragment6, jsx as
|
|
3723
|
-
var Quiz =
|
|
3724
|
-
return /* @__PURE__ */
|
|
4260
|
+
import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4261
|
+
var Quiz = forwardRef9(({ children, className, ...props }, ref) => {
|
|
4262
|
+
return /* @__PURE__ */ jsx16(
|
|
3725
4263
|
"div",
|
|
3726
4264
|
{
|
|
3727
4265
|
ref,
|
|
@@ -3734,31 +4272,56 @@ var Quiz = forwardRef7(({ children, className, ...props }, ref) => {
|
|
|
3734
4272
|
}
|
|
3735
4273
|
);
|
|
3736
4274
|
});
|
|
3737
|
-
var QuizHeaderResult =
|
|
4275
|
+
var QuizHeaderResult = forwardRef9(
|
|
3738
4276
|
({ className, ...props }, ref) => {
|
|
3739
|
-
const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
|
|
4277
|
+
const { getCurrentQuestion, getCurrentAnswer, getAllCurrentAnswer } = useQuizStore();
|
|
3740
4278
|
const currentQuestion = getCurrentQuestion();
|
|
3741
4279
|
const userAnswer = getCurrentAnswer();
|
|
3742
|
-
const isCorrect =
|
|
3743
|
-
|
|
4280
|
+
const [isCorrect, setIsCorrect] = useState6(false);
|
|
4281
|
+
useEffect7(() => {
|
|
4282
|
+
if (currentQuestion?.type === "MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */) {
|
|
4283
|
+
const allCurrentAnswers = getAllCurrentAnswer();
|
|
4284
|
+
const isCorrectOption = currentQuestion.options.filter(
|
|
4285
|
+
(op) => op.isCorrect
|
|
4286
|
+
);
|
|
4287
|
+
if (allCurrentAnswers?.length !== isCorrectOption.length) {
|
|
4288
|
+
setIsCorrect(false);
|
|
4289
|
+
return;
|
|
4290
|
+
}
|
|
4291
|
+
setIsCorrect(true);
|
|
4292
|
+
allCurrentAnswers.forEach((answer) => {
|
|
4293
|
+
const findInCorrectOptions = isCorrectOption.find(
|
|
4294
|
+
(op) => op.id === answer.optionId
|
|
4295
|
+
);
|
|
4296
|
+
if (!findInCorrectOptions) {
|
|
4297
|
+
setIsCorrect(false);
|
|
4298
|
+
}
|
|
4299
|
+
});
|
|
4300
|
+
} else {
|
|
4301
|
+
setIsCorrect(
|
|
4302
|
+
currentQuestion?.options.find((op) => op.id === userAnswer)?.isCorrect || false
|
|
4303
|
+
);
|
|
4304
|
+
}
|
|
4305
|
+
}, [currentQuestion, getAllCurrentAnswer]);
|
|
4306
|
+
return /* @__PURE__ */ jsxs13(
|
|
3744
4307
|
"div",
|
|
3745
4308
|
{
|
|
3746
4309
|
ref,
|
|
3747
4310
|
className: cn(
|
|
3748
|
-
"flex flex-row items-center gap-10 p-3.5 rounded-xl",
|
|
4311
|
+
"flex flex-row items-center gap-10 p-3.5 rounded-xl mb-4",
|
|
3749
4312
|
isCorrect ? "bg-success-background" : "bg-error-background",
|
|
3750
4313
|
className
|
|
3751
4314
|
),
|
|
3752
4315
|
...props,
|
|
3753
4316
|
children: [
|
|
3754
|
-
/* @__PURE__ */
|
|
3755
|
-
/* @__PURE__ */
|
|
4317
|
+
/* @__PURE__ */ jsx16("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
|
|
4318
|
+
/* @__PURE__ */ jsx16("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
|
|
3756
4319
|
]
|
|
3757
4320
|
}
|
|
3758
4321
|
);
|
|
3759
4322
|
}
|
|
3760
4323
|
);
|
|
3761
|
-
var QuizTitle =
|
|
4324
|
+
var QuizTitle = forwardRef9(
|
|
3762
4325
|
({ className, ...props }, ref) => {
|
|
3763
4326
|
const {
|
|
3764
4327
|
currentQuestionIndex,
|
|
@@ -3770,7 +4333,7 @@ var QuizTitle = forwardRef7(
|
|
|
3770
4333
|
} = useQuizStore();
|
|
3771
4334
|
const totalQuestions = getTotalQuestions();
|
|
3772
4335
|
const quizTitle = getQuizTitle();
|
|
3773
|
-
return /* @__PURE__ */
|
|
4336
|
+
return /* @__PURE__ */ jsxs13(
|
|
3774
4337
|
"div",
|
|
3775
4338
|
{
|
|
3776
4339
|
ref,
|
|
@@ -3780,11 +4343,11 @@ var QuizTitle = forwardRef7(
|
|
|
3780
4343
|
),
|
|
3781
4344
|
...props,
|
|
3782
4345
|
children: [
|
|
3783
|
-
/* @__PURE__ */
|
|
3784
|
-
/* @__PURE__ */
|
|
3785
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex flex-col gap-2 text-center", children: [
|
|
4347
|
+
/* @__PURE__ */ jsx16("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
|
|
4348
|
+
/* @__PURE__ */ jsx16("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
|
|
3786
4349
|
] }),
|
|
3787
|
-
/* @__PURE__ */
|
|
4350
|
+
/* @__PURE__ */ jsx16("span", { className: "absolute right-2", children: /* @__PURE__ */ jsx16(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx16(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
|
|
3788
4351
|
]
|
|
3789
4352
|
}
|
|
3790
4353
|
);
|
|
@@ -3793,7 +4356,7 @@ var QuizTitle = forwardRef7(
|
|
|
3793
4356
|
var QuizHeader = () => {
|
|
3794
4357
|
const { getCurrentQuestion } = useQuizStore();
|
|
3795
4358
|
const currentQuestion = getCurrentQuestion();
|
|
3796
|
-
return /* @__PURE__ */
|
|
4359
|
+
return /* @__PURE__ */ jsx16(
|
|
3797
4360
|
HeaderAlternative,
|
|
3798
4361
|
{
|
|
3799
4362
|
title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
|
|
@@ -3802,10 +4365,12 @@ var QuizHeader = () => {
|
|
|
3802
4365
|
}
|
|
3803
4366
|
);
|
|
3804
4367
|
};
|
|
3805
|
-
var QuizContent =
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
4368
|
+
var QuizContent = forwardRef9(({ type = "Alternativas", className, variant, ...props }, ref) => {
|
|
4369
|
+
const { getCurrentQuestion } = useQuizStore();
|
|
4370
|
+
const currentQuestion = getCurrentQuestion();
|
|
4371
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
4372
|
+
/* @__PURE__ */ jsx16("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx16("p", { className: "font-bold text-lg text-text-950", children: type }) }),
|
|
4373
|
+
/* @__PURE__ */ jsx16(
|
|
3809
4374
|
"div",
|
|
3810
4375
|
{
|
|
3811
4376
|
ref,
|
|
@@ -3814,7 +4379,11 @@ var QuizContent = forwardRef7(({ type = "Alternativas", children, className, ...
|
|
|
3814
4379
|
className
|
|
3815
4380
|
),
|
|
3816
4381
|
...props,
|
|
3817
|
-
children
|
|
4382
|
+
children: currentQuestion && /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
4383
|
+
currentQuestion.type === "ALTERNATIVA" /* ALTERNATIVA */ && /* @__PURE__ */ jsx16(QuizAlternative, { variant }),
|
|
4384
|
+
currentQuestion.type === "MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */ && /* @__PURE__ */ jsx16(QuizMultipleChoice, { variant }),
|
|
4385
|
+
currentQuestion.type === "DISSERTATIVA" /* DISSERTATIVA */ && /* @__PURE__ */ jsx16("div", { children: "Componente de dissertativa" })
|
|
4386
|
+
] })
|
|
3818
4387
|
}
|
|
3819
4388
|
)
|
|
3820
4389
|
] });
|
|
@@ -3826,9 +4395,12 @@ var QuizAlternative = ({ variant = "default" }) => {
|
|
|
3826
4395
|
const alternatives = currentQuestion?.options?.map((option) => {
|
|
3827
4396
|
let status = "neutral" /* NEUTRAL */;
|
|
3828
4397
|
if (variant === "result") {
|
|
3829
|
-
|
|
4398
|
+
const isCorrectOption = currentQuestion.options.find(
|
|
4399
|
+
(op) => op.isCorrect
|
|
4400
|
+
);
|
|
4401
|
+
if (isCorrectOption?.id === option.id) {
|
|
3830
4402
|
status = "correct" /* CORRECT */;
|
|
3831
|
-
} else if (currentAnswer === option.id && option.id !==
|
|
4403
|
+
} else if (currentAnswer === option.id && option.id !== isCorrectOption?.id) {
|
|
3832
4404
|
status = "incorrect" /* INCORRECT */;
|
|
3833
4405
|
}
|
|
3834
4406
|
}
|
|
@@ -3839,8 +4411,8 @@ var QuizAlternative = ({ variant = "default" }) => {
|
|
|
3839
4411
|
};
|
|
3840
4412
|
});
|
|
3841
4413
|
if (!alternatives)
|
|
3842
|
-
return /* @__PURE__ */
|
|
3843
|
-
return /* @__PURE__ */
|
|
4414
|
+
return /* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16("p", { children: "N\xE3o h\xE1 Alternativas" }) });
|
|
4415
|
+
return /* @__PURE__ */ jsx16("div", { className: "space-y-4", children: /* @__PURE__ */ jsx16(
|
|
3844
4416
|
AlternativesList,
|
|
3845
4417
|
{
|
|
3846
4418
|
mode: variant === "default" ? "interactive" : "readonly",
|
|
@@ -3858,6 +4430,77 @@ var QuizAlternative = ({ variant = "default" }) => {
|
|
|
3858
4430
|
`question-${currentQuestion?.id || "1"}`
|
|
3859
4431
|
) });
|
|
3860
4432
|
};
|
|
4433
|
+
var QuizMultipleChoice = ({
|
|
4434
|
+
variant = "default"
|
|
4435
|
+
}) => {
|
|
4436
|
+
const { getCurrentQuestion, selectMultipleAnswer, getAllCurrentAnswer } = useQuizStore();
|
|
4437
|
+
const currentQuestion = getCurrentQuestion();
|
|
4438
|
+
const allCurrentAnswers = getAllCurrentAnswer();
|
|
4439
|
+
const prevSelectedValuesRef = useRef5([]);
|
|
4440
|
+
const prevQuestionIdRef = useRef5("");
|
|
4441
|
+
const allCurrentAnswerIds = useMemo(() => {
|
|
4442
|
+
return allCurrentAnswers?.map((answer) => answer.optionId) || [];
|
|
4443
|
+
}, [allCurrentAnswers]);
|
|
4444
|
+
const selectedValues = useMemo(() => {
|
|
4445
|
+
return allCurrentAnswerIds?.filter((id) => id !== null) || [];
|
|
4446
|
+
}, [allCurrentAnswerIds]);
|
|
4447
|
+
const stableSelectedValues = useMemo(() => {
|
|
4448
|
+
const currentQuestionId = currentQuestion?.id || "";
|
|
4449
|
+
const hasQuestionChanged = prevQuestionIdRef.current !== currentQuestionId;
|
|
4450
|
+
if (hasQuestionChanged) {
|
|
4451
|
+
prevQuestionIdRef.current = currentQuestionId;
|
|
4452
|
+
prevSelectedValuesRef.current = selectedValues;
|
|
4453
|
+
return selectedValues;
|
|
4454
|
+
}
|
|
4455
|
+
const hasValuesChanged = JSON.stringify(prevSelectedValuesRef.current) !== JSON.stringify(selectedValues);
|
|
4456
|
+
if (hasValuesChanged) {
|
|
4457
|
+
prevSelectedValuesRef.current = selectedValues;
|
|
4458
|
+
return selectedValues;
|
|
4459
|
+
}
|
|
4460
|
+
return prevSelectedValuesRef.current;
|
|
4461
|
+
}, [selectedValues, currentQuestion?.id]);
|
|
4462
|
+
const handleSelectedValues = useCallback(
|
|
4463
|
+
(values) => {
|
|
4464
|
+
if (currentQuestion) {
|
|
4465
|
+
selectMultipleAnswer(currentQuestion.id, values);
|
|
4466
|
+
}
|
|
4467
|
+
},
|
|
4468
|
+
[currentQuestion, selectMultipleAnswer]
|
|
4469
|
+
);
|
|
4470
|
+
const questionKey = useMemo(
|
|
4471
|
+
() => `question-${currentQuestion?.id || "1"}`,
|
|
4472
|
+
[currentQuestion?.id]
|
|
4473
|
+
);
|
|
4474
|
+
const choices = currentQuestion?.options?.map((option) => {
|
|
4475
|
+
let status = "neutral" /* NEUTRAL */;
|
|
4476
|
+
if (variant === "result") {
|
|
4477
|
+
const isAllCorrectOptionId = currentQuestion.options.filter((op) => op.isCorrect).map((op) => op.id);
|
|
4478
|
+
if (isAllCorrectOptionId.includes(option.id)) {
|
|
4479
|
+
status = "correct" /* CORRECT */;
|
|
4480
|
+
} else if (allCurrentAnswerIds?.includes(option.id) && !isAllCorrectOptionId.includes(option.id)) {
|
|
4481
|
+
status = "incorrect" /* INCORRECT */;
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4484
|
+
return {
|
|
4485
|
+
label: option.option,
|
|
4486
|
+
value: option.id,
|
|
4487
|
+
status
|
|
4488
|
+
};
|
|
4489
|
+
});
|
|
4490
|
+
if (!choices)
|
|
4491
|
+
return /* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16("p", { children: "N\xE3o h\xE1 Escolhas Multiplas" }) });
|
|
4492
|
+
return /* @__PURE__ */ jsx16("div", { className: "space-y-4", children: /* @__PURE__ */ jsx16(
|
|
4493
|
+
MultipleChoiceList,
|
|
4494
|
+
{
|
|
4495
|
+
choices,
|
|
4496
|
+
name: questionKey,
|
|
4497
|
+
selectedValues: stableSelectedValues,
|
|
4498
|
+
onHandleSelectedValues: handleSelectedValues,
|
|
4499
|
+
mode: variant === "default" ? "interactive" : "readonly"
|
|
4500
|
+
},
|
|
4501
|
+
questionKey
|
|
4502
|
+
) });
|
|
4503
|
+
};
|
|
3861
4504
|
var QuizQuestionList = ({
|
|
3862
4505
|
filterType = "all",
|
|
3863
4506
|
onQuestionClick
|
|
@@ -3909,16 +4552,16 @@ var QuizQuestionList = ({
|
|
|
3909
4552
|
return "Em branco";
|
|
3910
4553
|
}
|
|
3911
4554
|
};
|
|
3912
|
-
return /* @__PURE__ */
|
|
3913
|
-
([subjectId, questions]) => /* @__PURE__ */
|
|
3914
|
-
/* @__PURE__ */
|
|
3915
|
-
/* @__PURE__ */
|
|
3916
|
-
/* @__PURE__ */
|
|
4555
|
+
return /* @__PURE__ */ jsx16("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
|
|
4556
|
+
([subjectId, questions]) => /* @__PURE__ */ jsxs13("section", { className: "flex flex-col gap-2", children: [
|
|
4557
|
+
/* @__PURE__ */ jsxs13("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
|
|
4558
|
+
/* @__PURE__ */ jsx16("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ jsx16(BookOpen, { size: 17, className: "text-white" }) }),
|
|
4559
|
+
/* @__PURE__ */ jsx16("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
|
|
3917
4560
|
] }),
|
|
3918
|
-
/* @__PURE__ */
|
|
4561
|
+
/* @__PURE__ */ jsx16("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
|
|
3919
4562
|
const status = getQuestionStatus(question.id);
|
|
3920
4563
|
const questionNumber = getQuestionIndex(question.id);
|
|
3921
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ jsx16(
|
|
3922
4565
|
CardStatus,
|
|
3923
4566
|
{
|
|
3924
4567
|
header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
|
|
@@ -3934,236 +4577,255 @@ var QuizQuestionList = ({
|
|
|
3934
4577
|
] }, subjectId)
|
|
3935
4578
|
) });
|
|
3936
4579
|
};
|
|
3937
|
-
var QuizFooter =
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
4580
|
+
var QuizFooter = forwardRef9(
|
|
4581
|
+
({
|
|
4582
|
+
className,
|
|
4583
|
+
onGoToSimulated,
|
|
4584
|
+
onDetailResult,
|
|
4585
|
+
variant = "default",
|
|
4586
|
+
...props
|
|
4587
|
+
}, ref) => {
|
|
4588
|
+
const {
|
|
4589
|
+
currentQuestionIndex,
|
|
4590
|
+
getUserAnswers,
|
|
4591
|
+
getTotalQuestions,
|
|
4592
|
+
goToNextQuestion,
|
|
4593
|
+
goToPreviousQuestion,
|
|
4594
|
+
getUnansweredQuestionsFromUserAnswers,
|
|
4595
|
+
getCurrentAnswer,
|
|
4596
|
+
skipQuestion,
|
|
4597
|
+
getCurrentQuestion,
|
|
4598
|
+
getQuestionStatusFromUserAnswers,
|
|
4599
|
+
getActiveQuiz
|
|
4600
|
+
} = useQuizStore();
|
|
4601
|
+
const totalQuestions = getTotalQuestions();
|
|
4602
|
+
const isFirstQuestion = currentQuestionIndex === 0;
|
|
4603
|
+
const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
|
|
4604
|
+
const currentAnswer = getCurrentAnswer();
|
|
4605
|
+
const currentQuestion = getCurrentQuestion();
|
|
4606
|
+
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
4607
|
+
const [alertDialogOpen, setAlertDialogOpen] = useState6(false);
|
|
4608
|
+
const [modalResultOpen, setModalResultOpen] = useState6(false);
|
|
4609
|
+
const [modalNavigateOpen, setModalNavigateOpen] = useState6(false);
|
|
4610
|
+
const [filterType, setFilterType] = useState6("all");
|
|
4611
|
+
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
4612
|
+
const userAnswers = getUserAnswers();
|
|
4613
|
+
const allQuestions = getTotalQuestions();
|
|
4614
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
4615
|
+
/* @__PURE__ */ jsx16(
|
|
4616
|
+
"footer",
|
|
4617
|
+
{
|
|
4618
|
+
ref,
|
|
4619
|
+
className: cn(
|
|
4620
|
+
"w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center",
|
|
4621
|
+
className
|
|
4622
|
+
),
|
|
4623
|
+
...props,
|
|
4624
|
+
children: variant === "default" ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
4625
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-row items-center gap-1", children: [
|
|
4626
|
+
/* @__PURE__ */ jsx16(
|
|
4627
|
+
IconButton_default,
|
|
4628
|
+
{
|
|
4629
|
+
icon: /* @__PURE__ */ jsx16(SquaresFour, { size: 24, className: "text-text-950" }),
|
|
4630
|
+
size: "md",
|
|
4631
|
+
onClick: () => setModalNavigateOpen(true)
|
|
4632
|
+
}
|
|
4633
|
+
),
|
|
4634
|
+
isFirstQuestion ? /* @__PURE__ */ jsx16(
|
|
4635
|
+
Button_default,
|
|
4636
|
+
{
|
|
4637
|
+
variant: "outline",
|
|
4638
|
+
size: "small",
|
|
4639
|
+
onClick: () => {
|
|
4640
|
+
skipQuestion();
|
|
4641
|
+
goToNextQuestion();
|
|
4642
|
+
},
|
|
4643
|
+
children: "Pular"
|
|
4644
|
+
}
|
|
4645
|
+
) : /* @__PURE__ */ jsx16(
|
|
4646
|
+
Button_default,
|
|
4647
|
+
{
|
|
4648
|
+
size: "medium",
|
|
4649
|
+
variant: "link",
|
|
4650
|
+
action: "primary",
|
|
4651
|
+
iconLeft: /* @__PURE__ */ jsx16(CaretLeft, { size: 18 }),
|
|
4652
|
+
onClick: () => {
|
|
4653
|
+
goToPreviousQuestion();
|
|
4654
|
+
},
|
|
4655
|
+
children: "Voltar"
|
|
4656
|
+
}
|
|
4657
|
+
)
|
|
4658
|
+
] }),
|
|
4659
|
+
!isFirstQuestion && /* @__PURE__ */ jsx16(
|
|
3984
4660
|
Button_default,
|
|
3985
4661
|
{
|
|
3986
|
-
variant: "outline",
|
|
3987
4662
|
size: "small",
|
|
4663
|
+
variant: "outline",
|
|
4664
|
+
action: "primary",
|
|
3988
4665
|
onClick: () => {
|
|
3989
4666
|
skipQuestion();
|
|
3990
4667
|
goToNextQuestion();
|
|
3991
4668
|
},
|
|
3992
4669
|
children: "Pular"
|
|
3993
4670
|
}
|
|
3994
|
-
)
|
|
4671
|
+
),
|
|
4672
|
+
isLastQuestion ? /* @__PURE__ */ jsx16(
|
|
4673
|
+
Button_default,
|
|
4674
|
+
{
|
|
4675
|
+
size: "medium",
|
|
4676
|
+
variant: "solid",
|
|
4677
|
+
action: "primary",
|
|
4678
|
+
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
4679
|
+
onClick: () => {
|
|
4680
|
+
if (unansweredQuestions.length > 0) {
|
|
4681
|
+
setAlertDialogOpen(true);
|
|
4682
|
+
} else {
|
|
4683
|
+
setModalResultOpen(true);
|
|
4684
|
+
}
|
|
4685
|
+
},
|
|
4686
|
+
children: "Finalizar"
|
|
4687
|
+
}
|
|
4688
|
+
) : /* @__PURE__ */ jsx16(
|
|
3995
4689
|
Button_default,
|
|
3996
4690
|
{
|
|
3997
4691
|
size: "medium",
|
|
3998
4692
|
variant: "link",
|
|
3999
4693
|
action: "primary",
|
|
4000
|
-
|
|
4694
|
+
iconRight: /* @__PURE__ */ jsx16(CaretRight2, { size: 18 }),
|
|
4695
|
+
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
4001
4696
|
onClick: () => {
|
|
4002
|
-
|
|
4697
|
+
goToNextQuestion();
|
|
4003
4698
|
},
|
|
4004
|
-
children: "
|
|
4699
|
+
children: "Avan\xE7ar"
|
|
4005
4700
|
}
|
|
4006
4701
|
)
|
|
4007
|
-
] }),
|
|
4008
|
-
!isFirstQuestion && /* @__PURE__ */ jsx13(
|
|
4009
|
-
Button_default,
|
|
4010
|
-
{
|
|
4011
|
-
size: "small",
|
|
4012
|
-
variant: "outline",
|
|
4013
|
-
action: "primary",
|
|
4014
|
-
onClick: () => {
|
|
4015
|
-
skipQuestion();
|
|
4016
|
-
goToNextQuestion();
|
|
4017
|
-
},
|
|
4018
|
-
children: "Pular"
|
|
4019
|
-
}
|
|
4020
|
-
),
|
|
4021
|
-
isLastQuestion ? /* @__PURE__ */ jsx13(
|
|
4022
|
-
Button_default,
|
|
4023
|
-
{
|
|
4024
|
-
size: "medium",
|
|
4025
|
-
variant: "solid",
|
|
4026
|
-
action: "primary",
|
|
4027
|
-
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
4028
|
-
onClick: () => {
|
|
4029
|
-
if (unansweredQuestions.length > 0) {
|
|
4030
|
-
setAlertDialogOpen(true);
|
|
4031
|
-
} else {
|
|
4032
|
-
setModalResultOpen(true);
|
|
4033
|
-
}
|
|
4034
|
-
},
|
|
4035
|
-
children: "Finalizar"
|
|
4036
|
-
}
|
|
4037
|
-
) : /* @__PURE__ */ jsx13(
|
|
4038
|
-
Button_default,
|
|
4039
|
-
{
|
|
4040
|
-
size: "medium",
|
|
4041
|
-
variant: "link",
|
|
4042
|
-
action: "primary",
|
|
4043
|
-
iconRight: /* @__PURE__ */ jsx13(CaretRight2, { size: 18 }),
|
|
4044
|
-
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
4045
|
-
onClick: () => {
|
|
4046
|
-
goToNextQuestion();
|
|
4047
|
-
},
|
|
4048
|
-
children: "Avan\xE7ar"
|
|
4049
|
-
}
|
|
4050
|
-
)
|
|
4051
|
-
]
|
|
4052
|
-
}
|
|
4053
|
-
),
|
|
4054
|
-
/* @__PURE__ */ jsx13(
|
|
4055
|
-
AlertDialog,
|
|
4056
|
-
{
|
|
4057
|
-
isOpen: alertDialogOpen,
|
|
4058
|
-
onChangeOpen: setAlertDialogOpen,
|
|
4059
|
-
title: "Finalizar simulado?",
|
|
4060
|
-
description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
|
|
4061
|
-
cancelButtonLabel: "Voltar e revisar",
|
|
4062
|
-
submitButtonLabel: "Finalizar Mesmo Assim",
|
|
4063
|
-
onSubmit: () => {
|
|
4064
|
-
setModalResultOpen(true);
|
|
4702
|
+
] }) : /* @__PURE__ */ jsx16("div", { className: "flex flex-row items-center justify-end w-full", children: /* @__PURE__ */ jsx16(Button_default, { variant: "solid", action: "primary", size: "medium", children: "Ver Resolu\xE7\xE3o" }) })
|
|
4065
4703
|
}
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
).length,
|
|
4095
|
-
" ",
|
|
4096
|
-
"de ",
|
|
4097
|
-
allQuestions,
|
|
4098
|
-
" quest\xF5es."
|
|
4099
|
-
] })
|
|
4100
|
-
] }),
|
|
4101
|
-
/* @__PURE__ */ jsxs11("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
|
|
4102
|
-
/* @__PURE__ */ jsx13(
|
|
4103
|
-
Button_default,
|
|
4704
|
+
),
|
|
4705
|
+
/* @__PURE__ */ jsx16(
|
|
4706
|
+
AlertDialog,
|
|
4707
|
+
{
|
|
4708
|
+
isOpen: alertDialogOpen,
|
|
4709
|
+
onChangeOpen: setAlertDialogOpen,
|
|
4710
|
+
title: "Finalizar simulado?",
|
|
4711
|
+
description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
|
|
4712
|
+
cancelButtonLabel: "Voltar e revisar",
|
|
4713
|
+
submitButtonLabel: "Finalizar Mesmo Assim",
|
|
4714
|
+
onSubmit: () => {
|
|
4715
|
+
setModalResultOpen(true);
|
|
4716
|
+
}
|
|
4717
|
+
}
|
|
4718
|
+
),
|
|
4719
|
+
/* @__PURE__ */ jsx16(
|
|
4720
|
+
Modal_default,
|
|
4721
|
+
{
|
|
4722
|
+
isOpen: modalResultOpen,
|
|
4723
|
+
onClose: () => setModalResultOpen(false),
|
|
4724
|
+
title: "",
|
|
4725
|
+
closeOnBackdropClick: false,
|
|
4726
|
+
closeOnEscape: false,
|
|
4727
|
+
hideCloseButton: true,
|
|
4728
|
+
size: "md",
|
|
4729
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
4730
|
+
/* @__PURE__ */ jsx16(
|
|
4731
|
+
"img",
|
|
4104
4732
|
{
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
onClick: onGoToSimulated,
|
|
4109
|
-
children: "Ir para simulados"
|
|
4733
|
+
src: simulated_result_default,
|
|
4734
|
+
alt: "Simulated Result",
|
|
4735
|
+
className: "w-[282px] h-auto object-cover"
|
|
4110
4736
|
}
|
|
4111
4737
|
),
|
|
4112
|
-
/* @__PURE__ */
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4738
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
4739
|
+
/* @__PURE__ */ jsx16("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
|
|
4740
|
+
/* @__PURE__ */ jsxs13("p", { className: "text-text-500 font-sm", children: [
|
|
4741
|
+
"Voc\xEA acertou",
|
|
4742
|
+
" ",
|
|
4743
|
+
(() => {
|
|
4744
|
+
const activeQuiz = getActiveQuiz();
|
|
4745
|
+
if (!activeQuiz) return 0;
|
|
4746
|
+
return userAnswers.filter((answer) => {
|
|
4747
|
+
const question = activeQuiz.quiz.questions.find(
|
|
4748
|
+
(q) => q.id === answer.questionId
|
|
4749
|
+
);
|
|
4750
|
+
const isCorrectOption = question?.options.find(
|
|
4751
|
+
(op) => op.isCorrect
|
|
4752
|
+
);
|
|
4753
|
+
return question && answer.optionId === isCorrectOption?.id;
|
|
4754
|
+
}).length;
|
|
4755
|
+
})(),
|
|
4756
|
+
" ",
|
|
4757
|
+
"de ",
|
|
4758
|
+
allQuestions,
|
|
4759
|
+
" quest\xF5es."
|
|
4133
4760
|
] })
|
|
4134
|
-
] })
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
})
|
|
4148
|
-
|
|
4761
|
+
] }),
|
|
4762
|
+
/* @__PURE__ */ jsxs13("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
|
|
4763
|
+
/* @__PURE__ */ jsx16(
|
|
4764
|
+
Button_default,
|
|
4765
|
+
{
|
|
4766
|
+
variant: "outline",
|
|
4767
|
+
className: "w-full",
|
|
4768
|
+
size: "small",
|
|
4769
|
+
onClick: onGoToSimulated,
|
|
4770
|
+
children: "Ir para simulados"
|
|
4771
|
+
}
|
|
4772
|
+
),
|
|
4773
|
+
/* @__PURE__ */ jsx16(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
|
|
4774
|
+
] })
|
|
4775
|
+
] })
|
|
4776
|
+
}
|
|
4777
|
+
),
|
|
4778
|
+
/* @__PURE__ */ jsx16(
|
|
4779
|
+
Modal_default,
|
|
4780
|
+
{
|
|
4781
|
+
isOpen: modalNavigateOpen,
|
|
4782
|
+
onClose: () => setModalNavigateOpen(false),
|
|
4783
|
+
title: "Quest\xF5es",
|
|
4784
|
+
size: "lg",
|
|
4785
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col w-full h-full", children: [
|
|
4786
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
|
|
4787
|
+
/* @__PURE__ */ jsx16("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
|
|
4788
|
+
/* @__PURE__ */ jsx16("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs13(Select_default, { value: filterType, onValueChange: setFilterType, children: [
|
|
4789
|
+
/* @__PURE__ */ jsx16(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ jsx16(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
|
|
4790
|
+
/* @__PURE__ */ jsxs13(SelectContent, { children: [
|
|
4791
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "all", children: "Todas" }),
|
|
4792
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "unanswered", children: "Em branco" }),
|
|
4793
|
+
/* @__PURE__ */ jsx16(SelectItem, { value: "answered", children: "Respondidas" })
|
|
4794
|
+
] })
|
|
4795
|
+
] }) })
|
|
4796
|
+
] }),
|
|
4797
|
+
/* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx16(
|
|
4798
|
+
QuizQuestionList,
|
|
4799
|
+
{
|
|
4800
|
+
filterType,
|
|
4801
|
+
onQuestionClick: () => setModalNavigateOpen(false)
|
|
4802
|
+
}
|
|
4803
|
+
) })
|
|
4804
|
+
] })
|
|
4805
|
+
}
|
|
4806
|
+
)
|
|
4807
|
+
] });
|
|
4808
|
+
}
|
|
4809
|
+
);
|
|
4810
|
+
var QuizResultHeaderTitle = forwardRef9(({ className, ...props }, ref) => {
|
|
4149
4811
|
const { bySimulated } = useQuizStore();
|
|
4150
|
-
return /* @__PURE__ */
|
|
4812
|
+
return /* @__PURE__ */ jsxs13(
|
|
4151
4813
|
"div",
|
|
4152
4814
|
{
|
|
4153
4815
|
ref,
|
|
4154
4816
|
className: cn("flex flex-row pt-4 justify-between", className),
|
|
4155
4817
|
...props,
|
|
4156
4818
|
children: [
|
|
4157
|
-
/* @__PURE__ */
|
|
4158
|
-
bySimulated && /* @__PURE__ */
|
|
4819
|
+
/* @__PURE__ */ jsx16("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
|
|
4820
|
+
bySimulated && /* @__PURE__ */ jsx16(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
|
|
4159
4821
|
]
|
|
4160
4822
|
}
|
|
4161
4823
|
);
|
|
4162
4824
|
});
|
|
4163
|
-
var QuizResultTitle =
|
|
4825
|
+
var QuizResultTitle = forwardRef9(({ className, ...props }, ref) => {
|
|
4164
4826
|
const { getQuizTitle } = useQuizStore();
|
|
4165
4827
|
const quizTitle = getQuizTitle();
|
|
4166
|
-
return /* @__PURE__ */
|
|
4828
|
+
return /* @__PURE__ */ jsx16(
|
|
4167
4829
|
"p",
|
|
4168
4830
|
{
|
|
4169
4831
|
className: cn("pt-6 pb-4 text-text-950 font-bold text-lg", className),
|
|
@@ -4173,7 +4835,7 @@ var QuizResultTitle = forwardRef7(({ className, ...props }, ref) => {
|
|
|
4173
4835
|
}
|
|
4174
4836
|
);
|
|
4175
4837
|
});
|
|
4176
|
-
var QuizResultPerformance =
|
|
4838
|
+
var QuizResultPerformance = forwardRef9(
|
|
4177
4839
|
({ ...props }, ref) => {
|
|
4178
4840
|
const {
|
|
4179
4841
|
getTotalQuestions,
|
|
@@ -4181,7 +4843,8 @@ var QuizResultPerformance = forwardRef7(
|
|
|
4181
4843
|
formatTime,
|
|
4182
4844
|
bySimulated,
|
|
4183
4845
|
byActivity,
|
|
4184
|
-
byQuestionary
|
|
4846
|
+
byQuestionary,
|
|
4847
|
+
getUserAnswerByQuestionId
|
|
4185
4848
|
} = useQuizStore();
|
|
4186
4849
|
const totalQuestions = getTotalQuestions();
|
|
4187
4850
|
const quiz = bySimulated || byActivity || byQuestionary;
|
|
@@ -4194,8 +4857,10 @@ var QuizResultPerformance = forwardRef7(
|
|
|
4194
4857
|
let totalDifficultQuestions = 0;
|
|
4195
4858
|
if (quiz) {
|
|
4196
4859
|
quiz.questions.forEach((question) => {
|
|
4197
|
-
const
|
|
4198
|
-
const
|
|
4860
|
+
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
4861
|
+
const userAnswer = userAnswerItem?.optionId;
|
|
4862
|
+
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
4863
|
+
const isCorrect = userAnswer && userAnswer === isCorrectOption?.id;
|
|
4199
4864
|
if (isCorrect) {
|
|
4200
4865
|
correctAnswers++;
|
|
4201
4866
|
}
|
|
@@ -4218,15 +4883,15 @@ var QuizResultPerformance = forwardRef7(
|
|
|
4218
4883
|
});
|
|
4219
4884
|
}
|
|
4220
4885
|
const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
|
|
4221
|
-
return /* @__PURE__ */
|
|
4886
|
+
return /* @__PURE__ */ jsxs13(
|
|
4222
4887
|
"div",
|
|
4223
4888
|
{
|
|
4224
4889
|
className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
|
|
4225
4890
|
ref,
|
|
4226
4891
|
...props,
|
|
4227
4892
|
children: [
|
|
4228
|
-
/* @__PURE__ */
|
|
4229
|
-
/* @__PURE__ */
|
|
4893
|
+
/* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
4894
|
+
/* @__PURE__ */ jsx16(
|
|
4230
4895
|
ProgressCircle_default,
|
|
4231
4896
|
{
|
|
4232
4897
|
size: "medium",
|
|
@@ -4236,21 +4901,21 @@ var QuizResultPerformance = forwardRef7(
|
|
|
4236
4901
|
label: ""
|
|
4237
4902
|
}
|
|
4238
4903
|
),
|
|
4239
|
-
/* @__PURE__ */
|
|
4240
|
-
/* @__PURE__ */
|
|
4241
|
-
/* @__PURE__ */
|
|
4242
|
-
/* @__PURE__ */
|
|
4904
|
+
/* @__PURE__ */ jsxs13("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
4905
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1 mb-1", children: [
|
|
4906
|
+
/* @__PURE__ */ jsx16(Clock2, { size: 12, weight: "regular", className: "text-text-800" }),
|
|
4907
|
+
/* @__PURE__ */ jsx16("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
|
|
4243
4908
|
] }),
|
|
4244
|
-
/* @__PURE__ */
|
|
4909
|
+
/* @__PURE__ */ jsxs13("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
|
|
4245
4910
|
correctAnswers,
|
|
4246
4911
|
" de ",
|
|
4247
4912
|
totalQuestions
|
|
4248
4913
|
] }),
|
|
4249
|
-
/* @__PURE__ */
|
|
4914
|
+
/* @__PURE__ */ jsx16("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
|
|
4250
4915
|
] })
|
|
4251
4916
|
] }),
|
|
4252
|
-
/* @__PURE__ */
|
|
4253
|
-
/* @__PURE__ */
|
|
4917
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-4 w-full", children: [
|
|
4918
|
+
/* @__PURE__ */ jsx16(
|
|
4254
4919
|
ProgressBar_default,
|
|
4255
4920
|
{
|
|
4256
4921
|
className: "w-full",
|
|
@@ -4264,7 +4929,7 @@ var QuizResultPerformance = forwardRef7(
|
|
|
4264
4929
|
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
4265
4930
|
}
|
|
4266
4931
|
),
|
|
4267
|
-
/* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsx16(
|
|
4268
4933
|
ProgressBar_default,
|
|
4269
4934
|
{
|
|
4270
4935
|
className: "w-full",
|
|
@@ -4278,7 +4943,7 @@ var QuizResultPerformance = forwardRef7(
|
|
|
4278
4943
|
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
4279
4944
|
}
|
|
4280
4945
|
),
|
|
4281
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsx16(
|
|
4282
4947
|
ProgressBar_default,
|
|
4283
4948
|
{
|
|
4284
4949
|
className: "w-full",
|
|
@@ -4298,8 +4963,12 @@ var QuizResultPerformance = forwardRef7(
|
|
|
4298
4963
|
);
|
|
4299
4964
|
}
|
|
4300
4965
|
);
|
|
4301
|
-
var QuizListResult =
|
|
4302
|
-
const {
|
|
4966
|
+
var QuizListResult = forwardRef9(({ className, onSubjectClick, ...props }, ref) => {
|
|
4967
|
+
const {
|
|
4968
|
+
getQuestionsGroupedBySubject,
|
|
4969
|
+
isQuestionAnswered,
|
|
4970
|
+
getUserAnswerByQuestionId
|
|
4971
|
+
} = useQuizStore();
|
|
4303
4972
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
4304
4973
|
const subjectsStats = Object.entries(groupedQuestions).map(
|
|
4305
4974
|
([subjectId, questions]) => {
|
|
@@ -4307,8 +4976,10 @@ var QuizListResult = forwardRef7(({ className, onSubjectClick, ...props }, ref)
|
|
|
4307
4976
|
let incorrect = 0;
|
|
4308
4977
|
questions.forEach((question) => {
|
|
4309
4978
|
if (isQuestionAnswered(question.id)) {
|
|
4310
|
-
const
|
|
4311
|
-
|
|
4979
|
+
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
4980
|
+
const userAnswer = userAnswerItem?.optionId;
|
|
4981
|
+
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
4982
|
+
if (userAnswer === isCorrectOption?.id) {
|
|
4312
4983
|
correct++;
|
|
4313
4984
|
} else {
|
|
4314
4985
|
incorrect++;
|
|
@@ -4323,9 +4994,9 @@ var QuizListResult = forwardRef7(({ className, onSubjectClick, ...props }, ref)
|
|
|
4323
4994
|
};
|
|
4324
4995
|
}
|
|
4325
4996
|
);
|
|
4326
|
-
return /* @__PURE__ */
|
|
4327
|
-
/* @__PURE__ */
|
|
4328
|
-
/* @__PURE__ */
|
|
4997
|
+
return /* @__PURE__ */ jsxs13("section", { ref, className, ...props, children: [
|
|
4998
|
+
/* @__PURE__ */ jsx16("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
|
|
4999
|
+
/* @__PURE__ */ jsx16("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsx16(
|
|
4329
5000
|
CardResults,
|
|
4330
5001
|
{
|
|
4331
5002
|
onClick: () => onSubjectClick?.(subject.subject),
|
|
@@ -4333,7 +5004,7 @@ var QuizListResult = forwardRef7(({ className, onSubjectClick, ...props }, ref)
|
|
|
4333
5004
|
header: subject.subject,
|
|
4334
5005
|
correct_answers: subject.correct,
|
|
4335
5006
|
incorrect_answers: subject.incorrect,
|
|
4336
|
-
icon: /* @__PURE__ */
|
|
5007
|
+
icon: /* @__PURE__ */ jsx16(Book, { size: 20 }),
|
|
4337
5008
|
direction: "row"
|
|
4338
5009
|
}
|
|
4339
5010
|
) }, subject.subject)) })
|
|
@@ -4343,19 +5014,25 @@ var QuizListResultByMateria = ({
|
|
|
4343
5014
|
subject,
|
|
4344
5015
|
onQuestionClick
|
|
4345
5016
|
}) => {
|
|
4346
|
-
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
5017
|
+
const { getQuestionsGroupedBySubject, getUserAnswerByQuestionId } = useQuizStore();
|
|
4347
5018
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
4348
5019
|
const answeredQuestions = groupedQuestions[subject] || [];
|
|
4349
|
-
return /* @__PURE__ */
|
|
4350
|
-
/* @__PURE__ */
|
|
4351
|
-
/* @__PURE__ */
|
|
4352
|
-
/* @__PURE__ */
|
|
4353
|
-
/* @__PURE__ */
|
|
5020
|
+
return /* @__PURE__ */ jsxs13("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
|
|
5021
|
+
/* @__PURE__ */ jsx16("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ jsx16("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
|
|
5022
|
+
/* @__PURE__ */ jsxs13("section", { className: "flex flex-col ", children: [
|
|
5023
|
+
/* @__PURE__ */ jsx16("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
|
|
5024
|
+
/* @__PURE__ */ jsx16("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsx16(
|
|
4354
5025
|
CardStatus,
|
|
4355
5026
|
{
|
|
4356
5027
|
className: "max-w-full",
|
|
4357
5028
|
header: `Quest\xE3o ${question.id}`,
|
|
4358
|
-
status:
|
|
5029
|
+
status: (() => {
|
|
5030
|
+
const userAnswer = getUserAnswerByQuestionId(question.id);
|
|
5031
|
+
const isCorrectOption = question?.options.find(
|
|
5032
|
+
(op) => op.isCorrect
|
|
5033
|
+
);
|
|
5034
|
+
return userAnswer && userAnswer.optionId === isCorrectOption?.id ? "correct" : "incorrect";
|
|
5035
|
+
})(),
|
|
4359
5036
|
onClick: () => onQuestionClick?.(question)
|
|
4360
5037
|
}
|
|
4361
5038
|
) }, question.id)) })
|
|
@@ -4371,10 +5048,10 @@ export {
|
|
|
4371
5048
|
QuizHeaderResult,
|
|
4372
5049
|
QuizListResult,
|
|
4373
5050
|
QuizListResultByMateria,
|
|
5051
|
+
QuizMultipleChoice,
|
|
4374
5052
|
QuizQuestionList,
|
|
4375
5053
|
QuizResultHeaderTitle,
|
|
4376
5054
|
QuizResultPerformance,
|
|
4377
5055
|
QuizResultTitle,
|
|
4378
5056
|
QuizTitle
|
|
4379
5057
|
};
|
|
4380
|
-
//# sourceMappingURL=index.mjs.map
|