analytica-frontend-lib 1.1.63 → 1.1.64
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/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 +35 -4
- package/dist/index.d.ts +35 -4
- package/dist/index.js +585 -440
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +586 -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,
|
|
@@ -8750,8 +8751,8 @@ function useApiConfig(api) {
|
|
|
8750
8751
|
}
|
|
8751
8752
|
|
|
8752
8753
|
// src/components/Quiz/Quiz.tsx
|
|
8753
|
-
var
|
|
8754
|
-
var
|
|
8754
|
+
var import_phosphor_react23 = require("phosphor-react");
|
|
8755
|
+
var import_react32 = require("react");
|
|
8755
8756
|
|
|
8756
8757
|
// src/components/Quiz/useQuizStore.ts
|
|
8757
8758
|
var import_zustand7 = require("zustand");
|
|
@@ -8762,6 +8763,12 @@ var QUESTION_DIFFICULTY = /* @__PURE__ */ ((QUESTION_DIFFICULTY2) => {
|
|
|
8762
8763
|
QUESTION_DIFFICULTY2["DIFICIL"] = "DIFICIL";
|
|
8763
8764
|
return QUESTION_DIFFICULTY2;
|
|
8764
8765
|
})(QUESTION_DIFFICULTY || {});
|
|
8766
|
+
var QUIZ_TYPE = /* @__PURE__ */ ((QUIZ_TYPE2) => {
|
|
8767
|
+
QUIZ_TYPE2["SIMULADO"] = "SIMULADO";
|
|
8768
|
+
QUIZ_TYPE2["QUESTIONARIO"] = "QUESTIONARIO";
|
|
8769
|
+
QUIZ_TYPE2["ATIVIDADE"] = "ATIVIDADE";
|
|
8770
|
+
return QUIZ_TYPE2;
|
|
8771
|
+
})(QUIZ_TYPE || {});
|
|
8765
8772
|
var QUESTION_TYPE = /* @__PURE__ */ ((QUESTION_TYPE2) => {
|
|
8766
8773
|
QUESTION_TYPE2["ALTERNATIVA"] = "ALTERNATIVA";
|
|
8767
8774
|
QUESTION_TYPE2["DISSERTATIVA"] = "DISSERTATIVA";
|
|
@@ -8850,6 +8857,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8850
8857
|
};
|
|
8851
8858
|
return {
|
|
8852
8859
|
// Initial State
|
|
8860
|
+
quiz: null,
|
|
8853
8861
|
currentQuestionIndex: 0,
|
|
8854
8862
|
selectedAnswers: {},
|
|
8855
8863
|
userAnswers: [],
|
|
@@ -8862,9 +8870,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8862
8870
|
questionsResult: null,
|
|
8863
8871
|
currentQuestionResult: null,
|
|
8864
8872
|
// Setters
|
|
8865
|
-
|
|
8866
|
-
setByActivity: (activity) => set({ byActivity: activity }),
|
|
8867
|
-
setByQuestionary: (lesson) => set({ byQuestionary: lesson }),
|
|
8873
|
+
setQuiz: (quiz) => set({ quiz }),
|
|
8868
8874
|
setUserId: (userId) => set({ userId }),
|
|
8869
8875
|
setUserAnswers: (userAnswers) => set({ userAnswers }),
|
|
8870
8876
|
getUserId: () => get().userId,
|
|
@@ -8891,29 +8897,16 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8891
8897
|
set({ currentQuestionIndex: index });
|
|
8892
8898
|
}
|
|
8893
8899
|
},
|
|
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
8900
|
selectAnswer: (questionId, answerId) => {
|
|
8905
|
-
const {
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
const activityId = activeQuiz.quiz.id;
|
|
8901
|
+
const { quiz, userAnswers } = get();
|
|
8902
|
+
if (!quiz) return;
|
|
8903
|
+
const activityId = quiz.id;
|
|
8909
8904
|
const userId = get().getUserId();
|
|
8910
8905
|
if (!userId || userId === "") {
|
|
8911
8906
|
console.warn("selectAnswer called before userId is set");
|
|
8912
8907
|
return;
|
|
8913
8908
|
}
|
|
8914
|
-
const question =
|
|
8915
|
-
(q) => q.id === questionId
|
|
8916
|
-
);
|
|
8909
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
8917
8910
|
if (!question) return;
|
|
8918
8911
|
const existingAnswerIndex = userAnswers.findIndex(
|
|
8919
8912
|
(answer) => answer.questionId === questionId
|
|
@@ -8939,18 +8932,15 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8939
8932
|
});
|
|
8940
8933
|
},
|
|
8941
8934
|
selectMultipleAnswer: (questionId, answerIds) => {
|
|
8942
|
-
const {
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
const activityId = activeQuiz.quiz.id;
|
|
8935
|
+
const { quiz, userAnswers } = get();
|
|
8936
|
+
if (!quiz) return;
|
|
8937
|
+
const activityId = quiz.id;
|
|
8946
8938
|
const userId = get().getUserId();
|
|
8947
8939
|
if (!userId || userId === "") {
|
|
8948
8940
|
console.warn("selectMultipleAnswer called before userId is set");
|
|
8949
8941
|
return;
|
|
8950
8942
|
}
|
|
8951
|
-
const question =
|
|
8952
|
-
(q) => q.id === questionId
|
|
8953
|
-
);
|
|
8943
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
8954
8944
|
if (!question) return;
|
|
8955
8945
|
const filteredUserAnswers = userAnswers.filter(
|
|
8956
8946
|
(answer) => answer.questionId !== questionId
|
|
@@ -8977,10 +8967,9 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8977
8967
|
});
|
|
8978
8968
|
},
|
|
8979
8969
|
selectDissertativeAnswer: (questionId, answer) => {
|
|
8980
|
-
const {
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
const activityId = activeQuiz.quiz.id;
|
|
8970
|
+
const { quiz, userAnswers } = get();
|
|
8971
|
+
if (!quiz) return;
|
|
8972
|
+
const activityId = quiz.id;
|
|
8984
8973
|
const userId = get().getUserId();
|
|
8985
8974
|
if (!userId || userId === "") {
|
|
8986
8975
|
console.warn(
|
|
@@ -8988,9 +8977,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
8988
8977
|
);
|
|
8989
8978
|
return;
|
|
8990
8979
|
}
|
|
8991
|
-
const question =
|
|
8992
|
-
(q) => q.id === questionId
|
|
8993
|
-
);
|
|
8980
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
8994
8981
|
if (!question || question.questionType !== "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
8995
8982
|
console.warn(
|
|
8996
8983
|
"selectDissertativeAnswer called for non-dissertative question"
|
|
@@ -9021,12 +9008,11 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9021
9008
|
});
|
|
9022
9009
|
},
|
|
9023
9010
|
skipQuestion: () => {
|
|
9024
|
-
const { getCurrentQuestion, userAnswers,
|
|
9011
|
+
const { getCurrentQuestion, userAnswers, quiz } = get();
|
|
9025
9012
|
const currentQuestion = getCurrentQuestion();
|
|
9026
|
-
|
|
9027
|
-
if (!activeQuiz) return;
|
|
9013
|
+
if (!quiz) return;
|
|
9028
9014
|
if (currentQuestion) {
|
|
9029
|
-
const activityId =
|
|
9015
|
+
const activityId = quiz.id;
|
|
9030
9016
|
const userId = get().getUserId();
|
|
9031
9017
|
if (!userId || userId === "") {
|
|
9032
9018
|
console.warn("skipQuestion called before userId is set");
|
|
@@ -9057,18 +9043,15 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9057
9043
|
}
|
|
9058
9044
|
},
|
|
9059
9045
|
addUserAnswer: (questionId, answerId) => {
|
|
9060
|
-
const {
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
const activityId = activeQuiz.quiz.id;
|
|
9046
|
+
const { quiz, userAnswers } = get();
|
|
9047
|
+
if (!quiz) return;
|
|
9048
|
+
const activityId = quiz.id;
|
|
9064
9049
|
const userId = get().getUserId();
|
|
9065
9050
|
if (!userId || userId === "") {
|
|
9066
9051
|
console.warn("addUserAnswer called before userId is set");
|
|
9067
9052
|
return;
|
|
9068
9053
|
}
|
|
9069
|
-
const question =
|
|
9070
|
-
(q) => q.id === questionId
|
|
9071
|
-
);
|
|
9054
|
+
const question = quiz.questions.find((q) => q.id === questionId);
|
|
9072
9055
|
if (!question) return;
|
|
9073
9056
|
const existingAnswerIndex = userAnswers.findIndex(
|
|
9074
9057
|
(answer) => answer.questionId === questionId
|
|
@@ -9104,6 +9087,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9104
9087
|
stopTimer();
|
|
9105
9088
|
stopMinuteCallback();
|
|
9106
9089
|
set({
|
|
9090
|
+
quiz: null,
|
|
9107
9091
|
currentQuestionIndex: 0,
|
|
9108
9092
|
selectedAnswers: {},
|
|
9109
9093
|
userAnswers: [],
|
|
@@ -9127,17 +9111,15 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9127
9111
|
stopMinuteCallback,
|
|
9128
9112
|
// Getters
|
|
9129
9113
|
getCurrentQuestion: () => {
|
|
9130
|
-
const { currentQuestionIndex,
|
|
9131
|
-
|
|
9132
|
-
if (!activeQuiz) {
|
|
9114
|
+
const { currentQuestionIndex, quiz } = get();
|
|
9115
|
+
if (!quiz) {
|
|
9133
9116
|
return null;
|
|
9134
9117
|
}
|
|
9135
|
-
return
|
|
9118
|
+
return quiz.questions[currentQuestionIndex];
|
|
9136
9119
|
},
|
|
9137
9120
|
getTotalQuestions: () => {
|
|
9138
|
-
const {
|
|
9139
|
-
|
|
9140
|
-
return activeQuiz?.quiz?.questions?.length || 0;
|
|
9121
|
+
const { quiz } = get();
|
|
9122
|
+
return quiz?.questions?.length || 0;
|
|
9141
9123
|
},
|
|
9142
9124
|
getAnsweredQuestions: () => {
|
|
9143
9125
|
const { userAnswers } = get();
|
|
@@ -9146,11 +9128,10 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9146
9128
|
).length;
|
|
9147
9129
|
},
|
|
9148
9130
|
getUnansweredQuestions: () => {
|
|
9149
|
-
const {
|
|
9150
|
-
|
|
9151
|
-
if (!activeQuiz) return [];
|
|
9131
|
+
const { quiz, userAnswers } = get();
|
|
9132
|
+
if (!quiz) return [];
|
|
9152
9133
|
const unansweredQuestions = [];
|
|
9153
|
-
|
|
9134
|
+
quiz.questions.forEach((question, index) => {
|
|
9154
9135
|
const userAnswer = userAnswers.find(
|
|
9155
9136
|
(answer) => answer.questionId === question.id
|
|
9156
9137
|
);
|
|
@@ -9211,9 +9192,8 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9211
9192
|
return userAnswer;
|
|
9212
9193
|
},
|
|
9213
9194
|
getQuizTitle: () => {
|
|
9214
|
-
const {
|
|
9215
|
-
|
|
9216
|
-
return activeQuiz?.quiz?.title || "Quiz";
|
|
9195
|
+
const { quiz } = get();
|
|
9196
|
+
return quiz?.title || "Quiz";
|
|
9217
9197
|
},
|
|
9218
9198
|
formatTime: (seconds) => {
|
|
9219
9199
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -9225,11 +9205,10 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9225
9205
|
return userAnswers;
|
|
9226
9206
|
},
|
|
9227
9207
|
getUnansweredQuestionsFromUserAnswers: () => {
|
|
9228
|
-
const {
|
|
9229
|
-
|
|
9230
|
-
if (!activeQuiz) return [];
|
|
9208
|
+
const { quiz, userAnswers } = get();
|
|
9209
|
+
if (!quiz) return [];
|
|
9231
9210
|
const unansweredQuestions = [];
|
|
9232
|
-
|
|
9211
|
+
quiz.questions.forEach((question, index) => {
|
|
9233
9212
|
const userAnswer = userAnswers.find(
|
|
9234
9213
|
(answer) => answer.questionId === question.id
|
|
9235
9214
|
);
|
|
@@ -9242,8 +9221,8 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9242
9221
|
return unansweredQuestions;
|
|
9243
9222
|
},
|
|
9244
9223
|
getQuestionsGroupedBySubject: () => {
|
|
9245
|
-
const { getQuestionResult,
|
|
9246
|
-
const questions = variant == "result" ? getQuestionResult()?.answers :
|
|
9224
|
+
const { getQuestionResult, quiz, variant } = get();
|
|
9225
|
+
const questions = variant == "result" ? getQuestionResult()?.answers : quiz?.questions;
|
|
9247
9226
|
if (!questions) return {};
|
|
9248
9227
|
const groupedQuestions = {};
|
|
9249
9228
|
questions.forEach((question) => {
|
|
@@ -9281,19 +9260,18 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9281
9260
|
return userAnswers;
|
|
9282
9261
|
},
|
|
9283
9262
|
setCurrentQuestion: (question) => {
|
|
9284
|
-
const {
|
|
9285
|
-
|
|
9286
|
-
if (!activeQuiz) return;
|
|
9263
|
+
const { quiz, variant, questionsResult } = get();
|
|
9264
|
+
if (!quiz) return;
|
|
9287
9265
|
let questionIndex = 0;
|
|
9288
9266
|
if (variant == "result") {
|
|
9289
9267
|
if (!questionsResult) return;
|
|
9290
9268
|
const questionResult = questionsResult.answers.find((q) => q.id === question.id) ?? questionsResult.answers.find((q) => q.questionId === question.id);
|
|
9291
9269
|
if (!questionResult) return;
|
|
9292
|
-
questionIndex =
|
|
9270
|
+
questionIndex = quiz.questions.findIndex(
|
|
9293
9271
|
(q) => q.id === questionResult.questionId
|
|
9294
9272
|
);
|
|
9295
9273
|
} else {
|
|
9296
|
-
questionIndex =
|
|
9274
|
+
questionIndex = quiz.questions.findIndex(
|
|
9297
9275
|
(q) => q.id === question.id
|
|
9298
9276
|
);
|
|
9299
9277
|
}
|
|
@@ -9327,7 +9305,7 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9327
9305
|
return userAnswer ? userAnswer.answerStatus : null;
|
|
9328
9306
|
},
|
|
9329
9307
|
getQuestionIndex: (questionId) => {
|
|
9330
|
-
const { questionsResult, variant } = get();
|
|
9308
|
+
const { questionsResult, variant, quiz } = get();
|
|
9331
9309
|
if (variant == "result") {
|
|
9332
9310
|
if (!questionsResult) return 0;
|
|
9333
9311
|
let idx = questionsResult.answers.findIndex(
|
|
@@ -9340,12 +9318,8 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9340
9318
|
}
|
|
9341
9319
|
return idx !== -1 ? idx + 1 : 0;
|
|
9342
9320
|
} else {
|
|
9343
|
-
|
|
9344
|
-
const
|
|
9345
|
-
if (!activeQuiz) return 0;
|
|
9346
|
-
const idx = activeQuiz.quiz.questions.findIndex(
|
|
9347
|
-
(q) => q.id === questionId
|
|
9348
|
-
);
|
|
9321
|
+
if (!quiz) return 0;
|
|
9322
|
+
const idx = quiz.questions.findIndex((q) => q.id === questionId);
|
|
9349
9323
|
return idx !== -1 ? idx + 1 : 0;
|
|
9350
9324
|
}
|
|
9351
9325
|
},
|
|
@@ -9383,10 +9357,14 @@ var useQuizStore = (0, import_zustand7.create)()(
|
|
|
9383
9357
|
)
|
|
9384
9358
|
);
|
|
9385
9359
|
|
|
9360
|
+
// src/components/Quiz/QuizContent.tsx
|
|
9361
|
+
var import_react31 = require("react");
|
|
9362
|
+
var import_phosphor_react22 = require("phosphor-react");
|
|
9363
|
+
|
|
9386
9364
|
// src/assets/img/mock-image-question.png
|
|
9387
9365
|
var mock_image_question_default = "./mock-image-question-HEZCLFDL.png";
|
|
9388
9366
|
|
|
9389
|
-
// src/components/Quiz/
|
|
9367
|
+
// src/components/Quiz/QuizContent.tsx
|
|
9390
9368
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
9391
9369
|
var getStatusBadge = (status) => {
|
|
9392
9370
|
switch (status) {
|
|
@@ -9406,158 +9384,11 @@ var getStatusStyles = (variantCorrect) => {
|
|
|
9406
9384
|
return "bg-error-background border-error-300";
|
|
9407
9385
|
}
|
|
9408
9386
|
};
|
|
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
9387
|
var QuizSubTitle = (0, import_react31.forwardRef)(
|
|
9545
9388
|
({ subTitle, ...props }, ref) => {
|
|
9546
9389
|
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
9390
|
}
|
|
9548
9391
|
);
|
|
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
9392
|
var QuizContainer = (0, import_react31.forwardRef)(({ children, className, ...props }, ref) => {
|
|
9562
9393
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9563
9394
|
"div",
|
|
@@ -9572,21 +9403,6 @@ var QuizContainer = (0, import_react31.forwardRef)(({ children, className, ...pr
|
|
|
9572
9403
|
}
|
|
9573
9404
|
);
|
|
9574
9405
|
});
|
|
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
9406
|
var QuizAlternative = ({ paddingBottom }) => {
|
|
9591
9407
|
const {
|
|
9592
9408
|
getCurrentQuestion,
|
|
@@ -9790,7 +9606,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
9790
9606
|
) }) : /* @__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
9607
|
variant === "result" && currentQuestionResult?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
9792
9608
|
/* @__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:
|
|
9609
|
+
/* @__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
9610
|
] })
|
|
9795
9611
|
] });
|
|
9796
9612
|
};
|
|
@@ -10291,6 +10107,153 @@ var QuizImageQuestion = ({ paddingBottom }) => {
|
|
|
10291
10107
|
) })
|
|
10292
10108
|
] });
|
|
10293
10109
|
};
|
|
10110
|
+
|
|
10111
|
+
// src/components/Quiz/Quiz.tsx
|
|
10112
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
10113
|
+
var getQuizTypeConfig = (type) => {
|
|
10114
|
+
const QUIZ_TYPE_CONFIG = {
|
|
10115
|
+
["SIMULADO" /* SIMULADO */]: {
|
|
10116
|
+
label: "Simulado",
|
|
10117
|
+
article: "o",
|
|
10118
|
+
preposition: "do"
|
|
10119
|
+
},
|
|
10120
|
+
["QUESTIONARIO" /* QUESTIONARIO */]: {
|
|
10121
|
+
label: "Question\xE1rio",
|
|
10122
|
+
article: "o",
|
|
10123
|
+
preposition: "do"
|
|
10124
|
+
},
|
|
10125
|
+
["ATIVIDADE" /* ATIVIDADE */]: {
|
|
10126
|
+
label: "Atividade",
|
|
10127
|
+
article: "a",
|
|
10128
|
+
preposition: "da"
|
|
10129
|
+
}
|
|
10130
|
+
};
|
|
10131
|
+
const config = QUIZ_TYPE_CONFIG[type];
|
|
10132
|
+
return config || QUIZ_TYPE_CONFIG["SIMULADO" /* SIMULADO */];
|
|
10133
|
+
};
|
|
10134
|
+
var getTypeLabel = (type) => {
|
|
10135
|
+
return getQuizTypeConfig(type).label;
|
|
10136
|
+
};
|
|
10137
|
+
var getCompletionTitle = (type) => {
|
|
10138
|
+
const config = getQuizTypeConfig(type);
|
|
10139
|
+
return `Voc\xEA concluiu ${config.article} ${config.label.toLowerCase()}!`;
|
|
10140
|
+
};
|
|
10141
|
+
var getExitConfirmationText = (type) => {
|
|
10142
|
+
const config = getQuizTypeConfig(type);
|
|
10143
|
+
return `Se voc\xEA sair ${config.preposition} ${config.label.toLowerCase()} agora, todas as respostas ser\xE3o perdidas.`;
|
|
10144
|
+
};
|
|
10145
|
+
var getFinishConfirmationText = (type) => {
|
|
10146
|
+
const config = getQuizTypeConfig(type);
|
|
10147
|
+
return `Tem certeza que deseja finalizar ${config.article} ${config.label.toLowerCase()}?`;
|
|
10148
|
+
};
|
|
10149
|
+
var Quiz = (0, import_react32.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
|
|
10150
|
+
const { setVariant } = useQuizStore();
|
|
10151
|
+
(0, import_react32.useEffect)(() => {
|
|
10152
|
+
setVariant(variant);
|
|
10153
|
+
}, [variant, setVariant]);
|
|
10154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
10155
|
+
});
|
|
10156
|
+
var QuizTitle = (0, import_react32.forwardRef)(
|
|
10157
|
+
({ className, ...props }, ref) => {
|
|
10158
|
+
const {
|
|
10159
|
+
quiz,
|
|
10160
|
+
currentQuestionIndex,
|
|
10161
|
+
getTotalQuestions,
|
|
10162
|
+
getQuizTitle,
|
|
10163
|
+
timeElapsed,
|
|
10164
|
+
formatTime: formatTime2,
|
|
10165
|
+
isStarted
|
|
10166
|
+
} = useQuizStore();
|
|
10167
|
+
const [showExitConfirmation, setShowExitConfirmation] = (0, import_react32.useState)(false);
|
|
10168
|
+
const totalQuestions = getTotalQuestions();
|
|
10169
|
+
const quizTitle = getQuizTitle();
|
|
10170
|
+
const handleBackClick = () => {
|
|
10171
|
+
if (isStarted) {
|
|
10172
|
+
setShowExitConfirmation(true);
|
|
10173
|
+
} else {
|
|
10174
|
+
window.history.back();
|
|
10175
|
+
}
|
|
10176
|
+
};
|
|
10177
|
+
const handleConfirmExit = () => {
|
|
10178
|
+
setShowExitConfirmation(false);
|
|
10179
|
+
window.history.back();
|
|
10180
|
+
};
|
|
10181
|
+
const handleCancelExit = () => {
|
|
10182
|
+
setShowExitConfirmation(false);
|
|
10183
|
+
};
|
|
10184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
10185
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
10186
|
+
"div",
|
|
10187
|
+
{
|
|
10188
|
+
ref,
|
|
10189
|
+
className: cn(
|
|
10190
|
+
"flex flex-row justify-between items-center relative p-2",
|
|
10191
|
+
className
|
|
10192
|
+
),
|
|
10193
|
+
...props,
|
|
10194
|
+
children: [
|
|
10195
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10196
|
+
IconButton_default,
|
|
10197
|
+
{
|
|
10198
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.CaretLeft, { size: 24 }),
|
|
10199
|
+
size: "md",
|
|
10200
|
+
"aria-label": "Voltar",
|
|
10201
|
+
onClick: handleBackClick
|
|
10202
|
+
}
|
|
10203
|
+
),
|
|
10204
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
|
|
10205
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
|
|
10206
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
|
|
10207
|
+
] }),
|
|
10208
|
+
/* @__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" }) })
|
|
10209
|
+
]
|
|
10210
|
+
}
|
|
10211
|
+
),
|
|
10212
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10213
|
+
AlertDialog,
|
|
10214
|
+
{
|
|
10215
|
+
isOpen: showExitConfirmation,
|
|
10216
|
+
onChangeOpen: setShowExitConfirmation,
|
|
10217
|
+
title: "Deseja sair?",
|
|
10218
|
+
description: getExitConfirmationText(
|
|
10219
|
+
quiz?.type || "SIMULADO" /* SIMULADO */
|
|
10220
|
+
),
|
|
10221
|
+
cancelButtonLabel: "Voltar e revisar",
|
|
10222
|
+
submitButtonLabel: "Sair Mesmo Assim",
|
|
10223
|
+
onSubmit: handleConfirmExit,
|
|
10224
|
+
onCancel: handleCancelExit
|
|
10225
|
+
}
|
|
10226
|
+
)
|
|
10227
|
+
] });
|
|
10228
|
+
}
|
|
10229
|
+
);
|
|
10230
|
+
var QuizHeader = () => {
|
|
10231
|
+
const { getCurrentQuestion, currentQuestionIndex } = useQuizStore();
|
|
10232
|
+
const currentQuestion = getCurrentQuestion();
|
|
10233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10234
|
+
HeaderAlternative,
|
|
10235
|
+
{
|
|
10236
|
+
title: currentQuestion ? `Quest\xE3o ${currentQuestionIndex + 1}` : "Quest\xE3o",
|
|
10237
|
+
subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topic?.name ?? "",
|
|
10238
|
+
content: currentQuestion?.statement ?? ""
|
|
10239
|
+
}
|
|
10240
|
+
);
|
|
10241
|
+
};
|
|
10242
|
+
var QuizContent = (0, import_react32.forwardRef)(({ paddingBottom }) => {
|
|
10243
|
+
const { getCurrentQuestion } = useQuizStore();
|
|
10244
|
+
const currentQuestion = getCurrentQuestion();
|
|
10245
|
+
const questionComponents = {
|
|
10246
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
|
|
10247
|
+
["MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */]: QuizMultipleChoice,
|
|
10248
|
+
["DISSERTATIVA" /* DISSERTATIVA */]: QuizDissertative,
|
|
10249
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: QuizTrueOrFalse,
|
|
10250
|
+
["LIGAR_PONTOS" /* LIGAR_PONTOS */]: QuizConnectDots,
|
|
10251
|
+
["PREENCHER" /* PREENCHER */]: QuizFill,
|
|
10252
|
+
["IMAGEM" /* IMAGEM */]: QuizImageQuestion
|
|
10253
|
+
};
|
|
10254
|
+
const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.questionType] : null;
|
|
10255
|
+
return QuestionComponent ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(QuestionComponent, { paddingBottom }) : null;
|
|
10256
|
+
});
|
|
10294
10257
|
var QuizQuestionList = ({
|
|
10295
10258
|
filterType = "all",
|
|
10296
10259
|
onQuestionClick
|
|
@@ -10336,18 +10299,18 @@ var QuizQuestionList = ({
|
|
|
10336
10299
|
return "Em branco";
|
|
10337
10300
|
}
|
|
10338
10301
|
};
|
|
10339
|
-
return /* @__PURE__ */ (0,
|
|
10340
|
-
Object.entries(filteredGroupedQuestions).length == 0 && /* @__PURE__ */ (0,
|
|
10302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-6 px-4 h-full", children: [
|
|
10303
|
+
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
10304
|
Object.entries(filteredGroupedQuestions).map(
|
|
10342
|
-
([subjectId, questions]) => /* @__PURE__ */ (0,
|
|
10343
|
-
/* @__PURE__ */ (0,
|
|
10344
|
-
/* @__PURE__ */ (0,
|
|
10345
|
-
/* @__PURE__ */ (0,
|
|
10305
|
+
([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: "flex flex-col gap-2", children: [
|
|
10306
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
|
|
10307
|
+
/* @__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" }) }),
|
|
10308
|
+
/* @__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
10309
|
] }),
|
|
10347
|
-
/* @__PURE__ */ (0,
|
|
10310
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
|
|
10348
10311
|
const status = getQuestionStatus(question.id);
|
|
10349
10312
|
const questionNumber = getQuestionIndex(question.id);
|
|
10350
|
-
return /* @__PURE__ */ (0,
|
|
10313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10351
10314
|
CardStatus,
|
|
10352
10315
|
{
|
|
10353
10316
|
header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
|
|
@@ -10364,16 +10327,21 @@ var QuizQuestionList = ({
|
|
|
10364
10327
|
)
|
|
10365
10328
|
] });
|
|
10366
10329
|
};
|
|
10367
|
-
var QuizFooter = (0,
|
|
10330
|
+
var QuizFooter = (0, import_react32.forwardRef)(
|
|
10368
10331
|
({
|
|
10369
10332
|
className,
|
|
10370
10333
|
onGoToSimulated,
|
|
10371
10334
|
onDetailResult,
|
|
10372
10335
|
handleFinishSimulated,
|
|
10336
|
+
onGoToNextModule,
|
|
10337
|
+
onRepeat,
|
|
10338
|
+
onTryLater,
|
|
10373
10339
|
resultImageComponent,
|
|
10340
|
+
resultIncorrectImageComponent,
|
|
10374
10341
|
...props
|
|
10375
10342
|
}, ref) => {
|
|
10376
10343
|
const {
|
|
10344
|
+
quiz,
|
|
10377
10345
|
currentQuestionIndex,
|
|
10378
10346
|
getTotalQuestions,
|
|
10379
10347
|
goToNextQuestion,
|
|
@@ -10392,23 +10360,36 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10392
10360
|
const currentAnswer = getCurrentAnswer();
|
|
10393
10361
|
const currentQuestion = getCurrentQuestion();
|
|
10394
10362
|
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
10395
|
-
const [
|
|
10396
|
-
const [
|
|
10397
|
-
const
|
|
10398
|
-
const
|
|
10399
|
-
const
|
|
10363
|
+
const [activeModal, setActiveModal] = (0, import_react32.useState)(null);
|
|
10364
|
+
const [filterType, setFilterType] = (0, import_react32.useState)("all");
|
|
10365
|
+
const openModal = (modalName) => setActiveModal(modalName);
|
|
10366
|
+
const closeModal = () => setActiveModal(null);
|
|
10367
|
+
const isModalOpen = (modalName) => activeModal === modalName;
|
|
10400
10368
|
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
10401
10369
|
const allQuestions = getTotalQuestions();
|
|
10370
|
+
const stats = getQuestionResultStatistics();
|
|
10371
|
+
const correctAnswers = stats?.correctAnswers;
|
|
10372
|
+
const totalAnswers = stats?.totalAnswered;
|
|
10373
|
+
const quizType = quiz?.type || "SIMULADO" /* SIMULADO */;
|
|
10374
|
+
const quizTypeLabel = getTypeLabel(quizType);
|
|
10402
10375
|
const handleFinishQuiz = async () => {
|
|
10403
10376
|
if (unansweredQuestions.length > 0) {
|
|
10404
|
-
|
|
10377
|
+
openModal("alertDialog");
|
|
10405
10378
|
return;
|
|
10406
10379
|
}
|
|
10407
10380
|
try {
|
|
10408
10381
|
if (handleFinishSimulated) {
|
|
10409
10382
|
await Promise.resolve(handleFinishSimulated());
|
|
10410
10383
|
}
|
|
10411
|
-
|
|
10384
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && typeof totalAnswers === "number" && correctAnswers === totalAnswers) {
|
|
10385
|
+
openModal("modalQuestionnaireAllCorrect");
|
|
10386
|
+
return;
|
|
10387
|
+
}
|
|
10388
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && correctAnswers === 0) {
|
|
10389
|
+
openModal("modalQuestionnaireAllIncorrect");
|
|
10390
|
+
return;
|
|
10391
|
+
}
|
|
10392
|
+
openModal("modalResult");
|
|
10412
10393
|
} catch (err) {
|
|
10413
10394
|
console.error("handleFinishSimulated failed:", err);
|
|
10414
10395
|
return;
|
|
@@ -10419,16 +10400,23 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10419
10400
|
if (handleFinishSimulated) {
|
|
10420
10401
|
await Promise.resolve(handleFinishSimulated());
|
|
10421
10402
|
}
|
|
10422
|
-
|
|
10423
|
-
|
|
10403
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && typeof totalAnswers === "number" && correctAnswers === totalAnswers) {
|
|
10404
|
+
openModal("modalQuestionnaireAllCorrect");
|
|
10405
|
+
return;
|
|
10406
|
+
}
|
|
10407
|
+
if (quizType === "QUESTIONARIO" /* QUESTIONARIO */ && typeof correctAnswers === "number" && correctAnswers === 0) {
|
|
10408
|
+
openModal("modalQuestionnaireAllIncorrect");
|
|
10409
|
+
return;
|
|
10410
|
+
}
|
|
10411
|
+
openModal("modalResult");
|
|
10424
10412
|
} catch (err) {
|
|
10425
10413
|
console.error("handleFinishSimulated failed:", err);
|
|
10426
|
-
|
|
10414
|
+
closeModal();
|
|
10427
10415
|
return;
|
|
10428
10416
|
}
|
|
10429
10417
|
};
|
|
10430
|
-
return /* @__PURE__ */ (0,
|
|
10431
|
-
/* @__PURE__ */ (0,
|
|
10418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
10419
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10432
10420
|
"footer",
|
|
10433
10421
|
{
|
|
10434
10422
|
ref,
|
|
@@ -10437,17 +10425,17 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10437
10425
|
className
|
|
10438
10426
|
),
|
|
10439
10427
|
...props,
|
|
10440
|
-
children: variant === "default" ? /* @__PURE__ */ (0,
|
|
10441
|
-
/* @__PURE__ */ (0,
|
|
10442
|
-
/* @__PURE__ */ (0,
|
|
10428
|
+
children: variant === "default" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
10429
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
|
|
10430
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10443
10431
|
IconButton_default,
|
|
10444
10432
|
{
|
|
10445
|
-
icon: /* @__PURE__ */ (0,
|
|
10433
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.SquaresFour, { size: 24, className: "text-text-950" }),
|
|
10446
10434
|
size: "md",
|
|
10447
|
-
onClick: () =>
|
|
10435
|
+
onClick: () => openModal("modalNavigate")
|
|
10448
10436
|
}
|
|
10449
10437
|
),
|
|
10450
|
-
isFirstQuestion ? /* @__PURE__ */ (0,
|
|
10438
|
+
isFirstQuestion ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10451
10439
|
Button_default,
|
|
10452
10440
|
{
|
|
10453
10441
|
variant: "outline",
|
|
@@ -10458,13 +10446,13 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10458
10446
|
},
|
|
10459
10447
|
children: "Pular"
|
|
10460
10448
|
}
|
|
10461
|
-
) : /* @__PURE__ */ (0,
|
|
10449
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10462
10450
|
Button_default,
|
|
10463
10451
|
{
|
|
10464
10452
|
size: "medium",
|
|
10465
10453
|
variant: "link",
|
|
10466
10454
|
action: "primary",
|
|
10467
|
-
iconLeft: /* @__PURE__ */ (0,
|
|
10455
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.CaretLeft, { size: 18 }),
|
|
10468
10456
|
onClick: () => {
|
|
10469
10457
|
goToPreviousQuestion();
|
|
10470
10458
|
},
|
|
@@ -10472,7 +10460,7 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10472
10460
|
}
|
|
10473
10461
|
)
|
|
10474
10462
|
] }),
|
|
10475
|
-
!isFirstQuestion && !isLastQuestion && /* @__PURE__ */ (0,
|
|
10463
|
+
!isFirstQuestion && !isLastQuestion && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10476
10464
|
Button_default,
|
|
10477
10465
|
{
|
|
10478
10466
|
size: "small",
|
|
@@ -10485,7 +10473,7 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10485
10473
|
children: "Pular"
|
|
10486
10474
|
}
|
|
10487
10475
|
),
|
|
10488
|
-
isLastQuestion ? /* @__PURE__ */ (0,
|
|
10476
|
+
isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10489
10477
|
Button_default,
|
|
10490
10478
|
{
|
|
10491
10479
|
size: "medium",
|
|
@@ -10495,13 +10483,13 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10495
10483
|
onClick: handleFinishQuiz,
|
|
10496
10484
|
children: "Finalizar"
|
|
10497
10485
|
}
|
|
10498
|
-
) : /* @__PURE__ */ (0,
|
|
10486
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10499
10487
|
Button_default,
|
|
10500
10488
|
{
|
|
10501
10489
|
size: "medium",
|
|
10502
10490
|
variant: "link",
|
|
10503
10491
|
action: "primary",
|
|
10504
|
-
iconRight: /* @__PURE__ */ (0,
|
|
10492
|
+
iconRight: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_phosphor_react23.CaretRight, { size: 18 }),
|
|
10505
10493
|
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
10506
10494
|
onClick: () => {
|
|
10507
10495
|
goToNextQuestion();
|
|
@@ -10509,157 +10497,313 @@ var QuizFooter = (0, import_react31.forwardRef)(
|
|
|
10509
10497
|
children: "Avan\xE7ar"
|
|
10510
10498
|
}
|
|
10511
10499
|
)
|
|
10512
|
-
] }) : /* @__PURE__ */ (0,
|
|
10500
|
+
] }) : /* @__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
10501
|
Button_default,
|
|
10514
10502
|
{
|
|
10515
10503
|
variant: "solid",
|
|
10516
10504
|
action: "primary",
|
|
10517
10505
|
size: "medium",
|
|
10518
|
-
onClick: () =>
|
|
10506
|
+
onClick: () => openModal("modalResolution"),
|
|
10519
10507
|
children: "Ver Resolu\xE7\xE3o"
|
|
10520
10508
|
}
|
|
10521
10509
|
) })
|
|
10522
10510
|
}
|
|
10523
10511
|
),
|
|
10524
|
-
/* @__PURE__ */ (0,
|
|
10512
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10525
10513
|
AlertDialog,
|
|
10526
10514
|
{
|
|
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.` :
|
|
10515
|
+
isOpen: isModalOpen("alertDialog"),
|
|
10516
|
+
onChangeOpen: (open) => open ? openModal("alertDialog") : closeModal(),
|
|
10517
|
+
title: `Finalizar ${quizTypeLabel.toLowerCase()}?`,
|
|
10518
|
+
description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : getFinishConfirmationText(quizType),
|
|
10531
10519
|
cancelButtonLabel: "Voltar e revisar",
|
|
10532
10520
|
submitButtonLabel: "Finalizar Mesmo Assim",
|
|
10533
10521
|
onSubmit: handleAlertSubmit
|
|
10534
10522
|
}
|
|
10535
10523
|
),
|
|
10536
|
-
/* @__PURE__ */ (0,
|
|
10524
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10537
10525
|
Modal_default,
|
|
10538
10526
|
{
|
|
10539
|
-
isOpen:
|
|
10540
|
-
onClose:
|
|
10527
|
+
isOpen: isModalOpen("modalResult"),
|
|
10528
|
+
onClose: closeModal,
|
|
10541
10529
|
title: "",
|
|
10542
10530
|
closeOnEscape: false,
|
|
10543
10531
|
hideCloseButton: true,
|
|
10544
10532
|
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
|
-
" ",
|
|
10533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
10534
|
+
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" }) }),
|
|
10535
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
10536
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: getCompletionTitle(quizType) }),
|
|
10537
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "text-text-500 font-sm", children: [
|
|
10538
|
+
"Voc\xEA acertou ",
|
|
10539
|
+
correctAnswers ?? "--",
|
|
10540
|
+
" de ",
|
|
10555
10541
|
allQuestions,
|
|
10556
|
-
"
|
|
10542
|
+
" ",
|
|
10543
|
+
"quest\xF5es."
|
|
10557
10544
|
] })
|
|
10558
10545
|
] }),
|
|
10559
|
-
/* @__PURE__ */ (0,
|
|
10560
|
-
/* @__PURE__ */ (0,
|
|
10546
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
|
|
10547
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
10561
10548
|
Button_default,
|
|
10562
10549
|
{
|
|
10563
10550
|
variant: "outline",
|
|
10564
10551
|
className: "w-full",
|
|
10565
10552
|
size: "small",
|
|
10566
10553
|
onClick: onGoToSimulated,
|
|
10567
|
-
children:
|
|
10554
|
+
children: [
|
|
10555
|
+
"Ir para ",
|
|
10556
|
+
quizTypeLabel.toLocaleLowerCase(),
|
|
10557
|
+
"s"
|
|
10558
|
+
]
|
|
10568
10559
|
}
|
|
10569
10560
|
),
|
|
10570
|
-
/* @__PURE__ */ (0,
|
|
10561
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
|
|
10571
10562
|
] })
|
|
10572
10563
|
] })
|
|
10573
10564
|
}
|
|
10574
10565
|
),
|
|
10575
|
-
/* @__PURE__ */ (0,
|
|
10566
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10576
10567
|
Modal_default,
|
|
10577
10568
|
{
|
|
10578
|
-
isOpen:
|
|
10579
|
-
onClose:
|
|
10569
|
+
isOpen: isModalOpen("modalNavigate"),
|
|
10570
|
+
onClose: closeModal,
|
|
10580
10571
|
title: "Quest\xF5es",
|
|
10581
10572
|
size: "lg",
|
|
10582
|
-
children: /* @__PURE__ */ (0,
|
|
10583
|
-
/* @__PURE__ */ (0,
|
|
10584
|
-
/* @__PURE__ */ (0,
|
|
10585
|
-
/* @__PURE__ */ (0,
|
|
10586
|
-
/* @__PURE__ */ (0,
|
|
10573
|
+
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: [
|
|
10574
|
+
/* @__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: [
|
|
10575
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
|
|
10576
|
+
/* @__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: [
|
|
10577
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10587
10578
|
SelectTrigger,
|
|
10588
10579
|
{
|
|
10589
10580
|
variant: "rounded",
|
|
10590
10581
|
className: "max-w-[266px] min-w-[160px]",
|
|
10591
|
-
children: /* @__PURE__ */ (0,
|
|
10582
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" })
|
|
10592
10583
|
}
|
|
10593
10584
|
),
|
|
10594
|
-
/* @__PURE__ */ (0,
|
|
10595
|
-
/* @__PURE__ */ (0,
|
|
10596
|
-
/* @__PURE__ */ (0,
|
|
10597
|
-
/* @__PURE__ */ (0,
|
|
10585
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(SelectContent, { children: [
|
|
10586
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectItem, { value: "all", children: "Todas" }),
|
|
10587
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
|
|
10588
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectItem, { value: "answered", children: "Respondidas" })
|
|
10598
10589
|
] })
|
|
10599
10590
|
] }) })
|
|
10600
10591
|
] }),
|
|
10601
|
-
/* @__PURE__ */ (0,
|
|
10592
|
+
/* @__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
10593
|
QuizQuestionList,
|
|
10603
10594
|
{
|
|
10604
10595
|
filterType,
|
|
10605
|
-
onQuestionClick:
|
|
10596
|
+
onQuestionClick: closeModal
|
|
10606
10597
|
}
|
|
10607
10598
|
) })
|
|
10608
10599
|
] })
|
|
10609
10600
|
}
|
|
10610
10601
|
),
|
|
10611
|
-
/* @__PURE__ */ (0,
|
|
10602
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10612
10603
|
Modal_default,
|
|
10613
10604
|
{
|
|
10614
|
-
isOpen:
|
|
10615
|
-
onClose:
|
|
10605
|
+
isOpen: isModalOpen("modalResolution"),
|
|
10606
|
+
onClose: closeModal,
|
|
10616
10607
|
title: "Resolu\xE7\xE3o",
|
|
10617
10608
|
size: "lg",
|
|
10618
10609
|
children: currentQuestion?.solutionExplanation
|
|
10619
10610
|
}
|
|
10611
|
+
),
|
|
10612
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10613
|
+
Modal_default,
|
|
10614
|
+
{
|
|
10615
|
+
isOpen: isModalOpen("modalQuestionnaireAllCorrect"),
|
|
10616
|
+
onClose: closeModal,
|
|
10617
|
+
title: "",
|
|
10618
|
+
closeOnEscape: false,
|
|
10619
|
+
hideCloseButton: true,
|
|
10620
|
+
size: "md",
|
|
10621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
10622
|
+
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" }) }),
|
|
10623
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
10624
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "\u{1F389} Parab\xE9ns!" }),
|
|
10625
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-text-500 font-sm", children: "Voc\xEA concluiu o m\xF3dulo Movimento Uniforme." })
|
|
10626
|
+
] }),
|
|
10627
|
+
/* @__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" }) })
|
|
10628
|
+
] })
|
|
10629
|
+
}
|
|
10630
|
+
),
|
|
10631
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10632
|
+
Modal_default,
|
|
10633
|
+
{
|
|
10634
|
+
isOpen: isModalOpen("modalQuestionnaireAllIncorrect"),
|
|
10635
|
+
onClose: closeModal,
|
|
10636
|
+
title: "",
|
|
10637
|
+
closeOnEscape: false,
|
|
10638
|
+
hideCloseButton: true,
|
|
10639
|
+
size: "md",
|
|
10640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
10641
|
+
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" }) }),
|
|
10642
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
10643
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "\u{1F615} N\xE3o foi dessa vez..." }),
|
|
10644
|
+
/* @__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." }),
|
|
10645
|
+
/* @__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." }),
|
|
10646
|
+
/* @__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}" })
|
|
10647
|
+
] }),
|
|
10648
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-row justify-center items-center gap-2 w-full", children: [
|
|
10649
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10650
|
+
Button_default,
|
|
10651
|
+
{
|
|
10652
|
+
type: "button",
|
|
10653
|
+
variant: "link",
|
|
10654
|
+
size: "small",
|
|
10655
|
+
className: "w-auto",
|
|
10656
|
+
onClick: () => {
|
|
10657
|
+
closeModal();
|
|
10658
|
+
openModal("alertDialogTryLater");
|
|
10659
|
+
},
|
|
10660
|
+
children: "Tentar depois"
|
|
10661
|
+
}
|
|
10662
|
+
),
|
|
10663
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10664
|
+
Button_default,
|
|
10665
|
+
{
|
|
10666
|
+
variant: "outline",
|
|
10667
|
+
size: "small",
|
|
10668
|
+
className: "w-auto",
|
|
10669
|
+
onClick: onDetailResult,
|
|
10670
|
+
children: "Detalhar resultado"
|
|
10671
|
+
}
|
|
10672
|
+
),
|
|
10673
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10674
|
+
Button_default,
|
|
10675
|
+
{
|
|
10676
|
+
className: "w-auto",
|
|
10677
|
+
size: "small",
|
|
10678
|
+
onClick: onGoToNextModule,
|
|
10679
|
+
children: "Pr\xF3ximo m\xF3dulo"
|
|
10680
|
+
}
|
|
10681
|
+
)
|
|
10682
|
+
] })
|
|
10683
|
+
] })
|
|
10684
|
+
}
|
|
10685
|
+
),
|
|
10686
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
10687
|
+
AlertDialog,
|
|
10688
|
+
{
|
|
10689
|
+
isOpen: isModalOpen("alertDialogTryLater"),
|
|
10690
|
+
onChangeOpen: (open) => open ? openModal("alertDialogTryLater") : closeModal(),
|
|
10691
|
+
title: "Tentar depois?",
|
|
10692
|
+
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.",
|
|
10693
|
+
cancelButtonLabel: "Repetir question\xE1rio",
|
|
10694
|
+
submitButtonLabel: "Tentar depois",
|
|
10695
|
+
onSubmit: () => {
|
|
10696
|
+
onTryLater?.();
|
|
10697
|
+
closeModal();
|
|
10698
|
+
},
|
|
10699
|
+
onCancel: () => {
|
|
10700
|
+
onRepeat?.();
|
|
10701
|
+
closeModal();
|
|
10702
|
+
}
|
|
10703
|
+
}
|
|
10620
10704
|
)
|
|
10621
10705
|
] });
|
|
10622
10706
|
}
|
|
10623
10707
|
);
|
|
10708
|
+
|
|
10709
|
+
// src/components/Quiz/QuizResult.tsx
|
|
10710
|
+
var import_react33 = require("react");
|
|
10711
|
+
var import_phosphor_react24 = require("phosphor-react");
|
|
10712
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
10624
10713
|
var QuizBadge = ({
|
|
10625
10714
|
subtype
|
|
10626
10715
|
}) => {
|
|
10627
10716
|
switch (subtype) {
|
|
10628
10717
|
case "PROVA" /* PROVA */:
|
|
10629
|
-
return /* @__PURE__ */ (0,
|
|
10718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam2", "data-testid": "quiz-badge", children: "Prova" });
|
|
10630
10719
|
case "ENEM_PROVA_1" /* ENEM_PROVA_1 */:
|
|
10631
10720
|
case "ENEM_PROVA_2" /* ENEM_PROVA_2 */:
|
|
10632
|
-
return /* @__PURE__ */ (0,
|
|
10721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam1", "data-testid": "quiz-badge", children: "Enem" });
|
|
10633
10722
|
case "VESTIBULAR" /* VESTIBULAR */:
|
|
10634
|
-
return /* @__PURE__ */ (0,
|
|
10723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam4", "data-testid": "quiz-badge", children: "Vestibular" });
|
|
10635
10724
|
case "SIMULADO" /* SIMULADO */:
|
|
10636
10725
|
case "SIMULADAO" /* SIMULADAO */:
|
|
10637
10726
|
case void 0:
|
|
10638
|
-
return /* @__PURE__ */ (0,
|
|
10727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "examsOutlined", action: "exam3", "data-testid": "quiz-badge", children: "Simulad\xE3o" });
|
|
10639
10728
|
default:
|
|
10640
|
-
return /* @__PURE__ */ (0,
|
|
10729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
|
|
10641
10730
|
}
|
|
10642
10731
|
};
|
|
10643
|
-
var
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10732
|
+
var QuizHeaderResult = (0, import_react33.forwardRef)(
|
|
10733
|
+
({ className, ...props }, ref) => {
|
|
10734
|
+
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
10735
|
+
const [status, setStatus] = (0, import_react33.useState)(void 0);
|
|
10736
|
+
(0, import_react33.useEffect)(() => {
|
|
10737
|
+
const cq = getCurrentQuestion();
|
|
10738
|
+
if (!cq) {
|
|
10739
|
+
setStatus(void 0);
|
|
10740
|
+
return;
|
|
10741
|
+
}
|
|
10742
|
+
const qr = getQuestionResultByQuestionId(cq.id);
|
|
10743
|
+
setStatus(qr?.answerStatus);
|
|
10744
|
+
}, [
|
|
10745
|
+
getCurrentQuestion,
|
|
10746
|
+
getQuestionResultByQuestionId,
|
|
10747
|
+
getCurrentQuestion()?.id
|
|
10748
|
+
]);
|
|
10749
|
+
const getClassesByAnswersStatus = () => {
|
|
10750
|
+
switch (status) {
|
|
10751
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
10752
|
+
return "bg-success-background";
|
|
10753
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
10754
|
+
return "bg-error-background";
|
|
10755
|
+
default:
|
|
10756
|
+
return "bg-error-background";
|
|
10757
|
+
}
|
|
10758
|
+
};
|
|
10759
|
+
const getLabelByAnswersStatus = () => {
|
|
10760
|
+
switch (status) {
|
|
10761
|
+
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
|
|
10762
|
+
return "\u{1F389} Parab\xE9ns!!";
|
|
10763
|
+
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
|
|
10764
|
+
return "N\xE3o foi dessa vez...";
|
|
10765
|
+
case "NAO_RESPONDIDO" /* NAO_RESPONDIDO */:
|
|
10766
|
+
default:
|
|
10767
|
+
return "N\xE3o foi dessa vez...voc\xEA deixou a resposta em branco";
|
|
10768
|
+
}
|
|
10769
|
+
};
|
|
10770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
10771
|
+
"div",
|
|
10772
|
+
{
|
|
10773
|
+
ref,
|
|
10774
|
+
className: cn(
|
|
10775
|
+
"flex flex-row items-center gap-10 p-3.5 rounded-xl mb-4",
|
|
10776
|
+
getClassesByAnswersStatus(),
|
|
10777
|
+
className
|
|
10778
|
+
),
|
|
10779
|
+
...props,
|
|
10780
|
+
children: [
|
|
10781
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
|
|
10782
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-700 text-md", children: getLabelByAnswersStatus() })
|
|
10783
|
+
]
|
|
10784
|
+
}
|
|
10785
|
+
);
|
|
10786
|
+
}
|
|
10787
|
+
);
|
|
10788
|
+
var QuizResultHeaderTitle = (0, import_react33.forwardRef)(({ className, ...props }, ref) => {
|
|
10789
|
+
const { quiz } = useQuizStore();
|
|
10790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
10647
10791
|
"div",
|
|
10648
10792
|
{
|
|
10649
10793
|
ref,
|
|
10650
10794
|
className: cn("flex flex-row pt-4 justify-between", className),
|
|
10651
10795
|
...props,
|
|
10652
10796
|
children: [
|
|
10653
|
-
/* @__PURE__ */ (0,
|
|
10654
|
-
/* @__PURE__ */ (0,
|
|
10797
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
|
|
10798
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(QuizBadge, { subtype: quiz?.subtype || void 0 })
|
|
10655
10799
|
]
|
|
10656
10800
|
}
|
|
10657
10801
|
);
|
|
10658
10802
|
});
|
|
10659
|
-
var QuizResultTitle = (0,
|
|
10803
|
+
var QuizResultTitle = (0, import_react33.forwardRef)(({ className, ...props }, ref) => {
|
|
10660
10804
|
const { getQuizTitle } = useQuizStore();
|
|
10661
10805
|
const quizTitle = getQuizTitle();
|
|
10662
|
-
return /* @__PURE__ */ (0,
|
|
10806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10663
10807
|
"p",
|
|
10664
10808
|
{
|
|
10665
10809
|
className: cn("pt-6 pb-4 text-text-950 font-bold text-lg", className),
|
|
@@ -10669,7 +10813,7 @@ var QuizResultTitle = (0, import_react31.forwardRef)(({ className, ...props }, r
|
|
|
10669
10813
|
}
|
|
10670
10814
|
);
|
|
10671
10815
|
});
|
|
10672
|
-
var QuizResultPerformance = (0,
|
|
10816
|
+
var QuizResultPerformance = (0, import_react33.forwardRef)(
|
|
10673
10817
|
({ ...props }, ref) => {
|
|
10674
10818
|
const {
|
|
10675
10819
|
getTotalQuestions,
|
|
@@ -10711,15 +10855,15 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10711
10855
|
});
|
|
10712
10856
|
}
|
|
10713
10857
|
const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
|
|
10714
|
-
return /* @__PURE__ */ (0,
|
|
10858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
10715
10859
|
"div",
|
|
10716
10860
|
{
|
|
10717
10861
|
className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
|
|
10718
10862
|
ref,
|
|
10719
10863
|
...props,
|
|
10720
10864
|
children: [
|
|
10721
|
-
/* @__PURE__ */ (0,
|
|
10722
|
-
/* @__PURE__ */ (0,
|
|
10865
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative", children: [
|
|
10866
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10723
10867
|
ProgressCircle_default,
|
|
10724
10868
|
{
|
|
10725
10869
|
size: "medium",
|
|
@@ -10729,24 +10873,24 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10729
10873
|
label: ""
|
|
10730
10874
|
}
|
|
10731
10875
|
),
|
|
10732
|
-
/* @__PURE__ */ (0,
|
|
10733
|
-
/* @__PURE__ */ (0,
|
|
10734
|
-
/* @__PURE__ */ (0,
|
|
10735
|
-
/* @__PURE__ */ (0,
|
|
10876
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
10877
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
|
|
10878
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_phosphor_react24.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
|
|
10879
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(
|
|
10736
10880
|
(getQuestionResultStatistics()?.timeSpent ?? 0) * 60
|
|
10737
10881
|
) })
|
|
10738
10882
|
] }),
|
|
10739
|
-
/* @__PURE__ */ (0,
|
|
10883
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
|
|
10740
10884
|
getQuestionResultStatistics()?.correctAnswers ?? "--",
|
|
10741
10885
|
" de",
|
|
10742
10886
|
" ",
|
|
10743
10887
|
totalQuestions
|
|
10744
10888
|
] }),
|
|
10745
|
-
/* @__PURE__ */ (0,
|
|
10889
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
|
|
10746
10890
|
] })
|
|
10747
10891
|
] }),
|
|
10748
|
-
/* @__PURE__ */ (0,
|
|
10749
|
-
/* @__PURE__ */ (0,
|
|
10892
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
|
|
10893
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10750
10894
|
ProgressBar_default,
|
|
10751
10895
|
{
|
|
10752
10896
|
className: "w-full",
|
|
@@ -10760,7 +10904,7 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10760
10904
|
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
10761
10905
|
}
|
|
10762
10906
|
),
|
|
10763
|
-
/* @__PURE__ */ (0,
|
|
10907
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10764
10908
|
ProgressBar_default,
|
|
10765
10909
|
{
|
|
10766
10910
|
className: "w-full",
|
|
@@ -10774,7 +10918,7 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10774
10918
|
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
10775
10919
|
}
|
|
10776
10920
|
),
|
|
10777
|
-
/* @__PURE__ */ (0,
|
|
10921
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10778
10922
|
ProgressBar_default,
|
|
10779
10923
|
{
|
|
10780
10924
|
className: "w-full",
|
|
@@ -10794,7 +10938,7 @@ var QuizResultPerformance = (0, import_react31.forwardRef)(
|
|
|
10794
10938
|
);
|
|
10795
10939
|
}
|
|
10796
10940
|
);
|
|
10797
|
-
var QuizListResult = (0,
|
|
10941
|
+
var QuizListResult = (0, import_react33.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
|
|
10798
10942
|
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
10799
10943
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
10800
10944
|
const subjectsStats = Object.entries(groupedQuestions).map(
|
|
@@ -10821,9 +10965,9 @@ var QuizListResult = (0, import_react31.forwardRef)(({ className, onSubjectClick
|
|
|
10821
10965
|
};
|
|
10822
10966
|
}
|
|
10823
10967
|
);
|
|
10824
|
-
return /* @__PURE__ */ (0,
|
|
10825
|
-
/* @__PURE__ */ (0,
|
|
10826
|
-
/* @__PURE__ */ (0,
|
|
10968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { ref, className, ...props, children: [
|
|
10969
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
|
|
10970
|
+
/* @__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
10971
|
CardResults,
|
|
10828
10972
|
{
|
|
10829
10973
|
onClick: () => onSubjectClick?.(subject.subject.id),
|
|
@@ -10845,16 +10989,16 @@ var QuizListResultByMateria = ({
|
|
|
10845
10989
|
const { getQuestionsGroupedBySubject, getQuestionIndex } = useQuizStore();
|
|
10846
10990
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
10847
10991
|
const answeredQuestions = groupedQuestions[subject] || [];
|
|
10848
|
-
return /* @__PURE__ */ (0,
|
|
10849
|
-
/* @__PURE__ */ (0,
|
|
10850
|
-
/* @__PURE__ */ (0,
|
|
10851
|
-
/* @__PURE__ */ (0,
|
|
10852
|
-
/* @__PURE__ */ (0,
|
|
10992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col", children: [
|
|
10993
|
+
/* @__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" }) }),
|
|
10994
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: "flex flex-col ", children: [
|
|
10995
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
|
|
10996
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
|
|
10853
10997
|
const questionIndex = getQuestionIndex(
|
|
10854
10998
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10855
10999
|
question.questionId ?? question.id
|
|
10856
11000
|
);
|
|
10857
|
-
return /* @__PURE__ */ (0,
|
|
11001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10858
11002
|
CardStatus,
|
|
10859
11003
|
{
|
|
10860
11004
|
className: "max-w-full",
|
|
@@ -10877,12 +11021,12 @@ var QuizListResultByMateria = ({
|
|
|
10877
11021
|
};
|
|
10878
11022
|
|
|
10879
11023
|
// src/components/LoadingModal/loadingModal.tsx
|
|
10880
|
-
var
|
|
10881
|
-
var
|
|
10882
|
-
var LoadingModal = (0,
|
|
11024
|
+
var import_react34 = require("react");
|
|
11025
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
11026
|
+
var LoadingModal = (0, import_react34.forwardRef)(
|
|
10883
11027
|
({ open, title = "Titulo...", subtitle = "Subtitulo...", ...props }, ref) => {
|
|
10884
11028
|
if (!open) return null;
|
|
10885
|
-
return /* @__PURE__ */ (0,
|
|
11029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10886
11030
|
"div",
|
|
10887
11031
|
{
|
|
10888
11032
|
ref,
|
|
@@ -10891,8 +11035,8 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10891
11035
|
"aria-describedby": "loading-modal-subtitle",
|
|
10892
11036
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-background/90 backdrop-blur-xs",
|
|
10893
11037
|
...props,
|
|
10894
|
-
children: /* @__PURE__ */ (0,
|
|
10895
|
-
/* @__PURE__ */ (0,
|
|
11038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "w-full max-w-[364px] flex flex-col items-center justify-center gap-14", children: [
|
|
11039
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "animate-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10896
11040
|
"svg",
|
|
10897
11041
|
{
|
|
10898
11042
|
width: "102",
|
|
@@ -10903,14 +11047,14 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10903
11047
|
"aria-hidden": "true",
|
|
10904
11048
|
focusable: false,
|
|
10905
11049
|
children: [
|
|
10906
|
-
/* @__PURE__ */ (0,
|
|
11050
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10907
11051
|
"path",
|
|
10908
11052
|
{
|
|
10909
11053
|
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
11054
|
className: "fill-primary-100"
|
|
10911
11055
|
}
|
|
10912
11056
|
),
|
|
10913
|
-
/* @__PURE__ */ (0,
|
|
11057
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10914
11058
|
"path",
|
|
10915
11059
|
{
|
|
10916
11060
|
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 +11064,9 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10920
11064
|
]
|
|
10921
11065
|
}
|
|
10922
11066
|
) }),
|
|
10923
|
-
/* @__PURE__ */ (0,
|
|
10924
|
-
/* @__PURE__ */ (0,
|
|
10925
|
-
/* @__PURE__ */ (0,
|
|
11067
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "flex flex-col gap-4 text-center", children: [
|
|
11068
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { id: "loading-modal-title", className: "text-text-950 text-lg", children: title }),
|
|
11069
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { id: "loading-modal-subtitle", className: "text-text-600 text-lg", children: subtitle })
|
|
10926
11070
|
] })
|
|
10927
11071
|
] })
|
|
10928
11072
|
}
|
|
@@ -10932,8 +11076,8 @@ var LoadingModal = (0, import_react32.forwardRef)(
|
|
|
10932
11076
|
var loadingModal_default = LoadingModal;
|
|
10933
11077
|
|
|
10934
11078
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
10935
|
-
var
|
|
10936
|
-
var
|
|
11079
|
+
var import_phosphor_react25 = require("phosphor-react");
|
|
11080
|
+
var import_react35 = require("react");
|
|
10937
11081
|
|
|
10938
11082
|
// src/store/notificationStore.ts
|
|
10939
11083
|
var import_zustand8 = require("zustand");
|
|
@@ -11180,14 +11324,14 @@ var createNotificationStore = (apiClient) => {
|
|
|
11180
11324
|
var mock_content_default = "./mock-content-K2CDVG6P.png";
|
|
11181
11325
|
|
|
11182
11326
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
11183
|
-
var
|
|
11327
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
11184
11328
|
var NotificationEmpty = ({
|
|
11185
11329
|
emptyStateImage,
|
|
11186
11330
|
emptyStateTitle = "Nenhuma notifica\xE7\xE3o no momento",
|
|
11187
11331
|
emptyStateDescription = "Voc\xEA est\xE1 em dia com todas as novidades. Volte depois para conferir atualiza\xE7\xF5es!"
|
|
11188
11332
|
}) => {
|
|
11189
|
-
return /* @__PURE__ */ (0,
|
|
11190
|
-
emptyStateImage && /* @__PURE__ */ (0,
|
|
11333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
11334
|
+
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
11335
|
"img",
|
|
11192
11336
|
{
|
|
11193
11337
|
src: emptyStateImage,
|
|
@@ -11197,23 +11341,23 @@ var NotificationEmpty = ({
|
|
|
11197
11341
|
className: "object-contain"
|
|
11198
11342
|
}
|
|
11199
11343
|
) }),
|
|
11200
|
-
/* @__PURE__ */ (0,
|
|
11201
|
-
/* @__PURE__ */ (0,
|
|
11344
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: emptyStateTitle }),
|
|
11345
|
+
/* @__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
11346
|
] });
|
|
11203
11347
|
};
|
|
11204
11348
|
var NotificationHeader = ({
|
|
11205
11349
|
unreadCount,
|
|
11206
11350
|
variant = "modal"
|
|
11207
11351
|
}) => {
|
|
11208
|
-
return /* @__PURE__ */ (0,
|
|
11209
|
-
variant === "modal" ? /* @__PURE__ */ (0,
|
|
11210
|
-
unreadCount > 0 && /* @__PURE__ */ (0,
|
|
11352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
11353
|
+
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" }),
|
|
11354
|
+
unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11211
11355
|
Badge_default,
|
|
11212
11356
|
{
|
|
11213
11357
|
variant: "solid",
|
|
11214
11358
|
action: "info",
|
|
11215
11359
|
size: "small",
|
|
11216
|
-
iconLeft: /* @__PURE__ */ (0,
|
|
11360
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.Bell, { size: 12, "aria-hidden": "true", focusable: "false" }),
|
|
11217
11361
|
className: "border-0",
|
|
11218
11362
|
children: unreadCount === 1 ? "1 n\xE3o lida" : `${unreadCount} n\xE3o lidas`
|
|
11219
11363
|
}
|
|
@@ -11249,7 +11393,7 @@ var SingleNotificationCard = ({
|
|
|
11249
11393
|
onNavigate();
|
|
11250
11394
|
}
|
|
11251
11395
|
};
|
|
11252
|
-
return /* @__PURE__ */ (0,
|
|
11396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
11253
11397
|
"div",
|
|
11254
11398
|
{
|
|
11255
11399
|
className: cn(
|
|
@@ -11258,20 +11402,20 @@ var SingleNotificationCard = ({
|
|
|
11258
11402
|
className
|
|
11259
11403
|
),
|
|
11260
11404
|
children: [
|
|
11261
|
-
/* @__PURE__ */ (0,
|
|
11262
|
-
!isRead && /* @__PURE__ */ (0,
|
|
11263
|
-
/* @__PURE__ */ (0,
|
|
11264
|
-
/* @__PURE__ */ (0,
|
|
11265
|
-
/* @__PURE__ */ (0,
|
|
11405
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-2 w-full", children: [
|
|
11406
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
11407
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
11408
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(DropdownMenu_default, { children: [
|
|
11409
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11266
11410
|
DropdownMenuTrigger,
|
|
11267
11411
|
{
|
|
11268
11412
|
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
11413
|
"aria-label": "Menu de a\xE7\xF5es",
|
|
11270
|
-
children: /* @__PURE__ */ (0,
|
|
11414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.DotsThreeVertical, { size: 24 })
|
|
11271
11415
|
}
|
|
11272
11416
|
),
|
|
11273
|
-
/* @__PURE__ */ (0,
|
|
11274
|
-
!isRead && /* @__PURE__ */ (0,
|
|
11417
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
11418
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11275
11419
|
DropdownMenuItem,
|
|
11276
11420
|
{
|
|
11277
11421
|
onClick: handleMarkAsRead,
|
|
@@ -11279,14 +11423,14 @@ var SingleNotificationCard = ({
|
|
|
11279
11423
|
children: "Marcar como lida"
|
|
11280
11424
|
}
|
|
11281
11425
|
),
|
|
11282
|
-
/* @__PURE__ */ (0,
|
|
11426
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
11283
11427
|
] })
|
|
11284
11428
|
] })
|
|
11285
11429
|
] }),
|
|
11286
|
-
/* @__PURE__ */ (0,
|
|
11287
|
-
/* @__PURE__ */ (0,
|
|
11288
|
-
/* @__PURE__ */ (0,
|
|
11289
|
-
onNavigate && actionLabel && /* @__PURE__ */ (0,
|
|
11430
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
11431
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
11432
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
11433
|
+
onNavigate && actionLabel && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11290
11434
|
"button",
|
|
11291
11435
|
{
|
|
11292
11436
|
type: "button",
|
|
@@ -11314,7 +11458,7 @@ var NotificationList = ({
|
|
|
11314
11458
|
className,
|
|
11315
11459
|
emptyStateImage
|
|
11316
11460
|
}) => {
|
|
11317
|
-
const [globalNotificationModal, setGlobalNotificationModal] = (0,
|
|
11461
|
+
const [globalNotificationModal, setGlobalNotificationModal] = (0, import_react35.useState)({ isOpen: false, notification: null });
|
|
11318
11462
|
const handleGlobalNotificationClick = (notification) => {
|
|
11319
11463
|
if (onGlobalNotificationClick) {
|
|
11320
11464
|
onGlobalNotificationClick(notification);
|
|
@@ -11326,9 +11470,9 @@ var NotificationList = ({
|
|
|
11326
11470
|
}
|
|
11327
11471
|
};
|
|
11328
11472
|
if (error) {
|
|
11329
|
-
return /* @__PURE__ */ (0,
|
|
11330
|
-
/* @__PURE__ */ (0,
|
|
11331
|
-
onRetry && /* @__PURE__ */ (0,
|
|
11473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
11474
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm text-error-600", children: error }),
|
|
11475
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11332
11476
|
"button",
|
|
11333
11477
|
{
|
|
11334
11478
|
type: "button",
|
|
@@ -11340,8 +11484,8 @@ var NotificationList = ({
|
|
|
11340
11484
|
] });
|
|
11341
11485
|
}
|
|
11342
11486
|
if (loading) {
|
|
11343
|
-
return /* @__PURE__ */ (0,
|
|
11344
|
-
(skeletonId) => /* @__PURE__ */ (0,
|
|
11487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
11488
|
+
(skeletonId) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11345
11489
|
SkeletonCard,
|
|
11346
11490
|
{
|
|
11347
11491
|
className: "p-4 border-b border-border-200"
|
|
@@ -11351,11 +11495,11 @@ var NotificationList = ({
|
|
|
11351
11495
|
) });
|
|
11352
11496
|
}
|
|
11353
11497
|
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
11354
|
-
return renderEmpty ? /* @__PURE__ */ (0,
|
|
11498
|
+
return renderEmpty ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationEmpty, {});
|
|
11355
11499
|
}
|
|
11356
|
-
return /* @__PURE__ */ (0,
|
|
11357
|
-
groupedNotifications.map((group, idx) => /* @__PURE__ */ (0,
|
|
11358
|
-
/* @__PURE__ */ (0,
|
|
11500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cn("flex flex-col gap-0 w-full", className), children: [
|
|
11501
|
+
groupedNotifications.map((group, idx) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col", children: [
|
|
11502
|
+
/* @__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
11503
|
group.notifications.map((notification) => {
|
|
11360
11504
|
const isGlobalNotification = !notification.entityType && !notification.entityId && !notification.activity && !notification.goal;
|
|
11361
11505
|
let navigationHandler;
|
|
@@ -11375,7 +11519,7 @@ var NotificationList = ({
|
|
|
11375
11519
|
notification.entityType ?? void 0
|
|
11376
11520
|
);
|
|
11377
11521
|
}
|
|
11378
|
-
return /* @__PURE__ */ (0,
|
|
11522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11379
11523
|
SingleNotificationCard,
|
|
11380
11524
|
{
|
|
11381
11525
|
title: notification.title,
|
|
@@ -11391,7 +11535,7 @@ var NotificationList = ({
|
|
|
11391
11535
|
);
|
|
11392
11536
|
})
|
|
11393
11537
|
] }, `${group.label}-${idx}`)),
|
|
11394
|
-
/* @__PURE__ */ (0,
|
|
11538
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11395
11539
|
Modal_default,
|
|
11396
11540
|
{
|
|
11397
11541
|
isOpen: globalNotificationModal.isOpen,
|
|
@@ -11428,8 +11572,8 @@ var NotificationCenter = ({
|
|
|
11428
11572
|
className
|
|
11429
11573
|
}) => {
|
|
11430
11574
|
const { isMobile } = useMobile();
|
|
11431
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
11432
|
-
const [globalNotificationModal, setGlobalNotificationModal] = (0,
|
|
11575
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react35.useState)(false);
|
|
11576
|
+
const [globalNotificationModal, setGlobalNotificationModal] = (0, import_react35.useState)({ isOpen: false, notification: null });
|
|
11433
11577
|
const handleMobileClick = () => {
|
|
11434
11578
|
setIsModalOpen(true);
|
|
11435
11579
|
onFetchNotifications?.();
|
|
@@ -11444,12 +11588,12 @@ var NotificationCenter = ({
|
|
|
11444
11588
|
onToggleActive?.();
|
|
11445
11589
|
}
|
|
11446
11590
|
};
|
|
11447
|
-
(0,
|
|
11591
|
+
(0, import_react35.useEffect)(() => {
|
|
11448
11592
|
if (isActive) {
|
|
11449
11593
|
onFetchNotifications?.();
|
|
11450
11594
|
}
|
|
11451
11595
|
}, [isActive, onFetchNotifications]);
|
|
11452
|
-
const renderEmptyState = () => /* @__PURE__ */ (0,
|
|
11596
|
+
const renderEmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11453
11597
|
NotificationEmpty,
|
|
11454
11598
|
{
|
|
11455
11599
|
emptyStateImage,
|
|
@@ -11458,17 +11602,17 @@ var NotificationCenter = ({
|
|
|
11458
11602
|
}
|
|
11459
11603
|
);
|
|
11460
11604
|
if (isMobile) {
|
|
11461
|
-
return /* @__PURE__ */ (0,
|
|
11462
|
-
/* @__PURE__ */ (0,
|
|
11605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
11606
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11463
11607
|
IconButton_default,
|
|
11464
11608
|
{
|
|
11465
11609
|
active: isModalOpen,
|
|
11466
11610
|
onClick: handleMobileClick,
|
|
11467
|
-
icon: /* @__PURE__ */ (0,
|
|
11611
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.Bell, { size: 24, className: "text-primary" }),
|
|
11468
11612
|
className
|
|
11469
11613
|
}
|
|
11470
11614
|
),
|
|
11471
|
-
/* @__PURE__ */ (0,
|
|
11615
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11472
11616
|
Modal_default,
|
|
11473
11617
|
{
|
|
11474
11618
|
isOpen: isModalOpen,
|
|
@@ -11477,10 +11621,10 @@ var NotificationCenter = ({
|
|
|
11477
11621
|
size: "md",
|
|
11478
11622
|
hideCloseButton: false,
|
|
11479
11623
|
closeOnEscape: true,
|
|
11480
|
-
children: /* @__PURE__ */ (0,
|
|
11481
|
-
/* @__PURE__ */ (0,
|
|
11482
|
-
/* @__PURE__ */ (0,
|
|
11483
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0,
|
|
11624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col h-full max-h-[80vh]", children: [
|
|
11625
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "px-0 pb-3 border-b border-border-200", children: [
|
|
11626
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationHeader, { unreadCount, variant: "modal" }),
|
|
11627
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11484
11628
|
"button",
|
|
11485
11629
|
{
|
|
11486
11630
|
type: "button",
|
|
@@ -11490,7 +11634,7 @@ var NotificationCenter = ({
|
|
|
11490
11634
|
}
|
|
11491
11635
|
)
|
|
11492
11636
|
] }),
|
|
11493
|
-
/* @__PURE__ */ (0,
|
|
11637
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11494
11638
|
NotificationList,
|
|
11495
11639
|
{
|
|
11496
11640
|
groupedNotifications,
|
|
@@ -11520,19 +11664,19 @@ var NotificationCenter = ({
|
|
|
11520
11664
|
)
|
|
11521
11665
|
] });
|
|
11522
11666
|
}
|
|
11523
|
-
return /* @__PURE__ */ (0,
|
|
11524
|
-
/* @__PURE__ */ (0,
|
|
11667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
11668
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
11525
11669
|
DropdownMenu_default,
|
|
11526
11670
|
{
|
|
11527
11671
|
...typeof isActive === "boolean" ? { open: isActive, onOpenChange: handleOpenChange } : { onOpenChange: handleOpenChange },
|
|
11528
11672
|
children: [
|
|
11529
|
-
/* @__PURE__ */ (0,
|
|
11673
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DropdownMenuTrigger, { className: "text-primary cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11530
11674
|
IconButton_default,
|
|
11531
11675
|
{
|
|
11532
11676
|
active: isActive,
|
|
11533
11677
|
onClick: handleDesktopClick,
|
|
11534
|
-
icon: /* @__PURE__ */ (0,
|
|
11535
|
-
|
|
11678
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11679
|
+
import_phosphor_react25.Bell,
|
|
11536
11680
|
{
|
|
11537
11681
|
size: 24,
|
|
11538
11682
|
className: isActive ? "text-primary-950" : "text-primary"
|
|
@@ -11541,22 +11685,22 @@ var NotificationCenter = ({
|
|
|
11541
11685
|
className
|
|
11542
11686
|
}
|
|
11543
11687
|
) }),
|
|
11544
|
-
/* @__PURE__ */ (0,
|
|
11688
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11545
11689
|
DropdownMenuContent,
|
|
11546
11690
|
{
|
|
11547
11691
|
className: "min-w-[320px] max-w-[400px] max-h-[500px] overflow-hidden",
|
|
11548
11692
|
side: "bottom",
|
|
11549
11693
|
align: "end",
|
|
11550
|
-
children: /* @__PURE__ */ (0,
|
|
11551
|
-
/* @__PURE__ */ (0,
|
|
11552
|
-
/* @__PURE__ */ (0,
|
|
11694
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col", children: [
|
|
11695
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "px-4 py-3 border-b border-border-200", children: [
|
|
11696
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11553
11697
|
NotificationHeader,
|
|
11554
11698
|
{
|
|
11555
11699
|
unreadCount,
|
|
11556
11700
|
variant: "dropdown"
|
|
11557
11701
|
}
|
|
11558
11702
|
),
|
|
11559
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0,
|
|
11703
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11560
11704
|
"button",
|
|
11561
11705
|
{
|
|
11562
11706
|
type: "button",
|
|
@@ -11566,7 +11710,7 @@ var NotificationCenter = ({
|
|
|
11566
11710
|
}
|
|
11567
11711
|
)
|
|
11568
11712
|
] }),
|
|
11569
|
-
/* @__PURE__ */ (0,
|
|
11713
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11570
11714
|
NotificationList,
|
|
11571
11715
|
{
|
|
11572
11716
|
groupedNotifications,
|
|
@@ -11593,7 +11737,7 @@ var NotificationCenter = ({
|
|
|
11593
11737
|
]
|
|
11594
11738
|
}
|
|
11595
11739
|
),
|
|
11596
|
-
/* @__PURE__ */ (0,
|
|
11740
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11597
11741
|
Modal_default,
|
|
11598
11742
|
{
|
|
11599
11743
|
isOpen: globalNotificationModal.isOpen,
|
|
@@ -11612,7 +11756,7 @@ var NotificationCenter = ({
|
|
|
11612
11756
|
var NotificationCard = (props) => {
|
|
11613
11757
|
switch (props.mode) {
|
|
11614
11758
|
case "single":
|
|
11615
|
-
return /* @__PURE__ */ (0,
|
|
11759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11616
11760
|
SingleNotificationCard,
|
|
11617
11761
|
{
|
|
11618
11762
|
title: props.title,
|
|
@@ -11627,7 +11771,7 @@ var NotificationCard = (props) => {
|
|
|
11627
11771
|
}
|
|
11628
11772
|
);
|
|
11629
11773
|
case "list":
|
|
11630
|
-
return /* @__PURE__ */ (0,
|
|
11774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11631
11775
|
NotificationList,
|
|
11632
11776
|
{
|
|
11633
11777
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -11650,9 +11794,9 @@ var NotificationCard = (props) => {
|
|
|
11650
11794
|
}
|
|
11651
11795
|
);
|
|
11652
11796
|
case "center":
|
|
11653
|
-
return /* @__PURE__ */ (0,
|
|
11797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationCenter, { ...props });
|
|
11654
11798
|
default:
|
|
11655
|
-
return /* @__PURE__ */ (0,
|
|
11799
|
+
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
11800
|
}
|
|
11657
11801
|
};
|
|
11658
11802
|
var NotificationCard_default = NotificationCard;
|
|
@@ -11663,7 +11807,7 @@ var createUseNotificationStore = (apiClient) => {
|
|
|
11663
11807
|
};
|
|
11664
11808
|
|
|
11665
11809
|
// src/hooks/useNotifications.ts
|
|
11666
|
-
var
|
|
11810
|
+
var import_react36 = require("react");
|
|
11667
11811
|
var createUseNotifications = (apiClient) => {
|
|
11668
11812
|
const useNotificationStore = createUseNotificationStore(apiClient);
|
|
11669
11813
|
return () => {
|
|
@@ -11682,7 +11826,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11682
11826
|
resetError,
|
|
11683
11827
|
getGroupedNotifications
|
|
11684
11828
|
} = useNotificationStore();
|
|
11685
|
-
const handleNavigate = (0,
|
|
11829
|
+
const handleNavigate = (0, import_react36.useCallback)(
|
|
11686
11830
|
(entityType, entityId, onAfterNavigate) => {
|
|
11687
11831
|
if (entityType && entityId) {
|
|
11688
11832
|
switch (entityType.toUpperCase()) {
|
|
@@ -11700,7 +11844,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11700
11844
|
},
|
|
11701
11845
|
[]
|
|
11702
11846
|
);
|
|
11703
|
-
const getActionLabel = (0,
|
|
11847
|
+
const getActionLabel = (0, import_react36.useCallback)(
|
|
11704
11848
|
(entityType) => {
|
|
11705
11849
|
if (!entityType) return "Ver mais";
|
|
11706
11850
|
switch (entityType.toUpperCase()) {
|
|
@@ -11714,7 +11858,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11714
11858
|
},
|
|
11715
11859
|
[]
|
|
11716
11860
|
);
|
|
11717
|
-
const markAsReadAndNavigate = (0,
|
|
11861
|
+
const markAsReadAndNavigate = (0, import_react36.useCallback)(
|
|
11718
11862
|
async (id, entityType, entityId, onAfterNavigate) => {
|
|
11719
11863
|
await markAsRead(id);
|
|
11720
11864
|
if (entityType && entityId) {
|
|
@@ -11723,11 +11867,11 @@ var createUseNotifications = (apiClient) => {
|
|
|
11723
11867
|
},
|
|
11724
11868
|
[markAsRead, handleNavigate]
|
|
11725
11869
|
);
|
|
11726
|
-
const refreshNotifications = (0,
|
|
11870
|
+
const refreshNotifications = (0, import_react36.useCallback)(async () => {
|
|
11727
11871
|
resetError();
|
|
11728
11872
|
await fetchNotifications();
|
|
11729
11873
|
}, [resetError, fetchNotifications]);
|
|
11730
|
-
const formatNotification = (0,
|
|
11874
|
+
const formatNotification = (0, import_react36.useCallback)(
|
|
11731
11875
|
(notification) => ({
|
|
11732
11876
|
...notification,
|
|
11733
11877
|
time: formatTimeAgo(notification.createdAt),
|
|
@@ -11736,7 +11880,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
11736
11880
|
}),
|
|
11737
11881
|
[]
|
|
11738
11882
|
);
|
|
11739
|
-
const getFormattedGroupedNotifications = (0,
|
|
11883
|
+
const getFormattedGroupedNotifications = (0, import_react36.useCallback)(() => {
|
|
11740
11884
|
const groups = getGroupedNotifications();
|
|
11741
11885
|
return groups.map((group) => ({
|
|
11742
11886
|
...group,
|
|
@@ -11832,6 +11976,7 @@ var createNotificationsHook = (apiClient) => {
|
|
|
11832
11976
|
QUESTION_DIFFICULTY,
|
|
11833
11977
|
QUESTION_STATUS,
|
|
11834
11978
|
QUESTION_TYPE,
|
|
11979
|
+
QUIZ_TYPE,
|
|
11835
11980
|
Quiz,
|
|
11836
11981
|
QuizAlternative,
|
|
11837
11982
|
QuizConnectDots,
|