analytica-frontend-lib 1.2.35 → 1.2.37
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/ActivityFilters/index.d.ts +6 -19
- package/dist/ActivityFilters/index.d.ts.map +1 -1
- package/dist/ActivityFilters/index.js +566 -52
- package/dist/ActivityFilters/index.js.map +1 -1
- package/dist/ActivityFilters/index.mjs +566 -52
- package/dist/ActivityFilters/index.mjs.map +1 -1
- package/dist/hooks/useActivityFiltersData.d.ts +76 -0
- package/dist/hooks/useActivityFiltersData.d.ts.map +1 -0
- package/dist/hooks/useQuestionsList/index.d.ts +57 -0
- package/dist/hooks/useQuestionsList/index.d.ts.map +1 -0
- package/dist/hooks/useQuestionsList/index.js +139 -0
- package/dist/hooks/useQuestionsList/index.js.map +1 -0
- package/dist/hooks/useQuestionsList/index.mjs +113 -0
- package/dist/hooks/useQuestionsList/index.mjs.map +1 -0
- package/dist/hooks/useQuestionsList.d.ts +57 -0
- package/dist/hooks/useQuestionsList.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +960 -303
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +927 -275
- package/dist/index.mjs.map +1 -1
- package/dist/store/questionFiltersStore.d.ts +13 -0
- package/dist/store/questionFiltersStore.d.ts.map +1 -0
- package/dist/types/api.d.ts +22 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/notifications.d.ts +3 -13
- package/dist/types/notifications.d.ts.map +1 -1
- package/dist/types/questions.d.ts +47 -0
- package/dist/types/questions.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11206,6 +11206,612 @@ var questionTypeLabels = {
|
|
|
11206
11206
|
["PREENCHER" /* PREENCHER */]: "Preencher Lacunas"
|
|
11207
11207
|
};
|
|
11208
11208
|
|
|
11209
|
+
// src/hooks/useActivityFiltersData.ts
|
|
11210
|
+
import { useState as useState21, useEffect as useEffect21, useCallback as useCallback3, useMemo as useMemo9, useRef as useRef12 } from "react";
|
|
11211
|
+
var mapQuestionTypeToEnum = (type) => {
|
|
11212
|
+
const upperType = type.toUpperCase();
|
|
11213
|
+
const typeMap = {
|
|
11214
|
+
ALTERNATIVA: "ALTERNATIVA" /* ALTERNATIVA */,
|
|
11215
|
+
DISSERTATIVA: "DISSERTATIVA" /* DISSERTATIVA */,
|
|
11216
|
+
MULTIPLA_ESCOLHA: "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */,
|
|
11217
|
+
VERDADEIRO_FALSO: "VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */,
|
|
11218
|
+
IMAGEM: "IMAGEM" /* IMAGEM */,
|
|
11219
|
+
LIGAR_PONTOS: "LIGAR_PONTOS" /* LIGAR_PONTOS */,
|
|
11220
|
+
PREENCHER: "PREENCHER" /* PREENCHER */
|
|
11221
|
+
};
|
|
11222
|
+
return typeMap[upperType] || null;
|
|
11223
|
+
};
|
|
11224
|
+
var areCategoriesSame = (prev, current) => {
|
|
11225
|
+
if (prev.length !== current.length) return false;
|
|
11226
|
+
return current.every((category) => {
|
|
11227
|
+
const prevCategory = prev.find((c) => c.key === category.key);
|
|
11228
|
+
if (!prevCategory) return false;
|
|
11229
|
+
const prevIds = (prevCategory.itens || []).map(
|
|
11230
|
+
(item) => item.id
|
|
11231
|
+
);
|
|
11232
|
+
const currentIds = (category.itens || []).map(
|
|
11233
|
+
(item) => item.id
|
|
11234
|
+
);
|
|
11235
|
+
if (prevIds.length !== currentIds.length) return false;
|
|
11236
|
+
return currentIds.every((id) => prevIds.includes(id));
|
|
11237
|
+
});
|
|
11238
|
+
};
|
|
11239
|
+
var mergeCategoriesWithSelection = (prev, current) => {
|
|
11240
|
+
return current.map((category) => {
|
|
11241
|
+
const prevCategory = prev.find((c) => c.key === category.key);
|
|
11242
|
+
if (!prevCategory) {
|
|
11243
|
+
return category;
|
|
11244
|
+
}
|
|
11245
|
+
const validSelectedIds = (prevCategory.selectedIds || []).filter(
|
|
11246
|
+
(id) => category.itens?.some((item) => item.id === id)
|
|
11247
|
+
);
|
|
11248
|
+
return {
|
|
11249
|
+
...category,
|
|
11250
|
+
selectedIds: validSelectedIds
|
|
11251
|
+
};
|
|
11252
|
+
});
|
|
11253
|
+
};
|
|
11254
|
+
var mapSelectedNames = (ids, items) => {
|
|
11255
|
+
return ids.map((id) => {
|
|
11256
|
+
const item = items.find((t) => t.id === id);
|
|
11257
|
+
return item ? item.name : null;
|
|
11258
|
+
}).filter((name) => name !== null);
|
|
11259
|
+
};
|
|
11260
|
+
var useActivityFiltersDataImpl = (apiClient, options) => {
|
|
11261
|
+
const { selectedSubjects, institutionId } = options;
|
|
11262
|
+
const [banksState, setBanksState] = useState21({
|
|
11263
|
+
banks: [],
|
|
11264
|
+
bankYears: [],
|
|
11265
|
+
loading: false,
|
|
11266
|
+
error: null
|
|
11267
|
+
});
|
|
11268
|
+
const loadBanks = useCallback3(async () => {
|
|
11269
|
+
setBanksState((prev) => ({ ...prev, loading: true, error: null }));
|
|
11270
|
+
try {
|
|
11271
|
+
const response = await apiClient.get(
|
|
11272
|
+
"/questions/exam-institutions"
|
|
11273
|
+
);
|
|
11274
|
+
const banksMap = /* @__PURE__ */ new Map();
|
|
11275
|
+
const bankYearsArray = [];
|
|
11276
|
+
for (const item of response.data.data) {
|
|
11277
|
+
if (!item.questionBankName) continue;
|
|
11278
|
+
const existingBank = banksMap.get(item.questionBankName);
|
|
11279
|
+
if (existingBank) {
|
|
11280
|
+
if (!existingBank.years.includes(item.year)) {
|
|
11281
|
+
existingBank.years.push(item.year);
|
|
11282
|
+
}
|
|
11283
|
+
existingBank.questionsCount += item.questionsCount;
|
|
11284
|
+
} else {
|
|
11285
|
+
banksMap.set(item.questionBankName, {
|
|
11286
|
+
id: item.questionBankName,
|
|
11287
|
+
name: item.questionBankName,
|
|
11288
|
+
examInstitution: item.questionBankName,
|
|
11289
|
+
years: [item.year],
|
|
11290
|
+
questionsCount: item.questionsCount
|
|
11291
|
+
});
|
|
11292
|
+
}
|
|
11293
|
+
bankYearsArray.push({
|
|
11294
|
+
id: `${item.questionBankYearId}-${item.questionBankName}`,
|
|
11295
|
+
name: item.year,
|
|
11296
|
+
bankId: item.questionBankName
|
|
11297
|
+
});
|
|
11298
|
+
}
|
|
11299
|
+
const banks = Array.from(banksMap.values()).map((bank) => ({
|
|
11300
|
+
id: bank.id,
|
|
11301
|
+
name: bank.name,
|
|
11302
|
+
examInstitution: bank.examInstitution
|
|
11303
|
+
}));
|
|
11304
|
+
setBanksState({
|
|
11305
|
+
banks,
|
|
11306
|
+
bankYears: bankYearsArray,
|
|
11307
|
+
loading: false,
|
|
11308
|
+
error: null
|
|
11309
|
+
});
|
|
11310
|
+
} catch (error) {
|
|
11311
|
+
console.error("Erro ao carregar bancas de vestibular:", error);
|
|
11312
|
+
setBanksState((prev) => ({
|
|
11313
|
+
...prev,
|
|
11314
|
+
loading: false,
|
|
11315
|
+
error: "Erro ao carregar bancas de vestibular"
|
|
11316
|
+
}));
|
|
11317
|
+
}
|
|
11318
|
+
}, [apiClient]);
|
|
11319
|
+
const [areasState, setAreasState] = useState21({
|
|
11320
|
+
knowledgeAreas: [],
|
|
11321
|
+
loading: false,
|
|
11322
|
+
error: null
|
|
11323
|
+
});
|
|
11324
|
+
const loadKnowledgeAreas = useCallback3(async () => {
|
|
11325
|
+
setAreasState((prev) => ({ ...prev, loading: true, error: null }));
|
|
11326
|
+
try {
|
|
11327
|
+
const response = await apiClient.get(
|
|
11328
|
+
"/knowledge/subjects"
|
|
11329
|
+
);
|
|
11330
|
+
setAreasState({
|
|
11331
|
+
knowledgeAreas: response.data.data,
|
|
11332
|
+
loading: false,
|
|
11333
|
+
error: null
|
|
11334
|
+
});
|
|
11335
|
+
} catch (error) {
|
|
11336
|
+
console.error("Erro ao carregar \xE1reas de conhecimento:", error);
|
|
11337
|
+
setAreasState((prev) => ({
|
|
11338
|
+
...prev,
|
|
11339
|
+
loading: false,
|
|
11340
|
+
error: "Erro ao carregar \xE1reas de conhecimento"
|
|
11341
|
+
}));
|
|
11342
|
+
}
|
|
11343
|
+
}, [apiClient]);
|
|
11344
|
+
const [questionTypesState, setQuestionTypesState] = useState21({
|
|
11345
|
+
questionTypes: [],
|
|
11346
|
+
loading: false,
|
|
11347
|
+
error: null
|
|
11348
|
+
});
|
|
11349
|
+
const loadQuestionTypes = useCallback3(async () => {
|
|
11350
|
+
if (!institutionId) {
|
|
11351
|
+
setQuestionTypesState((prev) => ({
|
|
11352
|
+
...prev,
|
|
11353
|
+
questionTypes: [],
|
|
11354
|
+
loading: false,
|
|
11355
|
+
error: null
|
|
11356
|
+
}));
|
|
11357
|
+
return;
|
|
11358
|
+
}
|
|
11359
|
+
setQuestionTypesState((prev) => ({
|
|
11360
|
+
...prev,
|
|
11361
|
+
loading: true,
|
|
11362
|
+
error: null
|
|
11363
|
+
}));
|
|
11364
|
+
try {
|
|
11365
|
+
const response = await apiClient.get(
|
|
11366
|
+
`/institutions/${institutionId}/question-types`
|
|
11367
|
+
);
|
|
11368
|
+
const mappedTypes = response.data.data.questionTypes.map(mapQuestionTypeToEnum).filter((type) => type !== null);
|
|
11369
|
+
setQuestionTypesState({
|
|
11370
|
+
questionTypes: mappedTypes,
|
|
11371
|
+
loading: false,
|
|
11372
|
+
error: null
|
|
11373
|
+
});
|
|
11374
|
+
} catch (error) {
|
|
11375
|
+
console.error("Erro ao carregar tipos de quest\xF5es:", error);
|
|
11376
|
+
setQuestionTypesState((prev) => ({
|
|
11377
|
+
...prev,
|
|
11378
|
+
loading: false,
|
|
11379
|
+
error: "Erro ao carregar tipos de quest\xF5es"
|
|
11380
|
+
}));
|
|
11381
|
+
}
|
|
11382
|
+
}, [apiClient, institutionId]);
|
|
11383
|
+
const [knowledgeStructure, setKnowledgeStructure] = useState21({
|
|
11384
|
+
topics: [],
|
|
11385
|
+
subtopics: [],
|
|
11386
|
+
contents: [],
|
|
11387
|
+
loading: false,
|
|
11388
|
+
error: null
|
|
11389
|
+
});
|
|
11390
|
+
const [knowledgeCategories, setKnowledgeCategories] = useState21([]);
|
|
11391
|
+
const previousSubjectsRef = useRef12(null);
|
|
11392
|
+
const loadTopics = useCallback3(
|
|
11393
|
+
async (subjectIds) => {
|
|
11394
|
+
if (subjectIds.length === 0) {
|
|
11395
|
+
setKnowledgeStructure({
|
|
11396
|
+
topics: [],
|
|
11397
|
+
subtopics: [],
|
|
11398
|
+
contents: [],
|
|
11399
|
+
loading: false,
|
|
11400
|
+
error: null
|
|
11401
|
+
});
|
|
11402
|
+
setKnowledgeCategories([]);
|
|
11403
|
+
return;
|
|
11404
|
+
}
|
|
11405
|
+
setKnowledgeStructure((prev) => ({
|
|
11406
|
+
...prev,
|
|
11407
|
+
loading: true,
|
|
11408
|
+
error: null
|
|
11409
|
+
}));
|
|
11410
|
+
try {
|
|
11411
|
+
const response = await apiClient.post(
|
|
11412
|
+
"/knowledge/topics",
|
|
11413
|
+
{ subjectIds }
|
|
11414
|
+
);
|
|
11415
|
+
const topics = response.data.data.map((topic) => ({
|
|
11416
|
+
id: topic.id,
|
|
11417
|
+
name: topic.name
|
|
11418
|
+
}));
|
|
11419
|
+
setKnowledgeStructure((prev) => ({
|
|
11420
|
+
...prev,
|
|
11421
|
+
topics,
|
|
11422
|
+
subtopics: [],
|
|
11423
|
+
contents: [],
|
|
11424
|
+
loading: false,
|
|
11425
|
+
error: null
|
|
11426
|
+
}));
|
|
11427
|
+
} catch (error) {
|
|
11428
|
+
console.error("Erro ao carregar temas:", error);
|
|
11429
|
+
setKnowledgeStructure((prev) => ({
|
|
11430
|
+
...prev,
|
|
11431
|
+
topics: [],
|
|
11432
|
+
subtopics: [],
|
|
11433
|
+
contents: [],
|
|
11434
|
+
loading: false,
|
|
11435
|
+
error: "Erro ao carregar temas"
|
|
11436
|
+
}));
|
|
11437
|
+
}
|
|
11438
|
+
},
|
|
11439
|
+
[apiClient]
|
|
11440
|
+
);
|
|
11441
|
+
const loadSubtopics = useCallback3(
|
|
11442
|
+
async (topicIds, options2 = {}) => {
|
|
11443
|
+
const { forceApi = false } = options2;
|
|
11444
|
+
if (topicIds.length === 0 && !forceApi) {
|
|
11445
|
+
setKnowledgeStructure((prev) => ({
|
|
11446
|
+
...prev,
|
|
11447
|
+
subtopics: [],
|
|
11448
|
+
contents: [],
|
|
11449
|
+
loading: false,
|
|
11450
|
+
error: null
|
|
11451
|
+
}));
|
|
11452
|
+
return;
|
|
11453
|
+
}
|
|
11454
|
+
setKnowledgeStructure((prev) => ({
|
|
11455
|
+
...prev,
|
|
11456
|
+
loading: topicIds.length > 0,
|
|
11457
|
+
error: null
|
|
11458
|
+
}));
|
|
11459
|
+
try {
|
|
11460
|
+
const response = await apiClient.post(
|
|
11461
|
+
"/knowledge/subtopics",
|
|
11462
|
+
{ topicIds }
|
|
11463
|
+
);
|
|
11464
|
+
const subtopics = response.data.data.map(
|
|
11465
|
+
(subtopic) => ({
|
|
11466
|
+
id: subtopic.id,
|
|
11467
|
+
name: subtopic.name,
|
|
11468
|
+
topicId: subtopic.topicId || topicIds[0]
|
|
11469
|
+
})
|
|
11470
|
+
);
|
|
11471
|
+
setKnowledgeStructure((prev) => ({
|
|
11472
|
+
...prev,
|
|
11473
|
+
subtopics,
|
|
11474
|
+
contents: [],
|
|
11475
|
+
loading: false,
|
|
11476
|
+
error: null
|
|
11477
|
+
}));
|
|
11478
|
+
} catch (error) {
|
|
11479
|
+
console.error("Erro ao carregar subtemas:", error);
|
|
11480
|
+
setKnowledgeStructure((prev) => ({
|
|
11481
|
+
...prev,
|
|
11482
|
+
subtopics: [],
|
|
11483
|
+
contents: [],
|
|
11484
|
+
loading: false,
|
|
11485
|
+
error: "Erro ao carregar subtemas"
|
|
11486
|
+
}));
|
|
11487
|
+
}
|
|
11488
|
+
},
|
|
11489
|
+
[apiClient]
|
|
11490
|
+
);
|
|
11491
|
+
const loadContents = useCallback3(
|
|
11492
|
+
async (subtopicIds) => {
|
|
11493
|
+
if (subtopicIds.length === 0) {
|
|
11494
|
+
setKnowledgeStructure((prev) => ({
|
|
11495
|
+
...prev,
|
|
11496
|
+
contents: [],
|
|
11497
|
+
loading: false,
|
|
11498
|
+
error: null
|
|
11499
|
+
}));
|
|
11500
|
+
return;
|
|
11501
|
+
}
|
|
11502
|
+
setKnowledgeStructure((prev) => ({
|
|
11503
|
+
...prev,
|
|
11504
|
+
loading: true,
|
|
11505
|
+
error: null
|
|
11506
|
+
}));
|
|
11507
|
+
try {
|
|
11508
|
+
const response = await apiClient.post(
|
|
11509
|
+
"/knowledge/contents",
|
|
11510
|
+
{ subtopicIds }
|
|
11511
|
+
);
|
|
11512
|
+
const contents = response.data.data.map(
|
|
11513
|
+
(content) => ({
|
|
11514
|
+
id: content.id,
|
|
11515
|
+
name: content.name,
|
|
11516
|
+
subtopicId: content.subtopicId || subtopicIds[0]
|
|
11517
|
+
})
|
|
11518
|
+
);
|
|
11519
|
+
setKnowledgeStructure((prev) => ({
|
|
11520
|
+
...prev,
|
|
11521
|
+
contents,
|
|
11522
|
+
loading: false,
|
|
11523
|
+
error: null
|
|
11524
|
+
}));
|
|
11525
|
+
} catch (error) {
|
|
11526
|
+
console.error("Erro ao carregar conte\xFAdos:", error);
|
|
11527
|
+
setKnowledgeStructure((prev) => ({
|
|
11528
|
+
...prev,
|
|
11529
|
+
contents: [],
|
|
11530
|
+
loading: false,
|
|
11531
|
+
error: "Erro ao carregar conte\xFAdos"
|
|
11532
|
+
}));
|
|
11533
|
+
}
|
|
11534
|
+
},
|
|
11535
|
+
[apiClient]
|
|
11536
|
+
);
|
|
11537
|
+
useEffect21(() => {
|
|
11538
|
+
const previousSubjects = previousSubjectsRef.current;
|
|
11539
|
+
const subjectsChanged = !previousSubjects || previousSubjects.length !== selectedSubjects.length || selectedSubjects.some((id, index) => id !== previousSubjects[index]);
|
|
11540
|
+
if (!subjectsChanged) return;
|
|
11541
|
+
previousSubjectsRef.current = selectedSubjects;
|
|
11542
|
+
if (selectedSubjects.length > 0) {
|
|
11543
|
+
loadTopics(selectedSubjects);
|
|
11544
|
+
return;
|
|
11545
|
+
}
|
|
11546
|
+
setKnowledgeStructure({
|
|
11547
|
+
topics: [],
|
|
11548
|
+
subtopics: [],
|
|
11549
|
+
contents: [],
|
|
11550
|
+
loading: false,
|
|
11551
|
+
error: null
|
|
11552
|
+
});
|
|
11553
|
+
setKnowledgeCategories([]);
|
|
11554
|
+
}, [selectedSubjects, loadTopics]);
|
|
11555
|
+
const handleCategoriesChange = useCallback3(
|
|
11556
|
+
(updatedCategories) => {
|
|
11557
|
+
const isFirstChange = knowledgeCategories.length === 0;
|
|
11558
|
+
const currentTemaCategory = knowledgeCategories.find(
|
|
11559
|
+
(c) => c.key === "tema"
|
|
11560
|
+
);
|
|
11561
|
+
const currentSubtemaCategory = knowledgeCategories.find(
|
|
11562
|
+
(c) => c.key === "subtema"
|
|
11563
|
+
);
|
|
11564
|
+
const currentSelectedTopicIds = currentTemaCategory?.selectedIds || [];
|
|
11565
|
+
const currentSelectedSubtopicIds = currentSubtemaCategory?.selectedIds || [];
|
|
11566
|
+
const temaCategory = updatedCategories.find((c) => c.key === "tema");
|
|
11567
|
+
const selectedTopicIds = temaCategory?.selectedIds || [];
|
|
11568
|
+
const subtemaCategory = updatedCategories.find(
|
|
11569
|
+
(c) => c.key === "subtema"
|
|
11570
|
+
);
|
|
11571
|
+
const selectedSubtopicIds = subtemaCategory?.selectedIds || [];
|
|
11572
|
+
setKnowledgeCategories(updatedCategories);
|
|
11573
|
+
const topicIdsChanged = isFirstChange || currentSelectedTopicIds.length !== selectedTopicIds.length || currentSelectedTopicIds.some(
|
|
11574
|
+
(id) => !selectedTopicIds.includes(id)
|
|
11575
|
+
) || selectedTopicIds.some(
|
|
11576
|
+
(id) => !currentSelectedTopicIds.includes(id)
|
|
11577
|
+
);
|
|
11578
|
+
if (topicIdsChanged) {
|
|
11579
|
+
loadSubtopics(selectedTopicIds, {
|
|
11580
|
+
forceApi: selectedTopicIds.length === 0
|
|
11581
|
+
});
|
|
11582
|
+
}
|
|
11583
|
+
const subtopicIdsChanged = isFirstChange || currentSelectedSubtopicIds.length !== selectedSubtopicIds.length || currentSelectedSubtopicIds.some(
|
|
11584
|
+
(id) => !selectedSubtopicIds.includes(id)
|
|
11585
|
+
) || selectedSubtopicIds.some(
|
|
11586
|
+
(id) => !currentSelectedSubtopicIds.includes(id)
|
|
11587
|
+
);
|
|
11588
|
+
if (subtopicIdsChanged) {
|
|
11589
|
+
if (selectedSubtopicIds.length > 0) {
|
|
11590
|
+
loadContents(selectedSubtopicIds);
|
|
11591
|
+
} else {
|
|
11592
|
+
loadContents([]);
|
|
11593
|
+
}
|
|
11594
|
+
}
|
|
11595
|
+
},
|
|
11596
|
+
[knowledgeCategories, loadSubtopics, loadContents]
|
|
11597
|
+
);
|
|
11598
|
+
useEffect21(() => {
|
|
11599
|
+
if (knowledgeStructure.topics.length === 0) {
|
|
11600
|
+
setKnowledgeCategories((prev) => {
|
|
11601
|
+
if (prev.length === 0) {
|
|
11602
|
+
return prev;
|
|
11603
|
+
}
|
|
11604
|
+
return [];
|
|
11605
|
+
});
|
|
11606
|
+
return;
|
|
11607
|
+
}
|
|
11608
|
+
const categories = [
|
|
11609
|
+
{
|
|
11610
|
+
key: "tema",
|
|
11611
|
+
label: "Tema",
|
|
11612
|
+
dependsOn: [],
|
|
11613
|
+
itens: knowledgeStructure.topics,
|
|
11614
|
+
selectedIds: []
|
|
11615
|
+
},
|
|
11616
|
+
{
|
|
11617
|
+
key: "subtema",
|
|
11618
|
+
label: "Subtema",
|
|
11619
|
+
dependsOn: ["tema"],
|
|
11620
|
+
itens: knowledgeStructure.subtopics,
|
|
11621
|
+
filteredBy: [{ key: "tema", internalField: "topicId" }],
|
|
11622
|
+
selectedIds: []
|
|
11623
|
+
},
|
|
11624
|
+
{
|
|
11625
|
+
key: "assunto",
|
|
11626
|
+
label: "Assunto",
|
|
11627
|
+
dependsOn: ["subtema"],
|
|
11628
|
+
itens: knowledgeStructure.contents,
|
|
11629
|
+
filteredBy: [{ key: "subtema", internalField: "subtopicId" }],
|
|
11630
|
+
selectedIds: []
|
|
11631
|
+
}
|
|
11632
|
+
];
|
|
11633
|
+
setKnowledgeCategories(
|
|
11634
|
+
(prev) => areCategoriesSame(prev, categories) ? prev : mergeCategoriesWithSelection(prev, categories)
|
|
11635
|
+
);
|
|
11636
|
+
}, [
|
|
11637
|
+
selectedSubjects,
|
|
11638
|
+
knowledgeStructure.topics,
|
|
11639
|
+
knowledgeStructure.subtopics,
|
|
11640
|
+
knowledgeStructure.contents
|
|
11641
|
+
]);
|
|
11642
|
+
const selectedKnowledgeSummary = useMemo9(() => {
|
|
11643
|
+
const temaCategory = knowledgeCategories.find((c) => c.key === "tema");
|
|
11644
|
+
const subtemaCategory = knowledgeCategories.find(
|
|
11645
|
+
(c) => c.key === "subtema"
|
|
11646
|
+
);
|
|
11647
|
+
const assuntoCategory = knowledgeCategories.find(
|
|
11648
|
+
(c) => c.key === "assunto"
|
|
11649
|
+
);
|
|
11650
|
+
const selectedTopics = mapSelectedNames(
|
|
11651
|
+
temaCategory?.selectedIds || [],
|
|
11652
|
+
knowledgeStructure.topics
|
|
11653
|
+
);
|
|
11654
|
+
const selectedSubtopics = mapSelectedNames(
|
|
11655
|
+
subtemaCategory?.selectedIds || [],
|
|
11656
|
+
knowledgeStructure.subtopics
|
|
11657
|
+
);
|
|
11658
|
+
const selectedContents = mapSelectedNames(
|
|
11659
|
+
assuntoCategory?.selectedIds || [],
|
|
11660
|
+
knowledgeStructure.contents
|
|
11661
|
+
);
|
|
11662
|
+
return {
|
|
11663
|
+
topics: selectedTopics,
|
|
11664
|
+
subtopics: selectedSubtopics,
|
|
11665
|
+
contents: selectedContents
|
|
11666
|
+
};
|
|
11667
|
+
}, [knowledgeCategories, knowledgeStructure]);
|
|
11668
|
+
const enableSummary = useMemo9(() => {
|
|
11669
|
+
return knowledgeStructure.topics.length === 1 || knowledgeStructure.subtopics.length === 1 || knowledgeStructure.contents.length === 1;
|
|
11670
|
+
}, [knowledgeStructure]);
|
|
11671
|
+
return {
|
|
11672
|
+
// Vestibular Banks
|
|
11673
|
+
banks: banksState.banks,
|
|
11674
|
+
bankYears: banksState.bankYears,
|
|
11675
|
+
loadingBanks: banksState.loading,
|
|
11676
|
+
banksError: banksState.error,
|
|
11677
|
+
loadBanks,
|
|
11678
|
+
// Knowledge Areas
|
|
11679
|
+
knowledgeAreas: areasState.knowledgeAreas,
|
|
11680
|
+
loadingSubjects: areasState.loading,
|
|
11681
|
+
subjectsError: areasState.error,
|
|
11682
|
+
loadKnowledgeAreas,
|
|
11683
|
+
// Knowledge Structure
|
|
11684
|
+
knowledgeStructure,
|
|
11685
|
+
knowledgeCategories,
|
|
11686
|
+
handleCategoriesChange,
|
|
11687
|
+
selectedKnowledgeSummary,
|
|
11688
|
+
enableSummary,
|
|
11689
|
+
loadTopics,
|
|
11690
|
+
loadSubtopics,
|
|
11691
|
+
loadContents,
|
|
11692
|
+
// Question Types
|
|
11693
|
+
questionTypes: questionTypesState.questionTypes,
|
|
11694
|
+
loadingQuestionTypes: questionTypesState.loading,
|
|
11695
|
+
questionTypesError: questionTypesState.error,
|
|
11696
|
+
loadQuestionTypes
|
|
11697
|
+
};
|
|
11698
|
+
};
|
|
11699
|
+
var createUseActivityFiltersData = (apiClient) => {
|
|
11700
|
+
return (options) => useActivityFiltersDataImpl(apiClient, options);
|
|
11701
|
+
};
|
|
11702
|
+
var createActivityFiltersDataHook = (apiClient) => {
|
|
11703
|
+
return createUseActivityFiltersData(apiClient);
|
|
11704
|
+
};
|
|
11705
|
+
|
|
11706
|
+
// src/hooks/useQuestionsList.ts
|
|
11707
|
+
import { useState as useState22, useCallback as useCallback4 } from "react";
|
|
11708
|
+
var useQuestionsListImpl = (apiClient) => {
|
|
11709
|
+
const [state, setState] = useState22({
|
|
11710
|
+
questions: [],
|
|
11711
|
+
pagination: null,
|
|
11712
|
+
loading: false,
|
|
11713
|
+
loadingMore: false,
|
|
11714
|
+
error: null,
|
|
11715
|
+
currentFilters: null
|
|
11716
|
+
});
|
|
11717
|
+
const updateState = useCallback4((updates) => {
|
|
11718
|
+
setState((prev) => ({ ...prev, ...updates }));
|
|
11719
|
+
}, []);
|
|
11720
|
+
const handleError = useCallback4(
|
|
11721
|
+
(error) => {
|
|
11722
|
+
console.error("Erro ao carregar quest\xF5es:", error);
|
|
11723
|
+
let errorMessage = "Erro ao carregar quest\xF5es";
|
|
11724
|
+
if (error && typeof error === "object" && "response" in error) {
|
|
11725
|
+
const axiosError = error;
|
|
11726
|
+
errorMessage = axiosError?.response?.data?.message || axiosError?.message || errorMessage;
|
|
11727
|
+
} else if (error instanceof Error) {
|
|
11728
|
+
errorMessage = error.message;
|
|
11729
|
+
}
|
|
11730
|
+
updateState({
|
|
11731
|
+
loading: false,
|
|
11732
|
+
loadingMore: false,
|
|
11733
|
+
error: errorMessage
|
|
11734
|
+
});
|
|
11735
|
+
},
|
|
11736
|
+
[updateState]
|
|
11737
|
+
);
|
|
11738
|
+
const fetchQuestions = useCallback4(
|
|
11739
|
+
async (filters, append = false) => {
|
|
11740
|
+
if (append) {
|
|
11741
|
+
setState((prev) => ({ ...prev, loadingMore: true, error: null }));
|
|
11742
|
+
} else {
|
|
11743
|
+
updateState({ loading: true, error: null, questions: [] });
|
|
11744
|
+
}
|
|
11745
|
+
try {
|
|
11746
|
+
const validatedFilters = {
|
|
11747
|
+
...filters
|
|
11748
|
+
};
|
|
11749
|
+
const response = await apiClient.post(
|
|
11750
|
+
"/questions/list",
|
|
11751
|
+
validatedFilters
|
|
11752
|
+
);
|
|
11753
|
+
setState((prev) => ({
|
|
11754
|
+
loading: false,
|
|
11755
|
+
loadingMore: false,
|
|
11756
|
+
questions: append ? [...prev.questions, ...response.data.data.questions] : response.data.data.questions,
|
|
11757
|
+
pagination: response.data.data.pagination,
|
|
11758
|
+
error: null,
|
|
11759
|
+
currentFilters: validatedFilters
|
|
11760
|
+
}));
|
|
11761
|
+
} catch (error) {
|
|
11762
|
+
setState((prev) => ({
|
|
11763
|
+
...prev,
|
|
11764
|
+
loading: false,
|
|
11765
|
+
loadingMore: false
|
|
11766
|
+
}));
|
|
11767
|
+
handleError(error);
|
|
11768
|
+
}
|
|
11769
|
+
},
|
|
11770
|
+
[apiClient, updateState, handleError]
|
|
11771
|
+
);
|
|
11772
|
+
const loadMore = useCallback4(async () => {
|
|
11773
|
+
setState((prev) => {
|
|
11774
|
+
const { currentFilters, pagination, loadingMore: isLoadingMore } = prev;
|
|
11775
|
+
if (isLoadingMore || !currentFilters || !pagination?.hasNext) {
|
|
11776
|
+
return prev;
|
|
11777
|
+
}
|
|
11778
|
+
const nextPageFilters = {
|
|
11779
|
+
...currentFilters,
|
|
11780
|
+
page: pagination.page + 1
|
|
11781
|
+
};
|
|
11782
|
+
fetchQuestions(nextPageFilters, true).catch((error) => {
|
|
11783
|
+
console.error("Erro ao carregar mais quest\xF5es:", error);
|
|
11784
|
+
});
|
|
11785
|
+
return {
|
|
11786
|
+
...prev,
|
|
11787
|
+
loadingMore: true
|
|
11788
|
+
};
|
|
11789
|
+
});
|
|
11790
|
+
}, [fetchQuestions]);
|
|
11791
|
+
const reset = useCallback4(() => {
|
|
11792
|
+
setState({
|
|
11793
|
+
questions: [],
|
|
11794
|
+
pagination: null,
|
|
11795
|
+
loading: false,
|
|
11796
|
+
loadingMore: false,
|
|
11797
|
+
error: null,
|
|
11798
|
+
currentFilters: null
|
|
11799
|
+
});
|
|
11800
|
+
}, []);
|
|
11801
|
+
return {
|
|
11802
|
+
...state,
|
|
11803
|
+
fetchQuestions,
|
|
11804
|
+
loadMore,
|
|
11805
|
+
reset
|
|
11806
|
+
};
|
|
11807
|
+
};
|
|
11808
|
+
var createUseQuestionsList = (apiClient) => {
|
|
11809
|
+
return () => useQuestionsListImpl(apiClient);
|
|
11810
|
+
};
|
|
11811
|
+
var createQuestionsListHook = (apiClient) => {
|
|
11812
|
+
return createUseQuestionsList(apiClient);
|
|
11813
|
+
};
|
|
11814
|
+
|
|
11209
11815
|
// src/components/Filter/FilterModal.tsx
|
|
11210
11816
|
import { jsx as jsx57, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
11211
11817
|
var FilterModal = ({
|
|
@@ -11349,10 +11955,10 @@ var FilterModal = ({
|
|
|
11349
11955
|
};
|
|
11350
11956
|
|
|
11351
11957
|
// src/components/Filter/useTableFilter.ts
|
|
11352
|
-
import { useEffect as
|
|
11958
|
+
import { useEffect as useEffect22, useState as useState23, useCallback as useCallback5, useMemo as useMemo10 } from "react";
|
|
11353
11959
|
var useTableFilter = (initialConfigs, options = {}) => {
|
|
11354
11960
|
const { syncWithUrl = false } = options;
|
|
11355
|
-
const getInitialState =
|
|
11961
|
+
const getInitialState = useCallback5(() => {
|
|
11356
11962
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
11357
11963
|
return initialConfigs;
|
|
11358
11964
|
}
|
|
@@ -11370,8 +11976,8 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11370
11976
|
}));
|
|
11371
11977
|
return configsWithUrlState;
|
|
11372
11978
|
}, [initialConfigs, syncWithUrl]);
|
|
11373
|
-
const [filterConfigs, setFilterConfigs] =
|
|
11374
|
-
const activeFilters =
|
|
11979
|
+
const [filterConfigs, setFilterConfigs] = useState23(getInitialState);
|
|
11980
|
+
const activeFilters = useMemo10(() => {
|
|
11375
11981
|
const filters = {};
|
|
11376
11982
|
for (const config of filterConfigs) {
|
|
11377
11983
|
for (const category of config.categories) {
|
|
@@ -11383,10 +11989,10 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11383
11989
|
return filters;
|
|
11384
11990
|
}, [filterConfigs]);
|
|
11385
11991
|
const hasActiveFilters = Object.keys(activeFilters).length > 0;
|
|
11386
|
-
const updateFilters =
|
|
11992
|
+
const updateFilters = useCallback5((configs) => {
|
|
11387
11993
|
setFilterConfigs(configs);
|
|
11388
11994
|
}, []);
|
|
11389
|
-
const applyFilters =
|
|
11995
|
+
const applyFilters = useCallback5(() => {
|
|
11390
11996
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
11391
11997
|
return;
|
|
11392
11998
|
}
|
|
@@ -11404,7 +12010,7 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11404
12010
|
}
|
|
11405
12011
|
globalThis.window.history.replaceState({}, "", url.toString());
|
|
11406
12012
|
}, [filterConfigs, syncWithUrl]);
|
|
11407
|
-
const clearFilters =
|
|
12013
|
+
const clearFilters = useCallback5(() => {
|
|
11408
12014
|
const clearedConfigs = filterConfigs.map((config) => ({
|
|
11409
12015
|
...config,
|
|
11410
12016
|
categories: config.categories.map((category) => ({
|
|
@@ -11424,7 +12030,7 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11424
12030
|
globalThis.window.history.replaceState({}, "", url.toString());
|
|
11425
12031
|
}
|
|
11426
12032
|
}, [filterConfigs, syncWithUrl]);
|
|
11427
|
-
|
|
12033
|
+
useEffect22(() => {
|
|
11428
12034
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
11429
12035
|
return;
|
|
11430
12036
|
}
|
|
@@ -11445,9 +12051,9 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11445
12051
|
};
|
|
11446
12052
|
|
|
11447
12053
|
// src/components/ActivityFilters/ActivityFilters.tsx
|
|
11448
|
-
import { useState as
|
|
12054
|
+
import { useState as useState24, useEffect as useEffect23, useMemo as useMemo11, useCallback as useCallback6, useRef as useRef13 } from "react";
|
|
11449
12055
|
import { jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11450
|
-
var
|
|
12056
|
+
var questionTypesFallback = [
|
|
11451
12057
|
"ALTERNATIVA" /* ALTERNATIVA */,
|
|
11452
12058
|
"VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */,
|
|
11453
12059
|
"DISSERTATIVA" /* DISSERTATIVA */,
|
|
@@ -11461,7 +12067,7 @@ var QuestionTypeFilter = ({
|
|
|
11461
12067
|
onToggleType,
|
|
11462
12068
|
allowedQuestionTypes
|
|
11463
12069
|
}) => {
|
|
11464
|
-
const availableQuestionTypes = allowedQuestionTypes ||
|
|
12070
|
+
const availableQuestionTypes = allowedQuestionTypes || questionTypesFallback;
|
|
11465
12071
|
return /* @__PURE__ */ jsxs45("div", { children: [
|
|
11466
12072
|
/* @__PURE__ */ jsx58(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tipo de quest\xE3o" }),
|
|
11467
12073
|
/* @__PURE__ */ jsx58("div", { className: "grid grid-cols-2 gap-2", children: availableQuestionTypes.map((questionType) => /* @__PURE__ */ jsx58(
|
|
@@ -11586,45 +12192,42 @@ var FilterActions = ({
|
|
|
11586
12192
|
] });
|
|
11587
12193
|
};
|
|
11588
12194
|
var ActivityFilters = ({
|
|
12195
|
+
apiClient,
|
|
11589
12196
|
onFiltersChange,
|
|
11590
12197
|
variant = "default",
|
|
11591
|
-
|
|
11592
|
-
banks = [],
|
|
11593
|
-
bankYears = [],
|
|
11594
|
-
knowledgeAreas = [],
|
|
11595
|
-
knowledgeStructure = {
|
|
11596
|
-
topics: [],
|
|
11597
|
-
subtopics: [],
|
|
11598
|
-
contents: [],
|
|
11599
|
-
loading: false,
|
|
11600
|
-
error: null
|
|
11601
|
-
},
|
|
11602
|
-
knowledgeCategories = [],
|
|
12198
|
+
institutionId = null,
|
|
11603
12199
|
// Question types
|
|
11604
12200
|
allowedQuestionTypes,
|
|
11605
|
-
// Loading states
|
|
11606
|
-
loadingBanks = false,
|
|
11607
|
-
loadingKnowledge: _loadingKnowledge = false,
|
|
11608
|
-
loadingSubjects = false,
|
|
11609
|
-
// Errors
|
|
11610
|
-
banksError = null,
|
|
11611
|
-
subjectsError = null,
|
|
11612
|
-
// Load functions
|
|
11613
|
-
loadBanks,
|
|
11614
|
-
loadKnowledge,
|
|
11615
|
-
loadTopics,
|
|
11616
|
-
loadSubtopics: _loadSubtopics,
|
|
11617
|
-
loadContents: _loadContents,
|
|
11618
|
-
// Handlers
|
|
11619
|
-
handleCategoriesChange,
|
|
11620
12201
|
// Action buttons
|
|
11621
12202
|
onClearFilters,
|
|
11622
12203
|
onApplyFilters
|
|
11623
12204
|
}) => {
|
|
11624
|
-
const
|
|
11625
|
-
const [
|
|
11626
|
-
const
|
|
11627
|
-
|
|
12205
|
+
const useActivityFiltersData = createUseActivityFiltersData(apiClient);
|
|
12206
|
+
const [selectedQuestionTypes, setSelectedQuestionTypes] = useState24([]);
|
|
12207
|
+
const [selectedSubject, setSelectedSubject] = useState24(null);
|
|
12208
|
+
const {
|
|
12209
|
+
banks,
|
|
12210
|
+
bankYears,
|
|
12211
|
+
loadingBanks,
|
|
12212
|
+
banksError,
|
|
12213
|
+
knowledgeAreas,
|
|
12214
|
+
loadingSubjects,
|
|
12215
|
+
subjectsError,
|
|
12216
|
+
knowledgeStructure,
|
|
12217
|
+
knowledgeCategories,
|
|
12218
|
+
handleCategoriesChange,
|
|
12219
|
+
loadBanks,
|
|
12220
|
+
loadKnowledgeAreas,
|
|
12221
|
+
loadQuestionTypes,
|
|
12222
|
+
questionTypes,
|
|
12223
|
+
loadingQuestionTypes,
|
|
12224
|
+
questionTypesError
|
|
12225
|
+
} = useActivityFiltersData({
|
|
12226
|
+
selectedSubjects: selectedSubject ? [selectedSubject] : [],
|
|
12227
|
+
institutionId
|
|
12228
|
+
});
|
|
12229
|
+
const prevAllowedQuestionTypesRef = useRef13(null);
|
|
12230
|
+
useEffect23(() => {
|
|
11628
12231
|
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
11629
12232
|
prevAllowedQuestionTypesRef.current = null;
|
|
11630
12233
|
return;
|
|
@@ -11657,8 +12260,8 @@ var ActivityFilters = ({
|
|
|
11657
12260
|
return prev;
|
|
11658
12261
|
});
|
|
11659
12262
|
}, [allowedQuestionTypes]);
|
|
11660
|
-
const [bankCategories, setBankCategories] =
|
|
11661
|
-
const selectedSubjects =
|
|
12263
|
+
const [bankCategories, setBankCategories] = useState24([]);
|
|
12264
|
+
const selectedSubjects = useMemo11(
|
|
11662
12265
|
() => selectedSubject ? [selectedSubject] : [],
|
|
11663
12266
|
[selectedSubject]
|
|
11664
12267
|
);
|
|
@@ -11671,7 +12274,7 @@ var ActivityFilters = ({
|
|
|
11671
12274
|
const handleBankCategoriesChange = (updatedCategories) => {
|
|
11672
12275
|
setBankCategories(updatedCategories);
|
|
11673
12276
|
};
|
|
11674
|
-
|
|
12277
|
+
useEffect23(() => {
|
|
11675
12278
|
setBankCategories((prevCategories) => {
|
|
11676
12279
|
const bankCategory = {
|
|
11677
12280
|
key: "banca",
|
|
@@ -11697,37 +12300,42 @@ var ActivityFilters = ({
|
|
|
11697
12300
|
return [bankCategory, yearCategory];
|
|
11698
12301
|
});
|
|
11699
12302
|
}, [banks, bankYears]);
|
|
11700
|
-
|
|
12303
|
+
useEffect23(() => {
|
|
11701
12304
|
if (loadBanks) {
|
|
11702
12305
|
loadBanks();
|
|
11703
12306
|
}
|
|
11704
|
-
if (
|
|
11705
|
-
|
|
12307
|
+
if (loadKnowledgeAreas) {
|
|
12308
|
+
loadKnowledgeAreas();
|
|
11706
12309
|
}
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
if (selectedSubject && loadTopics) {
|
|
11710
|
-
loadTopics([selectedSubject]);
|
|
12310
|
+
if (loadQuestionTypes) {
|
|
12311
|
+
loadQuestionTypes();
|
|
11711
12312
|
}
|
|
11712
|
-
}, [
|
|
11713
|
-
const
|
|
12313
|
+
}, [loadBanks, loadKnowledgeAreas, loadQuestionTypes, institutionId]);
|
|
12314
|
+
const availableQuestionTypes = useMemo11(() => {
|
|
12315
|
+
const source = questionTypes && questionTypes.length > 0 ? questionTypes : questionTypesFallback;
|
|
12316
|
+
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
12317
|
+
return source;
|
|
12318
|
+
}
|
|
12319
|
+
return source.filter((type) => allowedQuestionTypes.includes(type));
|
|
12320
|
+
}, [questionTypes, allowedQuestionTypes]);
|
|
12321
|
+
const getSelectedKnowledgeIds = useCallback6(() => {
|
|
11714
12322
|
return getSelectedIdsFromCategories(knowledgeCategories, {
|
|
11715
12323
|
topicIds: "tema",
|
|
11716
12324
|
subtopicIds: "subtema",
|
|
11717
12325
|
contentIds: "assunto"
|
|
11718
12326
|
});
|
|
11719
12327
|
}, [knowledgeCategories]);
|
|
11720
|
-
const getSelectedBankIds =
|
|
12328
|
+
const getSelectedBankIds = useCallback6(() => {
|
|
11721
12329
|
return getSelectedIdsFromCategories(bankCategories, {
|
|
11722
12330
|
bankIds: "banca",
|
|
11723
12331
|
yearIds: "ano"
|
|
11724
12332
|
});
|
|
11725
12333
|
}, [bankCategories]);
|
|
11726
|
-
const onFiltersChangeRef =
|
|
11727
|
-
|
|
12334
|
+
const onFiltersChangeRef = useRef13(onFiltersChange);
|
|
12335
|
+
useEffect23(() => {
|
|
11728
12336
|
onFiltersChangeRef.current = onFiltersChange;
|
|
11729
12337
|
}, [onFiltersChange]);
|
|
11730
|
-
|
|
12338
|
+
useEffect23(() => {
|
|
11731
12339
|
const knowledgeIds = getSelectedKnowledgeIds();
|
|
11732
12340
|
const bankIds = getSelectedBankIds();
|
|
11733
12341
|
const filters = {
|
|
@@ -11758,7 +12366,25 @@ var ActivityFilters = ({
|
|
|
11758
12366
|
{
|
|
11759
12367
|
selectedTypes: selectedQuestionTypes,
|
|
11760
12368
|
onToggleType: toggleQuestionType,
|
|
11761
|
-
allowedQuestionTypes
|
|
12369
|
+
allowedQuestionTypes: availableQuestionTypes
|
|
12370
|
+
}
|
|
12371
|
+
),
|
|
12372
|
+
loadingQuestionTypes && /* @__PURE__ */ jsx58(
|
|
12373
|
+
Text_default,
|
|
12374
|
+
{
|
|
12375
|
+
size: "sm",
|
|
12376
|
+
className: "text-text-600",
|
|
12377
|
+
"data-testid": "question-types-loading",
|
|
12378
|
+
children: "Carregando tipos de quest\xE3o..."
|
|
12379
|
+
}
|
|
12380
|
+
),
|
|
12381
|
+
questionTypesError && /* @__PURE__ */ jsx58(
|
|
12382
|
+
Text_default,
|
|
12383
|
+
{
|
|
12384
|
+
size: "sm",
|
|
12385
|
+
className: "text-error-500",
|
|
12386
|
+
"data-testid": "question-types-error",
|
|
12387
|
+
children: questionTypesError
|
|
11762
12388
|
}
|
|
11763
12389
|
),
|
|
11764
12390
|
/* @__PURE__ */ jsxs45("div", { children: [
|
|
@@ -11811,7 +12437,7 @@ var ActivityFiltersPopover = ({
|
|
|
11811
12437
|
triggerLabel = "Filtro de quest\xF5es",
|
|
11812
12438
|
...activityFiltersProps
|
|
11813
12439
|
}) => {
|
|
11814
|
-
const [open, setOpen] =
|
|
12440
|
+
const [open, setOpen] = useState24(false);
|
|
11815
12441
|
return /* @__PURE__ */ jsxs45(DropdownMenu_default, { open, onOpenChange: setOpen, children: [
|
|
11816
12442
|
/* @__PURE__ */ jsx58(DropdownMenuTrigger, { children: /* @__PURE__ */ jsx58(Button_default, { variant: "outline", children: triggerLabel }) }),
|
|
11817
12443
|
/* @__PURE__ */ jsx58(
|
|
@@ -11833,7 +12459,7 @@ var ActivityFiltersPopover = ({
|
|
|
11833
12459
|
};
|
|
11834
12460
|
|
|
11835
12461
|
// src/components/TableProvider/TableProvider.tsx
|
|
11836
|
-
import { useState as
|
|
12462
|
+
import { useState as useState25, useEffect as useEffect24, useMemo as useMemo12, useCallback as useCallback7 } from "react";
|
|
11837
12463
|
import { Funnel } from "phosphor-react";
|
|
11838
12464
|
import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
11839
12465
|
function TableProvider({
|
|
@@ -11857,7 +12483,7 @@ function TableProvider({
|
|
|
11857
12483
|
onRowClick,
|
|
11858
12484
|
children
|
|
11859
12485
|
}) {
|
|
11860
|
-
const [searchQuery, setSearchQuery] =
|
|
12486
|
+
const [searchQuery, setSearchQuery] = useState25("");
|
|
11861
12487
|
const sortResultRaw = useTableSort(data, { syncWithUrl: true });
|
|
11862
12488
|
const sortResult = enableTableSort ? sortResultRaw : {
|
|
11863
12489
|
sortedData: data,
|
|
@@ -11868,7 +12494,7 @@ function TableProvider({
|
|
|
11868
12494
|
};
|
|
11869
12495
|
const { sortedData, sortColumn, sortDirection, handleSort } = sortResult;
|
|
11870
12496
|
const filterResultRaw = useTableFilter(initialFilters, { syncWithUrl: true });
|
|
11871
|
-
const disabledFilterResult =
|
|
12497
|
+
const disabledFilterResult = useMemo12(
|
|
11872
12498
|
() => ({
|
|
11873
12499
|
filterConfigs: [],
|
|
11874
12500
|
activeFilters: {},
|
|
@@ -11898,10 +12524,10 @@ function TableProvider({
|
|
|
11898
12524
|
totalItems,
|
|
11899
12525
|
totalPages
|
|
11900
12526
|
} = paginationConfig;
|
|
11901
|
-
const [currentPage, setCurrentPage] =
|
|
11902
|
-
const [itemsPerPage, setItemsPerPage] =
|
|
11903
|
-
const [isFilterModalOpen, setIsFilterModalOpen] =
|
|
11904
|
-
const combinedParams =
|
|
12527
|
+
const [currentPage, setCurrentPage] = useState25(1);
|
|
12528
|
+
const [itemsPerPage, setItemsPerPage] = useState25(defaultItemsPerPage);
|
|
12529
|
+
const [isFilterModalOpen, setIsFilterModalOpen] = useState25(false);
|
|
12530
|
+
const combinedParams = useMemo12(() => {
|
|
11905
12531
|
const params = {
|
|
11906
12532
|
page: currentPage,
|
|
11907
12533
|
limit: itemsPerPage
|
|
@@ -11928,26 +12554,26 @@ function TableProvider({
|
|
|
11928
12554
|
enableFilters,
|
|
11929
12555
|
enableTableSort
|
|
11930
12556
|
]);
|
|
11931
|
-
|
|
12557
|
+
useEffect24(() => {
|
|
11932
12558
|
onParamsChange?.(combinedParams);
|
|
11933
12559
|
}, [combinedParams]);
|
|
11934
|
-
const handleSearchChange =
|
|
12560
|
+
const handleSearchChange = useCallback7((value) => {
|
|
11935
12561
|
setSearchQuery(value);
|
|
11936
12562
|
setCurrentPage(1);
|
|
11937
12563
|
}, []);
|
|
11938
|
-
const handleFilterApply =
|
|
12564
|
+
const handleFilterApply = useCallback7(() => {
|
|
11939
12565
|
applyFilters();
|
|
11940
12566
|
setIsFilterModalOpen(false);
|
|
11941
12567
|
setCurrentPage(1);
|
|
11942
12568
|
}, [applyFilters]);
|
|
11943
|
-
const handlePageChange =
|
|
12569
|
+
const handlePageChange = useCallback7((page) => {
|
|
11944
12570
|
setCurrentPage(page);
|
|
11945
12571
|
}, []);
|
|
11946
|
-
const handleItemsPerPageChange =
|
|
12572
|
+
const handleItemsPerPageChange = useCallback7((items) => {
|
|
11947
12573
|
setItemsPerPage(items);
|
|
11948
12574
|
setCurrentPage(1);
|
|
11949
12575
|
}, []);
|
|
11950
|
-
const handleRowClickInternal =
|
|
12576
|
+
const handleRowClickInternal = useCallback7(
|
|
11951
12577
|
(row, index) => {
|
|
11952
12578
|
if (enableRowClick && onRowClick) {
|
|
11953
12579
|
onRowClick(row, index);
|
|
@@ -11955,7 +12581,7 @@ function TableProvider({
|
|
|
11955
12581
|
},
|
|
11956
12582
|
[enableRowClick, onRowClick]
|
|
11957
12583
|
);
|
|
11958
|
-
const useInternalPagination =
|
|
12584
|
+
const useInternalPagination = useMemo12(
|
|
11959
12585
|
() => enablePagination && !onParamsChange && totalItems === void 0 && totalPages === void 0,
|
|
11960
12586
|
[enablePagination, onParamsChange, totalItems, totalPages]
|
|
11961
12587
|
);
|
|
@@ -11963,7 +12589,7 @@ function TableProvider({
|
|
|
11963
12589
|
(totalItems ?? (useInternalPagination ? sortedData.length : data.length)) / itemsPerPage
|
|
11964
12590
|
);
|
|
11965
12591
|
const calculatedTotalItems = totalItems ?? (useInternalPagination ? sortedData.length : data.length);
|
|
11966
|
-
const displayData =
|
|
12592
|
+
const displayData = useMemo12(() => {
|
|
11967
12593
|
if (!useInternalPagination) {
|
|
11968
12594
|
return sortedData;
|
|
11969
12595
|
}
|
|
@@ -12131,8 +12757,8 @@ var TableProvider_default = TableProvider;
|
|
|
12131
12757
|
// src/components/Select/Select.tsx
|
|
12132
12758
|
import { create as create10, useStore as useStore4 } from "zustand";
|
|
12133
12759
|
import {
|
|
12134
|
-
useEffect as
|
|
12135
|
-
useRef as
|
|
12760
|
+
useEffect as useEffect25,
|
|
12761
|
+
useRef as useRef14,
|
|
12136
12762
|
forwardRef as forwardRef19,
|
|
12137
12763
|
isValidElement as isValidElement6,
|
|
12138
12764
|
Children as Children6,
|
|
@@ -12238,10 +12864,10 @@ var Select = ({
|
|
|
12238
12864
|
errorMessage,
|
|
12239
12865
|
id
|
|
12240
12866
|
}) => {
|
|
12241
|
-
const storeRef =
|
|
12867
|
+
const storeRef = useRef14(null);
|
|
12242
12868
|
storeRef.current ??= createSelectStore(onValueChange);
|
|
12243
12869
|
const store = storeRef.current;
|
|
12244
|
-
const selectRef =
|
|
12870
|
+
const selectRef = useRef14(null);
|
|
12245
12871
|
const { open, setOpen, setValue, selectedLabel } = useStore4(store, (s) => s);
|
|
12246
12872
|
const generatedId = useId10();
|
|
12247
12873
|
const selectId = id ?? `select-${generatedId}`;
|
|
@@ -12262,13 +12888,13 @@ var Select = ({
|
|
|
12262
12888
|
search(children2);
|
|
12263
12889
|
return found;
|
|
12264
12890
|
};
|
|
12265
|
-
|
|
12891
|
+
useEffect25(() => {
|
|
12266
12892
|
if (!selectedLabel && defaultValue) {
|
|
12267
12893
|
const label2 = findLabelForValue(children, defaultValue);
|
|
12268
12894
|
if (label2) store.setState({ selectedLabel: label2 });
|
|
12269
12895
|
}
|
|
12270
12896
|
}, [children, defaultValue, selectedLabel]);
|
|
12271
|
-
|
|
12897
|
+
useEffect25(() => {
|
|
12272
12898
|
const handleClickOutside = (event) => {
|
|
12273
12899
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
12274
12900
|
setOpen(false);
|
|
@@ -12303,7 +12929,7 @@ var Select = ({
|
|
|
12303
12929
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
12304
12930
|
};
|
|
12305
12931
|
}, [open]);
|
|
12306
|
-
|
|
12932
|
+
useEffect25(() => {
|
|
12307
12933
|
if (propValue) {
|
|
12308
12934
|
setValue(propValue);
|
|
12309
12935
|
const label2 = findLabelForValue(children, propValue);
|
|
@@ -12484,13 +13110,13 @@ var Select_default = Select;
|
|
|
12484
13110
|
// src/components/Menu/Menu.tsx
|
|
12485
13111
|
import { create as create11, useStore as useStore5 } from "zustand";
|
|
12486
13112
|
import {
|
|
12487
|
-
useEffect as
|
|
12488
|
-
useRef as
|
|
13113
|
+
useEffect as useEffect26,
|
|
13114
|
+
useRef as useRef15,
|
|
12489
13115
|
forwardRef as forwardRef20,
|
|
12490
13116
|
isValidElement as isValidElement7,
|
|
12491
13117
|
Children as Children7,
|
|
12492
13118
|
cloneElement as cloneElement7,
|
|
12493
|
-
useState as
|
|
13119
|
+
useState as useState26
|
|
12494
13120
|
} from "react";
|
|
12495
13121
|
import { CaretLeft as CaretLeft4, CaretRight as CaretRight7 } from "phosphor-react";
|
|
12496
13122
|
import { jsx as jsx61, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
@@ -12522,11 +13148,11 @@ var Menu = forwardRef20(
|
|
|
12522
13148
|
onValueChange,
|
|
12523
13149
|
...props
|
|
12524
13150
|
}, ref) => {
|
|
12525
|
-
const storeRef =
|
|
13151
|
+
const storeRef = useRef15(null);
|
|
12526
13152
|
storeRef.current ??= createMenuStore(onValueChange);
|
|
12527
13153
|
const store = storeRef.current;
|
|
12528
13154
|
const { setValue } = useStore5(store, (s) => s);
|
|
12529
|
-
|
|
13155
|
+
useEffect26(() => {
|
|
12530
13156
|
setValue(propValue ?? defaultValue);
|
|
12531
13157
|
}, [defaultValue, propValue, setValue]);
|
|
12532
13158
|
const baseClasses = variant === "menu-overflow" ? "w-fit py-2 flex flex-row items-center justify-center" : "w-full py-2 flex flex-row items-center justify-center";
|
|
@@ -12727,10 +13353,10 @@ var MenuOverflow = ({
|
|
|
12727
13353
|
onValueChange,
|
|
12728
13354
|
...props
|
|
12729
13355
|
}) => {
|
|
12730
|
-
const containerRef =
|
|
12731
|
-
const [showLeftArrow, setShowLeftArrow] =
|
|
12732
|
-
const [showRightArrow, setShowRightArrow] =
|
|
12733
|
-
|
|
13356
|
+
const containerRef = useRef15(null);
|
|
13357
|
+
const [showLeftArrow, setShowLeftArrow] = useState26(false);
|
|
13358
|
+
const [showRightArrow, setShowRightArrow] = useState26(false);
|
|
13359
|
+
useEffect26(() => {
|
|
12734
13360
|
const checkScroll = () => internalCheckScroll(
|
|
12735
13361
|
containerRef.current,
|
|
12736
13362
|
setShowLeftArrow,
|
|
@@ -13054,10 +13680,10 @@ var NotFound_default = NotFound;
|
|
|
13054
13680
|
|
|
13055
13681
|
// src/components/VideoPlayer/VideoPlayer.tsx
|
|
13056
13682
|
import {
|
|
13057
|
-
useRef as
|
|
13058
|
-
useState as
|
|
13059
|
-
useEffect as
|
|
13060
|
-
useCallback as
|
|
13683
|
+
useRef as useRef16,
|
|
13684
|
+
useState as useState28,
|
|
13685
|
+
useEffect as useEffect27,
|
|
13686
|
+
useCallback as useCallback9
|
|
13061
13687
|
} from "react";
|
|
13062
13688
|
import { createPortal } from "react-dom";
|
|
13063
13689
|
import {
|
|
@@ -13072,7 +13698,7 @@ import {
|
|
|
13072
13698
|
} from "phosphor-react";
|
|
13073
13699
|
|
|
13074
13700
|
// src/components/DownloadButton/DownloadButton.tsx
|
|
13075
|
-
import { useCallback as
|
|
13701
|
+
import { useCallback as useCallback8, useState as useState27 } from "react";
|
|
13076
13702
|
import { DownloadSimple } from "phosphor-react";
|
|
13077
13703
|
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
13078
13704
|
var getMimeType = (url) => {
|
|
@@ -13149,13 +13775,13 @@ var DownloadButton = ({
|
|
|
13149
13775
|
lessonTitle = "aula",
|
|
13150
13776
|
disabled = false
|
|
13151
13777
|
}) => {
|
|
13152
|
-
const [isDownloading, setIsDownloading] =
|
|
13153
|
-
const isValidUrl =
|
|
13778
|
+
const [isDownloading, setIsDownloading] = useState27(false);
|
|
13779
|
+
const isValidUrl = useCallback8((url) => {
|
|
13154
13780
|
return Boolean(
|
|
13155
13781
|
url && url.trim() !== "" && url !== "undefined" && url !== "null"
|
|
13156
13782
|
);
|
|
13157
13783
|
}, []);
|
|
13158
|
-
const getAvailableContent =
|
|
13784
|
+
const getAvailableContent = useCallback8(() => {
|
|
13159
13785
|
const downloads = [];
|
|
13160
13786
|
if (isValidUrl(content.urlDoc)) {
|
|
13161
13787
|
downloads.push({
|
|
@@ -13190,7 +13816,7 @@ var DownloadButton = ({
|
|
|
13190
13816
|
}
|
|
13191
13817
|
return downloads;
|
|
13192
13818
|
}, [content, isValidUrl]);
|
|
13193
|
-
const handleDownload =
|
|
13819
|
+
const handleDownload = useCallback8(async () => {
|
|
13194
13820
|
if (disabled || isDownloading) return;
|
|
13195
13821
|
const availableContent = getAvailableContent();
|
|
13196
13822
|
if (availableContent.length === 0) {
|
|
@@ -13328,9 +13954,9 @@ var SpeedMenu = ({
|
|
|
13328
13954
|
iconSize = 24,
|
|
13329
13955
|
isTinyMobile = false
|
|
13330
13956
|
}) => {
|
|
13331
|
-
const buttonRef =
|
|
13332
|
-
const speedMenuContainerRef =
|
|
13333
|
-
const speedMenuRef =
|
|
13957
|
+
const buttonRef = useRef16(null);
|
|
13958
|
+
const speedMenuContainerRef = useRef16(null);
|
|
13959
|
+
const speedMenuRef = useRef16(null);
|
|
13334
13960
|
const getMenuPosition = () => {
|
|
13335
13961
|
if (!buttonRef.current) return { top: 0, left: 0 };
|
|
13336
13962
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
@@ -13344,7 +13970,7 @@ var SpeedMenu = ({
|
|
|
13344
13970
|
};
|
|
13345
13971
|
};
|
|
13346
13972
|
const position = getMenuPosition();
|
|
13347
|
-
|
|
13973
|
+
useEffect27(() => {
|
|
13348
13974
|
const handleClickOutside = (event) => {
|
|
13349
13975
|
const target = event.target;
|
|
13350
13976
|
const isOutsideContainer = speedMenuContainerRef.current && !speedMenuContainerRef.current.contains(target);
|
|
@@ -13423,28 +14049,28 @@ var VideoPlayer = ({
|
|
|
13423
14049
|
onDownloadComplete,
|
|
13424
14050
|
onDownloadError
|
|
13425
14051
|
}) => {
|
|
13426
|
-
const videoRef =
|
|
14052
|
+
const videoRef = useRef16(null);
|
|
13427
14053
|
const { isUltraSmallMobile, isTinyMobile } = useMobile();
|
|
13428
|
-
const [isPlaying, setIsPlaying] =
|
|
13429
|
-
const [currentTime, setCurrentTime] =
|
|
13430
|
-
const [duration, setDuration] =
|
|
13431
|
-
const [isMuted, setIsMuted] =
|
|
13432
|
-
const [volume, setVolume] =
|
|
13433
|
-
const [isFullscreen, setIsFullscreen] =
|
|
13434
|
-
const [showControls, setShowControls] =
|
|
13435
|
-
const [hasCompleted, setHasCompleted] =
|
|
13436
|
-
const [showCaptions, setShowCaptions] =
|
|
13437
|
-
const [subtitlesValidation, setSubtitlesValidation] =
|
|
13438
|
-
|
|
14054
|
+
const [isPlaying, setIsPlaying] = useState28(false);
|
|
14055
|
+
const [currentTime, setCurrentTime] = useState28(0);
|
|
14056
|
+
const [duration, setDuration] = useState28(0);
|
|
14057
|
+
const [isMuted, setIsMuted] = useState28(false);
|
|
14058
|
+
const [volume, setVolume] = useState28(1);
|
|
14059
|
+
const [isFullscreen, setIsFullscreen] = useState28(false);
|
|
14060
|
+
const [showControls, setShowControls] = useState28(true);
|
|
14061
|
+
const [hasCompleted, setHasCompleted] = useState28(false);
|
|
14062
|
+
const [showCaptions, setShowCaptions] = useState28(false);
|
|
14063
|
+
const [subtitlesValidation, setSubtitlesValidation] = useState28("idle");
|
|
14064
|
+
useEffect27(() => {
|
|
13439
14065
|
setHasCompleted(false);
|
|
13440
14066
|
}, [src]);
|
|
13441
|
-
const [playbackRate, setPlaybackRate] =
|
|
13442
|
-
const [showSpeedMenu, setShowSpeedMenu] =
|
|
13443
|
-
const lastSaveTimeRef =
|
|
13444
|
-
const trackRef =
|
|
13445
|
-
const controlsTimeoutRef =
|
|
13446
|
-
const lastMousePositionRef =
|
|
13447
|
-
const isUserInteracting =
|
|
14067
|
+
const [playbackRate, setPlaybackRate] = useState28(1);
|
|
14068
|
+
const [showSpeedMenu, setShowSpeedMenu] = useState28(false);
|
|
14069
|
+
const lastSaveTimeRef = useRef16(0);
|
|
14070
|
+
const trackRef = useRef16(null);
|
|
14071
|
+
const controlsTimeoutRef = useRef16(null);
|
|
14072
|
+
const lastMousePositionRef = useRef16({ x: 0, y: 0 });
|
|
14073
|
+
const isUserInteracting = useCallback9(() => {
|
|
13448
14074
|
if (showSpeedMenu) {
|
|
13449
14075
|
return true;
|
|
13450
14076
|
}
|
|
@@ -13461,13 +14087,13 @@ var VideoPlayer = ({
|
|
|
13461
14087
|
}
|
|
13462
14088
|
return false;
|
|
13463
14089
|
}, [showSpeedMenu]);
|
|
13464
|
-
const clearControlsTimeout =
|
|
14090
|
+
const clearControlsTimeout = useCallback9(() => {
|
|
13465
14091
|
if (controlsTimeoutRef.current) {
|
|
13466
14092
|
clearTimeout(controlsTimeoutRef.current);
|
|
13467
14093
|
controlsTimeoutRef.current = null;
|
|
13468
14094
|
}
|
|
13469
14095
|
}, []);
|
|
13470
|
-
const showControlsWithTimer =
|
|
14096
|
+
const showControlsWithTimer = useCallback9(() => {
|
|
13471
14097
|
setShowControls(true);
|
|
13472
14098
|
clearControlsTimeout();
|
|
13473
14099
|
if (isFullscreen) {
|
|
@@ -13482,7 +14108,7 @@ var VideoPlayer = ({
|
|
|
13482
14108
|
}, CONTROLS_HIDE_TIMEOUT);
|
|
13483
14109
|
}
|
|
13484
14110
|
}, [isFullscreen, isPlaying, clearControlsTimeout]);
|
|
13485
|
-
const handleMouseMove =
|
|
14111
|
+
const handleMouseMove = useCallback9(
|
|
13486
14112
|
(event) => {
|
|
13487
14113
|
const currentX = event.clientX;
|
|
13488
14114
|
const currentY = event.clientY;
|
|
@@ -13495,10 +14121,10 @@ var VideoPlayer = ({
|
|
|
13495
14121
|
},
|
|
13496
14122
|
[showControlsWithTimer]
|
|
13497
14123
|
);
|
|
13498
|
-
const handleMouseEnter =
|
|
14124
|
+
const handleMouseEnter = useCallback9(() => {
|
|
13499
14125
|
showControlsWithTimer();
|
|
13500
14126
|
}, [showControlsWithTimer]);
|
|
13501
|
-
const handleMouseLeave =
|
|
14127
|
+
const handleMouseLeave = useCallback9(() => {
|
|
13502
14128
|
const userInteracting = isUserInteracting();
|
|
13503
14129
|
clearControlsTimeout();
|
|
13504
14130
|
if (!isFullscreen && !userInteracting) {
|
|
@@ -13507,13 +14133,13 @@ var VideoPlayer = ({
|
|
|
13507
14133
|
}, LEAVE_HIDE_TIMEOUT);
|
|
13508
14134
|
}
|
|
13509
14135
|
}, [isFullscreen, clearControlsTimeout, isUserInteracting]);
|
|
13510
|
-
|
|
14136
|
+
useEffect27(() => {
|
|
13511
14137
|
if (videoRef.current) {
|
|
13512
14138
|
videoRef.current.volume = volume;
|
|
13513
14139
|
videoRef.current.muted = isMuted;
|
|
13514
14140
|
}
|
|
13515
14141
|
}, [volume, isMuted]);
|
|
13516
|
-
|
|
14142
|
+
useEffect27(() => {
|
|
13517
14143
|
const video = videoRef.current;
|
|
13518
14144
|
if (!video) return;
|
|
13519
14145
|
const onPlay = () => setIsPlaying(true);
|
|
@@ -13528,13 +14154,13 @@ var VideoPlayer = ({
|
|
|
13528
14154
|
video.removeEventListener("ended", onEnded);
|
|
13529
14155
|
};
|
|
13530
14156
|
}, []);
|
|
13531
|
-
|
|
14157
|
+
useEffect27(() => {
|
|
13532
14158
|
const video = videoRef.current;
|
|
13533
14159
|
if (!video) return;
|
|
13534
14160
|
video.setAttribute("playsinline", "");
|
|
13535
14161
|
video.setAttribute("webkit-playsinline", "");
|
|
13536
14162
|
}, []);
|
|
13537
|
-
|
|
14163
|
+
useEffect27(() => {
|
|
13538
14164
|
if (isPlaying) {
|
|
13539
14165
|
showControlsWithTimer();
|
|
13540
14166
|
} else {
|
|
@@ -13546,7 +14172,7 @@ var VideoPlayer = ({
|
|
|
13546
14172
|
}
|
|
13547
14173
|
}
|
|
13548
14174
|
}, [isPlaying, isFullscreen, showControlsWithTimer, clearControlsTimeout]);
|
|
13549
|
-
|
|
14175
|
+
useEffect27(() => {
|
|
13550
14176
|
const video = videoRef.current;
|
|
13551
14177
|
if (!video) return;
|
|
13552
14178
|
const handleFullscreenChange = () => {
|
|
@@ -13581,7 +14207,7 @@ var VideoPlayer = ({
|
|
|
13581
14207
|
);
|
|
13582
14208
|
};
|
|
13583
14209
|
}, [showControlsWithTimer]);
|
|
13584
|
-
|
|
14210
|
+
useEffect27(() => {
|
|
13585
14211
|
const init = () => {
|
|
13586
14212
|
if (!isFullscreen) {
|
|
13587
14213
|
showControlsWithTimer();
|
|
@@ -13603,7 +14229,7 @@ var VideoPlayer = ({
|
|
|
13603
14229
|
};
|
|
13604
14230
|
}
|
|
13605
14231
|
}, []);
|
|
13606
|
-
const getInitialTime =
|
|
14232
|
+
const getInitialTime = useCallback9(() => {
|
|
13607
14233
|
if (!autoSave || !storageKey) {
|
|
13608
14234
|
return Number.isFinite(initialTime) && initialTime >= 0 ? initialTime : void 0;
|
|
13609
14235
|
}
|
|
@@ -13616,14 +14242,14 @@ var VideoPlayer = ({
|
|
|
13616
14242
|
if (hasValidSaved) return saved;
|
|
13617
14243
|
return void 0;
|
|
13618
14244
|
}, [autoSave, storageKey, src, initialTime]);
|
|
13619
|
-
|
|
14245
|
+
useEffect27(() => {
|
|
13620
14246
|
const start = getInitialTime();
|
|
13621
14247
|
if (start !== void 0 && videoRef.current) {
|
|
13622
14248
|
videoRef.current.currentTime = start;
|
|
13623
14249
|
setCurrentTime(start);
|
|
13624
14250
|
}
|
|
13625
14251
|
}, [getInitialTime]);
|
|
13626
|
-
const saveProgress =
|
|
14252
|
+
const saveProgress = useCallback9(
|
|
13627
14253
|
(time) => {
|
|
13628
14254
|
if (!autoSave || !storageKey) return;
|
|
13629
14255
|
const now = Date.now();
|
|
@@ -13634,7 +14260,7 @@ var VideoPlayer = ({
|
|
|
13634
14260
|
},
|
|
13635
14261
|
[autoSave, storageKey, src]
|
|
13636
14262
|
);
|
|
13637
|
-
const togglePlayPause =
|
|
14263
|
+
const togglePlayPause = useCallback9(async () => {
|
|
13638
14264
|
const video = videoRef.current;
|
|
13639
14265
|
if (!video) return;
|
|
13640
14266
|
if (!video.paused) {
|
|
@@ -13646,7 +14272,7 @@ var VideoPlayer = ({
|
|
|
13646
14272
|
} catch {
|
|
13647
14273
|
}
|
|
13648
14274
|
}, []);
|
|
13649
|
-
const handleVolumeChange =
|
|
14275
|
+
const handleVolumeChange = useCallback9(
|
|
13650
14276
|
(newVolume) => {
|
|
13651
14277
|
const video = videoRef.current;
|
|
13652
14278
|
if (!video) return;
|
|
@@ -13665,7 +14291,7 @@ var VideoPlayer = ({
|
|
|
13665
14291
|
},
|
|
13666
14292
|
[isMuted]
|
|
13667
14293
|
);
|
|
13668
|
-
const toggleMute =
|
|
14294
|
+
const toggleMute = useCallback9(() => {
|
|
13669
14295
|
const video = videoRef.current;
|
|
13670
14296
|
if (!video) return;
|
|
13671
14297
|
if (isMuted) {
|
|
@@ -13679,20 +14305,20 @@ var VideoPlayer = ({
|
|
|
13679
14305
|
setIsMuted(true);
|
|
13680
14306
|
}
|
|
13681
14307
|
}, [isMuted, volume]);
|
|
13682
|
-
const handleSeek =
|
|
14308
|
+
const handleSeek = useCallback9((newTime) => {
|
|
13683
14309
|
const video = videoRef.current;
|
|
13684
14310
|
if (video) {
|
|
13685
14311
|
video.currentTime = newTime;
|
|
13686
14312
|
}
|
|
13687
14313
|
}, []);
|
|
13688
|
-
const isSafariIOS =
|
|
14314
|
+
const isSafariIOS = useCallback9(() => {
|
|
13689
14315
|
const ua = navigator.userAgent;
|
|
13690
14316
|
const isIOS = /iPad|iPhone|iPod/.test(ua);
|
|
13691
14317
|
const isWebKit = /WebKit/.test(ua);
|
|
13692
14318
|
const isNotChrome = !/CriOS|Chrome/.test(ua);
|
|
13693
14319
|
return isIOS && isWebKit && isNotChrome;
|
|
13694
14320
|
}, []);
|
|
13695
|
-
const toggleFullscreen =
|
|
14321
|
+
const toggleFullscreen = useCallback9(() => {
|
|
13696
14322
|
const video = videoRef.current;
|
|
13697
14323
|
const container = video?.parentElement;
|
|
13698
14324
|
if (!video || !container) return;
|
|
@@ -13709,24 +14335,24 @@ var VideoPlayer = ({
|
|
|
13709
14335
|
document.exitFullscreen();
|
|
13710
14336
|
}
|
|
13711
14337
|
}, [isFullscreen, isSafariIOS]);
|
|
13712
|
-
const handleSpeedChange =
|
|
14338
|
+
const handleSpeedChange = useCallback9((speed) => {
|
|
13713
14339
|
if (videoRef.current) {
|
|
13714
14340
|
videoRef.current.playbackRate = speed;
|
|
13715
14341
|
setPlaybackRate(speed);
|
|
13716
14342
|
setShowSpeedMenu(false);
|
|
13717
14343
|
}
|
|
13718
14344
|
}, []);
|
|
13719
|
-
const toggleSpeedMenu =
|
|
14345
|
+
const toggleSpeedMenu = useCallback9(() => {
|
|
13720
14346
|
setShowSpeedMenu(!showSpeedMenu);
|
|
13721
14347
|
}, [showSpeedMenu]);
|
|
13722
|
-
const toggleCaptions =
|
|
14348
|
+
const toggleCaptions = useCallback9(() => {
|
|
13723
14349
|
if (!trackRef.current?.track || !subtitles || subtitlesValidation !== "valid")
|
|
13724
14350
|
return;
|
|
13725
14351
|
const newShowCaptions = !showCaptions;
|
|
13726
14352
|
setShowCaptions(newShowCaptions);
|
|
13727
14353
|
trackRef.current.track.mode = newShowCaptions ? "showing" : "hidden";
|
|
13728
14354
|
}, [showCaptions, subtitles, subtitlesValidation]);
|
|
13729
|
-
const checkVideoCompletion =
|
|
14355
|
+
const checkVideoCompletion = useCallback9(
|
|
13730
14356
|
(progressPercent) => {
|
|
13731
14357
|
if (progressPercent >= 95 && !hasCompleted) {
|
|
13732
14358
|
setHasCompleted(true);
|
|
@@ -13735,7 +14361,7 @@ var VideoPlayer = ({
|
|
|
13735
14361
|
},
|
|
13736
14362
|
[hasCompleted, onVideoComplete]
|
|
13737
14363
|
);
|
|
13738
|
-
const handleTimeUpdate =
|
|
14364
|
+
const handleTimeUpdate = useCallback9(() => {
|
|
13739
14365
|
const video = videoRef.current;
|
|
13740
14366
|
if (!video) return;
|
|
13741
14367
|
const current = video.currentTime;
|
|
@@ -13748,12 +14374,12 @@ var VideoPlayer = ({
|
|
|
13748
14374
|
checkVideoCompletion(progressPercent);
|
|
13749
14375
|
}
|
|
13750
14376
|
}, [duration, saveProgress, onTimeUpdate, onProgress, checkVideoCompletion]);
|
|
13751
|
-
const handleLoadedMetadata =
|
|
14377
|
+
const handleLoadedMetadata = useCallback9(() => {
|
|
13752
14378
|
if (videoRef.current) {
|
|
13753
14379
|
setDuration(videoRef.current.duration);
|
|
13754
14380
|
}
|
|
13755
14381
|
}, []);
|
|
13756
|
-
|
|
14382
|
+
useEffect27(() => {
|
|
13757
14383
|
const controller = new AbortController();
|
|
13758
14384
|
const validateSubtitles = async () => {
|
|
13759
14385
|
if (!subtitles) {
|
|
@@ -13800,12 +14426,12 @@ var VideoPlayer = ({
|
|
|
13800
14426
|
controller.abort();
|
|
13801
14427
|
};
|
|
13802
14428
|
}, [subtitles]);
|
|
13803
|
-
|
|
14429
|
+
useEffect27(() => {
|
|
13804
14430
|
if (trackRef.current?.track) {
|
|
13805
14431
|
trackRef.current.track.mode = showCaptions && subtitles && subtitlesValidation === "valid" ? "showing" : "hidden";
|
|
13806
14432
|
}
|
|
13807
14433
|
}, [subtitles, showCaptions, subtitlesValidation]);
|
|
13808
|
-
|
|
14434
|
+
useEffect27(() => {
|
|
13809
14435
|
const handleVisibilityChange = () => {
|
|
13810
14436
|
if (document.hidden && isPlaying && videoRef.current) {
|
|
13811
14437
|
videoRef.current.pause();
|
|
@@ -13827,54 +14453,54 @@ var VideoPlayer = ({
|
|
|
13827
14453
|
};
|
|
13828
14454
|
}, [isPlaying, clearControlsTimeout]);
|
|
13829
14455
|
const progressPercentage = duration > 0 ? currentTime / duration * 100 : 0;
|
|
13830
|
-
const getIconSize2 =
|
|
14456
|
+
const getIconSize2 = useCallback9(() => {
|
|
13831
14457
|
if (isTinyMobile) return 18;
|
|
13832
14458
|
if (isUltraSmallMobile) return 20;
|
|
13833
14459
|
return 24;
|
|
13834
14460
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13835
|
-
const getControlsPadding =
|
|
14461
|
+
const getControlsPadding = useCallback9(() => {
|
|
13836
14462
|
if (isTinyMobile) return "px-2 pb-2 pt-1";
|
|
13837
14463
|
if (isUltraSmallMobile) return "px-3 pb-3 pt-1";
|
|
13838
14464
|
return "px-4 pb-4";
|
|
13839
14465
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13840
|
-
const getControlsGap =
|
|
14466
|
+
const getControlsGap = useCallback9(() => {
|
|
13841
14467
|
if (isTinyMobile) return "gap-1";
|
|
13842
14468
|
if (isUltraSmallMobile) return "gap-2";
|
|
13843
14469
|
return "gap-4";
|
|
13844
14470
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13845
|
-
const getProgressBarPadding =
|
|
14471
|
+
const getProgressBarPadding = useCallback9(() => {
|
|
13846
14472
|
if (isTinyMobile) return "px-2 pb-1";
|
|
13847
14473
|
if (isUltraSmallMobile) return "px-3 pb-1";
|
|
13848
14474
|
return "px-4 pb-2";
|
|
13849
14475
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13850
|
-
const getCenterPlayButtonPosition =
|
|
14476
|
+
const getCenterPlayButtonPosition = useCallback9(() => {
|
|
13851
14477
|
if (isTinyMobile) return "items-center justify-center -translate-y-12";
|
|
13852
14478
|
if (isUltraSmallMobile) return "items-center justify-center -translate-y-8";
|
|
13853
14479
|
return "items-center justify-center";
|
|
13854
14480
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13855
|
-
const getTopControlsOpacity =
|
|
14481
|
+
const getTopControlsOpacity = useCallback9(() => {
|
|
13856
14482
|
return showControls ? "opacity-100" : "opacity-0";
|
|
13857
14483
|
}, [showControls]);
|
|
13858
|
-
const getBottomControlsOpacity =
|
|
14484
|
+
const getBottomControlsOpacity = useCallback9(() => {
|
|
13859
14485
|
return showControls ? "opacity-100" : "opacity-0";
|
|
13860
14486
|
}, [showControls]);
|
|
13861
|
-
const seekBackward =
|
|
14487
|
+
const seekBackward = useCallback9(() => {
|
|
13862
14488
|
if (videoRef.current) {
|
|
13863
14489
|
videoRef.current.currentTime -= 10;
|
|
13864
14490
|
}
|
|
13865
14491
|
}, []);
|
|
13866
|
-
const seekForward =
|
|
14492
|
+
const seekForward = useCallback9(() => {
|
|
13867
14493
|
if (videoRef.current) {
|
|
13868
14494
|
videoRef.current.currentTime += 10;
|
|
13869
14495
|
}
|
|
13870
14496
|
}, []);
|
|
13871
|
-
const increaseVolume =
|
|
14497
|
+
const increaseVolume = useCallback9(() => {
|
|
13872
14498
|
handleVolumeChange(Math.min(100, volume * 100 + 10));
|
|
13873
14499
|
}, [handleVolumeChange, volume]);
|
|
13874
|
-
const decreaseVolume =
|
|
14500
|
+
const decreaseVolume = useCallback9(() => {
|
|
13875
14501
|
handleVolumeChange(Math.max(0, volume * 100 - 10));
|
|
13876
14502
|
}, [handleVolumeChange, volume]);
|
|
13877
|
-
const handleVideoKeyDown =
|
|
14503
|
+
const handleVideoKeyDown = useCallback9(
|
|
13878
14504
|
(e) => {
|
|
13879
14505
|
if (!e.key) return;
|
|
13880
14506
|
e.stopPropagation();
|
|
@@ -14117,7 +14743,7 @@ var VideoPlayer = ({
|
|
|
14117
14743
|
var VideoPlayer_default = VideoPlayer;
|
|
14118
14744
|
|
|
14119
14745
|
// src/components/Whiteboard/Whiteboard.tsx
|
|
14120
|
-
import { useCallback as
|
|
14746
|
+
import { useCallback as useCallback10, useState as useState29 } from "react";
|
|
14121
14747
|
import { ArrowsOut } from "phosphor-react";
|
|
14122
14748
|
import { Fragment as Fragment13, jsx as jsx66, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
14123
14749
|
var IMAGE_WIDTH = 225;
|
|
@@ -14130,8 +14756,8 @@ var Whiteboard = ({
|
|
|
14130
14756
|
imagesPerRow = 2,
|
|
14131
14757
|
...rest
|
|
14132
14758
|
}) => {
|
|
14133
|
-
const [imageErrors, setImageErrors] =
|
|
14134
|
-
const handleDownload =
|
|
14759
|
+
const [imageErrors, setImageErrors] = useState29(/* @__PURE__ */ new Set());
|
|
14760
|
+
const handleDownload = useCallback10(
|
|
14135
14761
|
(image) => {
|
|
14136
14762
|
if (onDownload) {
|
|
14137
14763
|
onDownload(image);
|
|
@@ -14148,7 +14774,7 @@ var Whiteboard = ({
|
|
|
14148
14774
|
},
|
|
14149
14775
|
[onDownload]
|
|
14150
14776
|
);
|
|
14151
|
-
const handleImageError =
|
|
14777
|
+
const handleImageError = useCallback10((imageId) => {
|
|
14152
14778
|
setImageErrors((prev) => new Set(prev).add(imageId));
|
|
14153
14779
|
}, []);
|
|
14154
14780
|
const gridColsClass = images?.length === 1 ? "grid-cols-1" : {
|
|
@@ -14238,10 +14864,10 @@ var Whiteboard_default = Whiteboard;
|
|
|
14238
14864
|
import {
|
|
14239
14865
|
createContext,
|
|
14240
14866
|
useContext,
|
|
14241
|
-
useEffect as
|
|
14242
|
-
useState as
|
|
14243
|
-
useCallback as
|
|
14244
|
-
useMemo as
|
|
14867
|
+
useEffect as useEffect28,
|
|
14868
|
+
useState as useState30,
|
|
14869
|
+
useCallback as useCallback11,
|
|
14870
|
+
useMemo as useMemo13
|
|
14245
14871
|
} from "react";
|
|
14246
14872
|
import { useLocation, Navigate } from "react-router-dom";
|
|
14247
14873
|
import { Fragment as Fragment14, jsx as jsx67 } from "react/jsx-runtime";
|
|
@@ -14255,12 +14881,12 @@ var AuthProvider = ({
|
|
|
14255
14881
|
getSessionFn,
|
|
14256
14882
|
getTokensFn
|
|
14257
14883
|
}) => {
|
|
14258
|
-
const [authState, setAuthState] =
|
|
14884
|
+
const [authState, setAuthState] = useState30({
|
|
14259
14885
|
isAuthenticated: false,
|
|
14260
14886
|
isLoading: true,
|
|
14261
14887
|
...initialAuthState
|
|
14262
14888
|
});
|
|
14263
|
-
const checkAuth =
|
|
14889
|
+
const checkAuth = useCallback11(async () => {
|
|
14264
14890
|
try {
|
|
14265
14891
|
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
14266
14892
|
if (!checkAuthFn) {
|
|
@@ -14291,7 +14917,7 @@ var AuthProvider = ({
|
|
|
14291
14917
|
return false;
|
|
14292
14918
|
}
|
|
14293
14919
|
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
14294
|
-
const signOut =
|
|
14920
|
+
const signOut = useCallback11(() => {
|
|
14295
14921
|
if (signOutFn) {
|
|
14296
14922
|
signOutFn();
|
|
14297
14923
|
}
|
|
@@ -14303,10 +14929,10 @@ var AuthProvider = ({
|
|
|
14303
14929
|
tokens: void 0
|
|
14304
14930
|
}));
|
|
14305
14931
|
}, [signOutFn]);
|
|
14306
|
-
|
|
14932
|
+
useEffect28(() => {
|
|
14307
14933
|
checkAuth();
|
|
14308
14934
|
}, [checkAuth]);
|
|
14309
|
-
const contextValue =
|
|
14935
|
+
const contextValue = useMemo13(
|
|
14310
14936
|
() => ({
|
|
14311
14937
|
...authState,
|
|
14312
14938
|
checkAuth,
|
|
@@ -14457,7 +15083,7 @@ function createZustandAuthAdapter(useAuthStore2) {
|
|
|
14457
15083
|
}
|
|
14458
15084
|
|
|
14459
15085
|
// src/components/Auth/useUrlAuthentication.ts
|
|
14460
|
-
import { useEffect as
|
|
15086
|
+
import { useEffect as useEffect29, useRef as useRef17 } from "react";
|
|
14461
15087
|
import { useLocation as useLocation2 } from "react-router-dom";
|
|
14462
15088
|
var getAuthParams = (location, extractParams) => {
|
|
14463
15089
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -14505,8 +15131,8 @@ var handleUserData = (responseData, setUser) => {
|
|
|
14505
15131
|
};
|
|
14506
15132
|
function useUrlAuthentication(options) {
|
|
14507
15133
|
const location = useLocation2();
|
|
14508
|
-
const processedRef =
|
|
14509
|
-
|
|
15134
|
+
const processedRef = useRef17(false);
|
|
15135
|
+
useEffect29(() => {
|
|
14510
15136
|
const handleAuthentication = async () => {
|
|
14511
15137
|
if (processedRef.current) {
|
|
14512
15138
|
return;
|
|
@@ -14577,9 +15203,9 @@ function useUrlAuthentication(options) {
|
|
|
14577
15203
|
}
|
|
14578
15204
|
|
|
14579
15205
|
// src/components/Auth/useApiConfig.ts
|
|
14580
|
-
import { useMemo as
|
|
15206
|
+
import { useMemo as useMemo14 } from "react";
|
|
14581
15207
|
function useApiConfig(api) {
|
|
14582
|
-
return
|
|
15208
|
+
return useMemo14(
|
|
14583
15209
|
() => ({
|
|
14584
15210
|
get: (endpoint, config) => api.get(endpoint, config)
|
|
14585
15211
|
}),
|
|
@@ -14597,23 +15223,23 @@ import {
|
|
|
14597
15223
|
} from "phosphor-react";
|
|
14598
15224
|
import {
|
|
14599
15225
|
forwardRef as forwardRef22,
|
|
14600
|
-
useEffect as
|
|
14601
|
-
useState as
|
|
15226
|
+
useEffect as useEffect32,
|
|
15227
|
+
useState as useState33
|
|
14602
15228
|
} from "react";
|
|
14603
15229
|
|
|
14604
15230
|
// src/components/Quiz/QuizContent.tsx
|
|
14605
15231
|
import {
|
|
14606
15232
|
forwardRef as forwardRef21,
|
|
14607
|
-
useCallback as
|
|
14608
|
-
useEffect as
|
|
15233
|
+
useCallback as useCallback12,
|
|
15234
|
+
useEffect as useEffect31,
|
|
14609
15235
|
useId as useId11,
|
|
14610
|
-
useMemo as
|
|
14611
|
-
useRef as
|
|
14612
|
-
useState as
|
|
15236
|
+
useMemo as useMemo15,
|
|
15237
|
+
useRef as useRef18,
|
|
15238
|
+
useState as useState32
|
|
14613
15239
|
} from "react";
|
|
14614
15240
|
|
|
14615
15241
|
// src/components/MultipleChoice/MultipleChoice.tsx
|
|
14616
|
-
import { useEffect as
|
|
15242
|
+
import { useEffect as useEffect30, useState as useState31 } from "react";
|
|
14617
15243
|
import { CheckCircle as CheckCircle5, XCircle as XCircle4, Check as Check5 } from "phosphor-react";
|
|
14618
15244
|
import { jsx as jsx68, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14619
15245
|
var MultipleChoiceList = ({
|
|
@@ -14625,8 +15251,8 @@ var MultipleChoiceList = ({
|
|
|
14625
15251
|
onHandleSelectedValues,
|
|
14626
15252
|
mode = "interactive"
|
|
14627
15253
|
}) => {
|
|
14628
|
-
const [actualValue, setActualValue] =
|
|
14629
|
-
|
|
15254
|
+
const [actualValue, setActualValue] = useState31(selectedValues);
|
|
15255
|
+
useEffect30(() => {
|
|
14630
15256
|
setActualValue(selectedValues);
|
|
14631
15257
|
}, [selectedValues]);
|
|
14632
15258
|
const getStatusBadge2 = (status) => {
|
|
@@ -14865,15 +15491,15 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
14865
15491
|
const currentQuestionResult = getQuestionResultByQuestionId(
|
|
14866
15492
|
currentQuestion?.id || ""
|
|
14867
15493
|
);
|
|
14868
|
-
const prevSelectedValuesRef =
|
|
14869
|
-
const prevQuestionIdRef =
|
|
14870
|
-
const allCurrentAnswerIds =
|
|
15494
|
+
const prevSelectedValuesRef = useRef18([]);
|
|
15495
|
+
const prevQuestionIdRef = useRef18("");
|
|
15496
|
+
const allCurrentAnswerIds = useMemo15(() => {
|
|
14871
15497
|
return allCurrentAnswers?.map((answer) => answer.optionId) || [];
|
|
14872
15498
|
}, [allCurrentAnswers]);
|
|
14873
|
-
const selectedValues =
|
|
15499
|
+
const selectedValues = useMemo15(() => {
|
|
14874
15500
|
return allCurrentAnswerIds?.filter((id) => id !== null) || [];
|
|
14875
15501
|
}, [allCurrentAnswerIds]);
|
|
14876
|
-
const stableSelectedValues =
|
|
15502
|
+
const stableSelectedValues = useMemo15(() => {
|
|
14877
15503
|
const currentQuestionId = currentQuestion?.id || "";
|
|
14878
15504
|
const hasQuestionChanged = prevQuestionIdRef.current !== currentQuestionId;
|
|
14879
15505
|
if (hasQuestionChanged) {
|
|
@@ -14897,7 +15523,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
14897
15523
|
variant,
|
|
14898
15524
|
currentQuestionResult?.selectedOptions
|
|
14899
15525
|
]);
|
|
14900
|
-
const handleSelectedValues =
|
|
15526
|
+
const handleSelectedValues = useCallback12(
|
|
14901
15527
|
(values) => {
|
|
14902
15528
|
if (currentQuestion) {
|
|
14903
15529
|
selectMultipleAnswer(currentQuestion.id, values);
|
|
@@ -14905,7 +15531,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
14905
15531
|
},
|
|
14906
15532
|
[currentQuestion, selectMultipleAnswer]
|
|
14907
15533
|
);
|
|
14908
|
-
const questionKey =
|
|
15534
|
+
const questionKey = useMemo15(
|
|
14909
15535
|
() => `question-${currentQuestion?.id || "1"}`,
|
|
14910
15536
|
[currentQuestion?.id]
|
|
14911
15537
|
);
|
|
@@ -14966,14 +15592,14 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
14966
15592
|
currentQuestion?.id || ""
|
|
14967
15593
|
);
|
|
14968
15594
|
const currentAnswer = getCurrentAnswer();
|
|
14969
|
-
const textareaRef =
|
|
15595
|
+
const textareaRef = useRef18(null);
|
|
14970
15596
|
const charLimit = getDissertativeCharLimit();
|
|
14971
15597
|
const handleAnswerChange = (value) => {
|
|
14972
15598
|
if (currentQuestion) {
|
|
14973
15599
|
selectDissertativeAnswer(currentQuestion.id, value);
|
|
14974
15600
|
}
|
|
14975
15601
|
};
|
|
14976
|
-
const adjustTextareaHeight =
|
|
15602
|
+
const adjustTextareaHeight = useCallback12(() => {
|
|
14977
15603
|
if (textareaRef.current) {
|
|
14978
15604
|
textareaRef.current.style.height = "auto";
|
|
14979
15605
|
const scrollHeight = textareaRef.current.scrollHeight;
|
|
@@ -14983,7 +15609,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
14983
15609
|
textareaRef.current.style.height = `${newHeight}px`;
|
|
14984
15610
|
}
|
|
14985
15611
|
}, []);
|
|
14986
|
-
|
|
15612
|
+
useEffect31(() => {
|
|
14987
15613
|
adjustTextareaHeight();
|
|
14988
15614
|
}, [currentAnswer, adjustTextareaHeight]);
|
|
14989
15615
|
if (!currentQuestion) {
|
|
@@ -15124,7 +15750,7 @@ var QuizConnectDots = ({ paddingBottom }) => {
|
|
|
15124
15750
|
isCorrect: false
|
|
15125
15751
|
}
|
|
15126
15752
|
];
|
|
15127
|
-
const [userAnswers, setUserAnswers] =
|
|
15753
|
+
const [userAnswers, setUserAnswers] = useState32(() => {
|
|
15128
15754
|
if (variant === "result") {
|
|
15129
15755
|
return mockUserAnswers;
|
|
15130
15756
|
}
|
|
@@ -15243,7 +15869,7 @@ var QuizFill = ({ paddingBottom }) => {
|
|
|
15243
15869
|
isCorrect: true
|
|
15244
15870
|
}
|
|
15245
15871
|
];
|
|
15246
|
-
const [answers, setAnswers] =
|
|
15872
|
+
const [answers, setAnswers] = useState32({});
|
|
15247
15873
|
const baseId = useId11();
|
|
15248
15874
|
const getAvailableOptionsForSelect = (selectId) => {
|
|
15249
15875
|
const usedOptions = new Set(
|
|
@@ -15383,7 +16009,7 @@ var QuizImageQuestion = ({ paddingBottom }) => {
|
|
|
15383
16009
|
};
|
|
15384
16010
|
const correctRadiusRelative = calculateCorrectRadiusRelative();
|
|
15385
16011
|
const mockUserAnswerRelative = { x: 0.72, y: 0.348 };
|
|
15386
|
-
const [clickPositionRelative, setClickPositionRelative] =
|
|
16012
|
+
const [clickPositionRelative, setClickPositionRelative] = useState32(variant == "result" ? mockUserAnswerRelative : null);
|
|
15387
16013
|
const convertToRelativeCoordinates = (x, y, rect) => {
|
|
15388
16014
|
const safeWidth = Math.max(rect.width, 1e-3);
|
|
15389
16015
|
const safeHeight = Math.max(rect.height, 1e-3);
|
|
@@ -15551,7 +16177,7 @@ var getFinishConfirmationText = (type) => {
|
|
|
15551
16177
|
};
|
|
15552
16178
|
var Quiz = forwardRef22(({ children, className, variant = "default", ...props }, ref) => {
|
|
15553
16179
|
const { setVariant } = useQuizStore();
|
|
15554
|
-
|
|
16180
|
+
useEffect32(() => {
|
|
15555
16181
|
setVariant(variant);
|
|
15556
16182
|
}, [variant, setVariant]);
|
|
15557
16183
|
return /* @__PURE__ */ jsx70("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
@@ -15566,7 +16192,7 @@ var QuizTitle = forwardRef22(({ className, onBack, ...props }, ref) => {
|
|
|
15566
16192
|
formatTime: formatTime2,
|
|
15567
16193
|
isStarted
|
|
15568
16194
|
} = useQuizStore();
|
|
15569
|
-
const [showExitConfirmation, setShowExitConfirmation] =
|
|
16195
|
+
const [showExitConfirmation, setShowExitConfirmation] = useState33(false);
|
|
15570
16196
|
const totalQuestions = getTotalQuestions();
|
|
15571
16197
|
const quizTitle = getQuizTitle();
|
|
15572
16198
|
const handleBackClick = () => {
|
|
@@ -15769,8 +16395,8 @@ var QuizFooter = forwardRef22(
|
|
|
15769
16395
|
const currentAnswer = getCurrentAnswer();
|
|
15770
16396
|
const currentQuestion = getCurrentQuestion();
|
|
15771
16397
|
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
15772
|
-
const [activeModal, setActiveModal] =
|
|
15773
|
-
const [filterType, setFilterType] =
|
|
16398
|
+
const [activeModal, setActiveModal] = useState33(null);
|
|
16399
|
+
const [filterType, setFilterType] = useState33("all");
|
|
15774
16400
|
const openModal = (modalName) => setActiveModal(modalName);
|
|
15775
16401
|
const closeModal = () => setActiveModal(null);
|
|
15776
16402
|
const isModalOpen = (modalName) => activeModal === modalName;
|
|
@@ -16112,7 +16738,7 @@ var QuizFooter = forwardRef22(
|
|
|
16112
16738
|
);
|
|
16113
16739
|
|
|
16114
16740
|
// src/components/Quiz/QuizResult.tsx
|
|
16115
|
-
import { forwardRef as forwardRef23, useEffect as
|
|
16741
|
+
import { forwardRef as forwardRef23, useEffect as useEffect33, useState as useState34 } from "react";
|
|
16116
16742
|
import { Clock as Clock3 } from "phosphor-react";
|
|
16117
16743
|
import { jsx as jsx71, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
16118
16744
|
var QuizBadge = ({
|
|
@@ -16141,8 +16767,8 @@ var QuizHeaderResult = forwardRef23(
|
|
|
16141
16767
|
getCurrentQuestion,
|
|
16142
16768
|
questionsResult
|
|
16143
16769
|
} = useQuizStore();
|
|
16144
|
-
const [status, setStatus] =
|
|
16145
|
-
|
|
16770
|
+
const [status, setStatus] = useState34(void 0);
|
|
16771
|
+
useEffect33(() => {
|
|
16146
16772
|
const cq = getCurrentQuestion();
|
|
16147
16773
|
if (!cq) {
|
|
16148
16774
|
setStatus(void 0);
|
|
@@ -16515,7 +17141,7 @@ var BreadcrumbMenu = ({
|
|
|
16515
17141
|
};
|
|
16516
17142
|
|
|
16517
17143
|
// src/components/BreadcrumbMenu/useBreadcrumbBuilder.ts
|
|
16518
|
-
import { useEffect as
|
|
17144
|
+
import { useEffect as useEffect34 } from "react";
|
|
16519
17145
|
|
|
16520
17146
|
// src/components/BreadcrumbMenu/breadcrumbStore.ts
|
|
16521
17147
|
import { create as create12 } from "zustand";
|
|
@@ -16644,7 +17270,7 @@ var useBreadcrumbBuilder = (config) => {
|
|
|
16644
17270
|
(level) => isBreadcrumbWithData(level) ? level.data : null
|
|
16645
17271
|
);
|
|
16646
17272
|
const levelUrlIds = levels.map((level) => level.urlId);
|
|
16647
|
-
|
|
17273
|
+
useEffect34(() => {
|
|
16648
17274
|
const newBreadcrumbs = [root];
|
|
16649
17275
|
const previousIds = [];
|
|
16650
17276
|
for (const level of levels) {
|
|
@@ -16676,11 +17302,11 @@ var useBreadcrumbBuilder = (config) => {
|
|
|
16676
17302
|
};
|
|
16677
17303
|
|
|
16678
17304
|
// src/components/BreadcrumbMenu/useUrlParams.ts
|
|
16679
|
-
import { useMemo as
|
|
17305
|
+
import { useMemo as useMemo16 } from "react";
|
|
16680
17306
|
import { useLocation as useLocation3 } from "react-router-dom";
|
|
16681
17307
|
var useUrlParams = (config) => {
|
|
16682
17308
|
const location = useLocation3();
|
|
16683
|
-
return
|
|
17309
|
+
return useMemo16(() => {
|
|
16684
17310
|
const segments = location.pathname.split("/").filter(Boolean);
|
|
16685
17311
|
const params = {};
|
|
16686
17312
|
for (const [key, index] of Object.entries(config)) {
|
|
@@ -16691,15 +17317,15 @@ var useUrlParams = (config) => {
|
|
|
16691
17317
|
};
|
|
16692
17318
|
|
|
16693
17319
|
// src/hooks/useAppInitialization.ts
|
|
16694
|
-
import { useMemo as
|
|
17320
|
+
import { useMemo as useMemo17 } from "react";
|
|
16695
17321
|
|
|
16696
17322
|
// src/hooks/useInstitution.ts
|
|
16697
|
-
import { useEffect as
|
|
17323
|
+
import { useEffect as useEffect35, useState as useState35 } from "react";
|
|
16698
17324
|
function useInstitutionId() {
|
|
16699
|
-
const [institutionId, setInstitutionId] =
|
|
17325
|
+
const [institutionId, setInstitutionId] = useState35(() => {
|
|
16700
17326
|
return document.querySelector('meta[name="institution-id"]')?.getAttribute("content") ?? null;
|
|
16701
17327
|
});
|
|
16702
|
-
|
|
17328
|
+
useEffect35(() => {
|
|
16703
17329
|
const metaTag = document.querySelector('meta[name="institution-id"]');
|
|
16704
17330
|
if (!metaTag) return;
|
|
16705
17331
|
const observer = new MutationObserver(() => {
|
|
@@ -16866,7 +17492,7 @@ var useAuthStore = create14()(
|
|
|
16866
17492
|
function useAppInitialization() {
|
|
16867
17493
|
const getInstitutionId = useInstitutionId();
|
|
16868
17494
|
const { initialize, initialized, institutionId } = useAppStore();
|
|
16869
|
-
const authFunctions =
|
|
17495
|
+
const authFunctions = useMemo17(
|
|
16870
17496
|
() => ({
|
|
16871
17497
|
checkAuth: async () => {
|
|
16872
17498
|
const { sessionInfo, tokens } = useAuthStore.getState();
|
|
@@ -16903,7 +17529,7 @@ function useAppInitialization() {
|
|
|
16903
17529
|
}
|
|
16904
17530
|
|
|
16905
17531
|
// src/hooks/useAppContent.ts
|
|
16906
|
-
import { useCallback as
|
|
17532
|
+
import { useCallback as useCallback13, useEffect as useEffect36, useMemo as useMemo18 } from "react";
|
|
16907
17533
|
import { useNavigate as useNavigate2 } from "react-router-dom";
|
|
16908
17534
|
function useAppContent(config) {
|
|
16909
17535
|
const navigate = useNavigate2();
|
|
@@ -16929,20 +17555,20 @@ function useAppContent(config) {
|
|
|
16929
17555
|
navigate("/painel");
|
|
16930
17556
|
}
|
|
16931
17557
|
};
|
|
16932
|
-
const handleSetSelectedProfile =
|
|
17558
|
+
const handleSetSelectedProfile = useCallback13(
|
|
16933
17559
|
(profile) => {
|
|
16934
17560
|
setSelectedProfile(profile);
|
|
16935
17561
|
},
|
|
16936
17562
|
[setSelectedProfile]
|
|
16937
17563
|
);
|
|
16938
|
-
const handleClearParamsFromURL =
|
|
17564
|
+
const handleClearParamsFromURL = useCallback13(() => {
|
|
16939
17565
|
if (onClearParamsFromURL) {
|
|
16940
17566
|
onClearParamsFromURL();
|
|
16941
17567
|
} else {
|
|
16942
17568
|
globalThis.location.replace("/painel");
|
|
16943
17569
|
}
|
|
16944
17570
|
}, [onClearParamsFromURL]);
|
|
16945
|
-
const handleError =
|
|
17571
|
+
const handleError = useCallback13(
|
|
16946
17572
|
(error) => {
|
|
16947
17573
|
if (onError) {
|
|
16948
17574
|
onError(error);
|
|
@@ -16953,7 +17579,7 @@ function useAppContent(config) {
|
|
|
16953
17579
|
},
|
|
16954
17580
|
[navigate, onError]
|
|
16955
17581
|
);
|
|
16956
|
-
const urlAuthConfig =
|
|
17582
|
+
const urlAuthConfig = useMemo18(
|
|
16957
17583
|
() => ({
|
|
16958
17584
|
setTokens,
|
|
16959
17585
|
setSessionInfo,
|
|
@@ -16979,10 +17605,10 @@ function useAppContent(config) {
|
|
|
16979
17605
|
);
|
|
16980
17606
|
useUrlAuthentication(urlAuthConfig);
|
|
16981
17607
|
const { sessionInfo } = useAuth();
|
|
16982
|
-
const institutionIdToUse =
|
|
17608
|
+
const institutionIdToUse = useMemo18(() => {
|
|
16983
17609
|
return sessionInfo?.institutionId || getInstitutionId;
|
|
16984
17610
|
}, [sessionInfo?.institutionId, getInstitutionId]);
|
|
16985
|
-
|
|
17611
|
+
useEffect36(() => {
|
|
16986
17612
|
if (institutionIdToUse && !initialized) {
|
|
16987
17613
|
initialize(institutionIdToUse);
|
|
16988
17614
|
}
|
|
@@ -16994,9 +17620,30 @@ function useAppContent(config) {
|
|
|
16994
17620
|
};
|
|
16995
17621
|
}
|
|
16996
17622
|
|
|
17623
|
+
// src/store/questionFiltersStore.ts
|
|
17624
|
+
import { create as create15 } from "zustand";
|
|
17625
|
+
var useQuestionFiltersStore = create15((set) => ({
|
|
17626
|
+
draftFilters: null,
|
|
17627
|
+
appliedFilters: null,
|
|
17628
|
+
setDraftFilters: (filters) => {
|
|
17629
|
+
set({ draftFilters: filters });
|
|
17630
|
+
},
|
|
17631
|
+
applyFilters: () => {
|
|
17632
|
+
set((state) => ({
|
|
17633
|
+
appliedFilters: state.draftFilters
|
|
17634
|
+
}));
|
|
17635
|
+
},
|
|
17636
|
+
clearFilters: () => {
|
|
17637
|
+
set({
|
|
17638
|
+
draftFilters: null,
|
|
17639
|
+
appliedFilters: null
|
|
17640
|
+
});
|
|
17641
|
+
}
|
|
17642
|
+
}));
|
|
17643
|
+
|
|
16997
17644
|
// src/components/ActivityCardQuestionBanks/ActivityCardQuestionBanks.tsx
|
|
16998
17645
|
import { Plus as Plus2, CheckCircle as CheckCircle7, XCircle as XCircle6 } from "phosphor-react";
|
|
16999
|
-
import { useMemo as
|
|
17646
|
+
import { useMemo as useMemo19 } from "react";
|
|
17000
17647
|
import { jsx as jsx73, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
17001
17648
|
var ActivityCardQuestionBanks = ({
|
|
17002
17649
|
question,
|
|
@@ -17008,7 +17655,7 @@ var ActivityCardQuestionBanks = ({
|
|
|
17008
17655
|
assunto,
|
|
17009
17656
|
enunciado
|
|
17010
17657
|
} = {}) => {
|
|
17011
|
-
const alternatives =
|
|
17658
|
+
const alternatives = useMemo19(() => {
|
|
17012
17659
|
if (!question?.options || questionType !== "ALTERNATIVA" /* ALTERNATIVA */)
|
|
17013
17660
|
return [];
|
|
17014
17661
|
const correctOptionIds2 = question.correctOptionIds || [];
|
|
@@ -17022,13 +17669,13 @@ var ActivityCardQuestionBanks = ({
|
|
|
17022
17669
|
};
|
|
17023
17670
|
});
|
|
17024
17671
|
}, [question, questionType]);
|
|
17025
|
-
const correctOptionId =
|
|
17672
|
+
const correctOptionId = useMemo19(() => {
|
|
17026
17673
|
if (!question?.correctOptionIds || question.correctOptionIds.length === 0) {
|
|
17027
17674
|
return void 0;
|
|
17028
17675
|
}
|
|
17029
17676
|
return question.correctOptionIds[0];
|
|
17030
17677
|
}, [question]);
|
|
17031
|
-
const multipleChoices =
|
|
17678
|
+
const multipleChoices = useMemo19(() => {
|
|
17032
17679
|
if (!question?.options || questionType !== "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */)
|
|
17033
17680
|
return [];
|
|
17034
17681
|
const correctOptionIds2 = question.correctOptionIds || [];
|
|
@@ -17042,7 +17689,7 @@ var ActivityCardQuestionBanks = ({
|
|
|
17042
17689
|
};
|
|
17043
17690
|
});
|
|
17044
17691
|
}, [question, questionType]);
|
|
17045
|
-
const correctOptionIds =
|
|
17692
|
+
const correctOptionIds = useMemo19(() => {
|
|
17046
17693
|
return question?.correctOptionIds || [];
|
|
17047
17694
|
}, [question]);
|
|
17048
17695
|
const getStatusBadge2 = (status) => {
|
|
@@ -17225,7 +17872,7 @@ var formatDateToBrazilian = (dateString) => {
|
|
|
17225
17872
|
};
|
|
17226
17873
|
|
|
17227
17874
|
// src/components/ActivityDetails/ActivityDetails.tsx
|
|
17228
|
-
import { useState as
|
|
17875
|
+
import { useState as useState36, useMemo as useMemo20, useCallback as useCallback14, useEffect as useEffect37 } from "react";
|
|
17229
17876
|
import { Medal as Medal2, Star as Star2, File as File2, CaretRight as CaretRight9, WarningCircle as WarningCircle7 } from "phosphor-react";
|
|
17230
17877
|
import { Fragment as Fragment17, jsx as jsx74, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
17231
17878
|
var createTableColumns = (onCorrectActivity) => [
|
|
@@ -17323,20 +17970,20 @@ var ActivityDetails = ({
|
|
|
17323
17970
|
mapSubjectNameToEnum
|
|
17324
17971
|
}) => {
|
|
17325
17972
|
const { isMobile } = useMobile();
|
|
17326
|
-
const [page, setPage] =
|
|
17327
|
-
const [limit, setLimit] =
|
|
17328
|
-
const [sortBy, setSortBy] =
|
|
17329
|
-
const [sortOrder, setSortOrder] =
|
|
17973
|
+
const [page, setPage] = useState36(1);
|
|
17974
|
+
const [limit, setLimit] = useState36(10);
|
|
17975
|
+
const [sortBy, setSortBy] = useState36(void 0);
|
|
17976
|
+
const [sortOrder, setSortOrder] = useState36(
|
|
17330
17977
|
void 0
|
|
17331
17978
|
);
|
|
17332
|
-
const [data, setData] =
|
|
17333
|
-
const [correctionData, setCorrectionData] =
|
|
17334
|
-
const [loading, setLoading] =
|
|
17335
|
-
const [error, setError] =
|
|
17336
|
-
const [isModalOpen, setIsModalOpen] =
|
|
17337
|
-
const [isViewOnlyModal, setIsViewOnlyModal] =
|
|
17338
|
-
const [correctionError, setCorrectionError] =
|
|
17339
|
-
|
|
17979
|
+
const [data, setData] = useState36(null);
|
|
17980
|
+
const [correctionData, setCorrectionData] = useState36(null);
|
|
17981
|
+
const [loading, setLoading] = useState36(true);
|
|
17982
|
+
const [error, setError] = useState36(null);
|
|
17983
|
+
const [isModalOpen, setIsModalOpen] = useState36(false);
|
|
17984
|
+
const [isViewOnlyModal, setIsViewOnlyModal] = useState36(false);
|
|
17985
|
+
const [correctionError, setCorrectionError] = useState36(null);
|
|
17986
|
+
useEffect37(() => {
|
|
17340
17987
|
const loadData = async () => {
|
|
17341
17988
|
if (!activityId) return;
|
|
17342
17989
|
setLoading(true);
|
|
@@ -17359,7 +18006,7 @@ var ActivityDetails = ({
|
|
|
17359
18006
|
};
|
|
17360
18007
|
loadData();
|
|
17361
18008
|
}, [activityId, page, limit, sortBy, sortOrder, fetchActivityDetails]);
|
|
17362
|
-
const handleCorrectActivity =
|
|
18009
|
+
const handleCorrectActivity = useCallback14(
|
|
17363
18010
|
async (studentId) => {
|
|
17364
18011
|
const student = data?.students.find((s) => s.studentId === studentId);
|
|
17365
18012
|
if (!student || !activityId) return;
|
|
@@ -17379,10 +18026,10 @@ var ActivityDetails = ({
|
|
|
17379
18026
|
},
|
|
17380
18027
|
[data?.students, activityId, fetchStudentCorrection]
|
|
17381
18028
|
);
|
|
17382
|
-
const handleCloseModal =
|
|
18029
|
+
const handleCloseModal = useCallback14(() => {
|
|
17383
18030
|
setIsModalOpen(false);
|
|
17384
18031
|
}, []);
|
|
17385
|
-
const handleObservationSubmit =
|
|
18032
|
+
const handleObservationSubmit = useCallback14(
|
|
17386
18033
|
async (observation, files) => {
|
|
17387
18034
|
if (!activityId || !correctionData?.studentId) return;
|
|
17388
18035
|
try {
|
|
@@ -17399,7 +18046,7 @@ var ActivityDetails = ({
|
|
|
17399
18046
|
},
|
|
17400
18047
|
[activityId, correctionData?.studentId, submitObservation]
|
|
17401
18048
|
);
|
|
17402
|
-
const tableData =
|
|
18049
|
+
const tableData = useMemo20(() => {
|
|
17403
18050
|
if (!data?.students) return [];
|
|
17404
18051
|
return data.students.map((student) => ({
|
|
17405
18052
|
id: student.studentId,
|
|
@@ -17411,7 +18058,7 @@ var ActivityDetails = ({
|
|
|
17411
18058
|
score: student.score
|
|
17412
18059
|
}));
|
|
17413
18060
|
}, [data?.students]);
|
|
17414
|
-
const columns =
|
|
18061
|
+
const columns = useMemo20(
|
|
17415
18062
|
() => createTableColumns(handleCorrectActivity),
|
|
17416
18063
|
[handleCorrectActivity]
|
|
17417
18064
|
);
|
|
@@ -17668,7 +18315,7 @@ var ActivityDetails = ({
|
|
|
17668
18315
|
};
|
|
17669
18316
|
|
|
17670
18317
|
// src/components/Support/Support.tsx
|
|
17671
|
-
import { useState as
|
|
18318
|
+
import { useState as useState38, useEffect as useEffect39 } from "react";
|
|
17672
18319
|
import { useForm } from "react-hook-form";
|
|
17673
18320
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
17674
18321
|
import {
|
|
@@ -17699,7 +18346,7 @@ var supportSchema = z.object({
|
|
|
17699
18346
|
});
|
|
17700
18347
|
|
|
17701
18348
|
// src/components/Support/components/TicketModal.tsx
|
|
17702
|
-
import { useState as
|
|
18349
|
+
import { useState as useState37, useEffect as useEffect38, useCallback as useCallback15 } from "react";
|
|
17703
18350
|
import dayjs from "dayjs";
|
|
17704
18351
|
import "dayjs/locale/pt-br";
|
|
17705
18352
|
|
|
@@ -17821,17 +18468,17 @@ var TicketModal = ({
|
|
|
17821
18468
|
apiClient,
|
|
17822
18469
|
userId
|
|
17823
18470
|
}) => {
|
|
17824
|
-
const [showCloseConfirmation, setShowCloseConfirmation] =
|
|
17825
|
-
const [responseText, setResponseText] =
|
|
17826
|
-
const [answers, setAnswers] =
|
|
17827
|
-
const [isSubmittingAnswer, setIsSubmittingAnswer] =
|
|
17828
|
-
const [isLoadingAnswers, setIsLoadingAnswers] =
|
|
18471
|
+
const [showCloseConfirmation, setShowCloseConfirmation] = useState37(false);
|
|
18472
|
+
const [responseText, setResponseText] = useState37("");
|
|
18473
|
+
const [answers, setAnswers] = useState37([]);
|
|
18474
|
+
const [isSubmittingAnswer, setIsSubmittingAnswer] = useState37(false);
|
|
18475
|
+
const [isLoadingAnswers, setIsLoadingAnswers] = useState37(false);
|
|
17829
18476
|
const handleCloseTicket = () => {
|
|
17830
18477
|
onTicketClose?.(ticket.id);
|
|
17831
18478
|
setShowCloseConfirmation(false);
|
|
17832
18479
|
onClose();
|
|
17833
18480
|
};
|
|
17834
|
-
const fetchAnswers =
|
|
18481
|
+
const fetchAnswers = useCallback15(async () => {
|
|
17835
18482
|
if (!ticket.id || ticket.status !== "respondido" /* RESPONDIDO */) return;
|
|
17836
18483
|
setIsLoadingAnswers(true);
|
|
17837
18484
|
try {
|
|
@@ -17870,7 +18517,7 @@ var TicketModal = ({
|
|
|
17870
18517
|
}
|
|
17871
18518
|
};
|
|
17872
18519
|
const canCloseTicket = ticket.status !== "encerrado" /* ENCERRADO */;
|
|
17873
|
-
|
|
18520
|
+
useEffect38(() => {
|
|
17874
18521
|
if (isOpen) {
|
|
17875
18522
|
setResponseText("");
|
|
17876
18523
|
(async () => {
|
|
@@ -18253,21 +18900,21 @@ var Support = ({
|
|
|
18253
18900
|
onTicketCreated,
|
|
18254
18901
|
onTicketClosed
|
|
18255
18902
|
}) => {
|
|
18256
|
-
const [activeTab, setActiveTab] =
|
|
18257
|
-
const [selectedProblem, setSelectedProblem] =
|
|
18258
|
-
const [statusFilter, setStatusFilter] =
|
|
18259
|
-
const [categoryFilter, setCategoryFilter] =
|
|
18260
|
-
const [selectedTicket, setSelectedTicket] =
|
|
18903
|
+
const [activeTab, setActiveTab] = useState38("criar-pedido");
|
|
18904
|
+
const [selectedProblem, setSelectedProblem] = useState38(null);
|
|
18905
|
+
const [statusFilter, setStatusFilter] = useState38("todos");
|
|
18906
|
+
const [categoryFilter, setCategoryFilter] = useState38("todos");
|
|
18907
|
+
const [selectedTicket, setSelectedTicket] = useState38(
|
|
18261
18908
|
null
|
|
18262
18909
|
);
|
|
18263
|
-
const [isModalOpen, setIsModalOpen] =
|
|
18264
|
-
const [submitError, setSubmitError] =
|
|
18265
|
-
const [showSuccessToast, setShowSuccessToast] =
|
|
18266
|
-
const [showCloseSuccessToast, setShowCloseSuccessToast] =
|
|
18267
|
-
const [showCloseErrorToast, setShowCloseErrorToast] =
|
|
18268
|
-
const [allTickets, setAllTickets] =
|
|
18269
|
-
const [loadingTickets, setLoadingTickets] =
|
|
18270
|
-
const [currentPage, setCurrentPage] =
|
|
18910
|
+
const [isModalOpen, setIsModalOpen] = useState38(false);
|
|
18911
|
+
const [submitError, setSubmitError] = useState38(null);
|
|
18912
|
+
const [showSuccessToast, setShowSuccessToast] = useState38(false);
|
|
18913
|
+
const [showCloseSuccessToast, setShowCloseSuccessToast] = useState38(false);
|
|
18914
|
+
const [showCloseErrorToast, setShowCloseErrorToast] = useState38(false);
|
|
18915
|
+
const [allTickets, setAllTickets] = useState38([]);
|
|
18916
|
+
const [loadingTickets, setLoadingTickets] = useState38(false);
|
|
18917
|
+
const [currentPage, setCurrentPage] = useState38(1);
|
|
18271
18918
|
const ITEMS_PER_PAGE = 10;
|
|
18272
18919
|
const handlePrevPage = () => {
|
|
18273
18920
|
if (currentPage > 1) {
|
|
@@ -18280,13 +18927,13 @@ var Support = ({
|
|
|
18280
18927
|
setCurrentPage(currentPage + 1);
|
|
18281
18928
|
}
|
|
18282
18929
|
};
|
|
18283
|
-
|
|
18930
|
+
useEffect39(() => {
|
|
18284
18931
|
if (activeTab === "historico") {
|
|
18285
18932
|
fetchTickets(statusFilter);
|
|
18286
18933
|
setCurrentPage(1);
|
|
18287
18934
|
}
|
|
18288
18935
|
}, [activeTab, statusFilter]);
|
|
18289
|
-
|
|
18936
|
+
useEffect39(() => {
|
|
18290
18937
|
setCurrentPage(1);
|
|
18291
18938
|
}, [categoryFilter]);
|
|
18292
18939
|
const convertApiTicketToComponent = (apiTicket) => {
|
|
@@ -18796,10 +19443,14 @@ export {
|
|
|
18796
19443
|
VideoPlayer_default as VideoPlayer,
|
|
18797
19444
|
Whiteboard_default as Whiteboard,
|
|
18798
19445
|
cn,
|
|
19446
|
+
createActivityFiltersDataHook,
|
|
18799
19447
|
createNotificationStore,
|
|
18800
19448
|
createNotificationsHook,
|
|
19449
|
+
createQuestionsListHook,
|
|
19450
|
+
createUseActivityFiltersData,
|
|
18801
19451
|
createUseNotificationStore,
|
|
18802
19452
|
createUseNotifications,
|
|
19453
|
+
createUseQuestionsList,
|
|
18803
19454
|
createZustandAuthAdapter,
|
|
18804
19455
|
formatDateToBrazilian,
|
|
18805
19456
|
formatFileSize,
|
|
@@ -18841,6 +19492,7 @@ export {
|
|
|
18841
19492
|
useBreadcrumbBuilder,
|
|
18842
19493
|
useInstitutionId,
|
|
18843
19494
|
useMobile,
|
|
19495
|
+
useQuestionFiltersStore,
|
|
18844
19496
|
useQuizStore,
|
|
18845
19497
|
useRouteAuth,
|
|
18846
19498
|
useTableFilter,
|