analytica-frontend-lib 1.0.82 → 1.0.83
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 +29 -0
- package/dist/Quiz/index.d.ts +29 -0
- package/dist/Quiz/index.js +3662 -0
- package/dist/Quiz/index.js.map +1 -0
- package/dist/Quiz/index.mjs +3673 -0
- package/dist/Quiz/index.mjs.map +1 -0
- package/dist/Quiz/useQuizStore/index.d.mts +108 -0
- package/dist/Quiz/useQuizStore/index.d.ts +108 -0
- package/dist/Quiz/useQuizStore/index.js +274 -0
- package/dist/Quiz/useQuizStore/index.js.map +1 -0
- package/dist/Quiz/useQuizStore/index.mjs +249 -0
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
- package/dist/index.css +53 -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 +659 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +657 -4
- package/dist/index.mjs.map +1 -1
- package/dist/simulated-result-QN5HCUY5.png +0 -0
- package/dist/styles.css +53 -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,651 @@ 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
|
+
} from "phosphor-react";
|
|
6258
|
+
import { forwardRef as forwardRef17, useState as useState12 } from "react";
|
|
6259
|
+
|
|
6260
|
+
// src/components/Quiz/useQuizStore.ts
|
|
6261
|
+
import { create as create6 } from "zustand";
|
|
6262
|
+
import { devtools } from "zustand/middleware";
|
|
6263
|
+
var useQuizStore = create6()(
|
|
6264
|
+
devtools(
|
|
6265
|
+
(set, get) => {
|
|
6266
|
+
let timerInterval = null;
|
|
6267
|
+
const startTimer = () => {
|
|
6268
|
+
if (timerInterval) {
|
|
6269
|
+
clearInterval(timerInterval);
|
|
6270
|
+
}
|
|
6271
|
+
timerInterval = setInterval(() => {
|
|
6272
|
+
const { timeElapsed } = get();
|
|
6273
|
+
set({ timeElapsed: timeElapsed + 1 });
|
|
6274
|
+
}, 1e3);
|
|
6275
|
+
};
|
|
6276
|
+
const stopTimer = () => {
|
|
6277
|
+
if (timerInterval) {
|
|
6278
|
+
clearInterval(timerInterval);
|
|
6279
|
+
timerInterval = null;
|
|
6280
|
+
}
|
|
6281
|
+
};
|
|
6282
|
+
return {
|
|
6283
|
+
// Initial State
|
|
6284
|
+
currentQuestionIndex: 0,
|
|
6285
|
+
selectedAnswers: {},
|
|
6286
|
+
skippedQuestions: [],
|
|
6287
|
+
userAnswers: [],
|
|
6288
|
+
timeElapsed: 0,
|
|
6289
|
+
isStarted: false,
|
|
6290
|
+
isFinished: false,
|
|
6291
|
+
// Setters
|
|
6292
|
+
setBySimulado: (simulado) => set({ bySimulado: simulado }),
|
|
6293
|
+
setByAtividade: (atividade) => set({ byAtividade: atividade }),
|
|
6294
|
+
setByAula: (aula) => set({ byAula: aula }),
|
|
6295
|
+
// Navigation
|
|
6296
|
+
goToNextQuestion: () => {
|
|
6297
|
+
const { currentQuestionIndex, getTotalQuestions } = get();
|
|
6298
|
+
const totalQuestions = getTotalQuestions();
|
|
6299
|
+
if (currentQuestionIndex < totalQuestions - 1) {
|
|
6300
|
+
set({ currentQuestionIndex: currentQuestionIndex + 1 });
|
|
6301
|
+
}
|
|
6302
|
+
},
|
|
6303
|
+
goToPreviousQuestion: () => {
|
|
6304
|
+
const { currentQuestionIndex } = get();
|
|
6305
|
+
if (currentQuestionIndex > 0) {
|
|
6306
|
+
set({ currentQuestionIndex: currentQuestionIndex - 1 });
|
|
6307
|
+
}
|
|
6308
|
+
},
|
|
6309
|
+
goToQuestion: (index) => {
|
|
6310
|
+
const { getTotalQuestions } = get();
|
|
6311
|
+
const totalQuestions = getTotalQuestions();
|
|
6312
|
+
if (index >= 0 && index < totalQuestions) {
|
|
6313
|
+
set({ currentQuestionIndex: index });
|
|
6314
|
+
}
|
|
6315
|
+
},
|
|
6316
|
+
// Quiz Actions
|
|
6317
|
+
selectAnswer: (questionId, answerId) => {
|
|
6318
|
+
const { selectedAnswers, skippedQuestions, addUserAnswer } = get();
|
|
6319
|
+
const newSkippedQuestions = skippedQuestions.filter(
|
|
6320
|
+
(id) => id !== questionId
|
|
6321
|
+
);
|
|
6322
|
+
set({
|
|
6323
|
+
selectedAnswers: {
|
|
6324
|
+
...selectedAnswers,
|
|
6325
|
+
[questionId]: answerId
|
|
6326
|
+
},
|
|
6327
|
+
skippedQuestions: newSkippedQuestions
|
|
6328
|
+
});
|
|
6329
|
+
addUserAnswer(questionId, answerId);
|
|
6330
|
+
},
|
|
6331
|
+
skipQuestion: () => {
|
|
6332
|
+
const { getCurrentQuestion, skippedQuestions, addUserAnswer } = get();
|
|
6333
|
+
const currentQuestion = getCurrentQuestion();
|
|
6334
|
+
if (currentQuestion) {
|
|
6335
|
+
set({
|
|
6336
|
+
skippedQuestions: [...skippedQuestions, currentQuestion.id]
|
|
6337
|
+
});
|
|
6338
|
+
addUserAnswer(currentQuestion.id);
|
|
6339
|
+
}
|
|
6340
|
+
},
|
|
6341
|
+
addUserAnswer: (questionId, answerId) => {
|
|
6342
|
+
const { userAnswers, bySimulado, byAtividade, byAula } = get();
|
|
6343
|
+
const quiz = bySimulado || byAtividade || byAula;
|
|
6344
|
+
const question = quiz?.questions.find((q) => q.id === questionId);
|
|
6345
|
+
if (!question) return;
|
|
6346
|
+
const existingAnswerIndex = userAnswers.findIndex(
|
|
6347
|
+
(answer) => answer.id === questionId
|
|
6348
|
+
);
|
|
6349
|
+
if (existingAnswerIndex !== -1) {
|
|
6350
|
+
const updatedAnswers = [...userAnswers];
|
|
6351
|
+
updatedAnswers[existingAnswerIndex] = {
|
|
6352
|
+
...question,
|
|
6353
|
+
answerKey: answerId || "",
|
|
6354
|
+
isSkipped: !answerId
|
|
6355
|
+
};
|
|
6356
|
+
set({ userAnswers: updatedAnswers });
|
|
6357
|
+
} else {
|
|
6358
|
+
set({
|
|
6359
|
+
userAnswers: [
|
|
6360
|
+
...userAnswers,
|
|
6361
|
+
{
|
|
6362
|
+
...question,
|
|
6363
|
+
answerKey: answerId || "",
|
|
6364
|
+
isSkipped: !answerId
|
|
6365
|
+
}
|
|
6366
|
+
]
|
|
6367
|
+
});
|
|
6368
|
+
}
|
|
6369
|
+
},
|
|
6370
|
+
startQuiz: () => {
|
|
6371
|
+
set({ isStarted: true, timeElapsed: 0 });
|
|
6372
|
+
startTimer();
|
|
6373
|
+
},
|
|
6374
|
+
finishQuiz: () => {
|
|
6375
|
+
set({ isFinished: true });
|
|
6376
|
+
stopTimer();
|
|
6377
|
+
},
|
|
6378
|
+
resetQuiz: () => {
|
|
6379
|
+
stopTimer();
|
|
6380
|
+
set({
|
|
6381
|
+
currentQuestionIndex: 0,
|
|
6382
|
+
selectedAnswers: {},
|
|
6383
|
+
skippedQuestions: [],
|
|
6384
|
+
userAnswers: [],
|
|
6385
|
+
timeElapsed: 0,
|
|
6386
|
+
isStarted: false,
|
|
6387
|
+
isFinished: false
|
|
6388
|
+
});
|
|
6389
|
+
},
|
|
6390
|
+
// Timer
|
|
6391
|
+
updateTime: (time) => set({ timeElapsed: time }),
|
|
6392
|
+
startTimer,
|
|
6393
|
+
stopTimer,
|
|
6394
|
+
// Getters
|
|
6395
|
+
getCurrentQuestion: () => {
|
|
6396
|
+
const { bySimulado, byAtividade, byAula, currentQuestionIndex } = get();
|
|
6397
|
+
const quiz = bySimulado || byAtividade || byAula;
|
|
6398
|
+
if (!quiz) {
|
|
6399
|
+
return null;
|
|
6400
|
+
}
|
|
6401
|
+
return quiz.questions[currentQuestionIndex];
|
|
6402
|
+
},
|
|
6403
|
+
getTotalQuestions: () => {
|
|
6404
|
+
const { bySimulado, byAtividade, byAula } = get();
|
|
6405
|
+
const quiz = bySimulado || byAtividade || byAula;
|
|
6406
|
+
return quiz?.questions?.length || 0;
|
|
6407
|
+
},
|
|
6408
|
+
getAnsweredQuestions: () => {
|
|
6409
|
+
const { selectedAnswers } = get();
|
|
6410
|
+
return Object.keys(selectedAnswers).length;
|
|
6411
|
+
},
|
|
6412
|
+
getUnansweredQuestions: () => {
|
|
6413
|
+
const {
|
|
6414
|
+
bySimulado,
|
|
6415
|
+
byAtividade,
|
|
6416
|
+
byAula,
|
|
6417
|
+
selectedAnswers,
|
|
6418
|
+
skippedQuestions
|
|
6419
|
+
} = get();
|
|
6420
|
+
const quiz = bySimulado || byAtividade || byAula;
|
|
6421
|
+
if (!quiz) return [];
|
|
6422
|
+
const unansweredQuestions = [];
|
|
6423
|
+
quiz.questions.forEach((question, index) => {
|
|
6424
|
+
const isAnswered = question.id in selectedAnswers;
|
|
6425
|
+
const isSkipped = skippedQuestions.includes(question.id);
|
|
6426
|
+
if (!isAnswered && !isSkipped) {
|
|
6427
|
+
unansweredQuestions.push(index + 1);
|
|
6428
|
+
}
|
|
6429
|
+
});
|
|
6430
|
+
return unansweredQuestions;
|
|
6431
|
+
},
|
|
6432
|
+
getSkippedQuestions: () => {
|
|
6433
|
+
const { skippedQuestions } = get();
|
|
6434
|
+
return skippedQuestions.length;
|
|
6435
|
+
},
|
|
6436
|
+
getProgress: () => {
|
|
6437
|
+
const { getTotalQuestions, getAnsweredQuestions } = get();
|
|
6438
|
+
const total = getTotalQuestions();
|
|
6439
|
+
const answered = getAnsweredQuestions();
|
|
6440
|
+
return total > 0 ? answered / total * 100 : 0;
|
|
6441
|
+
},
|
|
6442
|
+
isQuestionAnswered: (questionId) => {
|
|
6443
|
+
const { selectedAnswers } = get();
|
|
6444
|
+
return questionId in selectedAnswers;
|
|
6445
|
+
},
|
|
6446
|
+
isQuestionSkipped: (questionId) => {
|
|
6447
|
+
const { skippedQuestions } = get();
|
|
6448
|
+
return skippedQuestions.includes(questionId);
|
|
6449
|
+
},
|
|
6450
|
+
getCurrentAnswer: () => {
|
|
6451
|
+
const { getCurrentQuestion, selectedAnswers } = get();
|
|
6452
|
+
const currentQuestion = getCurrentQuestion();
|
|
6453
|
+
return selectedAnswers[currentQuestion?.id || ""];
|
|
6454
|
+
},
|
|
6455
|
+
getQuizTitle: () => {
|
|
6456
|
+
const { bySimulado, byAtividade, byAula } = get();
|
|
6457
|
+
const quiz = bySimulado || byAtividade || byAula;
|
|
6458
|
+
return quiz?.title || "Quiz";
|
|
6459
|
+
},
|
|
6460
|
+
formatTime: (seconds) => {
|
|
6461
|
+
const minutes = Math.floor(seconds / 60);
|
|
6462
|
+
const remainingSeconds = seconds % 60;
|
|
6463
|
+
return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
|
|
6464
|
+
},
|
|
6465
|
+
getUserAnswers: () => {
|
|
6466
|
+
const { userAnswers } = get();
|
|
6467
|
+
return userAnswers;
|
|
6468
|
+
},
|
|
6469
|
+
getUnansweredQuestionsFromUserAnswers: () => {
|
|
6470
|
+
const { bySimulado, byAtividade, byAula, userAnswers } = get();
|
|
6471
|
+
const quiz = bySimulado || byAtividade || byAula;
|
|
6472
|
+
if (!quiz) return [];
|
|
6473
|
+
const unansweredQuestions = [];
|
|
6474
|
+
quiz.questions.forEach((question, index) => {
|
|
6475
|
+
const userAnswer = userAnswers.find(
|
|
6476
|
+
(answer) => answer.id === question.id
|
|
6477
|
+
);
|
|
6478
|
+
if (!userAnswer || userAnswer.isSkipped) {
|
|
6479
|
+
unansweredQuestions.push(index + 1);
|
|
6480
|
+
}
|
|
6481
|
+
});
|
|
6482
|
+
return unansweredQuestions;
|
|
6483
|
+
},
|
|
6484
|
+
getQuestionsGroupedBySubject: () => {
|
|
6485
|
+
const { bySimulado, byAtividade, byAula } = get();
|
|
6486
|
+
const quiz = bySimulado || byAtividade || byAula;
|
|
6487
|
+
if (!quiz) return {};
|
|
6488
|
+
const groupedQuestions = {};
|
|
6489
|
+
quiz.questions.forEach((question) => {
|
|
6490
|
+
const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
|
|
6491
|
+
if (!groupedQuestions[subjectId]) {
|
|
6492
|
+
groupedQuestions[subjectId] = [];
|
|
6493
|
+
}
|
|
6494
|
+
groupedQuestions[subjectId].push(question);
|
|
6495
|
+
});
|
|
6496
|
+
return groupedQuestions;
|
|
6497
|
+
}
|
|
6498
|
+
};
|
|
6499
|
+
},
|
|
6500
|
+
{
|
|
6501
|
+
name: "quiz-store"
|
|
6502
|
+
}
|
|
6503
|
+
)
|
|
6504
|
+
);
|
|
6505
|
+
|
|
6506
|
+
// src/assets/img/simulated-result.png
|
|
6507
|
+
var simulated_result_default = "./simulated-result-QN5HCUY5.png";
|
|
6508
|
+
|
|
6509
|
+
// src/components/Quiz/Quiz.tsx
|
|
6510
|
+
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6511
|
+
var Quiz = forwardRef17(({ children, className, ...props }, ref) => {
|
|
6512
|
+
return /* @__PURE__ */ jsx33(
|
|
6513
|
+
"div",
|
|
6514
|
+
{
|
|
6515
|
+
ref,
|
|
6516
|
+
className: `w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6 ${className}`,
|
|
6517
|
+
...props,
|
|
6518
|
+
children
|
|
6519
|
+
}
|
|
6520
|
+
);
|
|
6521
|
+
});
|
|
6522
|
+
var QuizTitle = forwardRef17(
|
|
6523
|
+
({ className, ...props }, ref) => {
|
|
6524
|
+
const {
|
|
6525
|
+
currentQuestionIndex,
|
|
6526
|
+
getTotalQuestions,
|
|
6527
|
+
getQuizTitle,
|
|
6528
|
+
timeElapsed,
|
|
6529
|
+
formatTime,
|
|
6530
|
+
isStarted
|
|
6531
|
+
} = useQuizStore();
|
|
6532
|
+
const totalQuestions = getTotalQuestions();
|
|
6533
|
+
const quizTitle = getQuizTitle();
|
|
6534
|
+
return /* @__PURE__ */ jsxs27(
|
|
6535
|
+
"div",
|
|
6536
|
+
{
|
|
6537
|
+
ref,
|
|
6538
|
+
className: `flex flex-row justify-center items-center relative p-2 ${className}`,
|
|
6539
|
+
...props,
|
|
6540
|
+
children: [
|
|
6541
|
+
/* @__PURE__ */ jsxs27("span", { className: "flex flex-col gap-2 text-center", children: [
|
|
6542
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
|
|
6543
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
|
|
6544
|
+
] }),
|
|
6545
|
+
/* @__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" }) })
|
|
6546
|
+
]
|
|
6547
|
+
}
|
|
6548
|
+
);
|
|
6549
|
+
}
|
|
6550
|
+
);
|
|
6551
|
+
var QuizHeader = () => {
|
|
6552
|
+
const { getCurrentQuestion } = useQuizStore();
|
|
6553
|
+
const currentQuestion = getCurrentQuestion();
|
|
6554
|
+
return /* @__PURE__ */ jsx33(
|
|
6555
|
+
HeaderAlternative,
|
|
6556
|
+
{
|
|
6557
|
+
title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
|
|
6558
|
+
subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topicId ?? "",
|
|
6559
|
+
content: currentQuestion?.questionText ?? ""
|
|
6560
|
+
}
|
|
6561
|
+
);
|
|
6562
|
+
};
|
|
6563
|
+
var QuizContent = forwardRef17(({ type = "Alternativas", children, className, ...props }, ref) => {
|
|
6564
|
+
return /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
6565
|
+
/* @__PURE__ */ jsx33("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx33("p", { className: "font-bold text-lg text-text-950", children: type }) }),
|
|
6566
|
+
/* @__PURE__ */ jsx33(
|
|
6567
|
+
"div",
|
|
6568
|
+
{
|
|
6569
|
+
ref,
|
|
6570
|
+
className: `rounded-t-xl bg-background px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
|
|
6571
|
+
...props,
|
|
6572
|
+
children
|
|
6573
|
+
}
|
|
6574
|
+
)
|
|
6575
|
+
] });
|
|
6576
|
+
});
|
|
6577
|
+
var QuizAlternative = () => {
|
|
6578
|
+
const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
|
|
6579
|
+
const currentQuestion = getCurrentQuestion();
|
|
6580
|
+
const currentAnswer = getCurrentAnswer();
|
|
6581
|
+
const alternatives = currentQuestion?.options?.map((option) => ({
|
|
6582
|
+
label: option.option,
|
|
6583
|
+
value: option.id
|
|
6584
|
+
}));
|
|
6585
|
+
if (!alternatives)
|
|
6586
|
+
return /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33("p", { children: "N\xE3o h\xE1 Alternativas" }) });
|
|
6587
|
+
return /* @__PURE__ */ jsx33("div", { className: "space-y-4", children: /* @__PURE__ */ jsx33(
|
|
6588
|
+
AlternativesList,
|
|
6589
|
+
{
|
|
6590
|
+
name: `question-${currentQuestion?.id || "1"}`,
|
|
6591
|
+
layout: "default",
|
|
6592
|
+
alternatives,
|
|
6593
|
+
value: currentAnswer,
|
|
6594
|
+
onValueChange: (value) => {
|
|
6595
|
+
if (currentQuestion) {
|
|
6596
|
+
selectAnswer(currentQuestion.id, value);
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6599
|
+
},
|
|
6600
|
+
`question-${currentQuestion?.id || "1"}`
|
|
6601
|
+
) });
|
|
6602
|
+
};
|
|
6603
|
+
var QuizQuestionList = ({
|
|
6604
|
+
filterType = "all",
|
|
6605
|
+
onQuestionClick
|
|
6606
|
+
} = {}) => {
|
|
6607
|
+
const {
|
|
6608
|
+
getQuestionsGroupedBySubject,
|
|
6609
|
+
goToQuestion,
|
|
6610
|
+
isQuestionAnswered,
|
|
6611
|
+
isQuestionSkipped
|
|
6612
|
+
} = useQuizStore();
|
|
6613
|
+
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
6614
|
+
const getQuestionStatus = (questionId) => {
|
|
6615
|
+
if (isQuestionSkipped(questionId)) {
|
|
6616
|
+
return "skipped";
|
|
6617
|
+
}
|
|
6618
|
+
if (isQuestionAnswered(questionId)) {
|
|
6619
|
+
return "answered";
|
|
6620
|
+
}
|
|
6621
|
+
return "unanswered";
|
|
6622
|
+
};
|
|
6623
|
+
const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
|
|
6624
|
+
(acc, [subjectId, questions]) => {
|
|
6625
|
+
const filteredQuestions = questions.filter((question) => {
|
|
6626
|
+
const status = getQuestionStatus(question.id);
|
|
6627
|
+
switch (filterType) {
|
|
6628
|
+
case "answered":
|
|
6629
|
+
return status === "answered";
|
|
6630
|
+
case "unanswered":
|
|
6631
|
+
return status === "unanswered";
|
|
6632
|
+
default:
|
|
6633
|
+
return true;
|
|
6634
|
+
}
|
|
6635
|
+
});
|
|
6636
|
+
if (filteredQuestions.length > 0) {
|
|
6637
|
+
acc[subjectId] = filteredQuestions;
|
|
6638
|
+
}
|
|
6639
|
+
return acc;
|
|
6640
|
+
},
|
|
6641
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6642
|
+
{}
|
|
6643
|
+
);
|
|
6644
|
+
const getQuestionIndex = (questionId) => {
|
|
6645
|
+
const { bySimulado, byAtividade, byAula } = useQuizStore.getState();
|
|
6646
|
+
const quiz = bySimulado ?? byAtividade ?? byAula;
|
|
6647
|
+
if (!quiz) return 0;
|
|
6648
|
+
const index = quiz.questions.findIndex((q) => q.id === questionId);
|
|
6649
|
+
return index + 1;
|
|
6650
|
+
};
|
|
6651
|
+
const getStatusLabel = (status) => {
|
|
6652
|
+
switch (status) {
|
|
6653
|
+
case "answered":
|
|
6654
|
+
return "Respondida";
|
|
6655
|
+
case "skipped":
|
|
6656
|
+
return "Pulada";
|
|
6657
|
+
default:
|
|
6658
|
+
return "Em branco";
|
|
6659
|
+
}
|
|
6660
|
+
};
|
|
6661
|
+
return /* @__PURE__ */ jsx33("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
|
|
6662
|
+
([subjectId, questions]) => /* @__PURE__ */ jsxs27("section", { className: "flex flex-col gap-2", children: [
|
|
6663
|
+
/* @__PURE__ */ jsxs27("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
|
|
6664
|
+
/* @__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" }) }),
|
|
6665
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
|
|
6666
|
+
] }),
|
|
6667
|
+
/* @__PURE__ */ jsx33("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
|
|
6668
|
+
const status = getQuestionStatus(question.id);
|
|
6669
|
+
const questionNumber = getQuestionIndex(question.id);
|
|
6670
|
+
return /* @__PURE__ */ jsx33(
|
|
6671
|
+
CardStatus,
|
|
6672
|
+
{
|
|
6673
|
+
header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
|
|
6674
|
+
label: getStatusLabel(status),
|
|
6675
|
+
onClick: () => {
|
|
6676
|
+
goToQuestion(questionNumber - 1);
|
|
6677
|
+
onQuestionClick?.();
|
|
6678
|
+
}
|
|
6679
|
+
},
|
|
6680
|
+
question.id
|
|
6681
|
+
);
|
|
6682
|
+
}) })
|
|
6683
|
+
] }, subjectId)
|
|
6684
|
+
) });
|
|
6685
|
+
};
|
|
6686
|
+
var QuizFooter = forwardRef17(({ className, onGoToSimulated, onDetailResult, ...props }, ref) => {
|
|
6687
|
+
const {
|
|
6688
|
+
currentQuestionIndex,
|
|
6689
|
+
getUserAnswers,
|
|
6690
|
+
getTotalQuestions,
|
|
6691
|
+
goToNextQuestion,
|
|
6692
|
+
goToPreviousQuestion,
|
|
6693
|
+
getUnansweredQuestionsFromUserAnswers,
|
|
6694
|
+
getCurrentAnswer,
|
|
6695
|
+
skipQuestion,
|
|
6696
|
+
getCurrentQuestion,
|
|
6697
|
+
isQuestionSkipped
|
|
6698
|
+
} = useQuizStore();
|
|
6699
|
+
const totalQuestions = getTotalQuestions();
|
|
6700
|
+
const isFirstQuestion = currentQuestionIndex === 0;
|
|
6701
|
+
const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
|
|
6702
|
+
const currentAnswer = getCurrentAnswer();
|
|
6703
|
+
const currentQuestion = getCurrentQuestion();
|
|
6704
|
+
const isCurrentQuestionSkipped = currentQuestion ? isQuestionSkipped(currentQuestion.id) : false;
|
|
6705
|
+
const [alertDialogOpen, setAlertDialogOpen] = useState12(false);
|
|
6706
|
+
const [modalResultOpen, setModalResultOpen] = useState12(false);
|
|
6707
|
+
const [modalNavigateOpen, setModalNavigateOpen] = useState12(false);
|
|
6708
|
+
const [filterType, setFilterType] = useState12("all");
|
|
6709
|
+
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
6710
|
+
const userAnswers = getUserAnswers();
|
|
6711
|
+
const allQuestions = getTotalQuestions();
|
|
6712
|
+
return /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
6713
|
+
/* @__PURE__ */ jsxs27(
|
|
6714
|
+
"footer",
|
|
6715
|
+
{
|
|
6716
|
+
ref,
|
|
6717
|
+
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}`,
|
|
6718
|
+
...props,
|
|
6719
|
+
children: [
|
|
6720
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-row items-center gap-1", children: [
|
|
6721
|
+
/* @__PURE__ */ jsx33(
|
|
6722
|
+
IconButton_default,
|
|
6723
|
+
{
|
|
6724
|
+
icon: /* @__PURE__ */ jsx33(SquaresFour, { size: 24, className: "text-text-950" }),
|
|
6725
|
+
size: "md",
|
|
6726
|
+
onClick: () => setModalNavigateOpen(true)
|
|
6727
|
+
}
|
|
6728
|
+
),
|
|
6729
|
+
isFirstQuestion ? /* @__PURE__ */ jsx33(
|
|
6730
|
+
Button_default,
|
|
6731
|
+
{
|
|
6732
|
+
variant: "outline",
|
|
6733
|
+
size: "small",
|
|
6734
|
+
onClick: () => {
|
|
6735
|
+
skipQuestion();
|
|
6736
|
+
goToNextQuestion();
|
|
6737
|
+
},
|
|
6738
|
+
children: "Pular"
|
|
6739
|
+
}
|
|
6740
|
+
) : /* @__PURE__ */ jsx33(
|
|
6741
|
+
Button_default,
|
|
6742
|
+
{
|
|
6743
|
+
size: "medium",
|
|
6744
|
+
variant: "link",
|
|
6745
|
+
action: "primary",
|
|
6746
|
+
iconLeft: /* @__PURE__ */ jsx33(CaretLeft2, { size: 18 }),
|
|
6747
|
+
onClick: () => {
|
|
6748
|
+
goToPreviousQuestion();
|
|
6749
|
+
},
|
|
6750
|
+
children: "Voltar"
|
|
6751
|
+
}
|
|
6752
|
+
)
|
|
6753
|
+
] }),
|
|
6754
|
+
!isFirstQuestion && /* @__PURE__ */ jsx33(
|
|
6755
|
+
Button_default,
|
|
6756
|
+
{
|
|
6757
|
+
size: "small",
|
|
6758
|
+
variant: "outline",
|
|
6759
|
+
action: "primary",
|
|
6760
|
+
onClick: () => {
|
|
6761
|
+
skipQuestion();
|
|
6762
|
+
goToNextQuestion();
|
|
6763
|
+
},
|
|
6764
|
+
children: "Pular"
|
|
6765
|
+
}
|
|
6766
|
+
),
|
|
6767
|
+
isLastQuestion ? /* @__PURE__ */ jsx33(
|
|
6768
|
+
Button_default,
|
|
6769
|
+
{
|
|
6770
|
+
size: "medium",
|
|
6771
|
+
variant: "solid",
|
|
6772
|
+
action: "primary",
|
|
6773
|
+
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
6774
|
+
onClick: () => {
|
|
6775
|
+
if (unansweredQuestions.length > 0) {
|
|
6776
|
+
setAlertDialogOpen(true);
|
|
6777
|
+
} else {
|
|
6778
|
+
setModalResultOpen(true);
|
|
6779
|
+
}
|
|
6780
|
+
},
|
|
6781
|
+
children: "Finalizar"
|
|
6782
|
+
}
|
|
6783
|
+
) : /* @__PURE__ */ jsx33(
|
|
6784
|
+
Button_default,
|
|
6785
|
+
{
|
|
6786
|
+
size: "medium",
|
|
6787
|
+
variant: "link",
|
|
6788
|
+
action: "primary",
|
|
6789
|
+
iconRight: /* @__PURE__ */ jsx33(CaretRight4, { size: 18 }),
|
|
6790
|
+
disabled: !currentAnswer && !isCurrentQuestionSkipped,
|
|
6791
|
+
onClick: () => {
|
|
6792
|
+
goToNextQuestion();
|
|
6793
|
+
},
|
|
6794
|
+
children: "Avan\xE7ar"
|
|
6795
|
+
}
|
|
6796
|
+
)
|
|
6797
|
+
]
|
|
6798
|
+
}
|
|
6799
|
+
),
|
|
6800
|
+
/* @__PURE__ */ jsx33(
|
|
6801
|
+
AlertDialog,
|
|
6802
|
+
{
|
|
6803
|
+
isOpen: alertDialogOpen,
|
|
6804
|
+
onChangeOpen: setAlertDialogOpen,
|
|
6805
|
+
title: "Finalizar simulado?",
|
|
6806
|
+
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?",
|
|
6807
|
+
cancelButtonLabel: "Voltar e revisar",
|
|
6808
|
+
submitButtonLabel: "Finalizar Mesmo Assim",
|
|
6809
|
+
onSubmit: () => {
|
|
6810
|
+
setModalResultOpen(true);
|
|
6811
|
+
}
|
|
6812
|
+
}
|
|
6813
|
+
),
|
|
6814
|
+
/* @__PURE__ */ jsx33(
|
|
6815
|
+
Modal_default,
|
|
6816
|
+
{
|
|
6817
|
+
isOpen: modalResultOpen,
|
|
6818
|
+
onClose: () => setModalResultOpen(false),
|
|
6819
|
+
title: "",
|
|
6820
|
+
closeOnBackdropClick: false,
|
|
6821
|
+
closeOnEscape: false,
|
|
6822
|
+
hideCloseButton: true,
|
|
6823
|
+
size: "md",
|
|
6824
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
|
|
6825
|
+
/* @__PURE__ */ jsx33(
|
|
6826
|
+
"img",
|
|
6827
|
+
{
|
|
6828
|
+
src: simulated_result_default,
|
|
6829
|
+
alt: "Simulated Result",
|
|
6830
|
+
className: "w-[282px] h-auto object-cover"
|
|
6831
|
+
}
|
|
6832
|
+
),
|
|
6833
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-2 text-center", children: [
|
|
6834
|
+
/* @__PURE__ */ jsx33("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
|
|
6835
|
+
/* @__PURE__ */ jsxs27("p", { className: "text-text-500 font-sm", children: [
|
|
6836
|
+
"Voc\xEA acertou",
|
|
6837
|
+
" ",
|
|
6838
|
+
userAnswers.filter(
|
|
6839
|
+
(answer) => answer.answerKey === answer.correctOptionId
|
|
6840
|
+
).length,
|
|
6841
|
+
" ",
|
|
6842
|
+
"de ",
|
|
6843
|
+
allQuestions,
|
|
6844
|
+
" quest\xF5es."
|
|
6845
|
+
] })
|
|
6846
|
+
] }),
|
|
6847
|
+
/* @__PURE__ */ jsxs27("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
|
|
6848
|
+
/* @__PURE__ */ jsx33(
|
|
6849
|
+
Button_default,
|
|
6850
|
+
{
|
|
6851
|
+
variant: "outline",
|
|
6852
|
+
className: "w-full",
|
|
6853
|
+
size: "small",
|
|
6854
|
+
onClick: onGoToSimulated,
|
|
6855
|
+
children: "Ir para simulados"
|
|
6856
|
+
}
|
|
6857
|
+
),
|
|
6858
|
+
/* @__PURE__ */ jsx33(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
|
|
6859
|
+
] })
|
|
6860
|
+
] })
|
|
6861
|
+
}
|
|
6862
|
+
),
|
|
6863
|
+
/* @__PURE__ */ jsx33(
|
|
6864
|
+
Modal_default,
|
|
6865
|
+
{
|
|
6866
|
+
isOpen: modalNavigateOpen,
|
|
6867
|
+
onClose: () => setModalNavigateOpen(false),
|
|
6868
|
+
title: "Quest\xF5es",
|
|
6869
|
+
size: "lg",
|
|
6870
|
+
children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col w-full h-full", children: [
|
|
6871
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
|
|
6872
|
+
/* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
|
|
6873
|
+
/* @__PURE__ */ jsx33("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs27(Select_default, { value: filterType, onValueChange: setFilterType, children: [
|
|
6874
|
+
/* @__PURE__ */ jsx33(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ jsx33(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
|
|
6875
|
+
/* @__PURE__ */ jsxs27(SelectContent, { children: [
|
|
6876
|
+
/* @__PURE__ */ jsx33(SelectItem, { value: "all", children: "Todas" }),
|
|
6877
|
+
/* @__PURE__ */ jsx33(SelectItem, { value: "unanswered", children: "Em branco" }),
|
|
6878
|
+
/* @__PURE__ */ jsx33(SelectItem, { value: "answered", children: "Respondidas" })
|
|
6879
|
+
] })
|
|
6880
|
+
] }) })
|
|
6881
|
+
] }),
|
|
6882
|
+
/* @__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(
|
|
6883
|
+
QuizQuestionList,
|
|
6884
|
+
{
|
|
6885
|
+
filterType,
|
|
6886
|
+
onQuestionClick: () => setModalNavigateOpen(false)
|
|
6887
|
+
}
|
|
6888
|
+
) })
|
|
6889
|
+
] })
|
|
6890
|
+
}
|
|
6891
|
+
)
|
|
6892
|
+
] });
|
|
6893
|
+
});
|
|
6249
6894
|
export {
|
|
6250
6895
|
Alert_default as Alert,
|
|
6251
6896
|
AlertDialog,
|
|
@@ -6292,6 +6937,13 @@ export {
|
|
|
6292
6937
|
ProgressCircle_default as ProgressCircle,
|
|
6293
6938
|
ProtectedRoute,
|
|
6294
6939
|
PublicRoute,
|
|
6940
|
+
Quiz,
|
|
6941
|
+
QuizAlternative,
|
|
6942
|
+
QuizContent,
|
|
6943
|
+
QuizFooter,
|
|
6944
|
+
QuizHeader,
|
|
6945
|
+
QuizQuestionList,
|
|
6946
|
+
QuizTitle,
|
|
6295
6947
|
Radio_default as Radio,
|
|
6296
6948
|
RadioGroup,
|
|
6297
6949
|
RadioGroupItem,
|
|
@@ -6320,6 +6972,7 @@ export {
|
|
|
6320
6972
|
useApiConfig,
|
|
6321
6973
|
useAuth,
|
|
6322
6974
|
useAuthGuard,
|
|
6975
|
+
useQuizStore,
|
|
6323
6976
|
useRouteAuth,
|
|
6324
6977
|
ToastStore_default as useToastStore,
|
|
6325
6978
|
useUrlAuthentication,
|