analytica-frontend-lib 1.1.63 → 1.1.65
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/NotificationCard/index.d.mts +1 -1
- package/dist/NotificationCard/index.d.ts +1 -1
- package/dist/NotificationCard/index.js +23 -2
- package/dist/NotificationCard/index.js.map +1 -1
- package/dist/NotificationCard/index.mjs +21 -1
- package/dist/NotificationCard/index.mjs.map +1 -1
- package/dist/{NotificationCard-4GgB0Nsf.d.mts → NotificationCard-DMdkuVEr.d.mts} +7 -2
- package/dist/{NotificationCard-4GgB0Nsf.d.ts → NotificationCard-DMdkuVEr.d.ts} +7 -2
- package/dist/Quiz/index.d.mts +26 -40
- package/dist/Quiz/index.d.ts +26 -40
- package/dist/Quiz/index.js +3411 -3790
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +3425 -3792
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Quiz/useQuizStore/index.d.mts +10 -25
- package/dist/Quiz/useQuizStore/index.d.ts +10 -25
- package/dist/Quiz/useQuizStore/index.js +52 -77
- package/dist/Quiz/useQuizStore/index.js.map +1 -1
- package/dist/Quiz/useQuizStore/index.mjs +51 -77
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -1
- package/dist/index.d.mts +37 -6
- package/dist/index.d.ts +37 -6
- package/dist/index.js +606 -440
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +606 -440
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -88,6 +88,7 @@ __export(src_exports, {
|
|
|
88
88
|
QUESTION_DIFFICULTY: () => QUESTION_DIFFICULTY,
|
|
89
89
|
QUESTION_STATUS: () => QUESTION_STATUS,
|
|
90
90
|
QUESTION_TYPE: () => QUESTION_TYPE,
|
|
91
|
+
QUIZ_TYPE: () => QUIZ_TYPE,
|
|
91
92
|
Quiz: () => Quiz,
|
|
92
93
|
QuizAlternative: () => QuizAlternative,
|
|
93
94
|
QuizConnectDots: () => QuizConnectDots,
|
|
@@ -150,6 +151,7 @@ __export(src_exports, {
|
|
|
150
151
|
getSubjectIcon: () => getSubjectIcon,
|
|
151
152
|
getSubjectInfo: () => getSubjectInfo,
|
|
152
153
|
getSubjectName: () => getSubjectName,
|
|
154
|
+
syncNotificationState: () => syncNotificationState,
|
|
153
155
|
useApiConfig: () => useApiConfig,
|
|
154
156
|
useAuth: () => useAuth,
|
|
155
157
|
useAuthGuard: () => useAuthGuard,
|
|
@@ -8750,8 +8752,8 @@ function useApiConfig(api) {
|
|
|
8750
8752
|
}
|
|
8751
8753
|
|
|
8752
8754
|
// src/components/Quiz/Quiz.tsx
|
|
8753
|
-
var
|
|
8754
|
-
var
|
|
8755
|
+
var import_phosphor_react23 = require("phosphor-react");
|
|
8756
|
+
var import_react32 = require("react");
|
|
8755
8757
|
|
|
8756
8758
|
// src/components/Quiz/useQuizStore.ts
|
|
8757
8759
|
var import_zustand7 = require("zustand");
|
|
@@ -8762,6 +8764,12 @@ var QUESTION_DIFFICULTY = /* @__PURE__ */ ((QUESTION_DIFFICULTY2) => {
|
|
|
8762
8764
|
QUESTION_DIFFICULTY2["DIFICIL"] = "DIFICIL";
|
|
8763
8765
|
return QUESTION_DIFFICULTY2;
|
|
8764
8766
|
})(QUESTION_DIFFICULTY || {});
|
|
8767
|
+
var QUIZ_TYPE = /* @__PURE__ */ ((QUIZ_TYPE2) => {
|
|
8768
|
+
QUIZ_TYPE2["SIMULADO"] = "SIMULADO";
|
|
8769
|
+
QUIZ_TYPE2["QUESTIONARIO"] = "QUESTIONARIO";
|
|
8770
|
+
QUIZ_TYPE2["ATIVIDADE"] = "ATIVIDADE";
|
|
8771
|
+
return QUIZ_TYPE2;
|
|
8772
|
+
})(QUIZ_TYPE || {});
|
|
8765
8773
|
var QUESTION_TYPE = /* @__PURE__ */ ((QUESTION_TYPE2) => {
|
|
8766
8774
|
QUESTION_TYPE2["ALTERNATIVA"] = "ALTERNATIVA";
|
|
8767
8775
|
QUESTION_TYPE2["DISSERTATIVA"] = "DISSERTATIVA";
|
|
@@ -8850,6 +8858,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8850
8858
|
};
|
|
8851
8859
|
return {
|
|
8852
8860
|
// Initial State
|
|
8861
|
+
quiz: null,
|
|
8853
8862
|
currentQuestionIndex: 0,
|
|
8854
8863
|
selectedAnswers: {},
|
|
8855
8864
|
userAnswers: [],
|
|
@@ -8862,9 +8871,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8862
8871
|
questionsResult: null,
|
|
8863
8872
|
currentQuestionResult: null,
|
|
8864
8873
|
// Setters
|
|
8865
|
-
|
|
8866
|
-
setByActivity: (activity) => set({ byActivity: activity }),
|
|
8867
|
-
setByQuestionary: (lesson) => set({ byQuestionary: lesson }),
|
|
8874
|
+
setQuiz: (quiz) => set({ quiz }),
|
|
8868
8875
|
setUserId: (userId) => set({ userId }),
|
|
8869
8876
|
setUserAnswers: (userAnswers) => set({ userAnswers }),
|
|
8870
8877
|
getUserId: () => get().userId,
|
|
@@ -8891,29 +8898,16 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8891
8898
|
set({ currentQuestionIndex: index });
|
|
8892
8899
|
}
|
|
8893
8900
|
},
|
|
8894
|
-
getActiveQuiz: () => {
|
|
8895
|
-
const { bySimulated, byActivity, byQuestionary } = get();
|
|
8896
|
-
if (bySimulated)
|
|
8897
|
-
return { quiz: bySimulated, type: "bySimulated" };
|
|
8898
|
-
if (byActivity)
|
|
8899
|
-
return { quiz: byActivity, type: "byActivity" };
|
|
8900
|
-
if (byQuestionary)
|
|
8901
|
-
return { quiz: byQuestionary, type: "byQuestionary" };
|
|
8902
|
-
return null;
|
|
8903
|
-
},
|
|
8904
8901
|
selectAnswer: (questionId, answerId) => {
|
|
8905
|
-
const {
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
const activityId = activeQuiz.quiz.id;
|
|
8902
|
+
const { quiz, userAnswers } = get();
|
|
8903
|
+
if (!quiz) return;
|
|
8904
|
+
const activityId = quiz.id;
|
|
8909
8905
|
const userId = get().getUserId();
|
|
8910
8906
|
if (!userId || userId === "") {
|
|
8911
8907
|
console.warn("selectAnswer called before userId is set");
|
|
8912
8908
|
return;
|
|
8913
8909
|
}
|
|
8914
|
-
const question =
|
|
8915
|
-
(q) => q.id === questionId
|
|
8916
|
-
);
|
|
8910
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
8917
8911
|
if (!question) return;
|
|
8918
8912
|
const existingAnswerIndex = userAnswers.findIndex(
|
|
8919
8913
|
(answer) => answer.questionId === questionId
|
|
@@ -8939,18 +8933,15 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8939
8933
|
});
|
|
8940
8934
|
},
|
|
8941
8935
|
selectMultipleAnswer: (questionId, answerIds) => {
|
|
8942
|
-
const {
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
const activityId = activeQuiz.quiz.id;
|
|
8936
|
+
const { quiz, userAnswers } = get();
|
|
8937
|
+
if (!quiz) return;
|
|
8938
|
+
const activityId = quiz.id;
|
|
8946
8939
|
const userId = get().getUserId();
|
|
8947
8940
|
if (!userId || userId === "") {
|
|
8948
8941
|
console.warn("selectMultipleAnswer called before userId is set");
|
|
8949
8942
|
return;
|
|
8950
8943
|
}
|
|
8951
|
-
const question =
|
|
8952
|
-
(q) => q.id === questionId
|
|
8953
|
-
);
|
|
8944
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
8954
8945
|
if (!question) return;
|
|
8955
8946
|
const filteredUserAnswers = userAnswers.filter(
|
|
8956
8947
|
(answer) => answer.questionId !== questionId
|
|
@@ -8977,10 +8968,9 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8977
8968
|
});
|
|
8978
8969
|
},
|
|
8979
8970
|
selectDissertativeAnswer: (questionId, answer) => {
|
|
8980
|
-
const {
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
const activityId = activeQuiz.quiz.id;
|
|
8971
|
+
const { quiz, userAnswers } = get();
|
|
8972
|
+
if (!quiz) return;
|
|
8973
|
+
const activityId = quiz.id;
|
|
8984
8974
|
const userId = get().getUserId();
|
|
8985
8975
|
if (!userId || userId === "") {
|
|
8986
8976
|
console.warn(
|
|
@@ -8988,9 +8978,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8988
8978
|
);
|
|
8989
8979
|
return;
|
|
8990
8980
|
}
|
|
8991
|
-
const question =
|
|
8992
|
-
(q) => q.id === questionId
|
|
8993
|
-
);
|
|
8981
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
8994
8982
|
if (!question || question.questionType !== "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
8995
8983
|
console.warn(
|
|
8996
8984
|
"selectDissertativeAnswer called for non-dissertative question"
|
|
@@ -9021,12 +9009,11 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9021
9009
|
});
|
|
9022
9010
|
},
|
|
9023
9011
|
skipQuestion: () => {
|
|
9024
|
-
const { getCurrentQuestion, userAnswers,
|
|
9012
|
+
const { getCurrentQuestion, userAnswers, quiz } = get();
|
|
9025
9013
|
const currentQuestion = getCurrentQuestion();
|
|
9026
|
-
|
|
9027
|
-
if (!activeQuiz) return;
|
|
9014
|
+
if (!quiz) return;
|
|
9028
9015
|
if (currentQuestion) {
|
|
9029
|
-
const activityId =
|
|
9016
|
+
const activityId = quiz.id;
|
|
9030
9017
|
const userId = get().getUserId();
|
|
9031
9018
|
if (!userId || userId === "") {
|
|
9032
9019
|
console.warn("skipQuestion called before userId is set");
|
|
@@ -9057,18 +9044,15 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9057
9044
|
}
|
|
9058
9045
|
},
|
|
9059
9046
|
addUserAnswer: (questionId, answerId) => {
|
|
9060
|
-
const {
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
const activityId = activeQuiz.quiz.id;
|
|
9047
|
+
const { quiz, userAnswers } = get();
|
|
9048
|
+
if (!quiz) return;
|
|
9049
|
+
const activityId = quiz.id;
|
|
9064
9050
|
const userId = get().getUserId();
|
|
9065
9051
|
if (!userId || userId === "") {
|
|
9066
9052
|
console.warn("addUserAnswer called before userId is set");
|
|
9067
9053
|
return;
|
|
9068
9054
|
}
|
|
9069
|
-
const question =
|
|
9070
|
-
(q) => q.id === questionId
|
|
9071
|
-
);
|
|
9055
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
9072
9056
|
if (!question) return;
|
|
9073
9057
|
const existingAnswerIndex = userAnswers.findIndex(
|
|
9074
9058
|
(answer) => answer.questionId === questionId
|
|
@@ -9104,6 +9088,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9104
9088
|
stopTimer();
|
|
9105
9089
|
stopMinuteCallback();
|
|
9106
9090
|
set({
|
|
9091
|
+
quiz: null,
|
|
9107
9092
|
currentQuestionIndex: 0,
|
|
9108
9093
|
selectedAnswers: {},
|
|
9109
9094
|
userAnswers: [],
|
|
@@ -9127,17 +9112,15 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9127
9112
|
stopMinuteCallback,
|
|
9128
9113
|
// Getters
|
|
9129
9114
|
getCurrentQuestion: () => {
|
|
9130
|
-
const { currentQuestionIndex,
|
|
9131
|
-
|
|
9132
|
-
if (!activeQuiz) {
|
|
9115
|
+
const { currentQuestionIndex, quiz } = get();
|
|
9116
|
+
if (!quiz) {
|
|
9133
9117
|
return null;
|
|
9134
9118
|
}
|
|
9135
|
-
return
|
|
9119
|
+
return quiz.questions[currentQuestionIndex];
|
|
9136
9120
|
},
|
|
9137
9121
|
getTotalQuestions: () => {
|
|
9138
|
-
const {
|
|
9139
|
-
|
|
9140
|
-
return activeQuiz?.quiz?.questions?.length || 0;
|
|
9122
|
+
const { quiz } = get();
|
|
9123
|
+
return quiz?.questions?.length || 0;
|
|
9141
9124
|
},
|
|
9142
9125
|
getAnsweredQuestions: () => {
|
|
9143
9126
|
const { userAnswers } = get();
|
|
@@ -9146,11 +9129,10 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9146
9129
|
).length;
|
|
9147
9130
|
},
|
|
9148
9131
|
getUnansweredQuestions: () => {
|
|
9149
|
-
const {
|
|
9150
|
-
|
|
9151
|
-
if (!activeQuiz) return [];
|
|
9132
|
+
const { quiz, userAnswers } = get();
|
|
9133
|
+
if (!quiz) return [];
|
|
9152
9134
|
const unansweredQuestions = [];
|
|
9153
|
-
|
|
9135
|
+
quiz.questions.forEach((question, index) => {
|
|
9154
9136
|
const userAnswer = userAnswers.find(
|
|
9155
9137
|
(answer) => answer.questionId === question.id
|
|
9156
9138
|
);
|
|
@@ -9211,9 +9193,8 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9211
9193
|
return userAnswer;
|
|
9212
9194
|
},
|
|
9213
9195
|
getQuizTitle: () => {
|
|
9214
|
-
const {
|
|
9215
|
-
|
|
9216
|
-
return activeQuiz?.quiz?.title || "Quiz";
|
|
9196
|
+
const { quiz } = get();
|
|
9197
|
+
return quiz?.title || "Quiz";
|
|
9217
9198
|
},
|
|
9218
9199
|
formatTime: (seconds) => {
|
|
9219
9200
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -9225,11 +9206,10 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9225
9206
|
return userAnswers;
|
|
9226
9207
|
},
|
|
9227
9208
|
getUnansweredQuestionsFromUserAnswers: () => {
|
|
9228
|
-
const {
|
|
9229
|
-
|
|
9230
|
-
if (!activeQuiz) return [];
|
|
9209
|
+
const { quiz, userAnswers } = get();
|
|
9210
|
+
if (!quiz) return [];
|
|
9231
9211
|
const unansweredQuestions = [];
|
|
9232
|
-
|
|
9212
|
+
quiz.questions.forEach((question, index) => {
|
|
9233
9213
|
const userAnswer = userAnswers.find(
|
|
9234
9214
|
(answer) => answer.questionId === question.id
|
|
9235
9215
|
);
|
|
@@ -9242,8 +9222,8 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9242
9222
|
return unansweredQuestions;
|
|
9243
9223
|
},
|
|
9244
9224
|
getQuestionsGroupedBySubject: () => {
|
|
9245
|
-
const { getQuestionResult,
|
|
9246
|
-
const questions = variant == "result" ? getQuestionResult()?.answers :
|
|
9225
|
+
const { getQuestionResult, quiz, variant } = get();
|
|
9226
|
+
const questions = variant == "result" ? getQuestionResult()?.answers : quiz?.questions;
|
|
9247
9227
|
if (!questions) return {};
|
|
9248
9228
|
const groupedQuestions = {};
|
|
9249
9229
|
questions.forEach((question) => {
|
|
@@ -9281,19 +9261,18 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9281
9261
|
return userAnswers;
|
|
9282
9262
|
},
|
|
9283
9263
|
setCurrentQuestion: (question) => {
|
|
9284
|
-
const {
|
|
9285
|
-
|
|
9286
|
-
if (!activeQuiz) return;
|
|
9264
|
+
const { quiz, variant, questionsResult } = get();
|
|
9265
|
+
if (!quiz) return;
|
|
9287
9266
|
let questionIndex = 0;
|
|
9288
9267
|
if (variant == "result") {
|
|
9289
9268
|
if (!questionsResult) return;
|
|
9290
9269
|
const questionResult = questionsResult.answers.find((q) => q.id === question.id) ?? questionsResult.answers.find((q) => q.questionId === question.id);
|
|
9291
9270
|
if (!questionResult) return;
|
|
9292
|
-
questionIndex =
|
|
9271
|
+
questionIndex = quiz.questions.findIndex(
|
|
9293
9272
|
(q) => q.id === questionResult.questionId
|
|
9294
9273
|
);
|
|
9295
9274
|
} else {
|
|
9296
|
-
questionIndex =
|
|
9275
|
+
questionIndex = quiz.questions.findIndex(
|
|
9297
9276
|
(q) => q.id === question.id
|
|
9298
9277
|
);
|
|
9299
9278
|
}
|
|
@@ -9327,7 +9306,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9327
9306
|
return userAnswer ? userAnswer.answerStatus : null;
|
|
9328
9307
|
},
|
|
9329
9308
|
getQuestionIndex: (questionId) => {
|
|
9330
|
-
const { questionsResult, variant } = get();
|
|
9309
|
+
const { questionsResult, variant, quiz } = get();
|
|
9331
9310
|
if (variant == "result") {
|
|
9332
9311
|
if (!questionsResult) return 0;
|
|
9333
9312
|
let idx = questionsResult.answers.findIndex(
|
|
@@ -9340,12 +9319,8 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9340
9319
|
}
|
|
9341
9320
|
return idx !== -1 ? idx + 1 : 0;
|
|
9342
9321
|
} else {
|
|
9343
|
-
|
|
9344
|
-
const
|
|
9345
|
-
if (!activeQuiz) return 0;
|
|
9346
|
-
const idx = activeQuiz.quiz.questions.findIndex(
|
|
9347
|
-
(q) => q.id === questionId
|
|
9348
|
-
);
|
|
9322
|
+
if (!quiz) return 0;
|
|
9323
|
+
const idx = quiz.questions.findIndex((q) => q.id === questionId);
|
|
9349
9324
|
return idx !== -1 ? idx + 1 : 0;
|
|
9350
9325
|
}
|
|
9351
9326
|
},
|
|
@@ -9383,10 +9358,14 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9383
9358
|
)
|
|
9384
9359
|
);
|
|
9385
9360
|
|
|
9361
|
+
// src/components/Quiz/QuizContent.tsx
|
|
9362
|
+
var import_react31 = require("react");
|
|
9363
|
+
var import_phosphor_react22 = require("phosphor-react");
|
|
9364
|
+
|
|
9386
9365
|
// src/assets/img/mock-image-question.png
|
|
9387
9366
|
var mock_image_question_default = "./mock-image-question-HEZCLFDL.png";
|
|
9388
9367
|
|
|
9389
|
-
// src/components/Quiz/
|
|
9368
|
+
// src/components/Quiz/QuizContent.tsx
|
|
9390
9369
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
9391
9370
|
var getStatusBadge = (status) => {
|
|
9392
9371
|
switch (status) {
|
|
@@ -9406,158 +9385,11 @@ var getStatusStyles = (variantCorrect) => {
|
|
|
9406
9385
|
return "bg-error-background border-error-300";
|
|
9407
9386
|
}
|
|
9408
9387
|
};
|
|
9409
|
-
var Quiz = (0, import_react31.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
|
|
9410
|
-
const { setVariant } = useQuizStore();
|
|
9411
|
-
(0, import_react31.useEffect)(() => {
|
|
9412
|
-
setVariant(variant);
|
|
9413
|
-
}, [variant, setVariant]);
|
|
9414
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
9415
|
-
});
|
|
9416
|
-
var QuizHeaderResult = (0, import_react31.forwardRef)(
|
|
9417
|
-
({ className, ...props }, ref) => {
|
|
9418
|
-
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
9419
|
-
const [status, setStatus] = (0, import_react31.useState)(void 0);
|
|
9420
|
-
(0, import_react31.useEffect)(() => {
|
|
9421
|
-
const cq = getCurrentQuestion();
|
|
9422
|
-
if (!cq) {
|
|
9423
|
-
setStatus(void 0);
|
|
9424
|
-
return;
|
|
9425
|
-
}
|
|
9426
|
-
const qr = getQuestionResultByQuestionId(cq.id);
|
|
9427
|
-
setStatus(qr?.answerStatus);
|
|
9428
|
-
}, [
|
|
9429
|
-
getCurrentQuestion,
|
|
9430
|
-
getQuestionResultByQuestionId,
|
|
9431
|
-
getCurrentQuestion()?.id
|
|
9432
|
-
]);
|
|
9433
|
-
const getClassesByAnswersStatus = () => {
|
|
9434
|
-
switch (status) {
|
|
9435
|
-
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
9436
|
-
return "bg-success-background";
|
|
9437
|
-
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
9438
|
-
return "bg-error-background";
|
|
9439
|
-
default:
|
|
9440
|
-
return "bg-error-background";
|
|
9441
|
-
}
|
|
9442
|
-
};
|
|
9443
|
-
const getLabelByAnswersStatus = () => {
|
|
9444
|
-
switch (status) {
|
|
9445
|
-
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
9446
|
-
return "\u{1F389} Parab\xE9ns!!";
|
|
9447
|
-
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
9448
|
-
return "N\xE3o foi dessa vez...";
|
|
9449
|
-
case "NAO_RESPONDIDO" /* NAO_RESPONDIDO */:
|
|
9450
|
-
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
9451
|
-
default:
|
|
9452
|
-
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
9453
|
-
}
|
|
9454
|
-
};
|
|
9455
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
9456
|
-
"div",
|
|
9457
|
-
{
|
|
9458
|
-
ref,
|
|
9459
|
-
className: cn(
|
|
9460
|
-
"flex flex-row items-center gap-10 p-3.5 rounded-xl mb-4",
|
|
9461
|
-
getClassesByAnswersStatus(),
|
|
9462
|
-
className
|
|
9463
|
-
),
|
|
9464
|
-
...props,
|
|
9465
|
-
children: [
|
|
9466
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
|
|
9467
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-text-700 text-md", children: getLabelByAnswersStatus() })
|
|
9468
|
-
]
|
|
9469
|
-
}
|
|
9470
|
-
);
|
|
9471
|
-
}
|
|
9472
|
-
);
|
|
9473
|
-
var QuizTitle = (0, import_react31.forwardRef)(
|
|
9474
|
-
({ className, ...props }, ref) => {
|
|
9475
|
-
const {
|
|
9476
|
-
currentQuestionIndex,
|
|
9477
|
-
getTotalQuestions,
|
|
9478
|
-
getQuizTitle,
|
|
9479
|
-
timeElapsed,
|
|
9480
|
-
formatTime: formatTime2,
|
|
9481
|
-
isStarted
|
|
9482
|
-
} = useQuizStore();
|
|
9483
|
-
const [showExitConfirmation, setShowExitConfirmation] = (0, import_react31.useState)(false);
|
|
9484
|
-
const totalQuestions = getTotalQuestions();
|
|
9485
|
-
const quizTitle = getQuizTitle();
|
|
9486
|
-
const handleBackClick = () => {
|
|
9487
|
-
if (isStarted) {
|
|
9488
|
-
setShowExitConfirmation(true);
|
|
9489
|
-
} else {
|
|
9490
|
-
window.history.back();
|
|
9491
|
-
}
|
|
9492
|
-
};
|
|
9493
|
-
const handleConfirmExit = () => {
|
|
9494
|
-
setShowExitConfirmation(false);
|
|
9495
|
-
window.history.back();
|
|
9496
|
-
};
|
|
9497
|
-
const handleCancelExit = () => {
|
|
9498
|
-
setShowExitConfirmation(false);
|
|
9499
|
-
};
|
|
9500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
9501
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
9502
|
-
"div",
|
|
9503
|
-
{
|
|
9504
|
-
ref,
|
|
9505
|
-
className: cn(
|
|
9506
|
-
"flex flex-row justify-between items-center relative p-2",
|
|
9507
|
-
className
|
|
9508
|
-
),
|
|
9509
|
-
...props,
|
|
9510
|
-
children: [
|
|
9511
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9512
|
-
IconButton_default,
|
|
9513
|
-
{
|
|
9514
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_phosphor_react22.CaretLeft, { size: 24 }),
|
|
9515
|
-
size: "md",
|
|
9516
|
-
"aria-label": "Voltar",
|
|
9517
|
-
onClick: handleBackClick
|
|
9518
|
-
}
|
|
9519
|
-
),
|
|
9520
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
|
|
9521
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
|
|
9522
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
|
|
9523
|
-
] }),
|
|
9524
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_phosphor_react22.Clock, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
|
|
9525
|
-
]
|
|
9526
|
-
}
|
|
9527
|
-
),
|
|
9528
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9529
|
-
AlertDialog,
|
|
9530
|
-
{
|
|
9531
|
-
isOpen: showExitConfirmation,
|
|
9532
|
-
onChangeOpen: setShowExitConfirmation,
|
|
9533
|
-
title: "Deseja sair?",
|
|
9534
|
-
description: "Se voc\xEA sair do simulado agora, todas as respostas ser\xE3o perdidas.",
|
|
9535
|
-
cancelButtonLabel: "Voltar e revisar",
|
|
9536
|
-
submitButtonLabel: "Sair Mesmo Assim",
|
|
9537
|
-
onSubmit: handleConfirmExit,
|
|
9538
|
-
onCancel: handleCancelExit
|
|
9539
|
-
}
|
|
9540
|
-
)
|
|
9541
|
-
] });
|
|
9542
|
-
}
|
|
9543
|
-
);
|
|
9544
9388
|
var QuizSubTitle = (0, import_react31.forwardRef)(
|
|
9545
9389
|
({ subTitle, ...props }, ref) => {
|
|
9546
9390
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "px-4 pb-2 pt-6", ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "font-bold text-lg text-text-950", children: subTitle }) });
|
|
9547
9391
|
}
|
|
9548
9392
|
);
|
|
9549
|
-
var QuizHeader = () => {
|
|
9550
|
-
const { getCurrentQuestion, currentQuestionIndex } = useQuizStore();
|
|
9551
|
-
const currentQuestion = getCurrentQuestion();
|
|
9552
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9553
|
-
HeaderAlternative,
|
|
9554
|
-
{
|
|
9555
|
-
title: currentQuestion ? `Quest\xE3o ${currentQuestionIndex + 1}` : "Quest\xE3o",
|
|
9556
|
-
subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topic?.name ?? "",
|
|
9557
|
-
content: currentQuestion?.statement ?? ""
|
|
9558
|
-
}
|
|
9559
|
-
);
|
|
9560
|
-
};
|
|
9561
9393
|
var QuizContainer = (0, import_react31.forwardRef)(({ children, className, ...props }, ref) => {
|
|
9562
9394
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9563
9395
|
"div",
|
|
@@ -9572,21 +9404,6 @@ var QuizContainer = (0, import_react31.forwardRef)(({ children, className, ...pr
|
|
|
9572
9404
|
}
|
|
9573
9405
|
);
|
|
9574
9406
|
});
|
|
9575
|
-
var QuizContent = (0, import_react31.forwardRef)(({ paddingBottom }) => {
|
|
9576
|
-
const { getCurrentQuestion } = useQuizStore();
|
|
9577
|
-
const currentQuestion = getCurrentQuestion();
|
|
9578
|
-
const questionComponents = {
|
|
9579
|
-
["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
|
|
9580
|
-
["MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */]: QuizMultipleChoice,
|
|
9581
|
-
["DISSERTATIVA" /* DISSERTATIVA */]: QuizDissertative,
|
|
9582
|
-
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: QuizTrueOrFalse,
|
|
9583
|
-
["LIGAR_PONTOS" /* LIGAR_PONTOS */]: QuizConnectDots,
|
|
9584
|
-
["PREENCHER" /* PREENCHER */]: QuizFill,
|
|
9585
|
-
["IMAGEM" /* IMAGEM */]: QuizImageQuestion
|
|
9586
|
-
};
|
|
9587
|
-
const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.questionType] : null;
|
|
9588
|
-
return QuestionComponent ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(QuestionComponent, { paddingBottom }) : null;
|
|
9589
|
-
});
|
|
9590
9407
|
var QuizAlternative = ({ paddingBottom }) => {
|
|
9591
9408
|
const {
|
|
9592
9409
|
getCurrentQuestion,
|
|
@@ -9790,7 +9607,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
9790
9607
|
) }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: localAnswer || "Nenhuma resposta fornecida" }) }) }) }),
|
|
9791
9608
|
variant === "result" && currentQuestionResult?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
9792
9609
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(QuizSubTitle, { subTitle: "Observa\xE7\xE3o do professor" }),
|
|
9793
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-text-600 text-md whitespace-pre-wrap", children:
|
|
9610
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: currentQuestionResult?.teacherFeedback }) })
|
|
9794
9611
|
] })
|
|
9795
9612
|
] });
|
|
9796
9613
|
};
|
|
@@ -10291,6 +10108,153 @@ var QuizImageQuestion = ({ paddingBottom }) => {
|
|
|
10291
10108
|
) })
|
|
10292
10109
|
] });
|
|
10293
10110
|
};
|
|
10111
|
+
|
|
10112
|
+
// src/components/Quiz/Quiz.tsx
|
|
10113
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
10114
|
+
var getQuizTypeConfig = (type) => {
|
|
10115
|
+
const QUIZ_TYPE_CONFIG = {
|
|
10116
|
+
["SIMULADO" /* SIMULADO */]: {
|
|
10117
|
+
label: "Simulado",
|
|
10118
|
+
article: "o",
|
|
10119
|
+
preposition: "do"
|
|
10120
|
+
},
|
|
10121
|
+
["QUESTIONARIO" /* QUESTIONARIO */]: {
|
|
10122
|
+
label: "Question\xE1rio",
|
|
10123
|
+
article: "o",
|
|
10124
|
+
preposition: "do"
|
|
10125
|
+
},
|
|
10126
|
+
["ATIVIDADE" /* ATIVIDADE */]: {
|
|
10127
|
+
label: "Atividade",
|
|
10128
|
+
article: "a",
|
|
10129
|
+
preposition: "da"
|
|
10130
|
+
}
|
|
10131
|
+
};
|
|
10132
|
+
const config = QUIZ_TYPE_CONFIG[type];
|
|
10133
|
+
return config || QUIZ_TYPE_CONFIG["SIMULADO" /* SIMULADO */];
|
|
10134
|
+
};
|
|
10135
|
+
var getTypeLabel = (type) => {
|
|
10136
|
+
return getQuizTypeConfig(type).label;
|
|
10137
|
+
};
|
|
10138
|
+
var getCompletionTitle = (type) => {
|
|
10139
|
+
const config = getQuizTypeConfig(type);
|
|
10140
|
+
return `Voc\xEA concluiu ${config.article} ${config.label.toLowerCase()}!`;
|
|
10141
|
+
};
|
|
10142
|
+
var getExitConfirmationText = (type) => {
|
|
10143
|
+
const config = getQuizTypeConfig(type);
|
|
10144
|
+
return `Se voc\xEA sair ${config.preposition} ${config.label.toLowerCase()} agora, todas as respostas ser\xE3o perdidas.`;
|
|
10145
|
+
};
|
|
10146
|
+
var getFinishConfirmationText = (type) => {
|
|
10147
|
+
const config = getQuizTypeConfig(type);
|
|
10148
|
+
return `Tem certeza que deseja finalizar ${config.article} ${config.label.toLowerCase()}?`;
|
|
10149
|
+
};
|
|
10150
|
+
var Quiz = (0, import_react32.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
|
|
10151
|
+
const { setVariant } = useQuizStore();
|
|
10152
|
+
(0, import_react32.useEffect)(() => {
|
|
10153
|
+
setVariant(variant);
|
|
10154
|
+
}, [variant, setVariant]);
|
|
10155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
10156
|
+
});
|
|
10157
|
+
var QuizTitle = (0, import_react32.forwardRef)(
|
|
10158
|
+
({ className, ...props }, ref) => {
|
|
10159
|
+
const {
|
|
10160
|
+
quiz,
|
|
10161
|
+
currentQuestionIndex,
|
|
10162
|
+
getTotalQuestions,
|
|
10163
|
+
getQuizTitle,
|
|
10164
|
+
timeElapsed,
|
|
10165
|
+
formatTime: formatTime2,
|
|
10166
|
+
isStarted
|
|
10167
|
+
} = useQuizStore();
|
|
10168
|
+
const [showExitConfirmation, setShowExitConfirmation] = (0, import_react32.useState)(false);
|
|
10169
|
+
const totalQuestions = getTotalQuestions();
|
|
10170
|
+
const quizTitle = getQuizTitle();
|
|
10171
|
+
const handleBackClick = () => {
|
|
10172
|
+
if (isStarted) {
|
|
10173
|
+
setShowExitConfirmation(true);
|
|
10174
|
+
} else {
|
|
10175
|
+
window.history.back();
|
|
10176
|
+
}
|
|
10177
|
+
};
|
|
10178
|
+
const handleConfirmExit = () => {
|
|
10179
|
+
setShowExitConfirmation(false);
|
|
10180
|
+
window.history.back();
|
|
10181
|
+
};
|
|
10182
|
+
const handleCancelExit = () => {
|
|
10183
|
+
setShowExitConfirmation(false);
|
|
10184
|
+
};
|
|
10185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
10186
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
10187
|
+
"div",
|
|
10188
|
+
{
|
|
10189
|
+
ref,
|
|
10190
|
+
className: cn(
|
|
10191
|
+
"flex flex-row justify-between items-center relative p-2",
|
|
10192
|
+
className
|
|
10193
|
+
),
|
|
10194
|
+
...props,
|
|
10195
|
+
children: [
|
|
10196
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10197
|
+
IconButton_default,
|
|
10198
|
+
{
|
|
10199
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.CaretLeft, { size: 24 }),
|
|
10200
|
+
size: "md",
|
|
10201
|
+
"aria-label": "Voltar",
|
|
10202
|
+
onClick: handleBackClick
|
|
10203
|
+
}
|
|
10204
|
+
),
|
|
10205
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
|
|
10206
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
|
|
10207
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
|
|
10208
|
+
] }),
|
|
10209
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.Clock, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
|
|
10210
|
+
]
|
|
10211
|
+
}
|
|
10212
|
+
),
|
|
10213
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10214
|
+
AlertDialog,
|
|
10215
|
+
{
|
|
10216
|
+
isOpen: showExitConfirmation,
|
|
10217
|
+
onChangeOpen: setShowExitConfirmation,
|
|
10218
|
+
title: "Deseja sair?",
|
|
10219
|
+
description: getExitConfirmationText(
|
|
10220
|
+
quiz?.type || "SIMULADO" /* SIMULADO */
|
|
10221
|
+
),
|
|
10222
|
+
cancelButtonLabel: "Voltar e revisar",
|
|
10223
|
+
submitButtonLabel: "Sair Mesmo Assim",
|
|
10224
|
+
onSubmit: handleConfirmExit,
|
|
10225
|
+
onCancel: handleCancelExit
|
|
10226
|
+
}
|
|
10227
|
+
)
|
|
10228
|
+
] });
|
|
10229
|
+
}
|
|
10230
|
+
);
|
|
10231
|
+
var QuizHeader = () => {
|
|
10232
|
+
const { getCurrentQuestion, currentQuestionIndex } = useQuizStore();
|
|
10233
|
+
const currentQuestion = getCurrentQuestion();
|
|
10234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10235
|
+
HeaderAlternative,
|
|
10236
|
+
{
|
|
10237
|
+
title: currentQuestion ? `Quest\xE3o ${currentQuestionIndex + 1}` : "Quest\xE3o",
|
|
10238
|
+
subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topic?.name ?? "",
|
|
10239
|
+
content: currentQuestion?.statement ?? ""
|
|
10240
|
+
}
|
|
10241
|
+
);
|
|
10242
|
+
};
|
|
10243
|
+
var QuizContent = (0, import_react32.forwardRef)(({ paddingBottom }) => {
|
|
10244
|
+
const { getCurrentQuestion } = useQuizStore();
|
|
10245
|
+
const currentQuestion = getCurrentQuestion();
|
|
10246
|
+
const questionComponents = {
|
|
10247
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
|
|
10248
|
+
["MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */]: QuizMultipleChoice,
|
|
10249
|
+
["DISSERTATIVA" /* DISSERTATIVA */]: QuizDissertative,
|
|
10250
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: QuizTrueOrFalse,
|
|
10251
|
+
["LIGAR_PONTOS" /* LIGAR_PONTOS */]: QuizConnectDots,
|
|
10252
|
+
["PREENCHER" /* PREENCHER */]: QuizFill,
|
|
10253
|
+
["IMAGEM" /* IMAGEM */]: QuizImageQuestion
|
|
10254
|
+
};
|
|
10255
|
+
const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.questionType] : null;
|
|
10256
|
+
return QuestionComponent ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(QuestionComponent, { paddingBottom }) : null;
|
|
10257
|
+
});
|
|
10294
10258
|
var QuizQuestionList = ({
|
|
10295
10259
|
filterType = "all",
|
|
10296
10260
|
onQuestionClick
|
|
@@ -10336,18 +10300,18 @@ var QuizQuestionList = ({
|
|
|
10336
10300
|
return "Em branco";
|
|
10337
10301
|
}
|
|
10338
10302
|
};
|
|
10339
|
-
return /* @__PURE__ */ (0,
|
|
10340
|
-
Object.entries(filteredGroupedQuestions).length == 0 && /* @__PURE__ */ (0,
|
|
10303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-6 px-4 h-full", children: [
|
|
10304
|
+
Object.entries(filteredGroupedQuestions).length == 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex items-center justify-center text-gray-500 py-8 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-lg", children: "Nenhum resultado" }) }),
|
|
10341
10305
|
Object.entries(filteredGroupedQuestions).map(
|
|
10342
|
-
([subjectId, questions]) => /* @__PURE__ */ (0,
|
|
10343
|
-
/* @__PURE__ */ (0,
|
|
10344
|
-
/* @__PURE__ */ (0,
|
|
10345
|
-
/* @__PURE__ */ (0,
|
|
10306
|
+
([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: "flex flex-col gap-2", children: [
|
|
10307
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
|
|
10308
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.BookOpen, { size: 17, className: "text-white" }) }),
|
|
10309
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-800 font-bold text-lg", children: questions?.[0]?.knowledgeMatrix?.[0]?.subject?.name ?? "Sem mat\xE9ria" })
|
|
10346
10310
|
] }),
|
|
10347
|
-
/* @__PURE__ */ (0,
|
|
10311
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
|
|
10348
10312
|
const status = getQuestionStatus(question.id);
|
|
10349
10313
|
const questionNumber = getQuestionIndex(question.id);
|
|
10350
|
-
return /* @__PURE__ */ (0,
|
|
10314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10351
10315
|
CardStatus,
|
|
10352
10316
|
{
|
|
10353
10317
|
header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
|
|
@@ -10364,16 +10328,21 @@ var QuizQuestionList = ({
|
|
|
10364
10328
|
)
|
|
10365
10329
|
] });
|
|
10366
10330
|
};
|
|
10367
|
-
var QuizFooter = (0,
|
|
10331
|
+
var QuizFooter = (0, import_react32.forwardRef)(
|
|
10368
10332
|
({
|
|
10369
10333
|
className,
|
|
10370
10334
|
onGoToSimulated,
|
|
10371
10335
|
onDetailResult,
|
|
10372
10336
|
handleFinishSimulated,
|
|
10337
|
+
onGoToNextModule,
|
|
10338
|
+
onRepeat,
|
|
10339
|
+
onTryLater,
|
|
10373
10340
|
resultImageComponent,
|
|
10341
|
+
resultIncorrectImageComponent,
|
|
10374
10342
|
...props
|
|
10375
10343
|
}, ref) => {
|
|
10376
10344
|
const {
|
|
10345
|
+
quiz,
|
|
10377
10346
|
currentQuestionIndex,
|
|
10378
10347
|
getTotalQuestions,
|
|
10379
10348
|
goToNextQuestion,
|
|
@@ -10392,23 +10361,36 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10392
10361
|
const currentAnswer = getCurrentAnswer();
|
|
10393
10362
|
const currentQuestion = getCurrentQuestion();
|
|
10394
10363
|
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
10395
|
-
const [
|
|
10396
|
-
const [
|
|
10397
|
-
const
|
|
10398
|
-
const
|
|
10399
|
-
const
|
|
10364
|
+
const [activeModal, setActiveModal] = (0, import_react32.useState)(null);
|
|
10365
|
+
const [filterType, setFilterType] = (0, import_react32.useState)("all");
|
|
10366
|
+
const openModal = (modalName) => setActiveModal(modalName);
|
|
10367
|
+
const closeModal = () => setActiveModal(null);
|
|
10368
|
+
const isModalOpen = (modalName) => activeModal === modalName;
|
|
10400
10369
|
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
10401
10370
|
const allQuestions = getTotalQuestions();
|
|
10371
|
+
const stats = getQuestionResultStatistics();
|
|
10372
|
+
const correctAnswers = stats?.correctAnswers;
|
|
10373
|
+
const totalAnswers = stats?.totalAnswered;
|
|
10374
|
+
const quizType = quiz?.type || "SIMULADO" /* SIMULADO */;
|
|
10375
|
+
const quizTypeLabel = getTypeLabel(quizType);
|
|
10402
10376
|
const handleFinishQuiz = async () => {
|
|
10403
10377
|
if (unansweredQuestions.length > 0) {
|
|
10404
|
-
|
|
10378
|
+
openModal("alertDialog");
|
|
10405
10379
|
return;
|
|
10406
10380
|
}
|
|
10407
10381
|
try {
|
|
10408
10382
|
if (handleFinishSimulated) {
|
|
10409
10383
|
await Promise.resolve(handleFinishSimulated());
|
|
10410
10384
|
}
|
|
10411
|
-
|
|
10385
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && typeof totalAnswers === "number" && correctAnswers === totalAnswers) {
|
|
10386
|
+
openModal("modalQuestionnaireAllCorrect");
|
|
10387
|
+
return;
|
|
10388
|
+
}
|
|
10389
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && correctAnswers === 0) {
|
|
10390
|
+
openModal("modalQuestionnaireAllIncorrect");
|
|
10391
|
+
return;
|
|
10392
|
+
}
|
|
10393
|
+
openModal("modalResult");
|
|
10412
10394
|
} catch (err) {
|
|
10413
10395
|
console.error("handleFinishSimulated failed:", err);
|
|
10414
10396
|
return;
|
|
@@ -10419,16 +10401,23 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10419
10401
|
if (handleFinishSimulated) {
|
|
10420
10402
|
await Promise.resolve(handleFinishSimulated());
|
|
10421
10403
|
}
|
|
10422
|
-
|
|
10423
|
-
|
|
10404
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && typeof totalAnswers === "number" && correctAnswers === totalAnswers) {
|
|
10405
|
+
openModal("modalQuestionnaireAllCorrect");
|
|
10406
|
+
return;
|
|
10407
|
+
}
|
|
10408
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && correctAnswers === 0) {
|
|
10409
|
+
openModal("modalQuestionnaireAllIncorrect");
|
|
10410
|
+
return;
|
|
10411
|
+
}
|
|
10412
|
+
openModal("modalResult");
|
|
10424
10413
|
} catch (err) {
|
|
10425
10414
|
console.error("handleFinishSimulated failed:", err);
|
|
10426
|
-
|
|
10415
|
+
closeModal();
|
|
10427
10416
|
return;
|
|
10428
10417
|
}
|
|
10429
10418
|
};
|
|
10430
|
-
return /* @__PURE__ */ (0,
|
|
10431
|
-
/* @__PURE__ */ (0,
|
|
10419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
10420
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10432
10421
|
"footer",
|
|
10433
10422
|
{
|
|
10434
10423
|
ref,
|
|
@@ -10437,17 +10426,17 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10437
10426
|
className
|
|
10438
10427
|
),
|
|
10439
10428
|
...props,
|
|
10440
|
-
children: variant === "default" ? /* @__PURE__ */ (0,
|
|
10441
|
-
/* @__PURE__ */ (0,
|
|
10442
|
-
/* @__PURE__ */ (0,
|
|
10429
|
+
children: variant === "default" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
10430
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
|
|
10431
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10443
10432
|
IconButton_default,
|
|
10444
10433
|
{
|
|
10445
|
-
icon: /* @__PURE__ */ (0,
|
|
10434
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.SquaresFour, { size: 24, className: "text-text-950" }),
|
|
10446
10435
|
size: "md",
|
|
10447
|
-
onClick: () =>
|
|
10436
|
+
onClick: () => openModal("modalNavigate")
|
|
10448
10437
|
}
|
|
10449
10438
|
),
|
|
10450
|
-
isFirstQuestion ? /* @__PURE__ */ (0,
|
|
10439
|
+
isFirstQuestion ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10451
10440
|
Button_default,
|
|
10452
10441
|
{
|
|
10453
10442
|
variant: "outline",
|
|
@@ -10458,13 +10447,13 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10458
10447
|
},
|
|
10459
10448
|
children: "Pular"
|
|
10460
10449
|
}
|
|
10461
|
-
) : /* @__PURE__ */ (0,
|
|
10450
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10462
10451
|
Button_default,
|
|
10463
10452
|
{
|
|
10464
10453
|
size: "medium",
|
|
10465
10454
|
variant: "link",
|
|
10466
10455
|
action: "primary",
|
|
10467
|
-
iconLeft: /* @__PURE__ */ (0,
|
|
10456
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.CaretLeft, { size: 18 }),
|
|
10468
10457
|
onClick: () => {
|
|
10469
10458
|
goToPreviousQuestion();
|
|
10470
10459
|
},
|
|
@@ -10472,7 +10461,7 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10472
10461
|
}
|
|
10473
10462
|
)
|
|
10474
10463
|
] }),
|
|
10475
|
-
!isFirstQuestion && !isLastQuestion && /* @__PURE__ */ (0,
|
|
10464
|
+
!isFirstQuestion && !isLastQuestion && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10476
10465
|
Button_default,
|
|
10477
10466
|
{
|
|
10478
10467
|
size: "small",
|
|
@@ -10485,7 +10474,7 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10485
10474
|
children: "Pular"
|
|
10486
10475
|
}
|
|
10487
10476
|
),
|
|
10488
|
-
isLastQuestion ? /* @__PURE__ */ (0,
|
|
10477
|
+
isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10489
10478
|
Button_default,
|
|
10490
10479
|
{
|
|
10491
10480
|
size: "medium",
|
|
@@ -10495,13 +10484,13 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10495
10484
|
onClick: handleFinishQuiz,
|
|
10496
10485
|
children: "Finalizar"
|
|
10497
10486
|
}
|
|
10498
|
-
) : /* @__PURE__ */ (0,
|
|
10487
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10499
10488
|
Button_default,
|
|
10500
10489
|
{
|
|
10501
10490
|
size: "medium",
|
|
10502
10491
|
variant: "link",
|
|
10503
10492
|
action: "primary",
|
|
10504
|
-
iconRight: /* @__PURE__ */ (0,
|
|
10493
|
+
iconRight: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.CaretRight, { size: 18 }),
|
|
10505
10494
|
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
10506
10495
|
onClick: () => {
|
|
10507
10496
|
goToNextQuestion();
|
|
@@ -10509,157 +10498,313 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10509
10498
|
children: "Avan\xE7ar"
|
|
10510
10499
|
}
|
|
10511
10500
|
)
|
|
10512
|
-
] }) : /* @__PURE__ */ (0,
|
|
10501
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-row items-center justify-end w-full", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10513
10502
|
Button_default,
|
|
10514
10503
|
{
|
|
10515
10504
|
variant: "solid",
|
|
10516
10505
|
action: "primary",
|
|
10517
10506
|
size: "medium",
|
|
10518
|
-
onClick: () =>
|
|
10507
|
+
onClick: () => openModal("modalResolution"),
|
|
10519
10508
|
children: "Ver Resolu\xE7\xE3o"
|
|
10520
10509
|
}
|
|
10521
10510
|
) })
|
|
10522
10511
|
}
|
|
10523
10512
|
),
|
|
10524
|
-
/* @__PURE__ */ (0,
|
|
10513
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10525
10514
|
AlertDialog,
|
|
10526
10515
|
{
|
|
10527
|
-
isOpen:
|
|
10528
|
-
onChangeOpen:
|
|
10529
|
-
title:
|
|
10530
|
-
description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` :
|
|
10516
|
+
isOpen: isModalOpen("alertDialog"),
|
|
10517
|
+
onChangeOpen: (open) => open ? openModal("alertDialog") : closeModal(),
|
|
10518
|
+
title: `Finalizar ${quizTypeLabel.toLowerCase()}?`,
|
|
10519
|
+
description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : getFinishConfirmationText(quizType),
|
|
10531
10520
|
cancelButtonLabel: "Voltar e revisar",
|
|
10532
10521
|
submitButtonLabel: "Finalizar Mesmo Assim",
|
|
10533
10522
|
onSubmit: handleAlertSubmit
|
|
10534
10523
|
}
|
|
10535
10524
|
),
|
|
10536
|
-
/* @__PURE__ */ (0,
|
|
10525
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10537
10526
|
Modal_default,
|
|
10538
10527
|
{
|
|
10539
|
-
isOpen:
|
|
10540
|
-
onClose:
|
|
10528
|
+
isOpen: isModalOpen("modalResult"),
|
|
10529
|
+
onClose: closeModal,
|
|
10541
10530
|
title: "",
|
|
10542
10531
|
closeOnEscape: false,
|
|
10543
10532
|
hideCloseButton: true,
|
|
10544
10533
|
size: "md",
|
|
10545
|
-
children: /* @__PURE__ */ (0,
|
|
10546
|
-
resultImageComponent ? /* @__PURE__ */ (0,
|
|
10547
|
-
/* @__PURE__ */ (0,
|
|
10548
|
-
/* @__PURE__ */ (0,
|
|
10549
|
-
/* @__PURE__ */ (0,
|
|
10550
|
-
"Voc\xEA acertou",
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
" de",
|
|
10554
|
-
" ",
|
|
10534
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
10535
|
+
resultImageComponent ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-[282px] h-auto", children: resultImageComponent }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-[282px] h-[200px] bg-gray-100 rounded-md flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-gray-500 text-sm", children: "Imagem de resultado" }) }),
|
|
10536
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
10537
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: getCompletionTitle(quizType) }),
|
|
10538
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "text-text-500 font-sm", children: [
|
|
10539
|
+
"Voc\xEA acertou ",
|
|
10540
|
+
correctAnswers ?? "--",
|
|
10541
|
+
" de ",
|
|
10555
10542
|
allQuestions,
|
|
10556
|
-
"
|
|
10543
|
+
" ",
|
|
10544
|
+
"quest\xF5es."
|
|
10557
10545
|
] })
|
|
10558
10546
|
] }),
|
|
10559
|
-
/* @__PURE__ */ (0,
|
|
10560
|
-
/* @__PURE__ */ (0,
|
|
10547
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
|
|
10548
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
10561
10549
|
Button_default,
|
|
10562
10550
|
{
|
|
10563
10551
|
variant: "outline",
|
|
10564
10552
|
className: "w-full",
|
|
10565
10553
|
size: "small",
|
|
10566
10554
|
onClick: onGoToSimulated,
|
|
10567
|
-
children:
|
|
10555
|
+
children: [
|
|
10556
|
+
"Ir para ",
|
|
10557
|
+
quizTypeLabel.toLocaleLowerCase(),
|
|
10558
|
+
"s"
|
|
10559
|
+
]
|
|
10568
10560
|
}
|
|
10569
10561
|
),
|
|
10570
|
-
/* @__PURE__ */ (0,
|
|
10562
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
|
|
10571
10563
|
] })
|
|
10572
10564
|
] })
|
|
10573
10565
|
}
|
|
10574
10566
|
),
|
|
10575
|
-
/* @__PURE__ */ (0,
|
|
10567
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10576
10568
|
Modal_default,
|
|
10577
10569
|
{
|
|
10578
|
-
isOpen:
|
|
10579
|
-
onClose:
|
|
10570
|
+
isOpen: isModalOpen("modalNavigate"),
|
|
10571
|
+
onClose: closeModal,
|
|
10580
10572
|
title: "Quest\xF5es",
|
|
10581
10573
|
size: "lg",
|
|
10582
|
-
children: /* @__PURE__ */ (0,
|
|
10583
|
-
/* @__PURE__ */ (0,
|
|
10584
|
-
/* @__PURE__ */ (0,
|
|
10585
|
-
/* @__PURE__ */ (0,
|
|
10586
|
-
/* @__PURE__ */ (0,
|
|
10574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col w-full not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] lg:h-[687px]", children: [
|
|
10575
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200 flex-shrink-0", children: [
|
|
10576
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
|
|
10577
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
|
|
10578
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10587
10579
|
SelectTrigger,
|
|
10588
10580
|
{
|
|
10589
10581
|
variant: "rounded",
|
|
10590
10582
|
className: "max-w-[266px] min-w-[160px]",
|
|
10591
|
-
children: /* @__PURE__ */ (0,
|
|
10583
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" })
|
|
10592
10584
|
}
|
|
10593
10585
|
),
|
|
10594
|
-
/* @__PURE__ */ (0,
|
|
10595
|
-
/* @__PURE__ */ (0,
|
|
10596
|
-
/* @__PURE__ */ (0,
|
|
10597
|
-
/* @__PURE__ */ (0,
|
|
10586
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(SelectContent, { children: [
|
|
10587
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectItem, { value: "all", children: "Todas" }),
|
|
10588
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
|
|
10589
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectItem, { value: "answered", children: "Respondidas" })
|
|
10598
10590
|
] })
|
|
10599
10591
|
] }) })
|
|
10600
10592
|
] }),
|
|
10601
|
-
/* @__PURE__ */ (0,
|
|
10593
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-col gap-2 flex-1 min-h-0 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10602
10594
|
QuizQuestionList,
|
|
10603
10595
|
{
|
|
10604
10596
|
filterType,
|
|
10605
|
-
onQuestionClick:
|
|
10597
|
+
onQuestionClick: closeModal
|
|
10606
10598
|
}
|
|
10607
10599
|
) })
|
|
10608
10600
|
] })
|
|
10609
10601
|
}
|
|
10610
10602
|
),
|
|
10611
|
-
/* @__PURE__ */ (0,
|
|
10603
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10612
10604
|
Modal_default,
|
|
10613
10605
|
{
|
|
10614
|
-
isOpen:
|
|
10615
|
-
onClose:
|
|
10606
|
+
isOpen: isModalOpen("modalResolution"),
|
|
10607
|
+
onClose: closeModal,
|
|
10616
10608
|
title: "Resolu\xE7\xE3o",
|
|
10617
10609
|
size: "lg",
|
|
10618
10610
|
children: currentQuestion?.solutionExplanation
|
|
10619
10611
|
}
|
|
10612
|
+
),
|
|
10613
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10614
|
+
Modal_default,
|
|
10615
|
+
{
|
|
10616
|
+
isOpen: isModalOpen("modalQuestionnaireAllCorrect"),
|
|
10617
|
+
onClose: closeModal,
|
|
10618
|
+
title: "",
|
|
10619
|
+
closeOnEscape: false,
|
|
10620
|
+
hideCloseButton: true,
|
|
10621
|
+
size: "md",
|
|
10622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
10623
|
+
resultImageComponent ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-[282px] h-auto", children: resultImageComponent }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-[282px] h-[200px] bg-gray-100 rounded-md flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-gray-500 text-sm", children: "Imagem de resultado" }) }),
|
|
10624
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
10625
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "\u{1F389} Parab\xE9ns!" }),
|
|
10626
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-500 font-sm", children: "Voc\xEA concluiu o m\xF3dulo Movimento Uniforme." })
|
|
10627
|
+
] }),
|
|
10628
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button_default, { className: "w-full", onClick: onGoToNextModule, children: "Pr\xF3ximo m\xF3dulo" }) })
|
|
10629
|
+
] })
|
|
10630
|
+
}
|
|
10631
|
+
),
|
|
10632
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10633
|
+
Modal_default,
|
|
10634
|
+
{
|
|
10635
|
+
isOpen: isModalOpen("modalQuestionnaireAllIncorrect"),
|
|
10636
|
+
onClose: closeModal,
|
|
10637
|
+
title: "",
|
|
10638
|
+
closeOnEscape: false,
|
|
10639
|
+
hideCloseButton: true,
|
|
10640
|
+
size: "md",
|
|
10641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
10642
|
+
resultIncorrectImageComponent ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-[282px] h-auto", children: resultIncorrectImageComponent }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-[282px] h-[200px] bg-gray-100 rounded-md flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-gray-500 text-sm", children: "Imagem de resultado" }) }),
|
|
10643
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
10644
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "\u{1F615} N\xE3o foi dessa vez..." }),
|
|
10645
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-500 font-sm", children: "Voc\xEA tirou 0 no question\xE1rio, mas n\xE3o se preocupe! Isso \xE9 apenas uma oportunidade de aprendizado." }),
|
|
10646
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-500 font-sm", children: "Que tal tentar novamente para melhorar sua nota? Estamos aqui para te ajudar a entender o conte\xFAdo e evoluir." }),
|
|
10647
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-500 font-sm", children: "Clique em Repetir Question\xE1rio e mostre do que voc\xEA \xE9 capaz! \u{1F4AA}" })
|
|
10648
|
+
] }),
|
|
10649
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-row justify-center items-center gap-2 w-full", children: [
|
|
10650
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10651
|
+
Button_default,
|
|
10652
|
+
{
|
|
10653
|
+
type: "button",
|
|
10654
|
+
variant: "link",
|
|
10655
|
+
size: "small",
|
|
10656
|
+
className: "w-auto",
|
|
10657
|
+
onClick: () => {
|
|
10658
|
+
closeModal();
|
|
10659
|
+
openModal("alertDialogTryLater");
|
|
10660
|
+
},
|
|
10661
|
+
children: "Tentar depois"
|
|
10662
|
+
}
|
|
10663
|
+
),
|
|
10664
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10665
|
+
Button_default,
|
|
10666
|
+
{
|
|
10667
|
+
variant: "outline",
|
|
10668
|
+
size: "small",
|
|
10669
|
+
className: "w-auto",
|
|
10670
|
+
onClick: onDetailResult,
|
|
10671
|
+
children: "Detalhar resultado"
|
|
10672
|
+
}
|
|
10673
|
+
),
|
|
10674
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10675
|
+
Button_default,
|
|
10676
|
+
{
|
|
10677
|
+
className: "w-auto",
|
|
10678
|
+
size: "small",
|
|
10679
|
+
onClick: onGoToNextModule,
|
|
10680
|
+
children: "Pr\xF3ximo m\xF3dulo"
|
|
10681
|
+
}
|
|
10682
|
+
)
|
|
10683
|
+
] })
|
|
10684
|
+
] })
|
|
10685
|
+
}
|
|
10686
|
+
),
|
|
10687
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10688
|
+
AlertDialog,
|
|
10689
|
+
{
|
|
10690
|
+
isOpen: isModalOpen("alertDialogTryLater"),
|
|
10691
|
+
onChangeOpen: (open) => open ? openModal("alertDialogTryLater") : closeModal(),
|
|
10692
|
+
title: "Tentar depois?",
|
|
10693
|
+
description: "Voc\xEA optou por refazer o question\xE1rio mais tarde.\n\nLembre-se: enquanto n\xE3o refazer o question\xE1rio, sua nota permanecer\xE1 0 no sistema.",
|
|
10694
|
+
cancelButtonLabel: "Repetir question\xE1rio",
|
|
10695
|
+
submitButtonLabel: "Tentar depois",
|
|
10696
|
+
onSubmit: () => {
|
|
10697
|
+
onTryLater?.();
|
|
10698
|
+
closeModal();
|
|
10699
|
+
},
|
|
10700
|
+
onCancel: () => {
|
|
10701
|
+
onRepeat?.();
|
|
10702
|
+
closeModal();
|
|
10703
|
+
}
|
|
10704
|
+
}
|
|
10620
10705
|
)
|
|
10621
10706
|
] });
|
|
10622
10707
|
}
|
|
10623
10708
|
);
|
|
10709
|
+
|
|
10710
|
+
// src/components/Quiz/QuizResult.tsx
|
|
10711
|
+
var import_react33 = require("react");
|
|
10712
|
+
var import_phosphor_react24 = require("phosphor-react");
|
|
10713
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
10624
10714
|
var QuizBadge = ({
|
|
10625
10715
|
subtype
|
|
10626
10716
|
}) => {
|
|
10627
10717
|
switch (subtype) {
|
|
10628
10718
|
case "PROVA" /* PROVA */:
|
|
10629
|
-
return /* @__PURE__ */ (0,
|
|
10719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam2", "data-testid": "quiz-badge", children: "Prova" });
|
|
10630
10720
|
case "ENEM_PROVA_1" /* ENEM_PROVA_1 */:
|
|
10631
10721
|
case "ENEM_PROVA_2" /* ENEM_PROVA_2 */:
|
|
10632
|
-
return /* @__PURE__ */ (0,
|
|
10722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam1", "data-testid": "quiz-badge", children: "Enem" });
|
|
10633
10723
|
case "VESTIBULAR" /* VESTIBULAR */:
|
|
10634
|
-
return /* @__PURE__ */ (0,
|
|
10724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam4", "data-testid": "quiz-badge", children: "Vestibular" });
|
|
10635
10725
|
case "SIMULADO" /* SIMULADO */:
|
|
10636
10726
|
case "SIMULADAO" /* SIMULADAO */:
|
|
10637
10727
|
case void 0:
|
|
10638
|
-
return /* @__PURE__ */ (0,
|
|
10728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam3", "data-testid": "quiz-badge", children: "Simulad\xE3o" });
|
|
10639
10729
|
default:
|
|
10640
|
-
return /* @__PURE__ */ (0,
|
|
10730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
|
|
10641
10731
|
}
|
|
10642
10732
|
};
|
|
10643
|
-
var
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10733
|
+
var QuizHeaderResult = (0, import_react33.forwardRef)(
|
|
10734
|
+
({ className, ...props }, ref) => {
|
|
10735
|
+
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
10736
|
+
const [status, setStatus] = (0, import_react33.useState)(void 0);
|
|
10737
|
+
(0, import_react33.useEffect)(() => {
|
|
10738
|
+
const cq = getCurrentQuestion();
|
|
10739
|
+
if (!cq) {
|
|
10740
|
+
setStatus(void 0);
|
|
10741
|
+
return;
|
|
10742
|
+
}
|
|
10743
|
+
const qr = getQuestionResultByQuestionId(cq.id);
|
|
10744
|
+
setStatus(qr?.answerStatus);
|
|
10745
|
+
}, [
|
|
10746
|
+
getCurrentQuestion,
|
|
10747
|
+
getQuestionResultByQuestionId,
|
|
10748
|
+
getCurrentQuestion()?.id
|
|
10749
|
+
]);
|
|
10750
|
+
const getClassesByAnswersStatus = () => {
|
|
10751
|
+
switch (status) {
|
|
10752
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
10753
|
+
return "bg-success-background";
|
|
10754
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
10755
|
+
return "bg-error-background";
|
|
10756
|
+
default:
|
|
10757
|
+
return "bg-error-background";
|
|
10758
|
+
}
|
|
10759
|
+
};
|
|
10760
|
+
const getLabelByAnswersStatus = () => {
|
|
10761
|
+
switch (status) {
|
|
10762
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
10763
|
+
return "\u{1F389} Parab\xE9ns!!";
|
|
10764
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
10765
|
+
return "N\xE3o foi dessa vez...";
|
|
10766
|
+
case "NAO_RESPONDIDO" /* NAO_RESPONDIDO */:
|
|
10767
|
+
default:
|
|
10768
|
+
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
10769
|
+
}
|
|
10770
|
+
};
|
|
10771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
10772
|
+
"div",
|
|
10773
|
+
{
|
|
10774
|
+
ref,
|
|
10775
|
+
className: cn(
|
|
10776
|
+
"flex flex-row items-center gap-10 p-3.5 rounded-xl mb-4",
|
|
10777
|
+
getClassesByAnswersStatus(),
|
|
10778
|
+
className
|
|
10779
|
+
),
|
|
10780
|
+
...props,
|
|
10781
|
+
children: [
|
|
10782
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
|
|
10783
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-700 text-md", children: getLabelByAnswersStatus() })
|
|
10784
|
+
]
|
|
10785
|
+
}
|
|
10786
|
+
);
|
|
10787
|
+
}
|
|
10788
|
+
);
|
|
10789
|
+
var QuizResultHeaderTitle = (0, import_react33.forwardRef)(({ className, ...props }, ref) => {
|
|
10790
|
+
const { quiz } = useQuizStore();
|
|
10791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
10647
10792
|
"div",
|
|
10648
10793
|
{
|
|
10649
10794
|
ref,
|
|
10650
10795
|
className: cn("flex flex-row pt-4 justify-between", className),
|
|
10651
10796
|
...props,
|
|
10652
10797
|
children: [
|
|
10653
|
-
/* @__PURE__ */ (0,
|
|
10654
|
-
/* @__PURE__ */ (0,
|
|
10798
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
|
|
10799
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(QuizBadge, { subtype: quiz?.subtype || void 0 })
|
|
10655
10800
|
]
|
|
10656
10801
|
}
|
|
10657
10802
|
);
|
|
10658
10803
|
});
|
|
10659
|
-
var QuizResultTitle = (0,
|
|
10804
|
+
var QuizResultTitle = (0, import_react33.forwardRef)(({ className, ...props }, ref) => {
|
|
10660
10805
|
const { getQuizTitle } = useQuizStore();
|
|
10661
10806
|
const quizTitle = getQuizTitle();
|
|
10662
|
-
return /* @__PURE__ */ (0,
|
|
10807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10663
10808
|
"p",
|
|
10664
10809
|
{
|
|
10665
10810
|
className: cn("pt-6 pb-4 text-text-950 font-bold text-lg", className),
|
|
@@ -10669,7 +10814,7 @@ var QuizResultTitle = (0, import_react31.forwardRef)(({ className, ...props }, r
|
|
|
10669
10814
|
}
|
|
10670
10815
|
);
|
|
10671
10816
|
});
|
|
10672
|
-
var QuizResultPerformance = (0,
|
|
10817
|
+
var QuizResultPerformance = (0, import_react33.forwardRef)(
|
|
10673
10818
|
({ ...props }, ref) => {
|
|
10674
10819
|
const {
|
|
10675
10820
|
getTotalQuestions,
|
|
@@ -10711,15 +10856,15 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10711
10856
|
});
|
|
10712
10857
|
}
|
|
10713
10858
|
const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
|
|
10714
|
-
return /* @__PURE__ */ (0,
|
|
10859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
10715
10860
|
"div",
|
|
10716
10861
|
{
|
|
10717
10862
|
className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
|
|
10718
10863
|
ref,
|
|
10719
10864
|
...props,
|
|
10720
10865
|
children: [
|
|
10721
|
-
/* @__PURE__ */ (0,
|
|
10722
|
-
/* @__PURE__ */ (0,
|
|
10866
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative", children: [
|
|
10867
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10723
10868
|
ProgressCircle_default,
|
|
10724
10869
|
{
|
|
10725
10870
|
size: "medium",
|
|
@@ -10729,24 +10874,24 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10729
10874
|
label: ""
|
|
10730
10875
|
}
|
|
10731
10876
|
),
|
|
10732
|
-
/* @__PURE__ */ (0,
|
|
10733
|
-
/* @__PURE__ */ (0,
|
|
10734
|
-
/* @__PURE__ */ (0,
|
|
10735
|
-
/* @__PURE__ */ (0,
|
|
10877
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
10878
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
|
|
10879
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_phosphor_react24.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
|
|
10880
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(
|
|
10736
10881
|
(getQuestionResultStatistics()?.timeSpent ?? 0) * 60
|
|
10737
10882
|
) })
|
|
10738
10883
|
] }),
|
|
10739
|
-
/* @__PURE__ */ (0,
|
|
10884
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
|
|
10740
10885
|
getQuestionResultStatistics()?.correctAnswers ?? "--",
|
|
10741
10886
|
" de",
|
|
10742
10887
|
" ",
|
|
10743
10888
|
totalQuestions
|
|
10744
10889
|
] }),
|
|
10745
|
-
/* @__PURE__ */ (0,
|
|
10890
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
|
|
10746
10891
|
] })
|
|
10747
10892
|
] }),
|
|
10748
|
-
/* @__PURE__ */ (0,
|
|
10749
|
-
/* @__PURE__ */ (0,
|
|
10893
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
|
|
10894
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10750
10895
|
ProgressBar_default,
|
|
10751
10896
|
{
|
|
10752
10897
|
className: "w-full",
|
|
@@ -10760,7 +10905,7 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10760
10905
|
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
10761
10906
|
}
|
|
10762
10907
|
),
|
|
10763
|
-
/* @__PURE__ */ (0,
|
|
10908
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10764
10909
|
ProgressBar_default,
|
|
10765
10910
|
{
|
|
10766
10911
|
className: "w-full",
|
|
@@ -10774,7 +10919,7 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10774
10919
|
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
10775
10920
|
}
|
|
10776
10921
|
),
|
|
10777
|
-
/* @__PURE__ */ (0,
|
|
10922
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10778
10923
|
ProgressBar_default,
|
|
10779
10924
|
{
|
|
10780
10925
|
className: "w-full",
|
|
@@ -10794,7 +10939,7 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10794
10939
|
);
|
|
10795
10940
|
}
|
|
10796
10941
|
);
|
|
10797
|
-
var QuizListResult = (0,
|
|
10942
|
+
var QuizListResult = (0, import_react33.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
|
|
10798
10943
|
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
10799
10944
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
10800
10945
|
const subjectsStats = Object.entries(groupedQuestions).map(
|
|
@@ -10821,9 +10966,9 @@ var QuizListResult = (0, import_react31.forwardRef)(({ className, onSubjectClick
|
|
|
10821
10966
|
};
|
|
10822
10967
|
}
|
|
10823
10968
|
);
|
|
10824
|
-
return /* @__PURE__ */ (0,
|
|
10825
|
-
/* @__PURE__ */ (0,
|
|
10826
|
-
/* @__PURE__ */ (0,
|
|
10969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { ref, className, ...props, children: [
|
|
10970
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
|
|
10971
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10827
10972
|
CardResults,
|
|
10828
10973
|
{
|
|
10829
10974
|
onClick: () => onSubjectClick?.(subject.subject.id),
|
|
@@ -10845,16 +10990,16 @@ var QuizListResultByMateria = ({
|
|
|
10845
10990
|
const { getQuestionsGroupedBySubject, getQuestionIndex } = useQuizStore();
|
|
10846
10991
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
10847
10992
|
const answeredQuestions = groupedQuestions[subject] || [];
|
|
10848
|
-
return /* @__PURE__ */ (0,
|
|
10849
|
-
/* @__PURE__ */ (0,
|
|
10850
|
-
/* @__PURE__ */ (0,
|
|
10851
|
-
/* @__PURE__ */ (0,
|
|
10852
|
-
/* @__PURE__ */ (0,
|
|
10993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col", children: [
|
|
10994
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: answeredQuestions?.[0]?.knowledgeMatrix?.[0]?.subject?.name ?? "Sem mat\xE9ria" }) }),
|
|
10995
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: "flex flex-col ", children: [
|
|
10996
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
|
|
10997
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
|
|
10853
10998
|
const questionIndex = getQuestionIndex(
|
|
10854
10999
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10855
11000
|
question.questionId ?? question.id
|
|
10856
11001
|
);
|
|
10857
|
-
return /* @__PURE__ */ (0,
|
|
11002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10858
11003
|
CardStatus,
|
|
10859
11004
|
{
|
|
10860
11005
|
className: "max-w-full",
|
|
@@ -10877,12 +11022,12 @@ var QuizListResultByMateria = ({
|
|
|
10877
11022
|
};
|
|
10878
11023
|
|
|
10879
11024
|
// src/components/LoadingModal/loadingModal.tsx
|
|
10880
|
-
var
|
|
10881
|
-
var
|
|
10882
|
-
var LoadingModal = (0,
|
|
11025
|
+
var import_react34 = require("react");
|
|
11026
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
11027
|
+
var LoadingModal = (0, import_react34.forwardRef)(
|
|
10883
11028
|
({ open, title = "Titulo...", subtitle = "Subtitulo...", ...props }, ref) => {
|
|
10884
11029
|
if (!open) return null;
|
|
10885
|
-
return /* @__PURE__ */ (0,
|
|
11030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10886
11031
|
"div",
|
|
10887
11032
|
{
|
|
10888
11033
|
ref,
|
|
@@ -10891,8 +11036,8 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10891
11036
|
"aria-describedby": "loading-modal-subtitle",
|
|
10892
11037
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-background/90 backdrop-blur-xs",
|
|
10893
11038
|
...props,
|
|
10894
|
-
children: /* @__PURE__ */ (0,
|
|
10895
|
-
/* @__PURE__ */ (0,
|
|
11039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "w-full max-w-[364px] flex flex-col items-center justify-center gap-14", children: [
|
|
11040
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "animate-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10896
11041
|
"svg",
|
|
10897
11042
|
{
|
|
10898
11043
|
width: "102",
|
|
@@ -10903,14 +11048,14 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10903
11048
|
"aria-hidden": "true",
|
|
10904
11049
|
focusable: false,
|
|
10905
11050
|
children: [
|
|
10906
|
-
/* @__PURE__ */ (0,
|
|
11051
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10907
11052
|
"path",
|
|
10908
11053
|
{
|
|
10909
11054
|
d: "M101.5 51C101.5 78.8904 78.8904 101.5 51 101.5C23.1096 101.5 0.5 78.8904 0.5 51C0.5 23.1096 23.1096 0.5 51 0.5C78.8904 0.5 101.5 23.1096 101.5 51ZM8.62286 51C8.62286 74.4043 27.5957 93.3771 51 93.3771C74.4043 93.3771 93.3771 74.4043 93.3771 51C93.3771 27.5957 74.4043 8.62286 51 8.62286C27.5957 8.62286 8.62286 27.5957 8.62286 51Z",
|
|
10910
11055
|
className: "fill-primary-100"
|
|
10911
11056
|
}
|
|
10912
11057
|
),
|
|
10913
|
-
/* @__PURE__ */ (0,
|
|
11058
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10914
11059
|
"path",
|
|
10915
11060
|
{
|
|
10916
11061
|
d: "M97.4386 51C99.6816 51 101.517 52.8213 101.337 55.0571C100.754 62.2833 98.6212 69.3162 95.0643 75.6696C90.8444 83.207 84.7616 89.536 77.3975 94.0514C70.0333 98.5668 61.6339 101.118 53.0024 101.46C44.371 101.803 35.7959 99.9255 28.0971 96.0078C20.3982 92.0902 13.833 86.2631 9.02917 79.0838C4.22529 71.9045 1.34332 63.6129 0.658804 55.0017C-0.0257159 46.3906 1.51009 37.7479 5.1194 29.8997C8.16173 23.2845 12.5915 17.4202 18.0904 12.6959C19.7917 11.2341 22.3444 11.6457 23.6647 13.459C24.9851 15.2723 24.5702 17.7988 22.8916 19.2866C18.5048 23.1747 14.9608 27.9413 12.4992 33.2937C9.47048 39.8794 8.1817 47.132 8.75612 54.3581C9.33053 61.5841 11.7489 68.542 15.7801 74.5666C19.8113 80.5911 25.3205 85.4809 31.781 88.7684C38.2414 92.0559 45.4372 93.6312 52.6804 93.3438C59.9235 93.0564 66.9718 90.9158 73.1515 87.1267C79.3311 83.3375 84.4355 78.0266 87.9766 71.7015C90.8546 66.561 92.6217 60.8903 93.1827 55.0553C93.3973 52.8225 95.1955 51 97.4386 51Z",
|
|
@@ -10920,9 +11065,9 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10920
11065
|
]
|
|
10921
11066
|
}
|
|
10922
11067
|
) }),
|
|
10923
|
-
/* @__PURE__ */ (0,
|
|
10924
|
-
/* @__PURE__ */ (0,
|
|
10925
|
-
/* @__PURE__ */ (0,
|
|
11068
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "flex flex-col gap-4 text-center", children: [
|
|
11069
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { id: "loading-modal-title", className: "text-text-950 text-lg", children: title }),
|
|
11070
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { id: "loading-modal-subtitle", className: "text-text-600 text-lg", children: subtitle })
|
|
10926
11071
|
] })
|
|
10927
11072
|
] })
|
|
10928
11073
|
}
|
|
@@ -10932,8 +11077,8 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10932
11077
|
var loadingModal_default = LoadingModal;
|
|
10933
11078
|
|
|
10934
11079
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
10935
|
-
var
|
|
10936
|
-
var
|
|
11080
|
+
var import_phosphor_react25 = require("phosphor-react");
|
|
11081
|
+
var import_react35 = require("react");
|
|
10937
11082
|
|
|
10938
11083
|
// src/store/notificationStore.ts
|
|
10939
11084
|
var import_zustand8 = require("zustand");
|
|
@@ -11180,14 +11325,19 @@ var createNotificationStore = (apiClient) => {
|
|
|
11180
11325
|
var mock_content_default = "./mock-content-K2CDVG6P.png";
|
|
11181
11326
|
|
|
11182
11327
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
11183
|
-
var
|
|
11328
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
11329
|
+
var syncNotificationState = (open, isNotificationActive, setActiveStates, key = "notifications") => {
|
|
11330
|
+
if (!open && isNotificationActive) {
|
|
11331
|
+
setActiveStates((prev) => ({ ...prev, [key]: false }));
|
|
11332
|
+
}
|
|
11333
|
+
};
|
|
11184
11334
|
var NotificationEmpty = ({
|
|
11185
11335
|
emptyStateImage,
|
|
11186
11336
|
emptyStateTitle = "Nenhuma notifica\xE7\xE3o no momento",
|
|
11187
11337
|
emptyStateDescription = "Voc\xEA est\xE1 em dia com todas as novidades. Volte depois para conferir atualiza\xE7\xF5es!"
|
|
11188
11338
|
}) => {
|
|
11189
|
-
return /* @__PURE__ */ (0,
|
|
11190
|
-
emptyStateImage && /* @__PURE__ */ (0,
|
|
11339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
11340
|
+
emptyStateImage && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11191
11341
|
"img",
|
|
11192
11342
|
{
|
|
11193
11343
|
src: emptyStateImage,
|
|
@@ -11197,23 +11347,23 @@ var NotificationEmpty = ({
|
|
|
11197
11347
|
className: "object-contain"
|
|
11198
11348
|
}
|
|
11199
11349
|
) }),
|
|
11200
|
-
/* @__PURE__ */ (0,
|
|
11201
|
-
/* @__PURE__ */ (0,
|
|
11350
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: emptyStateTitle }),
|
|
11351
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-[316px] leading-[21px]", children: emptyStateDescription })
|
|
11202
11352
|
] });
|
|
11203
11353
|
};
|
|
11204
11354
|
var NotificationHeader = ({
|
|
11205
11355
|
unreadCount,
|
|
11206
11356
|
variant = "modal"
|
|
11207
11357
|
}) => {
|
|
11208
|
-
return /* @__PURE__ */ (0,
|
|
11209
|
-
variant === "modal" ? /* @__PURE__ */ (0,
|
|
11210
|
-
unreadCount > 0 && /* @__PURE__ */ (0,
|
|
11358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
11359
|
+
variant === "modal" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950", children: "Notifica\xE7\xF5es" }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h3", { className: "text-sm font-semibold text-text-950", children: "Notifica\xE7\xF5es" }),
|
|
11360
|
+
unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11211
11361
|
Badge_default,
|
|
11212
11362
|
{
|
|
11213
11363
|
variant: "solid",
|
|
11214
11364
|
action: "info",
|
|
11215
11365
|
size: "small",
|
|
11216
|
-
iconLeft: /* @__PURE__ */ (0,
|
|
11366
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.Bell, { size: 12, "aria-hidden": "true", focusable: "false" }),
|
|
11217
11367
|
className: "border-0",
|
|
11218
11368
|
children: unreadCount === 1 ? "1 n\xE3o lida" : `${unreadCount} n\xE3o lidas`
|
|
11219
11369
|
}
|
|
@@ -11249,7 +11399,7 @@ var SingleNotificationCard = ({
|
|
|
11249
11399
|
onNavigate();
|
|
11250
11400
|
}
|
|
11251
11401
|
};
|
|
11252
|
-
return /* @__PURE__ */ (0,
|
|
11402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
11253
11403
|
"div",
|
|
11254
11404
|
{
|
|
11255
11405
|
className: cn(
|
|
@@ -11258,20 +11408,20 @@ var SingleNotificationCard = ({
|
|
|
11258
11408
|
className
|
|
11259
11409
|
),
|
|
11260
11410
|
children: [
|
|
11261
|
-
/* @__PURE__ */ (0,
|
|
11262
|
-
!isRead && /* @__PURE__ */ (0,
|
|
11263
|
-
/* @__PURE__ */ (0,
|
|
11264
|
-
/* @__PURE__ */ (0,
|
|
11265
|
-
/* @__PURE__ */ (0,
|
|
11411
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-2 w-full", children: [
|
|
11412
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
11413
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
11414
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(DropdownMenu_default, { children: [
|
|
11415
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11266
11416
|
DropdownMenuTrigger,
|
|
11267
11417
|
{
|
|
11268
11418
|
className: "flex-shrink-0 inline-flex items-center justify-center font-medium bg-transparent text-text-950 cursor-pointer hover:bg-info-50 w-6 h-6 rounded-lg",
|
|
11269
11419
|
"aria-label": "Menu de a\xE7\xF5es",
|
|
11270
|
-
children: /* @__PURE__ */ (0,
|
|
11420
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.DotsThreeVertical, { size: 24 })
|
|
11271
11421
|
}
|
|
11272
11422
|
),
|
|
11273
|
-
/* @__PURE__ */ (0,
|
|
11274
|
-
!isRead && /* @__PURE__ */ (0,
|
|
11423
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
11424
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11275
11425
|
DropdownMenuItem,
|
|
11276
11426
|
{
|
|
11277
11427
|
onClick: handleMarkAsRead,
|
|
@@ -11279,14 +11429,14 @@ var SingleNotificationCard = ({
|
|
|
11279
11429
|
children: "Marcar como lida"
|
|
11280
11430
|
}
|
|
11281
11431
|
),
|
|
11282
|
-
/* @__PURE__ */ (0,
|
|
11432
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
11283
11433
|
] })
|
|
11284
11434
|
] })
|
|
11285
11435
|
] }),
|
|
11286
|
-
/* @__PURE__ */ (0,
|
|
11287
|
-
/* @__PURE__ */ (0,
|
|
11288
|
-
/* @__PURE__ */ (0,
|
|
11289
|
-
onNavigate && actionLabel && /* @__PURE__ */ (0,
|
|
11436
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
11437
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
11438
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
11439
|
+
onNavigate && actionLabel && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11290
11440
|
"button",
|
|
11291
11441
|
{
|
|
11292
11442
|
type: "button",
|
|
@@ -11314,7 +11464,7 @@ var NotificationList = ({
|
|
|
11314
11464
|
className,
|
|
11315
11465
|
emptyStateImage
|
|
11316
11466
|
}) => {
|
|
11317
|
-
const [globalNotificationModal, setGlobalNotificationModal] = (0,
|
|
11467
|
+
const [globalNotificationModal, setGlobalNotificationModal] = (0, import_react35.useState)({ isOpen: false, notification: null });
|
|
11318
11468
|
const handleGlobalNotificationClick = (notification) => {
|
|
11319
11469
|
if (onGlobalNotificationClick) {
|
|
11320
11470
|
onGlobalNotificationClick(notification);
|
|
@@ -11326,9 +11476,9 @@ var NotificationList = ({
|
|
|
11326
11476
|
}
|
|
11327
11477
|
};
|
|
11328
11478
|
if (error) {
|
|
11329
|
-
return /* @__PURE__ */ (0,
|
|
11330
|
-
/* @__PURE__ */ (0,
|
|
11331
|
-
onRetry && /* @__PURE__ */ (0,
|
|
11479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
11480
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm text-error-600", children: error }),
|
|
11481
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11332
11482
|
"button",
|
|
11333
11483
|
{
|
|
11334
11484
|
type: "button",
|
|
@@ -11340,8 +11490,8 @@ var NotificationList = ({
|
|
|
11340
11490
|
] });
|
|
11341
11491
|
}
|
|
11342
11492
|
if (loading) {
|
|
11343
|
-
return /* @__PURE__ */ (0,
|
|
11344
|
-
(skeletonId) => /* @__PURE__ */ (0,
|
|
11493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
11494
|
+
(skeletonId) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11345
11495
|
SkeletonCard,
|
|
11346
11496
|
{
|
|
11347
11497
|
className: "p-4 border-b border-border-200"
|
|
@@ -11351,11 +11501,11 @@ var NotificationList = ({
|
|
|
11351
11501
|
) });
|
|
11352
11502
|
}
|
|
11353
11503
|
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
11354
|
-
return renderEmpty ? /* @__PURE__ */ (0,
|
|
11504
|
+
return renderEmpty ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationEmpty, {});
|
|
11355
11505
|
}
|
|
11356
|
-
return /* @__PURE__ */ (0,
|
|
11357
|
-
groupedNotifications.map((group, idx) => /* @__PURE__ */ (0,
|
|
11358
|
-
/* @__PURE__ */ (0,
|
|
11506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cn("flex flex-col gap-0 w-full", className), children: [
|
|
11507
|
+
groupedNotifications.map((group, idx) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col", children: [
|
|
11508
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
11359
11509
|
group.notifications.map((notification) => {
|
|
11360
11510
|
const isGlobalNotification = !notification.entityType && !notification.entityId && !notification.activity && !notification.goal;
|
|
11361
11511
|
let navigationHandler;
|
|
@@ -11375,7 +11525,7 @@ var NotificationList = ({
|
|
|
11375
11525
|
notification.entityType ?? void 0
|
|
11376
11526
|
);
|
|
11377
11527
|
}
|
|
11378
|
-
return /* @__PURE__ */ (0,
|
|
11528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11379
11529
|
SingleNotificationCard,
|
|
11380
11530
|
{
|
|
11381
11531
|
title: notification.title,
|
|
@@ -11391,7 +11541,7 @@ var NotificationList = ({
|
|
|
11391
11541
|
);
|
|
11392
11542
|
})
|
|
11393
11543
|
] }, `${group.label}-${idx}`)),
|
|
11394
|
-
/* @__PURE__ */ (0,
|
|
11544
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11395
11545
|
Modal_default,
|
|
11396
11546
|
{
|
|
11397
11547
|
isOpen: globalNotificationModal.isOpen,
|
|
@@ -11428,8 +11578,8 @@ var NotificationCenter = ({
|
|
|
11428
11578
|
className
|
|
11429
11579
|
}) => {
|
|
11430
11580
|
const { isMobile } = useMobile();
|
|
11431
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
11432
|
-
const [globalNotificationModal, setGlobalNotificationModal] = (0,
|
|
11581
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react35.useState)(false);
|
|
11582
|
+
const [globalNotificationModal, setGlobalNotificationModal] = (0, import_react35.useState)({ isOpen: false, notification: null });
|
|
11433
11583
|
const handleMobileClick = () => {
|
|
11434
11584
|
setIsModalOpen(true);
|
|
11435
11585
|
onFetchNotifications?.();
|
|
@@ -11444,12 +11594,12 @@ var NotificationCenter = ({
|
|
|
11444
11594
|
onToggleActive?.();
|
|
11445
11595
|
}
|
|
11446
11596
|
};
|
|
11447
|
-
(0,
|
|
11597
|
+
(0, import_react35.useEffect)(() => {
|
|
11448
11598
|
if (isActive) {
|
|
11449
11599
|
onFetchNotifications?.();
|
|
11450
11600
|
}
|
|
11451
11601
|
}, [isActive, onFetchNotifications]);
|
|
11452
|
-
const renderEmptyState = () => /* @__PURE__ */ (0,
|
|
11602
|
+
const renderEmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11453
11603
|
NotificationEmpty,
|
|
11454
11604
|
{
|
|
11455
11605
|
emptyStateImage,
|
|
@@ -11458,17 +11608,17 @@ var NotificationCenter = ({
|
|
|
11458
11608
|
}
|
|
11459
11609
|
);
|
|
11460
11610
|
if (isMobile) {
|
|
11461
|
-
return /* @__PURE__ */ (0,
|
|
11462
|
-
/* @__PURE__ */ (0,
|
|
11611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
11612
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11463
11613
|
IconButton_default,
|
|
11464
11614
|
{
|
|
11465
11615
|
active: isModalOpen,
|
|
11466
11616
|
onClick: handleMobileClick,
|
|
11467
|
-
icon: /* @__PURE__ */ (0,
|
|
11617
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.Bell, { size: 24, className: "text-primary" }),
|
|
11468
11618
|
className
|
|
11469
11619
|
}
|
|
11470
11620
|
),
|
|
11471
|
-
/* @__PURE__ */ (0,
|
|
11621
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11472
11622
|
Modal_default,
|
|
11473
11623
|
{
|
|
11474
11624
|
isOpen: isModalOpen,
|
|
@@ -11477,10 +11627,10 @@ var NotificationCenter = ({
|
|
|
11477
11627
|
size: "md",
|
|
11478
11628
|
hideCloseButton: false,
|
|
11479
11629
|
closeOnEscape: true,
|
|
11480
|
-
children: /* @__PURE__ */ (0,
|
|
11481
|
-
/* @__PURE__ */ (0,
|
|
11482
|
-
/* @__PURE__ */ (0,
|
|
11483
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0,
|
|
11630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col h-full max-h-[80vh]", children: [
|
|
11631
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "px-0 pb-3 border-b border-border-200", children: [
|
|
11632
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationHeader, { unreadCount, variant: "modal" }),
|
|
11633
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11484
11634
|
"button",
|
|
11485
11635
|
{
|
|
11486
11636
|
type: "button",
|
|
@@ -11490,7 +11640,7 @@ var NotificationCenter = ({
|
|
|
11490
11640
|
}
|
|
11491
11641
|
)
|
|
11492
11642
|
] }),
|
|
11493
|
-
/* @__PURE__ */ (0,
|
|
11643
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11494
11644
|
NotificationList,
|
|
11495
11645
|
{
|
|
11496
11646
|
groupedNotifications,
|
|
@@ -11517,22 +11667,36 @@ var NotificationCenter = ({
|
|
|
11517
11667
|
) })
|
|
11518
11668
|
] })
|
|
11519
11669
|
}
|
|
11670
|
+
),
|
|
11671
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11672
|
+
Modal_default,
|
|
11673
|
+
{
|
|
11674
|
+
isOpen: globalNotificationModal.isOpen,
|
|
11675
|
+
onClose: () => setGlobalNotificationModal({ isOpen: false, notification: null }),
|
|
11676
|
+
title: globalNotificationModal.notification?.title || "",
|
|
11677
|
+
variant: "activity",
|
|
11678
|
+
description: globalNotificationModal.notification?.message,
|
|
11679
|
+
image: emptyStateImage || mock_content_default,
|
|
11680
|
+
actionLink: globalNotificationModal.notification?.actionLink || void 0,
|
|
11681
|
+
actionLabel: "Ver mais",
|
|
11682
|
+
size: "lg"
|
|
11683
|
+
}
|
|
11520
11684
|
)
|
|
11521
11685
|
] });
|
|
11522
11686
|
}
|
|
11523
|
-
return /* @__PURE__ */ (0,
|
|
11524
|
-
/* @__PURE__ */ (0,
|
|
11687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
11688
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
11525
11689
|
DropdownMenu_default,
|
|
11526
11690
|
{
|
|
11527
11691
|
...typeof isActive === "boolean" ? { open: isActive, onOpenChange: handleOpenChange } : { onOpenChange: handleOpenChange },
|
|
11528
11692
|
children: [
|
|
11529
|
-
/* @__PURE__ */ (0,
|
|
11693
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DropdownMenuTrigger, { className: "text-primary cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11530
11694
|
IconButton_default,
|
|
11531
11695
|
{
|
|
11532
11696
|
active: isActive,
|
|
11533
11697
|
onClick: handleDesktopClick,
|
|
11534
|
-
icon: /* @__PURE__ */ (0,
|
|
11535
|
-
|
|
11698
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11699
|
+
import_phosphor_react25.Bell,
|
|
11536
11700
|
{
|
|
11537
11701
|
size: 24,
|
|
11538
11702
|
className: isActive ? "text-primary-950" : "text-primary"
|
|
@@ -11541,22 +11705,22 @@ var NotificationCenter = ({
|
|
|
11541
11705
|
className
|
|
11542
11706
|
}
|
|
11543
11707
|
) }),
|
|
11544
|
-
/* @__PURE__ */ (0,
|
|
11708
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11545
11709
|
DropdownMenuContent,
|
|
11546
11710
|
{
|
|
11547
11711
|
className: "min-w-[320px] max-w-[400px] max-h-[500px] overflow-hidden",
|
|
11548
11712
|
side: "bottom",
|
|
11549
11713
|
align: "end",
|
|
11550
|
-
children: /* @__PURE__ */ (0,
|
|
11551
|
-
/* @__PURE__ */ (0,
|
|
11552
|
-
/* @__PURE__ */ (0,
|
|
11714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col", children: [
|
|
11715
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "px-4 py-3 border-b border-border-200", children: [
|
|
11716
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11553
11717
|
NotificationHeader,
|
|
11554
11718
|
{
|
|
11555
11719
|
unreadCount,
|
|
11556
11720
|
variant: "dropdown"
|
|
11557
11721
|
}
|
|
11558
11722
|
),
|
|
11559
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0,
|
|
11723
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11560
11724
|
"button",
|
|
11561
11725
|
{
|
|
11562
11726
|
type: "button",
|
|
@@ -11566,7 +11730,7 @@ var NotificationCenter = ({
|
|
|
11566
11730
|
}
|
|
11567
11731
|
)
|
|
11568
11732
|
] }),
|
|
11569
|
-
/* @__PURE__ */ (0,
|
|
11733
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11570
11734
|
NotificationList,
|
|
11571
11735
|
{
|
|
11572
11736
|
groupedNotifications,
|
|
@@ -11593,7 +11757,7 @@ var NotificationCenter = ({
|
|
|
11593
11757
|
]
|
|
11594
11758
|
}
|
|
11595
11759
|
),
|
|
11596
|
-
/* @__PURE__ */ (0,
|
|
11760
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11597
11761
|
Modal_default,
|
|
11598
11762
|
{
|
|
11599
11763
|
isOpen: globalNotificationModal.isOpen,
|
|
@@ -11612,7 +11776,7 @@ var NotificationCenter = ({
|
|
|
11612
11776
|
var NotificationCard = (props) => {
|
|
11613
11777
|
switch (props.mode) {
|
|
11614
11778
|
case "single":
|
|
11615
|
-
return /* @__PURE__ */ (0,
|
|
11779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11616
11780
|
SingleNotificationCard,
|
|
11617
11781
|
{
|
|
11618
11782
|
title: props.title,
|
|
@@ -11627,7 +11791,7 @@ var NotificationCard = (props) => {
|
|
|
11627
11791
|
}
|
|
11628
11792
|
);
|
|
11629
11793
|
case "list":
|
|
11630
|
-
return /* @__PURE__ */ (0,
|
|
11794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11631
11795
|
NotificationList,
|
|
11632
11796
|
{
|
|
11633
11797
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -11650,9 +11814,9 @@ var NotificationCard = (props) => {
|
|
|
11650
11814
|
}
|
|
11651
11815
|
);
|
|
11652
11816
|
case "center":
|
|
11653
|
-
return /* @__PURE__ */ (0,
|
|
11817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationCenter, { ...props });
|
|
11654
11818
|
default:
|
|
11655
|
-
return /* @__PURE__ */ (0,
|
|
11819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm text-text-600", children: "Modo de notifica\xE7\xE3o n\xE3o reconhecido" }) });
|
|
11656
11820
|
}
|
|
11657
11821
|
};
|
|
11658
11822
|
var NotificationCard_default = NotificationCard;
|
|
@@ -11663,7 +11827,7 @@ var createUseNotificationStore = (apiClient) => {
|
|
|
11663
11827
|
};
|
|
11664
11828
|
|
|
11665
11829
|
// src/hooks/useNotifications.ts
|
|
11666
|
-
var
|
|
11830
|
+
var import_react36 = require("react");
|
|
11667
11831
|
var createUseNotifications = (apiClient) => {
|
|
11668
11832
|
const useNotificationStore = createUseNotificationStore(apiClient);
|
|
11669
11833
|
return () => {
|
|
@@ -11682,7 +11846,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11682
11846
|
resetError,
|
|
11683
11847
|
getGroupedNotifications
|
|
11684
11848
|
} = useNotificationStore();
|
|
11685
|
-
const handleNavigate = (0,
|
|
11849
|
+
const handleNavigate = (0, import_react36.useCallback)(
|
|
11686
11850
|
(entityType, entityId, onAfterNavigate) => {
|
|
11687
11851
|
if (entityType && entityId) {
|
|
11688
11852
|
switch (entityType.toUpperCase()) {
|
|
@@ -11700,7 +11864,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11700
11864
|
},
|
|
11701
11865
|
[]
|
|
11702
11866
|
);
|
|
11703
|
-
const getActionLabel = (0,
|
|
11867
|
+
const getActionLabel = (0, import_react36.useCallback)(
|
|
11704
11868
|
(entityType) => {
|
|
11705
11869
|
if (!entityType) return "Ver mais";
|
|
11706
11870
|
switch (entityType.toUpperCase()) {
|
|
@@ -11714,7 +11878,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11714
11878
|
},
|
|
11715
11879
|
[]
|
|
11716
11880
|
);
|
|
11717
|
-
const markAsReadAndNavigate = (0,
|
|
11881
|
+
const markAsReadAndNavigate = (0, import_react36.useCallback)(
|
|
11718
11882
|
async (id, entityType, entityId, onAfterNavigate) => {
|
|
11719
11883
|
await markAsRead(id);
|
|
11720
11884
|
if (entityType && entityId) {
|
|
@@ -11723,11 +11887,11 @@ var createUseNotifications = (apiClient) => {
|
|
|
11723
11887
|
},
|
|
11724
11888
|
[markAsRead, handleNavigate]
|
|
11725
11889
|
);
|
|
11726
|
-
const refreshNotifications = (0,
|
|
11890
|
+
const refreshNotifications = (0, import_react36.useCallback)(async () => {
|
|
11727
11891
|
resetError();
|
|
11728
11892
|
await fetchNotifications();
|
|
11729
11893
|
}, [resetError, fetchNotifications]);
|
|
11730
|
-
const formatNotification = (0,
|
|
11894
|
+
const formatNotification = (0, import_react36.useCallback)(
|
|
11731
11895
|
(notification) => ({
|
|
11732
11896
|
...notification,
|
|
11733
11897
|
time: formatTimeAgo(notification.createdAt),
|
|
@@ -11736,7 +11900,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11736
11900
|
}),
|
|
11737
11901
|
[]
|
|
11738
11902
|
);
|
|
11739
|
-
const getFormattedGroupedNotifications = (0,
|
|
11903
|
+
const getFormattedGroupedNotifications = (0, import_react36.useCallback)(() => {
|
|
11740
11904
|
const groups = getGroupedNotifications();
|
|
11741
11905
|
return groups.map((group) => ({
|
|
11742
11906
|
...group,
|
|
@@ -11832,6 +11996,7 @@ var createNotificationsHook = (apiClient) => {
|
|
|
11832
11996
|
QUESTION_DIFFICULTY,
|
|
11833
11997
|
QUESTION_STATUS,
|
|
11834
11998
|
QUESTION_TYPE,
|
|
11999
|
+
QUIZ_TYPE,
|
|
11835
12000
|
Quiz,
|
|
11836
12001
|
QuizAlternative,
|
|
11837
12002
|
QuizConnectDots,
|
|
@@ -11894,6 +12059,7 @@ var createNotificationsHook = (apiClient) => {
|
|
|
11894
12059
|
getSubjectIcon,
|
|
11895
12060
|
getSubjectInfo,
|
|
11896
12061
|
getSubjectName,
|
|
12062
|
+
syncNotificationState,
|
|
11897
12063
|
useApiConfig,
|
|
11898
12064
|
useAuth,
|
|
11899
12065
|
useAuthGuard,
|