analytica-frontend-lib 1.0.82 → 1.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordation/index.js +2 -2
- package/dist/Accordation/index.js.map +1 -1
- package/dist/Accordation/index.mjs +2 -2
- package/dist/Accordation/index.mjs.map +1 -1
- package/dist/AlertDialog/index.js +1 -1
- package/dist/AlertDialog/index.js.map +1 -1
- package/dist/AlertDialog/index.mjs +1 -1
- package/dist/AlertDialog/index.mjs.map +1 -1
- package/dist/Card/index.js +2 -2
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +2 -2
- package/dist/Card/index.mjs.map +1 -1
- package/dist/Modal/index.js +1 -1
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/index.mjs +1 -1
- package/dist/Modal/index.mjs.map +1 -1
- package/dist/Quiz/index.d.mts +52 -0
- package/dist/Quiz/index.d.ts +52 -0
- package/dist/Quiz/index.js +4185 -0
- package/dist/Quiz/index.js.map +1 -0
- package/dist/Quiz/index.mjs +4191 -0
- package/dist/Quiz/index.mjs.map +1 -0
- package/dist/Quiz/useQuizStore/index.d.mts +140 -0
- package/dist/Quiz/useQuizStore/index.d.ts +140 -0
- package/dist/Quiz/useQuizStore/index.js +395 -0
- package/dist/Quiz/useQuizStore/index.js.map +1 -0
- package/dist/Quiz/useQuizStore/index.mjs +367 -0
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
- package/dist/index.css +59 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1008 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1003 -4
- package/dist/index.mjs.map +1 -1
- package/dist/simulated-result-QN5HCUY5.png +0 -0
- package/dist/styles.css +59 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -3070,7 +3070,7 @@ var Modal = ({
|
|
|
3070
3070
|
};
|
|
3071
3071
|
if (!isOpen) return null;
|
|
3072
3072
|
const sizeClasses = SIZE_CLASSES10[size];
|
|
3073
|
-
const baseClasses = "bg-
|
|
3073
|
+
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
3074
3074
|
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
3075
3075
|
const modalClasses = `${baseClasses} ${sizeClasses} ${dialogResetClasses} ${className}`;
|
|
3076
3076
|
return /* @__PURE__ */ jsx22(
|
|
@@ -3629,8 +3629,8 @@ var CardStatus = forwardRef9(
|
|
|
3629
3629
|
...props,
|
|
3630
3630
|
children: /* @__PURE__ */ jsxs18("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
|
|
3631
3631
|
/* @__PURE__ */ jsx23("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
3632
|
-
|
|
3633
|
-
/* @__PURE__ */ jsx23(
|
|
3632
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
|
|
3633
|
+
status && /* @__PURE__ */ jsx23(
|
|
3634
3634
|
Badge_default,
|
|
3635
3635
|
{
|
|
3636
3636
|
action: status == "correct" ? "success" : "error",
|
|
@@ -4664,7 +4664,7 @@ var AlertDialog = forwardRef12(
|
|
|
4664
4664
|
"h2",
|
|
4665
4665
|
{
|
|
4666
4666
|
id: "alert-dialog-title",
|
|
4667
|
-
className: "pb-3 text-xl font-semibold",
|
|
4667
|
+
className: "pb-3 text-xl font-semibold text-text-950",
|
|
4668
4668
|
children: title
|
|
4669
4669
|
}
|
|
4670
4670
|
),
|
|
@@ -6246,6 +6246,993 @@ function useApiConfig(api) {
|
|
|
6246
6246
|
[api]
|
|
6247
6247
|
);
|
|
6248
6248
|
}
|
|
6249
|
+
|
|
6250
|
+
// src/components/Quiz/Quiz.tsx
|
|
6251
|
+
import {
|
|
6252
|
+
CaretLeft as CaretLeft2,
|
|
6253
|
+
CaretRight as CaretRight4,
|
|
6254
|
+
Clock as Clock2,
|
|
6255
|
+
SquaresFour,
|
|
6256
|
+
BookOpen,
|
|
6257
|
+
Book
|
|
6258
|
+
} from "phosphor-react";
|
|
6259
|
+
import { forwardRef as forwardRef17, useState as useState12 } from "react";
|
|
6260
|
+
|
|
6261
|
+
// src/components/Quiz/useQuizStore.ts
|
|
6262
|
+
import { create as create6 } from "zustand";
|
|
6263
|
+
import { devtools } from "zustand/middleware";
|
|
6264
|
+
var useQuizStore = create6()(
|
|
6265
|
+
devtools(
|
|
6266
|
+
(set, get) => {
|
|
6267
|
+
let timerInterval = null;
|
|
6268
|
+
const startTimer = () => {
|
|
6269
|
+
if (get().isFinished) {
|
|
6270
|
+
return;
|
|
6271
|
+
}
|
|
6272
|
+
if (timerInterval) {
|
|
6273
|
+
clearInterval(timerInterval);
|
|
6274
|
+
}
|
|
6275
|
+
timerInterval = setInterval(() => {
|
|
6276
|
+
const { timeElapsed } = get();
|
|
6277
|
+
set({ timeElapsed: timeElapsed + 1 });
|
|
6278
|
+
}, 1e3);
|
|
6279
|
+
};
|
|
6280
|
+
const stopTimer = () => {
|
|
6281
|
+
if (timerInterval) {
|
|
6282
|
+
clearInterval(timerInterval);
|
|
6283
|
+
timerInterval = null;
|
|
6284
|
+
}
|
|
6285
|
+
};
|
|
6286
|
+
return {
|
|
6287
|
+
// Initial State
|
|
6288
|
+
currentQuestionIndex: 0,
|
|
6289
|
+
selectedAnswers: {},
|
|
6290
|
+
userAnswers: [],
|
|
6291
|
+
timeElapsed: 0,
|
|
6292
|
+
isStarted: false,
|
|
6293
|
+
isFinished: false,
|
|
6294
|
+
userId: "",
|
|
6295
|
+
// Setters
|
|
6296
|
+
setBySimulated: (simulado) => set({ bySimulated: simulado }),
|
|
6297
|
+
setByActivity: (atividade) => set({ byActivity: atividade }),
|
|
6298
|
+
setByQuestionary: (aula) => set({ byQuestionary: aula }),
|
|
6299
|
+
setUserId: (userId) => set({ userId }),
|
|
6300
|
+
getUserId: () => get().userId,
|
|
6301
|
+
// Navigation
|
|
6302
|
+
goToNextQuestion: () => {
|
|
6303
|
+
const { currentQuestionIndex, getTotalQuestions } = get();
|
|
6304
|
+
const totalQuestions = getTotalQuestions();
|
|
6305
|
+
if (currentQuestionIndex < totalQuestions - 1) {
|
|
6306
|
+
set({ currentQuestionIndex: currentQuestionIndex + 1 });
|
|
6307
|
+
}
|
|
6308
|
+
},
|
|
6309
|
+
goToPreviousQuestion: () => {
|
|
6310
|
+
const { currentQuestionIndex } = get();
|
|
6311
|
+
if (currentQuestionIndex > 0) {
|
|
6312
|
+
set({ currentQuestionIndex: currentQuestionIndex - 1 });
|
|
6313
|
+
}
|
|
6314
|
+
},
|
|
6315
|
+
goToQuestion: (index) => {
|
|
6316
|
+
const { getTotalQuestions } = get();
|
|
6317
|
+
const totalQuestions = getTotalQuestions();
|
|
6318
|
+
if (index >= 0 && index < totalQuestions) {
|
|
6319
|
+
set({ currentQuestionIndex: index });
|
|
6320
|
+
}
|
|
6321
|
+
},
|
|
6322
|
+
getActiveQuiz: () => {
|
|
6323
|
+
const { bySimulated, byActivity, byQuestionary } = get();
|
|
6324
|
+
if (bySimulated)
|
|
6325
|
+
return { quiz: bySimulated, type: "bySimulated" };
|
|
6326
|
+
if (byActivity)
|
|
6327
|
+
return { quiz: byActivity, type: "byActivity" };
|
|
6328
|
+
if (byQuestionary)
|
|
6329
|
+
return { quiz: byQuestionary, type: "byQuestionary" };
|
|
6330
|
+
return null;
|
|
6331
|
+
},
|
|
6332
|
+
selectAnswer: (questionId, answerId) => {
|
|
6333
|
+
const { getActiveQuiz, userAnswers } = get();
|
|
6334
|
+
const activeQuiz = getActiveQuiz();
|
|
6335
|
+
if (!activeQuiz) return;
|
|
6336
|
+
const updatedQuestions = activeQuiz.quiz.questions.map(
|
|
6337
|
+
(question) => question.id === questionId ? { ...question, answerKey: answerId } : question
|
|
6338
|
+
);
|
|
6339
|
+
const updatedQuiz = {
|
|
6340
|
+
...activeQuiz.quiz,
|
|
6341
|
+
questions: updatedQuestions
|
|
6342
|
+
};
|
|
6343
|
+
const activityId = activeQuiz.quiz.id;
|
|
6344
|
+
const userId = get().getUserId();
|
|
6345
|
+
if (!userId) {
|
|
6346
|
+
console.warn("selectAnswer called before userId is set");
|
|
6347
|
+
return;
|
|
6348
|
+
}
|
|
6349
|
+
const existingAnswerIndex = userAnswers.findIndex(
|
|
6350
|
+
(answer) => answer.questionId === questionId
|
|
6351
|
+
);
|
|
6352
|
+
const newUserAnswer = {
|
|
6353
|
+
questionId,
|
|
6354
|
+
activityId,
|
|
6355
|
+
userId,
|
|
6356
|
+
answer: answerId,
|
|
6357
|
+
optionId: answerId
|
|
6358
|
+
};
|
|
6359
|
+
let updatedUserAnswers;
|
|
6360
|
+
if (existingAnswerIndex !== -1) {
|
|
6361
|
+
updatedUserAnswers = [...userAnswers];
|
|
6362
|
+
updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
|
|
6363
|
+
} else {
|
|
6364
|
+
updatedUserAnswers = [...userAnswers, newUserAnswer];
|
|
6365
|
+
}
|
|
6366
|
+
set({
|
|
6367
|
+
[activeQuiz.type]: updatedQuiz,
|
|
6368
|
+
userAnswers: updatedUserAnswers
|
|
6369
|
+
});
|
|
6370
|
+
},
|
|
6371
|
+
skipQuestion: () => {
|
|
6372
|
+
const { getCurrentQuestion, userAnswers, getActiveQuiz } = get();
|
|
6373
|
+
const currentQuestion = getCurrentQuestion();
|
|
6374
|
+
const activeQuiz = getActiveQuiz();
|
|
6375
|
+
if (!activeQuiz) return;
|
|
6376
|
+
if (currentQuestion) {
|
|
6377
|
+
const activityId = activeQuiz.quiz.id;
|
|
6378
|
+
const userId = get().getUserId();
|
|
6379
|
+
const existingAnswerIndex = userAnswers.findIndex(
|
|
6380
|
+
(answer) => answer.questionId === currentQuestion.id
|
|
6381
|
+
);
|
|
6382
|
+
const newUserAnswer = {
|
|
6383
|
+
questionId: currentQuestion.id,
|
|
6384
|
+
activityId,
|
|
6385
|
+
userId,
|
|
6386
|
+
answer: null,
|
|
6387
|
+
optionId: null
|
|
6388
|
+
};
|
|
6389
|
+
let updatedUserAnswers;
|
|
6390
|
+
if (existingAnswerIndex !== -1) {
|
|
6391
|
+
updatedUserAnswers = [...userAnswers];
|
|
6392
|
+
updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
|
|
6393
|
+
} else {
|
|
6394
|
+
updatedUserAnswers = [...userAnswers, newUserAnswer];
|
|
6395
|
+
}
|
|
6396
|
+
set({
|
|
6397
|
+
userAnswers: updatedUserAnswers
|
|
6398
|
+
});
|
|
6399
|
+
}
|
|
6400
|
+
},
|
|
6401
|
+
addUserAnswer: (questionId, answerId) => {
|
|
6402
|
+
const { getActiveQuiz, userAnswers } = get();
|
|
6403
|
+
const activeQuiz = getActiveQuiz();
|
|
6404
|
+
if (!activeQuiz) return;
|
|
6405
|
+
const activityId = activeQuiz.quiz.id;
|
|
6406
|
+
const userId = get().getUserId();
|
|
6407
|
+
const existingAnswerIndex = userAnswers.findIndex(
|
|
6408
|
+
(answer) => answer.questionId === questionId
|
|
6409
|
+
);
|
|
6410
|
+
const newUserAnswer = {
|
|
6411
|
+
questionId,
|
|
6412
|
+
activityId,
|
|
6413
|
+
userId,
|
|
6414
|
+
answer: answerId || null,
|
|
6415
|
+
optionId: answerId || null
|
|
6416
|
+
};
|
|
6417
|
+
if (existingAnswerIndex !== -1) {
|
|
6418
|
+
const updatedUserAnswers = [...userAnswers];
|
|
6419
|
+
updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
|
|
6420
|
+
set({ userAnswers: updatedUserAnswers });
|
|
6421
|
+
} else {
|
|
6422
|
+
set({ userAnswers: [...userAnswers, newUserAnswer] });
|
|
6423
|
+
}
|
|
6424
|
+
},
|
|
6425
|
+
startQuiz: () => {
|
|
6426
|
+
set({ isStarted: true, timeElapsed: 0 });
|
|
6427
|
+
startTimer();
|
|
6428
|
+
},
|
|
6429
|
+
finishQuiz: () => {
|
|
6430
|
+
set({ isFinished: true });
|
|
6431
|
+
stopTimer();
|
|
6432
|
+
},
|
|
6433
|
+
resetQuiz: () => {
|
|
6434
|
+
stopTimer();
|
|
6435
|
+
set({
|
|
6436
|
+
currentQuestionIndex: 0,
|
|
6437
|
+
selectedAnswers: {},
|
|
6438
|
+
userAnswers: [],
|
|
6439
|
+
timeElapsed: 0,
|
|
6440
|
+
isStarted: false,
|
|
6441
|
+
isFinished: false,
|
|
6442
|
+
userId: ""
|
|
6443
|
+
});
|
|
6444
|
+
},
|
|
6445
|
+
// Timer
|
|
6446
|
+
updateTime: (time) => set({ timeElapsed: time }),
|
|
6447
|
+
startTimer,
|
|
6448
|
+
stopTimer,
|
|
6449
|
+
// Getters
|
|
6450
|
+
getCurrentQuestion: () => {
|
|
6451
|
+
const { currentQuestionIndex, getActiveQuiz } = get();
|
|
6452
|
+
const activeQuiz = getActiveQuiz();
|
|
6453
|
+
if (!activeQuiz) {
|
|
6454
|
+
return null;
|
|
6455
|
+
}
|
|
6456
|
+
return activeQuiz.quiz.questions[currentQuestionIndex];
|
|
6457
|
+
},
|
|
6458
|
+
getTotalQuestions: () => {
|
|
6459
|
+
const { getActiveQuiz } = get();
|
|
6460
|
+
const activeQuiz = getActiveQuiz();
|
|
6461
|
+
return activeQuiz?.quiz?.questions?.length || 0;
|
|
6462
|
+
},
|
|
6463
|
+
getAnsweredQuestions: () => {
|
|
6464
|
+
const { userAnswers } = get();
|
|
6465
|
+
return userAnswers.filter((answer) => answer.answer !== null).length;
|
|
6466
|
+
},
|
|
6467
|
+
getUnansweredQuestions: () => {
|
|
6468
|
+
const { getActiveQuiz, userAnswers } = get();
|
|
6469
|
+
const activeQuiz = getActiveQuiz();
|
|
6470
|
+
if (!activeQuiz) return [];
|
|
6471
|
+
const unansweredQuestions = [];
|
|
6472
|
+
activeQuiz.quiz.questions.forEach((question, index) => {
|
|
6473
|
+
const userAnswer = userAnswers.find(
|
|
6474
|
+
(answer) => answer.questionId === question.id
|
|
6475
|
+
);
|
|
6476
|
+
const isAnswered = userAnswer && userAnswer.answer !== null;
|
|
6477
|
+
const isSkipped = userAnswer && userAnswer.answer === null;
|
|
6478
|
+
if (!isAnswered && !isSkipped) {
|
|
6479
|
+
unansweredQuestions.push(index + 1);
|
|
6480
|
+
}
|
|
6481
|
+
});
|
|
6482
|
+
return unansweredQuestions;
|
|
6483
|
+
},
|
|
6484
|
+
getSkippedQuestions: () => {
|
|
6485
|
+
const { userAnswers } = get();
|
|
6486
|
+
return userAnswers.filter((answer) => answer.answer === null).length;
|
|
6487
|
+
},
|
|
6488
|
+
getProgress: () => {
|
|
6489
|
+
const { getTotalQuestions, getAnsweredQuestions } = get();
|
|
6490
|
+
const total = getTotalQuestions();
|
|
6491
|
+
const answered = getAnsweredQuestions();
|
|
6492
|
+
return total > 0 ? answered / total * 100 : 0;
|
|
6493
|
+
},
|
|
6494
|
+
isQuestionAnswered: (questionId) => {
|
|
6495
|
+
const { userAnswers } = get();
|
|
6496
|
+
const userAnswer = userAnswers.find(
|
|
6497
|
+
(answer) => answer.questionId === questionId
|
|
6498
|
+
);
|
|
6499
|
+
return userAnswer ? userAnswer.answer !== null : false;
|
|
6500
|
+
},
|
|
6501
|
+
isQuestionSkipped: (questionId) => {
|
|
6502
|
+
const { userAnswers } = get();
|
|
6503
|
+
const userAnswer = userAnswers.find(
|
|
6504
|
+
(answer) => answer.questionId === questionId
|
|
6505
|
+
);
|
|
6506
|
+
return userAnswer ? userAnswer.answer === null : false;
|
|
6507
|
+
},
|
|
6508
|
+
getCurrentAnswer: () => {
|
|
6509
|
+
const { getCurrentQuestion, userAnswers } = get();
|
|
6510
|
+
const currentQuestion = getCurrentQuestion();
|
|
6511
|
+
if (!currentQuestion) return void 0;
|
|
6512
|
+
const userAnswer = userAnswers.find(
|
|
6513
|
+
(answer) => answer.questionId === currentQuestion.id
|
|
6514
|
+
);
|
|
6515
|
+
return userAnswer?.answer;
|
|
6516
|
+
},
|
|
6517
|
+
getQuizTitle: () => {
|
|
6518
|
+
const { getActiveQuiz } = get();
|
|
6519
|
+
const activeQuiz = getActiveQuiz();
|
|
6520
|
+
return activeQuiz?.quiz?.title || "Quiz";
|
|
6521
|
+
},
|
|
6522
|
+
formatTime: (seconds) => {
|
|
6523
|
+
const minutes = Math.floor(seconds / 60);
|
|
6524
|
+
const remainingSeconds = seconds % 60;
|
|
6525
|
+
return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
|
|
6526
|
+
},
|
|
6527
|
+
getUserAnswers: () => {
|
|
6528
|
+
const { getActiveQuiz, userAnswers } = get();
|
|
6529
|
+
const activeQuiz = getActiveQuiz();
|
|
6530
|
+
if (!activeQuiz) return [];
|
|
6531
|
+
return activeQuiz.quiz.questions.map((question) => {
|
|
6532
|
+
const userAnswer = userAnswers.find(
|
|
6533
|
+
(answer) => answer.questionId === question.id
|
|
6534
|
+
);
|
|
6535
|
+
return {
|
|
6536
|
+
...question,
|
|
6537
|
+
isSkipped: userAnswer ? userAnswer.answer === null : false
|
|
6538
|
+
};
|
|
6539
|
+
});
|
|
6540
|
+
},
|
|
6541
|
+
getUnansweredQuestionsFromUserAnswers: () => {
|
|
6542
|
+
const { getActiveQuiz, userAnswers } = get();
|
|
6543
|
+
const activeQuiz = getActiveQuiz();
|
|
6544
|
+
if (!activeQuiz) return [];
|
|
6545
|
+
const unansweredQuestions = [];
|
|
6546
|
+
activeQuiz.quiz.questions.forEach((question, index) => {
|
|
6547
|
+
const userAnswer = userAnswers.find(
|
|
6548
|
+
(answer) => answer.questionId === question.id
|
|
6549
|
+
);
|
|
6550
|
+
const hasAnswer = userAnswer && userAnswer.answer !== null;
|
|
6551
|
+
const isSkipped = userAnswer && userAnswer.answer === null;
|
|
6552
|
+
if (!hasAnswer || isSkipped) {
|
|
6553
|
+
unansweredQuestions.push(index + 1);
|
|
6554
|
+
}
|
|
6555
|
+
});
|
|
6556
|
+
return unansweredQuestions;
|
|
6557
|
+
},
|
|
6558
|
+
getQuestionsGroupedBySubject: () => {
|
|
6559
|
+
const { getActiveQuiz } = get();
|
|
6560
|
+
const activeQuiz = getActiveQuiz();
|
|
6561
|
+
if (!activeQuiz) return {};
|
|
6562
|
+
const groupedQuestions = {};
|
|
6563
|
+
activeQuiz.quiz.questions.forEach((question) => {
|
|
6564
|
+
const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
|
|
6565
|
+
if (!groupedQuestions[subjectId]) {
|
|
6566
|
+
groupedQuestions[subjectId] = [];
|
|
6567
|
+
}
|
|
6568
|
+
groupedQuestions[subjectId].push(question);
|
|
6569
|
+
});
|
|
6570
|
+
return groupedQuestions;
|
|
6571
|
+
},
|
|
6572
|
+
// New methods for userAnswers
|
|
6573
|
+
getUserAnswerByQuestionId: (questionId) => {
|
|
6574
|
+
const { userAnswers } = get();
|
|
6575
|
+
return userAnswers.find((answer) => answer.questionId === questionId) || null;
|
|
6576
|
+
},
|
|
6577
|
+
isQuestionAnsweredByUserAnswers: (questionId) => {
|
|
6578
|
+
const { userAnswers } = get();
|
|
6579
|
+
const answer = userAnswers.find(
|
|
6580
|
+
(answer2) => answer2.questionId === questionId
|
|
6581
|
+
);
|
|
6582
|
+
return answer ? answer.answer !== null : false;
|
|
6583
|
+
},
|
|
6584
|
+
getQuestionStatusFromUserAnswers: (questionId) => {
|
|
6585
|
+
const { userAnswers } = get();
|
|
6586
|
+
const answer = userAnswers.find(
|
|
6587
|
+
(answer2) => answer2.questionId === questionId
|
|
6588
|
+
);
|
|
6589
|
+
if (!answer) return "unanswered";
|
|
6590
|
+
if (answer.answer === null) return "skipped";
|
|
6591
|
+
return "answered";
|
|
6592
|
+
},
|
|
6593
|
+
getUserAnswersForActivity: () => {
|
|
6594
|
+
const { userAnswers } = get();
|
|
6595
|
+
return userAnswers;
|
|
6596
|
+
}
|
|
6597
|
+
};
|
|
6598
|
+
},
|
|
6599
|
+
{
|
|
6600
|
+
name: "quiz-store"
|
|
6601
|
+
}
|
|
6602
|
+
)
|
|
6603
|
+
);
|
|
6604
|
+
|
|
6605
|
+
// src/assets/img/simulated-result.png
|
|
6606
|
+
var simulated_result_default = "./simulated-result-QN5HCUY5.png";
|
|
6607
|
+
|
|
6608
|
+
// src/components/Quiz/Quiz.tsx
|
|
6609
|
+
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6610
|
+
var Quiz = forwardRef17(({ children, className, ...props }, ref) => {
|
|
6611
|
+
return /* @__PURE__ */ jsx33(
|
|
6612
|
+
"div",
|
|
6613
|
+
{
|
|
6614
|
+
ref,
|
|
6615
|
+
className: `w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6 ${className}`,
|
|
6616
|
+
...props,
|
|
6617
|
+
children
|
|
6618
|
+
}
|
|
6619
|
+
);
|
|
6620
|
+
});
|
|
6621
|
+
var QuizHeaderResult = forwardRef17(
|
|
6622
|
+
({ className, ...props }, ref) => {
|
|
6623
|
+
const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
|
|
6624
|
+
const currentQuestion = getCurrentQuestion();
|
|
6625
|
+
const userAnswer = getCurrentAnswer();
|
|
6626
|
+
const isCorrect = userAnswer === currentQuestion?.correctOptionId;
|
|
6627
|
+
return /* @__PURE__ */ jsxs27(
|
|
6628
|
+
"div",
|
|
6629
|
+
{
|
|
6630
|
+
ref,
|
|
6631
|
+
className: `flex flex-row items-center gap-10 p-3.5 rounded-xl ${isCorrect ? "bg-success-background" : "bg-error-background"} ${className}`,
|
|
6632
|
+
...props,
|
|
6633
|
+
children: [
|
|
6634
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
|
|
6635
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
|
|
6636
|
+
]
|
|
6637
|
+
}
|
|
6638
|
+
);
|
|
6639
|
+
}
|
|
6640
|
+
);
|
|
6641
|
+
var QuizTitle = forwardRef17(
|
|
6642
|
+
({ className, ...props }, ref) => {
|
|
6643
|
+
const {
|
|
6644
|
+
currentQuestionIndex,
|
|
6645
|
+
getTotalQuestions,
|
|
6646
|
+
getQuizTitle,
|
|
6647
|
+
timeElapsed,
|
|
6648
|
+
formatTime,
|
|
6649
|
+
isStarted
|
|
6650
|
+
} = useQuizStore();
|
|
6651
|
+
const totalQuestions = getTotalQuestions();
|
|
6652
|
+
const quizTitle = getQuizTitle();
|
|
6653
|
+
return /* @__PURE__ */ jsxs27(
|
|
6654
|
+
"div",
|
|
6655
|
+
{
|
|
6656
|
+
ref,
|
|
6657
|
+
className: `flex flex-row justify-center items-center relative p-2 ${className}`,
|
|
6658
|
+
...props,
|
|
6659
|
+
children: [
|
|
6660
|
+
/* @__PURE__ */ jsxs27("span", { className: "flex flex-col gap-2 text-center", children: [
|
|
6661
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
|
|
6662
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
|
|
6663
|
+
] }),
|
|
6664
|
+
/* @__PURE__ */ jsx33("span", { className: "absolute right-2", children: /* @__PURE__ */ jsx33(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx33(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
|
|
6665
|
+
]
|
|
6666
|
+
}
|
|
6667
|
+
);
|
|
6668
|
+
}
|
|
6669
|
+
);
|
|
6670
|
+
var QuizHeader = () => {
|
|
6671
|
+
const { getCurrentQuestion } = useQuizStore();
|
|
6672
|
+
const currentQuestion = getCurrentQuestion();
|
|
6673
|
+
return /* @__PURE__ */ jsx33(
|
|
6674
|
+
HeaderAlternative,
|
|
6675
|
+
{
|
|
6676
|
+
title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
|
|
6677
|
+
subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topicId ?? "",
|
|
6678
|
+
content: currentQuestion?.questionText ?? ""
|
|
6679
|
+
}
|
|
6680
|
+
);
|
|
6681
|
+
};
|
|
6682
|
+
var QuizContent = forwardRef17(({ type = "Alternativas", children, className, ...props }, ref) => {
|
|
6683
|
+
return /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
6684
|
+
/* @__PURE__ */ jsx33("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx33("p", { className: "font-bold text-lg text-text-950", children: type }) }),
|
|
6685
|
+
/* @__PURE__ */ jsx33(
|
|
6686
|
+
"div",
|
|
6687
|
+
{
|
|
6688
|
+
ref,
|
|
6689
|
+
className: `rounded-t-xl px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
|
|
6690
|
+
...props,
|
|
6691
|
+
children
|
|
6692
|
+
}
|
|
6693
|
+
)
|
|
6694
|
+
] });
|
|
6695
|
+
});
|
|
6696
|
+
var QuizAlternative = ({ variant = "default" }) => {
|
|
6697
|
+
const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
|
|
6698
|
+
const currentQuestion = getCurrentQuestion();
|
|
6699
|
+
const currentAnswer = getCurrentAnswer();
|
|
6700
|
+
const alternatives = currentQuestion?.options?.map((option) => {
|
|
6701
|
+
let status = "neutral" /* NEUTRAL */;
|
|
6702
|
+
if (variant === "result") {
|
|
6703
|
+
if (option.id === currentQuestion.correctOptionId) {
|
|
6704
|
+
status = "correct" /* CORRECT */;
|
|
6705
|
+
} else if (currentAnswer === option.id && option.id !== currentQuestion.correctOptionId) {
|
|
6706
|
+
status = "incorrect" /* INCORRECT */;
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
return {
|
|
6710
|
+
label: option.option,
|
|
6711
|
+
value: option.id,
|
|
6712
|
+
status
|
|
6713
|
+
};
|
|
6714
|
+
});
|
|
6715
|
+
if (!alternatives)
|
|
6716
|
+
return /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33("p", { children: "N\xE3o h\xE1 Alternativas" }) });
|
|
6717
|
+
return /* @__PURE__ */ jsx33("div", { className: "space-y-4", children: /* @__PURE__ */ jsx33(
|
|
6718
|
+
AlternativesList,
|
|
6719
|
+
{
|
|
6720
|
+
mode: variant === "default" ? "interactive" : "readonly",
|
|
6721
|
+
name: `question-${currentQuestion?.id || "1"}`,
|
|
6722
|
+
layout: "compact",
|
|
6723
|
+
alternatives,
|
|
6724
|
+
value: currentAnswer,
|
|
6725
|
+
selectedValue: currentAnswer,
|
|
6726
|
+
onValueChange: (value) => {
|
|
6727
|
+
if (currentQuestion) {
|
|
6728
|
+
selectAnswer(currentQuestion.id, value);
|
|
6729
|
+
}
|
|
6730
|
+
}
|
|
6731
|
+
},
|
|
6732
|
+
`question-${currentQuestion?.id || "1"}`
|
|
6733
|
+
) });
|
|
6734
|
+
};
|
|
6735
|
+
var QuizQuestionList = ({
|
|
6736
|
+
filterType = "all",
|
|
6737
|
+
onQuestionClick
|
|
6738
|
+
} = {}) => {
|
|
6739
|
+
const {
|
|
6740
|
+
getQuestionsGroupedBySubject,
|
|
6741
|
+
goToQuestion,
|
|
6742
|
+
getQuestionStatusFromUserAnswers
|
|
6743
|
+
} = useQuizStore();
|
|
6744
|
+
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
6745
|
+
const getQuestionStatus = (questionId) => {
|
|
6746
|
+
return getQuestionStatusFromUserAnswers(questionId);
|
|
6747
|
+
};
|
|
6748
|
+
const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
|
|
6749
|
+
(acc, [subjectId, questions]) => {
|
|
6750
|
+
const filteredQuestions = questions.filter((question) => {
|
|
6751
|
+
const status = getQuestionStatus(question.id);
|
|
6752
|
+
switch (filterType) {
|
|
6753
|
+
case "answered":
|
|
6754
|
+
return status === "answered";
|
|
6755
|
+
case "unanswered":
|
|
6756
|
+
return status === "unanswered";
|
|
6757
|
+
default:
|
|
6758
|
+
return true;
|
|
6759
|
+
}
|
|
6760
|
+
});
|
|
6761
|
+
if (filteredQuestions.length > 0) {
|
|
6762
|
+
acc[subjectId] = filteredQuestions;
|
|
6763
|
+
}
|
|
6764
|
+
return acc;
|
|
6765
|
+
},
|
|
6766
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6767
|
+
{}
|
|
6768
|
+
);
|
|
6769
|
+
const getQuestionIndex = (questionId) => {
|
|
6770
|
+
const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
|
|
6771
|
+
const quiz = bySimulated ?? byActivity ?? byQuestionary;
|
|
6772
|
+
if (!quiz) return 0;
|
|
6773
|
+
const index = quiz.questions.findIndex((q) => q.id === questionId);
|
|
6774
|
+
return index + 1;
|
|
6775
|
+
};
|
|
6776
|
+
const getStatusLabel = (status) => {
|
|
6777
|
+
switch (status) {
|
|
6778
|
+
case "answered":
|
|
6779
|
+
return "Respondida";
|
|
6780
|
+
case "skipped":
|
|
6781
|
+
return "N\xE3o respondida";
|
|
6782
|
+
default:
|
|
6783
|
+
return "Em branco";
|
|
6784
|
+
}
|
|
6785
|
+
};
|
|
6786
|
+
return /* @__PURE__ */ jsx33("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
|
|
6787
|
+
([subjectId, questions]) => /* @__PURE__ */ jsxs27("section", { className: "flex flex-col gap-2", children: [
|
|
6788
|
+
/* @__PURE__ */ jsxs27("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
|
|
6789
|
+
/* @__PURE__ */ jsx33("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ jsx33(BookOpen, { size: 17, className: "text-white" }) }),
|
|
6790
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
|
|
6791
|
+
] }),
|
|
6792
|
+
/* @__PURE__ */ jsx33("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
|
|
6793
|
+
const status = getQuestionStatus(question.id);
|
|
6794
|
+
const questionNumber = getQuestionIndex(question.id);
|
|
6795
|
+
return /* @__PURE__ */ jsx33(
|
|
6796
|
+
CardStatus,
|
|
6797
|
+
{
|
|
6798
|
+
header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
|
|
6799
|
+
label: getStatusLabel(status),
|
|
6800
|
+
onClick: () => {
|
|
6801
|
+
goToQuestion(questionNumber - 1);
|
|
6802
|
+
onQuestionClick?.();
|
|
6803
|
+
}
|
|
6804
|
+
},
|
|
6805
|
+
question.id
|
|
6806
|
+
);
|
|
6807
|
+
}) })
|
|
6808
|
+
] }, subjectId)
|
|
6809
|
+
) });
|
|
6810
|
+
};
|
|
6811
|
+
var QuizFooter = forwardRef17(({ className, onGoToSimulated, onDetailResult, ...props }, ref) => {
|
|
6812
|
+
const {
|
|
6813
|
+
currentQuestionIndex,
|
|
6814
|
+
getUserAnswers,
|
|
6815
|
+
getTotalQuestions,
|
|
6816
|
+
goToNextQuestion,
|
|
6817
|
+
goToPreviousQuestion,
|
|
6818
|
+
getUnansweredQuestionsFromUserAnswers,
|
|
6819
|
+
getCurrentAnswer,
|
|
6820
|
+
skipQuestion,
|
|
6821
|
+
getCurrentQuestion,
|
|
6822
|
+
getQuestionStatusFromUserAnswers
|
|
6823
|
+
} = useQuizStore();
|
|
6824
|
+
const totalQuestions = getTotalQuestions();
|
|
6825
|
+
const isFirstQuestion = currentQuestionIndex === 0;
|
|
6826
|
+
const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
|
|
6827
|
+
const currentAnswer = getCurrentAnswer();
|
|
6828
|
+
const currentQuestion = getCurrentQuestion();
|
|
6829
|
+
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
6830
|
+
const [alertDialogOpen, setAlertDialogOpen] = useState12(false);
|
|
6831
|
+
const [modalResultOpen, setModalResultOpen] = useState12(false);
|
|
6832
|
+
const [modalNavigateOpen, setModalNavigateOpen] = useState12(false);
|
|
6833
|
+
const [filterType, setFilterType] = useState12("all");
|
|
6834
|
+
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
6835
|
+
const userAnswers = getUserAnswers();
|
|
6836
|
+
const allQuestions = getTotalQuestions();
|
|
6837
|
+
return /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
6838
|
+
/* @__PURE__ */ jsxs27(
|
|
6839
|
+
"footer",
|
|
6840
|
+
{
|
|
6841
|
+
ref,
|
|
6842
|
+
className: `w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center ${className}`,
|
|
6843
|
+
...props,
|
|
6844
|
+
children: [
|
|
6845
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-row items-center gap-1", children: [
|
|
6846
|
+
/* @__PURE__ */ jsx33(
|
|
6847
|
+
IconButton_default,
|
|
6848
|
+
{
|
|
6849
|
+
icon: /* @__PURE__ */ jsx33(SquaresFour, { size: 24, className: "text-text-950" }),
|
|
6850
|
+
size: "md",
|
|
6851
|
+
onClick: () => setModalNavigateOpen(true)
|
|
6852
|
+
}
|
|
6853
|
+
),
|
|
6854
|
+
isFirstQuestion ? /* @__PURE__ */ jsx33(
|
|
6855
|
+
Button_default,
|
|
6856
|
+
{
|
|
6857
|
+
variant: "outline",
|
|
6858
|
+
size: "small",
|
|
6859
|
+
onClick: () => {
|
|
6860
|
+
skipQuestion();
|
|
6861
|
+
goToNextQuestion();
|
|
6862
|
+
},
|
|
6863
|
+
children: "Pular"
|
|
6864
|
+
}
|
|
6865
|
+
) : /* @__PURE__ */ jsx33(
|
|
6866
|
+
Button_default,
|
|
6867
|
+
{
|
|
6868
|
+
size: "medium",
|
|
6869
|
+
variant: "link",
|
|
6870
|
+
action: "primary",
|
|
6871
|
+
iconLeft: /* @__PURE__ */ jsx33(CaretLeft2, { size: 18 }),
|
|
6872
|
+
onClick: () => {
|
|
6873
|
+
goToPreviousQuestion();
|
|
6874
|
+
},
|
|
6875
|
+
children: "Voltar"
|
|
6876
|
+
}
|
|
6877
|
+
)
|
|
6878
|
+
] }),
|
|
6879
|
+
!isFirstQuestion && /* @__PURE__ */ jsx33(
|
|
6880
|
+
Button_default,
|
|
6881
|
+
{
|
|
6882
|
+
size: "small",
|
|
6883
|
+
variant: "outline",
|
|
6884
|
+
action: "primary",
|
|
6885
|
+
onClick: () => {
|
|
6886
|
+
skipQuestion();
|
|
6887
|
+
goToNextQuestion();
|
|
6888
|
+
},
|
|
6889
|
+
children: "Pular"
|
|
6890
|
+
}
|
|
6891
|
+
),
|
|
6892
|
+
isLastQuestion ? /* @__PURE__ */ jsx33(
|
|
6893
|
+
Button_default,
|
|
6894
|
+
{
|
|
6895
|
+
size: "medium",
|
|
6896
|
+
variant: "solid",
|
|
6897
|
+
action: "primary",
|
|
6898
|
+
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
6899
|
+
onClick: () => {
|
|
6900
|
+
if (unansweredQuestions.length > 0) {
|
|
6901
|
+
setAlertDialogOpen(true);
|
|
6902
|
+
} else {
|
|
6903
|
+
setModalResultOpen(true);
|
|
6904
|
+
}
|
|
6905
|
+
},
|
|
6906
|
+
children: "Finalizar"
|
|
6907
|
+
}
|
|
6908
|
+
) : /* @__PURE__ */ jsx33(
|
|
6909
|
+
Button_default,
|
|
6910
|
+
{
|
|
6911
|
+
size: "medium",
|
|
6912
|
+
variant: "link",
|
|
6913
|
+
action: "primary",
|
|
6914
|
+
iconRight: /* @__PURE__ */ jsx33(CaretRight4, { size: 18 }),
|
|
6915
|
+
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
6916
|
+
onClick: () => {
|
|
6917
|
+
goToNextQuestion();
|
|
6918
|
+
},
|
|
6919
|
+
children: "Avan\xE7ar"
|
|
6920
|
+
}
|
|
6921
|
+
)
|
|
6922
|
+
]
|
|
6923
|
+
}
|
|
6924
|
+
),
|
|
6925
|
+
/* @__PURE__ */ jsx33(
|
|
6926
|
+
AlertDialog,
|
|
6927
|
+
{
|
|
6928
|
+
isOpen: alertDialogOpen,
|
|
6929
|
+
onChangeOpen: setAlertDialogOpen,
|
|
6930
|
+
title: "Finalizar simulado?",
|
|
6931
|
+
description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
|
|
6932
|
+
cancelButtonLabel: "Voltar e revisar",
|
|
6933
|
+
submitButtonLabel: "Finalizar Mesmo Assim",
|
|
6934
|
+
onSubmit: () => {
|
|
6935
|
+
setModalResultOpen(true);
|
|
6936
|
+
}
|
|
6937
|
+
}
|
|
6938
|
+
),
|
|
6939
|
+
/* @__PURE__ */ jsx33(
|
|
6940
|
+
Modal_default,
|
|
6941
|
+
{
|
|
6942
|
+
isOpen: modalResultOpen,
|
|
6943
|
+
onClose: () => setModalResultOpen(false),
|
|
6944
|
+
title: "",
|
|
6945
|
+
closeOnBackdropClick: false,
|
|
6946
|
+
closeOnEscape: false,
|
|
6947
|
+
hideCloseButton: true,
|
|
6948
|
+
size: "md",
|
|
6949
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
6950
|
+
/* @__PURE__ */ jsx33(
|
|
6951
|
+
"img",
|
|
6952
|
+
{
|
|
6953
|
+
src: simulated_result_default,
|
|
6954
|
+
alt: "Simulated Result",
|
|
6955
|
+
className: "w-[282px] h-auto object-cover"
|
|
6956
|
+
}
|
|
6957
|
+
),
|
|
6958
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
6959
|
+
/* @__PURE__ */ jsx33("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
|
|
6960
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-text-500 font-sm", children: [
|
|
6961
|
+
"Voc\xEA acertou",
|
|
6962
|
+
" ",
|
|
6963
|
+
userAnswers.filter(
|
|
6964
|
+
(answer) => answer.answerKey === answer.correctOptionId
|
|
6965
|
+
).length,
|
|
6966
|
+
" ",
|
|
6967
|
+
"de ",
|
|
6968
|
+
allQuestions,
|
|
6969
|
+
" quest\xF5es."
|
|
6970
|
+
] })
|
|
6971
|
+
] }),
|
|
6972
|
+
/* @__PURE__ */ jsxs27("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
|
|
6973
|
+
/* @__PURE__ */ jsx33(
|
|
6974
|
+
Button_default,
|
|
6975
|
+
{
|
|
6976
|
+
variant: "outline",
|
|
6977
|
+
className: "w-full",
|
|
6978
|
+
size: "small",
|
|
6979
|
+
onClick: onGoToSimulated,
|
|
6980
|
+
children: "Ir para simulados"
|
|
6981
|
+
}
|
|
6982
|
+
),
|
|
6983
|
+
/* @__PURE__ */ jsx33(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
|
|
6984
|
+
] })
|
|
6985
|
+
] })
|
|
6986
|
+
}
|
|
6987
|
+
),
|
|
6988
|
+
/* @__PURE__ */ jsx33(
|
|
6989
|
+
Modal_default,
|
|
6990
|
+
{
|
|
6991
|
+
isOpen: modalNavigateOpen,
|
|
6992
|
+
onClose: () => setModalNavigateOpen(false),
|
|
6993
|
+
title: "Quest\xF5es",
|
|
6994
|
+
size: "lg",
|
|
6995
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col w-full h-full", children: [
|
|
6996
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
|
|
6997
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
|
|
6998
|
+
/* @__PURE__ */ jsx33("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs27(Select_default, { value: filterType, onValueChange: setFilterType, children: [
|
|
6999
|
+
/* @__PURE__ */ jsx33(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ jsx33(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
|
|
7000
|
+
/* @__PURE__ */ jsxs27(SelectContent, { children: [
|
|
7001
|
+
/* @__PURE__ */ jsx33(SelectItem, { value: "all", children: "Todas" }),
|
|
7002
|
+
/* @__PURE__ */ jsx33(SelectItem, { value: "unanswered", children: "Em branco" }),
|
|
7003
|
+
/* @__PURE__ */ jsx33(SelectItem, { value: "answered", children: "Respondidas" })
|
|
7004
|
+
] })
|
|
7005
|
+
] }) })
|
|
7006
|
+
] }),
|
|
7007
|
+
/* @__PURE__ */ jsx33("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx33(
|
|
7008
|
+
QuizQuestionList,
|
|
7009
|
+
{
|
|
7010
|
+
filterType,
|
|
7011
|
+
onQuestionClick: () => setModalNavigateOpen(false)
|
|
7012
|
+
}
|
|
7013
|
+
) })
|
|
7014
|
+
] })
|
|
7015
|
+
}
|
|
7016
|
+
)
|
|
7017
|
+
] });
|
|
7018
|
+
});
|
|
7019
|
+
var QuizResultHeaderTitle = forwardRef17(({ className, ...props }, ref) => {
|
|
7020
|
+
const { bySimulated } = useQuizStore();
|
|
7021
|
+
return /* @__PURE__ */ jsxs27(
|
|
7022
|
+
"div",
|
|
7023
|
+
{
|
|
7024
|
+
ref,
|
|
7025
|
+
className: `flex flex-row pt-4 justify-between ${className}`,
|
|
7026
|
+
...props,
|
|
7027
|
+
children: [
|
|
7028
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
|
|
7029
|
+
bySimulated && /* @__PURE__ */ jsx33(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
|
|
7030
|
+
]
|
|
7031
|
+
}
|
|
7032
|
+
);
|
|
7033
|
+
});
|
|
7034
|
+
var QuizResultTitle = forwardRef17(({ className, ...props }, ref) => {
|
|
7035
|
+
const { getQuizTitle } = useQuizStore();
|
|
7036
|
+
const quizTitle = getQuizTitle();
|
|
7037
|
+
return /* @__PURE__ */ jsx33(
|
|
7038
|
+
"p",
|
|
7039
|
+
{
|
|
7040
|
+
className: `pt-6 pb-4 text-text-950 font-bold text-lg ${className}`,
|
|
7041
|
+
ref,
|
|
7042
|
+
...props,
|
|
7043
|
+
children: quizTitle
|
|
7044
|
+
}
|
|
7045
|
+
);
|
|
7046
|
+
});
|
|
7047
|
+
var QuizResultPerformance = forwardRef17(
|
|
7048
|
+
({ ...props }, ref) => {
|
|
7049
|
+
const {
|
|
7050
|
+
getTotalQuestions,
|
|
7051
|
+
timeElapsed,
|
|
7052
|
+
formatTime,
|
|
7053
|
+
bySimulated,
|
|
7054
|
+
byActivity,
|
|
7055
|
+
byQuestionary
|
|
7056
|
+
} = useQuizStore();
|
|
7057
|
+
const totalQuestions = getTotalQuestions();
|
|
7058
|
+
const quiz = bySimulated || byActivity || byQuestionary;
|
|
7059
|
+
let correctAnswers = 0;
|
|
7060
|
+
let correctEasyAnswers = 0;
|
|
7061
|
+
let correctMediumAnswers = 0;
|
|
7062
|
+
let correctDifficultAnswers = 0;
|
|
7063
|
+
let totalEasyQuestions = 0;
|
|
7064
|
+
let totalMediumQuestions = 0;
|
|
7065
|
+
let totalDifficultQuestions = 0;
|
|
7066
|
+
if (quiz) {
|
|
7067
|
+
quiz.questions.forEach((question) => {
|
|
7068
|
+
const userAnswer = question.answerKey;
|
|
7069
|
+
const isCorrect = userAnswer && userAnswer === question.correctOptionId;
|
|
7070
|
+
if (isCorrect) {
|
|
7071
|
+
correctAnswers++;
|
|
7072
|
+
}
|
|
7073
|
+
if (question.difficulty === "FACIL" /* FACIL */) {
|
|
7074
|
+
totalEasyQuestions++;
|
|
7075
|
+
if (isCorrect) {
|
|
7076
|
+
correctEasyAnswers++;
|
|
7077
|
+
}
|
|
7078
|
+
} else if (question.difficulty === "MEDIO" /* MEDIO */) {
|
|
7079
|
+
totalMediumQuestions++;
|
|
7080
|
+
if (isCorrect) {
|
|
7081
|
+
correctMediumAnswers++;
|
|
7082
|
+
}
|
|
7083
|
+
} else if (question.difficulty === "DIFICIL" /* DIFICIL */) {
|
|
7084
|
+
totalDifficultQuestions++;
|
|
7085
|
+
if (isCorrect) {
|
|
7086
|
+
correctDifficultAnswers++;
|
|
7087
|
+
}
|
|
7088
|
+
}
|
|
7089
|
+
});
|
|
7090
|
+
}
|
|
7091
|
+
const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
|
|
7092
|
+
return /* @__PURE__ */ jsxs27(
|
|
7093
|
+
"div",
|
|
7094
|
+
{
|
|
7095
|
+
className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
|
|
7096
|
+
ref,
|
|
7097
|
+
...props,
|
|
7098
|
+
children: [
|
|
7099
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
7100
|
+
/* @__PURE__ */ jsx33(
|
|
7101
|
+
ProgressCircle_default,
|
|
7102
|
+
{
|
|
7103
|
+
size: "medium",
|
|
7104
|
+
variant: "green",
|
|
7105
|
+
value: percentage,
|
|
7106
|
+
showPercentage: false,
|
|
7107
|
+
label: ""
|
|
7108
|
+
}
|
|
7109
|
+
),
|
|
7110
|
+
/* @__PURE__ */ jsxs27("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
7111
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1 mb-1", children: [
|
|
7112
|
+
/* @__PURE__ */ jsx33(Clock2, { size: 12, weight: "regular", className: "text-text-800" }),
|
|
7113
|
+
/* @__PURE__ */ jsx33("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
|
|
7114
|
+
] }),
|
|
7115
|
+
/* @__PURE__ */ jsxs27("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
|
|
7116
|
+
correctAnswers,
|
|
7117
|
+
" de ",
|
|
7118
|
+
totalQuestions
|
|
7119
|
+
] }),
|
|
7120
|
+
/* @__PURE__ */ jsx33("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
|
|
7121
|
+
] })
|
|
7122
|
+
] }),
|
|
7123
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-4 w-full", children: [
|
|
7124
|
+
/* @__PURE__ */ jsx33(
|
|
7125
|
+
ProgressBar_default,
|
|
7126
|
+
{
|
|
7127
|
+
className: "w-full",
|
|
7128
|
+
layout: "stacked",
|
|
7129
|
+
variant: "green",
|
|
7130
|
+
value: correctEasyAnswers,
|
|
7131
|
+
max: totalEasyQuestions,
|
|
7132
|
+
label: "F\xE1ceis",
|
|
7133
|
+
showHitCount: true,
|
|
7134
|
+
labelClassName: "text-base font-medium text-text-800 leading-none",
|
|
7135
|
+
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
7136
|
+
}
|
|
7137
|
+
),
|
|
7138
|
+
/* @__PURE__ */ jsx33(
|
|
7139
|
+
ProgressBar_default,
|
|
7140
|
+
{
|
|
7141
|
+
className: "w-full",
|
|
7142
|
+
layout: "stacked",
|
|
7143
|
+
variant: "green",
|
|
7144
|
+
value: correctMediumAnswers,
|
|
7145
|
+
max: totalMediumQuestions,
|
|
7146
|
+
label: "M\xE9dias",
|
|
7147
|
+
showHitCount: true,
|
|
7148
|
+
labelClassName: "text-base font-medium text-text-800 leading-none",
|
|
7149
|
+
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
7150
|
+
}
|
|
7151
|
+
),
|
|
7152
|
+
/* @__PURE__ */ jsx33(
|
|
7153
|
+
ProgressBar_default,
|
|
7154
|
+
{
|
|
7155
|
+
className: "w-full",
|
|
7156
|
+
layout: "stacked",
|
|
7157
|
+
variant: "green",
|
|
7158
|
+
value: correctDifficultAnswers,
|
|
7159
|
+
max: totalDifficultQuestions,
|
|
7160
|
+
label: "Dif\xEDceis",
|
|
7161
|
+
showHitCount: true,
|
|
7162
|
+
labelClassName: "text-base font-medium text-text-800 leading-none",
|
|
7163
|
+
percentageClassName: "text-xs font-medium leading-[14px] text-right"
|
|
7164
|
+
}
|
|
7165
|
+
)
|
|
7166
|
+
] })
|
|
7167
|
+
]
|
|
7168
|
+
}
|
|
7169
|
+
);
|
|
7170
|
+
}
|
|
7171
|
+
);
|
|
7172
|
+
var QuizListResult = forwardRef17(({ className, onSubjectClick, ...props }, ref) => {
|
|
7173
|
+
const { getQuestionsGroupedBySubject, isQuestionAnswered } = useQuizStore();
|
|
7174
|
+
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
7175
|
+
const subjectsStats = Object.entries(groupedQuestions).map(
|
|
7176
|
+
([subjectId, questions]) => {
|
|
7177
|
+
let correct = 0;
|
|
7178
|
+
let incorrect = 0;
|
|
7179
|
+
questions.forEach((question) => {
|
|
7180
|
+
if (isQuestionAnswered(question.id)) {
|
|
7181
|
+
const userAnswer = question.answerKey;
|
|
7182
|
+
if (userAnswer === question.correctOptionId) {
|
|
7183
|
+
correct++;
|
|
7184
|
+
} else {
|
|
7185
|
+
incorrect++;
|
|
7186
|
+
}
|
|
7187
|
+
}
|
|
7188
|
+
});
|
|
7189
|
+
return {
|
|
7190
|
+
subject: subjectId,
|
|
7191
|
+
correct,
|
|
7192
|
+
incorrect,
|
|
7193
|
+
total: questions.length
|
|
7194
|
+
};
|
|
7195
|
+
}
|
|
7196
|
+
);
|
|
7197
|
+
return /* @__PURE__ */ jsxs27("section", { ref, className, ...props, children: [
|
|
7198
|
+
/* @__PURE__ */ jsx33("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
|
|
7199
|
+
/* @__PURE__ */ jsx33("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ jsx33("li", { children: /* @__PURE__ */ jsx33(
|
|
7200
|
+
CardResults,
|
|
7201
|
+
{
|
|
7202
|
+
onClick: () => onSubjectClick?.(subject.subject),
|
|
7203
|
+
className: "max-w-full",
|
|
7204
|
+
header: subject.subject,
|
|
7205
|
+
correct_answers: subject.correct,
|
|
7206
|
+
incorrect_answers: subject.incorrect,
|
|
7207
|
+
icon: /* @__PURE__ */ jsx33(Book, { size: 20 }),
|
|
7208
|
+
direction: "row"
|
|
7209
|
+
}
|
|
7210
|
+
) }, subject.subject)) })
|
|
7211
|
+
] });
|
|
7212
|
+
});
|
|
7213
|
+
var QuizListResultByMateria = ({
|
|
7214
|
+
subject,
|
|
7215
|
+
onQuestionClick
|
|
7216
|
+
}) => {
|
|
7217
|
+
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
7218
|
+
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
7219
|
+
const answeredQuestions = groupedQuestions[subject] || [];
|
|
7220
|
+
return /* @__PURE__ */ jsxs27("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
|
|
7221
|
+
/* @__PURE__ */ jsx33("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
|
|
7222
|
+
/* @__PURE__ */ jsxs27("section", { className: "flex flex-col ", children: [
|
|
7223
|
+
/* @__PURE__ */ jsx33("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
|
|
7224
|
+
/* @__PURE__ */ jsx33("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ jsx33("li", { children: /* @__PURE__ */ jsx33(
|
|
7225
|
+
CardStatus,
|
|
7226
|
+
{
|
|
7227
|
+
className: "max-w-full",
|
|
7228
|
+
header: `Quest\xE3o ${question.id}`,
|
|
7229
|
+
status: question.answerKey === question.correctOptionId ? "correct" : "incorrect",
|
|
7230
|
+
onClick: () => onQuestionClick?.(question)
|
|
7231
|
+
}
|
|
7232
|
+
) }, question.id)) })
|
|
7233
|
+
] })
|
|
7234
|
+
] });
|
|
7235
|
+
};
|
|
6249
7236
|
export {
|
|
6250
7237
|
Alert_default as Alert,
|
|
6251
7238
|
AlertDialog,
|
|
@@ -6292,6 +7279,17 @@ export {
|
|
|
6292
7279
|
ProgressCircle_default as ProgressCircle,
|
|
6293
7280
|
ProtectedRoute,
|
|
6294
7281
|
PublicRoute,
|
|
7282
|
+
Quiz,
|
|
7283
|
+
QuizAlternative,
|
|
7284
|
+
QuizContent,
|
|
7285
|
+
QuizFooter,
|
|
7286
|
+
QuizHeader,
|
|
7287
|
+
QuizListResultByMateria,
|
|
7288
|
+
QuizQuestionList,
|
|
7289
|
+
QuizResultHeaderTitle,
|
|
7290
|
+
QuizResultPerformance,
|
|
7291
|
+
QuizResultTitle,
|
|
7292
|
+
QuizTitle,
|
|
6295
7293
|
Radio_default as Radio,
|
|
6296
7294
|
RadioGroup,
|
|
6297
7295
|
RadioGroupItem,
|
|
@@ -6320,6 +7318,7 @@ export {
|
|
|
6320
7318
|
useApiConfig,
|
|
6321
7319
|
useAuth,
|
|
6322
7320
|
useAuthGuard,
|
|
7321
|
+
useQuizStore,
|
|
6323
7322
|
useRouteAuth,
|
|
6324
7323
|
ToastStore_default as useToastStore,
|
|
6325
7324
|
useUrlAuthentication,
|