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.js
CHANGED
|
@@ -172,10 +172,14 @@ __export(src_exports, {
|
|
|
172
172
|
VideoPlayer: () => VideoPlayer_default,
|
|
173
173
|
Whiteboard: () => Whiteboard_default,
|
|
174
174
|
cn: () => cn,
|
|
175
|
+
createActivityFiltersDataHook: () => createActivityFiltersDataHook,
|
|
175
176
|
createNotificationStore: () => createNotificationStore,
|
|
176
177
|
createNotificationsHook: () => createNotificationsHook,
|
|
178
|
+
createQuestionsListHook: () => createQuestionsListHook,
|
|
179
|
+
createUseActivityFiltersData: () => createUseActivityFiltersData,
|
|
177
180
|
createUseNotificationStore: () => createUseNotificationStore,
|
|
178
181
|
createUseNotifications: () => createUseNotifications,
|
|
182
|
+
createUseQuestionsList: () => createUseQuestionsList,
|
|
179
183
|
createZustandAuthAdapter: () => createZustandAuthAdapter,
|
|
180
184
|
formatDateToBrazilian: () => formatDateToBrazilian,
|
|
181
185
|
formatFileSize: () => formatFileSize,
|
|
@@ -217,6 +221,7 @@ __export(src_exports, {
|
|
|
217
221
|
useBreadcrumbBuilder: () => useBreadcrumbBuilder,
|
|
218
222
|
useInstitutionId: () => useInstitutionId,
|
|
219
223
|
useMobile: () => useMobile,
|
|
224
|
+
useQuestionFiltersStore: () => useQuestionFiltersStore,
|
|
220
225
|
useQuizStore: () => useQuizStore,
|
|
221
226
|
useRouteAuth: () => useRouteAuth,
|
|
222
227
|
useTableFilter: () => useTableFilter,
|
|
@@ -11321,6 +11326,612 @@ var questionTypeLabels = {
|
|
|
11321
11326
|
["PREENCHER" /* PREENCHER */]: "Preencher Lacunas"
|
|
11322
11327
|
};
|
|
11323
11328
|
|
|
11329
|
+
// src/hooks/useActivityFiltersData.ts
|
|
11330
|
+
var import_react35 = require("react");
|
|
11331
|
+
var mapQuestionTypeToEnum = (type) => {
|
|
11332
|
+
const upperType = type.toUpperCase();
|
|
11333
|
+
const typeMap = {
|
|
11334
|
+
ALTERNATIVA: "ALTERNATIVA" /* ALTERNATIVA */,
|
|
11335
|
+
DISSERTATIVA: "DISSERTATIVA" /* DISSERTATIVA */,
|
|
11336
|
+
MULTIPLA_ESCOLHA: "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */,
|
|
11337
|
+
VERDADEIRO_FALSO: "VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */,
|
|
11338
|
+
IMAGEM: "IMAGEM" /* IMAGEM */,
|
|
11339
|
+
LIGAR_PONTOS: "LIGAR_PONTOS" /* LIGAR_PONTOS */,
|
|
11340
|
+
PREENCHER: "PREENCHER" /* PREENCHER */
|
|
11341
|
+
};
|
|
11342
|
+
return typeMap[upperType] || null;
|
|
11343
|
+
};
|
|
11344
|
+
var areCategoriesSame = (prev, current) => {
|
|
11345
|
+
if (prev.length !== current.length) return false;
|
|
11346
|
+
return current.every((category) => {
|
|
11347
|
+
const prevCategory = prev.find((c) => c.key === category.key);
|
|
11348
|
+
if (!prevCategory) return false;
|
|
11349
|
+
const prevIds = (prevCategory.itens || []).map(
|
|
11350
|
+
(item) => item.id
|
|
11351
|
+
);
|
|
11352
|
+
const currentIds = (category.itens || []).map(
|
|
11353
|
+
(item) => item.id
|
|
11354
|
+
);
|
|
11355
|
+
if (prevIds.length !== currentIds.length) return false;
|
|
11356
|
+
return currentIds.every((id) => prevIds.includes(id));
|
|
11357
|
+
});
|
|
11358
|
+
};
|
|
11359
|
+
var mergeCategoriesWithSelection = (prev, current) => {
|
|
11360
|
+
return current.map((category) => {
|
|
11361
|
+
const prevCategory = prev.find((c) => c.key === category.key);
|
|
11362
|
+
if (!prevCategory) {
|
|
11363
|
+
return category;
|
|
11364
|
+
}
|
|
11365
|
+
const validSelectedIds = (prevCategory.selectedIds || []).filter(
|
|
11366
|
+
(id) => category.itens?.some((item) => item.id === id)
|
|
11367
|
+
);
|
|
11368
|
+
return {
|
|
11369
|
+
...category,
|
|
11370
|
+
selectedIds: validSelectedIds
|
|
11371
|
+
};
|
|
11372
|
+
});
|
|
11373
|
+
};
|
|
11374
|
+
var mapSelectedNames = (ids, items) => {
|
|
11375
|
+
return ids.map((id) => {
|
|
11376
|
+
const item = items.find((t) => t.id === id);
|
|
11377
|
+
return item ? item.name : null;
|
|
11378
|
+
}).filter((name) => name !== null);
|
|
11379
|
+
};
|
|
11380
|
+
var useActivityFiltersDataImpl = (apiClient, options) => {
|
|
11381
|
+
const { selectedSubjects, institutionId } = options;
|
|
11382
|
+
const [banksState, setBanksState] = (0, import_react35.useState)({
|
|
11383
|
+
banks: [],
|
|
11384
|
+
bankYears: [],
|
|
11385
|
+
loading: false,
|
|
11386
|
+
error: null
|
|
11387
|
+
});
|
|
11388
|
+
const loadBanks = (0, import_react35.useCallback)(async () => {
|
|
11389
|
+
setBanksState((prev) => ({ ...prev, loading: true, error: null }));
|
|
11390
|
+
try {
|
|
11391
|
+
const response = await apiClient.get(
|
|
11392
|
+
"/questions/exam-institutions"
|
|
11393
|
+
);
|
|
11394
|
+
const banksMap = /* @__PURE__ */ new Map();
|
|
11395
|
+
const bankYearsArray = [];
|
|
11396
|
+
for (const item of response.data.data) {
|
|
11397
|
+
if (!item.questionBankName) continue;
|
|
11398
|
+
const existingBank = banksMap.get(item.questionBankName);
|
|
11399
|
+
if (existingBank) {
|
|
11400
|
+
if (!existingBank.years.includes(item.year)) {
|
|
11401
|
+
existingBank.years.push(item.year);
|
|
11402
|
+
}
|
|
11403
|
+
existingBank.questionsCount += item.questionsCount;
|
|
11404
|
+
} else {
|
|
11405
|
+
banksMap.set(item.questionBankName, {
|
|
11406
|
+
id: item.questionBankName,
|
|
11407
|
+
name: item.questionBankName,
|
|
11408
|
+
examInstitution: item.questionBankName,
|
|
11409
|
+
years: [item.year],
|
|
11410
|
+
questionsCount: item.questionsCount
|
|
11411
|
+
});
|
|
11412
|
+
}
|
|
11413
|
+
bankYearsArray.push({
|
|
11414
|
+
id: `${item.questionBankYearId}-${item.questionBankName}`,
|
|
11415
|
+
name: item.year,
|
|
11416
|
+
bankId: item.questionBankName
|
|
11417
|
+
});
|
|
11418
|
+
}
|
|
11419
|
+
const banks = Array.from(banksMap.values()).map((bank) => ({
|
|
11420
|
+
id: bank.id,
|
|
11421
|
+
name: bank.name,
|
|
11422
|
+
examInstitution: bank.examInstitution
|
|
11423
|
+
}));
|
|
11424
|
+
setBanksState({
|
|
11425
|
+
banks,
|
|
11426
|
+
bankYears: bankYearsArray,
|
|
11427
|
+
loading: false,
|
|
11428
|
+
error: null
|
|
11429
|
+
});
|
|
11430
|
+
} catch (error) {
|
|
11431
|
+
console.error("Erro ao carregar bancas de vestibular:", error);
|
|
11432
|
+
setBanksState((prev) => ({
|
|
11433
|
+
...prev,
|
|
11434
|
+
loading: false,
|
|
11435
|
+
error: "Erro ao carregar bancas de vestibular"
|
|
11436
|
+
}));
|
|
11437
|
+
}
|
|
11438
|
+
}, [apiClient]);
|
|
11439
|
+
const [areasState, setAreasState] = (0, import_react35.useState)({
|
|
11440
|
+
knowledgeAreas: [],
|
|
11441
|
+
loading: false,
|
|
11442
|
+
error: null
|
|
11443
|
+
});
|
|
11444
|
+
const loadKnowledgeAreas = (0, import_react35.useCallback)(async () => {
|
|
11445
|
+
setAreasState((prev) => ({ ...prev, loading: true, error: null }));
|
|
11446
|
+
try {
|
|
11447
|
+
const response = await apiClient.get(
|
|
11448
|
+
"/knowledge/subjects"
|
|
11449
|
+
);
|
|
11450
|
+
setAreasState({
|
|
11451
|
+
knowledgeAreas: response.data.data,
|
|
11452
|
+
loading: false,
|
|
11453
|
+
error: null
|
|
11454
|
+
});
|
|
11455
|
+
} catch (error) {
|
|
11456
|
+
console.error("Erro ao carregar \xE1reas de conhecimento:", error);
|
|
11457
|
+
setAreasState((prev) => ({
|
|
11458
|
+
...prev,
|
|
11459
|
+
loading: false,
|
|
11460
|
+
error: "Erro ao carregar \xE1reas de conhecimento"
|
|
11461
|
+
}));
|
|
11462
|
+
}
|
|
11463
|
+
}, [apiClient]);
|
|
11464
|
+
const [questionTypesState, setQuestionTypesState] = (0, import_react35.useState)({
|
|
11465
|
+
questionTypes: [],
|
|
11466
|
+
loading: false,
|
|
11467
|
+
error: null
|
|
11468
|
+
});
|
|
11469
|
+
const loadQuestionTypes = (0, import_react35.useCallback)(async () => {
|
|
11470
|
+
if (!institutionId) {
|
|
11471
|
+
setQuestionTypesState((prev) => ({
|
|
11472
|
+
...prev,
|
|
11473
|
+
questionTypes: [],
|
|
11474
|
+
loading: false,
|
|
11475
|
+
error: null
|
|
11476
|
+
}));
|
|
11477
|
+
return;
|
|
11478
|
+
}
|
|
11479
|
+
setQuestionTypesState((prev) => ({
|
|
11480
|
+
...prev,
|
|
11481
|
+
loading: true,
|
|
11482
|
+
error: null
|
|
11483
|
+
}));
|
|
11484
|
+
try {
|
|
11485
|
+
const response = await apiClient.get(
|
|
11486
|
+
`/institutions/${institutionId}/question-types`
|
|
11487
|
+
);
|
|
11488
|
+
const mappedTypes = response.data.data.questionTypes.map(mapQuestionTypeToEnum).filter((type) => type !== null);
|
|
11489
|
+
setQuestionTypesState({
|
|
11490
|
+
questionTypes: mappedTypes,
|
|
11491
|
+
loading: false,
|
|
11492
|
+
error: null
|
|
11493
|
+
});
|
|
11494
|
+
} catch (error) {
|
|
11495
|
+
console.error("Erro ao carregar tipos de quest\xF5es:", error);
|
|
11496
|
+
setQuestionTypesState((prev) => ({
|
|
11497
|
+
...prev,
|
|
11498
|
+
loading: false,
|
|
11499
|
+
error: "Erro ao carregar tipos de quest\xF5es"
|
|
11500
|
+
}));
|
|
11501
|
+
}
|
|
11502
|
+
}, [apiClient, institutionId]);
|
|
11503
|
+
const [knowledgeStructure, setKnowledgeStructure] = (0, import_react35.useState)({
|
|
11504
|
+
topics: [],
|
|
11505
|
+
subtopics: [],
|
|
11506
|
+
contents: [],
|
|
11507
|
+
loading: false,
|
|
11508
|
+
error: null
|
|
11509
|
+
});
|
|
11510
|
+
const [knowledgeCategories, setKnowledgeCategories] = (0, import_react35.useState)([]);
|
|
11511
|
+
const previousSubjectsRef = (0, import_react35.useRef)(null);
|
|
11512
|
+
const loadTopics = (0, import_react35.useCallback)(
|
|
11513
|
+
async (subjectIds) => {
|
|
11514
|
+
if (subjectIds.length === 0) {
|
|
11515
|
+
setKnowledgeStructure({
|
|
11516
|
+
topics: [],
|
|
11517
|
+
subtopics: [],
|
|
11518
|
+
contents: [],
|
|
11519
|
+
loading: false,
|
|
11520
|
+
error: null
|
|
11521
|
+
});
|
|
11522
|
+
setKnowledgeCategories([]);
|
|
11523
|
+
return;
|
|
11524
|
+
}
|
|
11525
|
+
setKnowledgeStructure((prev) => ({
|
|
11526
|
+
...prev,
|
|
11527
|
+
loading: true,
|
|
11528
|
+
error: null
|
|
11529
|
+
}));
|
|
11530
|
+
try {
|
|
11531
|
+
const response = await apiClient.post(
|
|
11532
|
+
"/knowledge/topics",
|
|
11533
|
+
{ subjectIds }
|
|
11534
|
+
);
|
|
11535
|
+
const topics = response.data.data.map((topic) => ({
|
|
11536
|
+
id: topic.id,
|
|
11537
|
+
name: topic.name
|
|
11538
|
+
}));
|
|
11539
|
+
setKnowledgeStructure((prev) => ({
|
|
11540
|
+
...prev,
|
|
11541
|
+
topics,
|
|
11542
|
+
subtopics: [],
|
|
11543
|
+
contents: [],
|
|
11544
|
+
loading: false,
|
|
11545
|
+
error: null
|
|
11546
|
+
}));
|
|
11547
|
+
} catch (error) {
|
|
11548
|
+
console.error("Erro ao carregar temas:", error);
|
|
11549
|
+
setKnowledgeStructure((prev) => ({
|
|
11550
|
+
...prev,
|
|
11551
|
+
topics: [],
|
|
11552
|
+
subtopics: [],
|
|
11553
|
+
contents: [],
|
|
11554
|
+
loading: false,
|
|
11555
|
+
error: "Erro ao carregar temas"
|
|
11556
|
+
}));
|
|
11557
|
+
}
|
|
11558
|
+
},
|
|
11559
|
+
[apiClient]
|
|
11560
|
+
);
|
|
11561
|
+
const loadSubtopics = (0, import_react35.useCallback)(
|
|
11562
|
+
async (topicIds, options2 = {}) => {
|
|
11563
|
+
const { forceApi = false } = options2;
|
|
11564
|
+
if (topicIds.length === 0 && !forceApi) {
|
|
11565
|
+
setKnowledgeStructure((prev) => ({
|
|
11566
|
+
...prev,
|
|
11567
|
+
subtopics: [],
|
|
11568
|
+
contents: [],
|
|
11569
|
+
loading: false,
|
|
11570
|
+
error: null
|
|
11571
|
+
}));
|
|
11572
|
+
return;
|
|
11573
|
+
}
|
|
11574
|
+
setKnowledgeStructure((prev) => ({
|
|
11575
|
+
...prev,
|
|
11576
|
+
loading: topicIds.length > 0,
|
|
11577
|
+
error: null
|
|
11578
|
+
}));
|
|
11579
|
+
try {
|
|
11580
|
+
const response = await apiClient.post(
|
|
11581
|
+
"/knowledge/subtopics",
|
|
11582
|
+
{ topicIds }
|
|
11583
|
+
);
|
|
11584
|
+
const subtopics = response.data.data.map(
|
|
11585
|
+
(subtopic) => ({
|
|
11586
|
+
id: subtopic.id,
|
|
11587
|
+
name: subtopic.name,
|
|
11588
|
+
topicId: subtopic.topicId || topicIds[0]
|
|
11589
|
+
})
|
|
11590
|
+
);
|
|
11591
|
+
setKnowledgeStructure((prev) => ({
|
|
11592
|
+
...prev,
|
|
11593
|
+
subtopics,
|
|
11594
|
+
contents: [],
|
|
11595
|
+
loading: false,
|
|
11596
|
+
error: null
|
|
11597
|
+
}));
|
|
11598
|
+
} catch (error) {
|
|
11599
|
+
console.error("Erro ao carregar subtemas:", error);
|
|
11600
|
+
setKnowledgeStructure((prev) => ({
|
|
11601
|
+
...prev,
|
|
11602
|
+
subtopics: [],
|
|
11603
|
+
contents: [],
|
|
11604
|
+
loading: false,
|
|
11605
|
+
error: "Erro ao carregar subtemas"
|
|
11606
|
+
}));
|
|
11607
|
+
}
|
|
11608
|
+
},
|
|
11609
|
+
[apiClient]
|
|
11610
|
+
);
|
|
11611
|
+
const loadContents = (0, import_react35.useCallback)(
|
|
11612
|
+
async (subtopicIds) => {
|
|
11613
|
+
if (subtopicIds.length === 0) {
|
|
11614
|
+
setKnowledgeStructure((prev) => ({
|
|
11615
|
+
...prev,
|
|
11616
|
+
contents: [],
|
|
11617
|
+
loading: false,
|
|
11618
|
+
error: null
|
|
11619
|
+
}));
|
|
11620
|
+
return;
|
|
11621
|
+
}
|
|
11622
|
+
setKnowledgeStructure((prev) => ({
|
|
11623
|
+
...prev,
|
|
11624
|
+
loading: true,
|
|
11625
|
+
error: null
|
|
11626
|
+
}));
|
|
11627
|
+
try {
|
|
11628
|
+
const response = await apiClient.post(
|
|
11629
|
+
"/knowledge/contents",
|
|
11630
|
+
{ subtopicIds }
|
|
11631
|
+
);
|
|
11632
|
+
const contents = response.data.data.map(
|
|
11633
|
+
(content) => ({
|
|
11634
|
+
id: content.id,
|
|
11635
|
+
name: content.name,
|
|
11636
|
+
subtopicId: content.subtopicId || subtopicIds[0]
|
|
11637
|
+
})
|
|
11638
|
+
);
|
|
11639
|
+
setKnowledgeStructure((prev) => ({
|
|
11640
|
+
...prev,
|
|
11641
|
+
contents,
|
|
11642
|
+
loading: false,
|
|
11643
|
+
error: null
|
|
11644
|
+
}));
|
|
11645
|
+
} catch (error) {
|
|
11646
|
+
console.error("Erro ao carregar conte\xFAdos:", error);
|
|
11647
|
+
setKnowledgeStructure((prev) => ({
|
|
11648
|
+
...prev,
|
|
11649
|
+
contents: [],
|
|
11650
|
+
loading: false,
|
|
11651
|
+
error: "Erro ao carregar conte\xFAdos"
|
|
11652
|
+
}));
|
|
11653
|
+
}
|
|
11654
|
+
},
|
|
11655
|
+
[apiClient]
|
|
11656
|
+
);
|
|
11657
|
+
(0, import_react35.useEffect)(() => {
|
|
11658
|
+
const previousSubjects = previousSubjectsRef.current;
|
|
11659
|
+
const subjectsChanged = !previousSubjects || previousSubjects.length !== selectedSubjects.length || selectedSubjects.some((id, index) => id !== previousSubjects[index]);
|
|
11660
|
+
if (!subjectsChanged) return;
|
|
11661
|
+
previousSubjectsRef.current = selectedSubjects;
|
|
11662
|
+
if (selectedSubjects.length > 0) {
|
|
11663
|
+
loadTopics(selectedSubjects);
|
|
11664
|
+
return;
|
|
11665
|
+
}
|
|
11666
|
+
setKnowledgeStructure({
|
|
11667
|
+
topics: [],
|
|
11668
|
+
subtopics: [],
|
|
11669
|
+
contents: [],
|
|
11670
|
+
loading: false,
|
|
11671
|
+
error: null
|
|
11672
|
+
});
|
|
11673
|
+
setKnowledgeCategories([]);
|
|
11674
|
+
}, [selectedSubjects, loadTopics]);
|
|
11675
|
+
const handleCategoriesChange = (0, import_react35.useCallback)(
|
|
11676
|
+
(updatedCategories) => {
|
|
11677
|
+
const isFirstChange = knowledgeCategories.length === 0;
|
|
11678
|
+
const currentTemaCategory = knowledgeCategories.find(
|
|
11679
|
+
(c) => c.key === "tema"
|
|
11680
|
+
);
|
|
11681
|
+
const currentSubtemaCategory = knowledgeCategories.find(
|
|
11682
|
+
(c) => c.key === "subtema"
|
|
11683
|
+
);
|
|
11684
|
+
const currentSelectedTopicIds = currentTemaCategory?.selectedIds || [];
|
|
11685
|
+
const currentSelectedSubtopicIds = currentSubtemaCategory?.selectedIds || [];
|
|
11686
|
+
const temaCategory = updatedCategories.find((c) => c.key === "tema");
|
|
11687
|
+
const selectedTopicIds = temaCategory?.selectedIds || [];
|
|
11688
|
+
const subtemaCategory = updatedCategories.find(
|
|
11689
|
+
(c) => c.key === "subtema"
|
|
11690
|
+
);
|
|
11691
|
+
const selectedSubtopicIds = subtemaCategory?.selectedIds || [];
|
|
11692
|
+
setKnowledgeCategories(updatedCategories);
|
|
11693
|
+
const topicIdsChanged = isFirstChange || currentSelectedTopicIds.length !== selectedTopicIds.length || currentSelectedTopicIds.some(
|
|
11694
|
+
(id) => !selectedTopicIds.includes(id)
|
|
11695
|
+
) || selectedTopicIds.some(
|
|
11696
|
+
(id) => !currentSelectedTopicIds.includes(id)
|
|
11697
|
+
);
|
|
11698
|
+
if (topicIdsChanged) {
|
|
11699
|
+
loadSubtopics(selectedTopicIds, {
|
|
11700
|
+
forceApi: selectedTopicIds.length === 0
|
|
11701
|
+
});
|
|
11702
|
+
}
|
|
11703
|
+
const subtopicIdsChanged = isFirstChange || currentSelectedSubtopicIds.length !== selectedSubtopicIds.length || currentSelectedSubtopicIds.some(
|
|
11704
|
+
(id) => !selectedSubtopicIds.includes(id)
|
|
11705
|
+
) || selectedSubtopicIds.some(
|
|
11706
|
+
(id) => !currentSelectedSubtopicIds.includes(id)
|
|
11707
|
+
);
|
|
11708
|
+
if (subtopicIdsChanged) {
|
|
11709
|
+
if (selectedSubtopicIds.length > 0) {
|
|
11710
|
+
loadContents(selectedSubtopicIds);
|
|
11711
|
+
} else {
|
|
11712
|
+
loadContents([]);
|
|
11713
|
+
}
|
|
11714
|
+
}
|
|
11715
|
+
},
|
|
11716
|
+
[knowledgeCategories, loadSubtopics, loadContents]
|
|
11717
|
+
);
|
|
11718
|
+
(0, import_react35.useEffect)(() => {
|
|
11719
|
+
if (knowledgeStructure.topics.length === 0) {
|
|
11720
|
+
setKnowledgeCategories((prev) => {
|
|
11721
|
+
if (prev.length === 0) {
|
|
11722
|
+
return prev;
|
|
11723
|
+
}
|
|
11724
|
+
return [];
|
|
11725
|
+
});
|
|
11726
|
+
return;
|
|
11727
|
+
}
|
|
11728
|
+
const categories = [
|
|
11729
|
+
{
|
|
11730
|
+
key: "tema",
|
|
11731
|
+
label: "Tema",
|
|
11732
|
+
dependsOn: [],
|
|
11733
|
+
itens: knowledgeStructure.topics,
|
|
11734
|
+
selectedIds: []
|
|
11735
|
+
},
|
|
11736
|
+
{
|
|
11737
|
+
key: "subtema",
|
|
11738
|
+
label: "Subtema",
|
|
11739
|
+
dependsOn: ["tema"],
|
|
11740
|
+
itens: knowledgeStructure.subtopics,
|
|
11741
|
+
filteredBy: [{ key: "tema", internalField: "topicId" }],
|
|
11742
|
+
selectedIds: []
|
|
11743
|
+
},
|
|
11744
|
+
{
|
|
11745
|
+
key: "assunto",
|
|
11746
|
+
label: "Assunto",
|
|
11747
|
+
dependsOn: ["subtema"],
|
|
11748
|
+
itens: knowledgeStructure.contents,
|
|
11749
|
+
filteredBy: [{ key: "subtema", internalField: "subtopicId" }],
|
|
11750
|
+
selectedIds: []
|
|
11751
|
+
}
|
|
11752
|
+
];
|
|
11753
|
+
setKnowledgeCategories(
|
|
11754
|
+
(prev) => areCategoriesSame(prev, categories) ? prev : mergeCategoriesWithSelection(prev, categories)
|
|
11755
|
+
);
|
|
11756
|
+
}, [
|
|
11757
|
+
selectedSubjects,
|
|
11758
|
+
knowledgeStructure.topics,
|
|
11759
|
+
knowledgeStructure.subtopics,
|
|
11760
|
+
knowledgeStructure.contents
|
|
11761
|
+
]);
|
|
11762
|
+
const selectedKnowledgeSummary = (0, import_react35.useMemo)(() => {
|
|
11763
|
+
const temaCategory = knowledgeCategories.find((c) => c.key === "tema");
|
|
11764
|
+
const subtemaCategory = knowledgeCategories.find(
|
|
11765
|
+
(c) => c.key === "subtema"
|
|
11766
|
+
);
|
|
11767
|
+
const assuntoCategory = knowledgeCategories.find(
|
|
11768
|
+
(c) => c.key === "assunto"
|
|
11769
|
+
);
|
|
11770
|
+
const selectedTopics = mapSelectedNames(
|
|
11771
|
+
temaCategory?.selectedIds || [],
|
|
11772
|
+
knowledgeStructure.topics
|
|
11773
|
+
);
|
|
11774
|
+
const selectedSubtopics = mapSelectedNames(
|
|
11775
|
+
subtemaCategory?.selectedIds || [],
|
|
11776
|
+
knowledgeStructure.subtopics
|
|
11777
|
+
);
|
|
11778
|
+
const selectedContents = mapSelectedNames(
|
|
11779
|
+
assuntoCategory?.selectedIds || [],
|
|
11780
|
+
knowledgeStructure.contents
|
|
11781
|
+
);
|
|
11782
|
+
return {
|
|
11783
|
+
topics: selectedTopics,
|
|
11784
|
+
subtopics: selectedSubtopics,
|
|
11785
|
+
contents: selectedContents
|
|
11786
|
+
};
|
|
11787
|
+
}, [knowledgeCategories, knowledgeStructure]);
|
|
11788
|
+
const enableSummary = (0, import_react35.useMemo)(() => {
|
|
11789
|
+
return knowledgeStructure.topics.length === 1 || knowledgeStructure.subtopics.length === 1 || knowledgeStructure.contents.length === 1;
|
|
11790
|
+
}, [knowledgeStructure]);
|
|
11791
|
+
return {
|
|
11792
|
+
// Vestibular Banks
|
|
11793
|
+
banks: banksState.banks,
|
|
11794
|
+
bankYears: banksState.bankYears,
|
|
11795
|
+
loadingBanks: banksState.loading,
|
|
11796
|
+
banksError: banksState.error,
|
|
11797
|
+
loadBanks,
|
|
11798
|
+
// Knowledge Areas
|
|
11799
|
+
knowledgeAreas: areasState.knowledgeAreas,
|
|
11800
|
+
loadingSubjects: areasState.loading,
|
|
11801
|
+
subjectsError: areasState.error,
|
|
11802
|
+
loadKnowledgeAreas,
|
|
11803
|
+
// Knowledge Structure
|
|
11804
|
+
knowledgeStructure,
|
|
11805
|
+
knowledgeCategories,
|
|
11806
|
+
handleCategoriesChange,
|
|
11807
|
+
selectedKnowledgeSummary,
|
|
11808
|
+
enableSummary,
|
|
11809
|
+
loadTopics,
|
|
11810
|
+
loadSubtopics,
|
|
11811
|
+
loadContents,
|
|
11812
|
+
// Question Types
|
|
11813
|
+
questionTypes: questionTypesState.questionTypes,
|
|
11814
|
+
loadingQuestionTypes: questionTypesState.loading,
|
|
11815
|
+
questionTypesError: questionTypesState.error,
|
|
11816
|
+
loadQuestionTypes
|
|
11817
|
+
};
|
|
11818
|
+
};
|
|
11819
|
+
var createUseActivityFiltersData = (apiClient) => {
|
|
11820
|
+
return (options) => useActivityFiltersDataImpl(apiClient, options);
|
|
11821
|
+
};
|
|
11822
|
+
var createActivityFiltersDataHook = (apiClient) => {
|
|
11823
|
+
return createUseActivityFiltersData(apiClient);
|
|
11824
|
+
};
|
|
11825
|
+
|
|
11826
|
+
// src/hooks/useQuestionsList.ts
|
|
11827
|
+
var import_react36 = require("react");
|
|
11828
|
+
var useQuestionsListImpl = (apiClient) => {
|
|
11829
|
+
const [state, setState] = (0, import_react36.useState)({
|
|
11830
|
+
questions: [],
|
|
11831
|
+
pagination: null,
|
|
11832
|
+
loading: false,
|
|
11833
|
+
loadingMore: false,
|
|
11834
|
+
error: null,
|
|
11835
|
+
currentFilters: null
|
|
11836
|
+
});
|
|
11837
|
+
const updateState = (0, import_react36.useCallback)((updates) => {
|
|
11838
|
+
setState((prev) => ({ ...prev, ...updates }));
|
|
11839
|
+
}, []);
|
|
11840
|
+
const handleError = (0, import_react36.useCallback)(
|
|
11841
|
+
(error) => {
|
|
11842
|
+
console.error("Erro ao carregar quest\xF5es:", error);
|
|
11843
|
+
let errorMessage = "Erro ao carregar quest\xF5es";
|
|
11844
|
+
if (error && typeof error === "object" && "response" in error) {
|
|
11845
|
+
const axiosError = error;
|
|
11846
|
+
errorMessage = axiosError?.response?.data?.message || axiosError?.message || errorMessage;
|
|
11847
|
+
} else if (error instanceof Error) {
|
|
11848
|
+
errorMessage = error.message;
|
|
11849
|
+
}
|
|
11850
|
+
updateState({
|
|
11851
|
+
loading: false,
|
|
11852
|
+
loadingMore: false,
|
|
11853
|
+
error: errorMessage
|
|
11854
|
+
});
|
|
11855
|
+
},
|
|
11856
|
+
[updateState]
|
|
11857
|
+
);
|
|
11858
|
+
const fetchQuestions = (0, import_react36.useCallback)(
|
|
11859
|
+
async (filters, append = false) => {
|
|
11860
|
+
if (append) {
|
|
11861
|
+
setState((prev) => ({ ...prev, loadingMore: true, error: null }));
|
|
11862
|
+
} else {
|
|
11863
|
+
updateState({ loading: true, error: null, questions: [] });
|
|
11864
|
+
}
|
|
11865
|
+
try {
|
|
11866
|
+
const validatedFilters = {
|
|
11867
|
+
...filters
|
|
11868
|
+
};
|
|
11869
|
+
const response = await apiClient.post(
|
|
11870
|
+
"/questions/list",
|
|
11871
|
+
validatedFilters
|
|
11872
|
+
);
|
|
11873
|
+
setState((prev) => ({
|
|
11874
|
+
loading: false,
|
|
11875
|
+
loadingMore: false,
|
|
11876
|
+
questions: append ? [...prev.questions, ...response.data.data.questions] : response.data.data.questions,
|
|
11877
|
+
pagination: response.data.data.pagination,
|
|
11878
|
+
error: null,
|
|
11879
|
+
currentFilters: validatedFilters
|
|
11880
|
+
}));
|
|
11881
|
+
} catch (error) {
|
|
11882
|
+
setState((prev) => ({
|
|
11883
|
+
...prev,
|
|
11884
|
+
loading: false,
|
|
11885
|
+
loadingMore: false
|
|
11886
|
+
}));
|
|
11887
|
+
handleError(error);
|
|
11888
|
+
}
|
|
11889
|
+
},
|
|
11890
|
+
[apiClient, updateState, handleError]
|
|
11891
|
+
);
|
|
11892
|
+
const loadMore = (0, import_react36.useCallback)(async () => {
|
|
11893
|
+
setState((prev) => {
|
|
11894
|
+
const { currentFilters, pagination, loadingMore: isLoadingMore } = prev;
|
|
11895
|
+
if (isLoadingMore || !currentFilters || !pagination?.hasNext) {
|
|
11896
|
+
return prev;
|
|
11897
|
+
}
|
|
11898
|
+
const nextPageFilters = {
|
|
11899
|
+
...currentFilters,
|
|
11900
|
+
page: pagination.page + 1
|
|
11901
|
+
};
|
|
11902
|
+
fetchQuestions(nextPageFilters, true).catch((error) => {
|
|
11903
|
+
console.error("Erro ao carregar mais quest\xF5es:", error);
|
|
11904
|
+
});
|
|
11905
|
+
return {
|
|
11906
|
+
...prev,
|
|
11907
|
+
loadingMore: true
|
|
11908
|
+
};
|
|
11909
|
+
});
|
|
11910
|
+
}, [fetchQuestions]);
|
|
11911
|
+
const reset = (0, import_react36.useCallback)(() => {
|
|
11912
|
+
setState({
|
|
11913
|
+
questions: [],
|
|
11914
|
+
pagination: null,
|
|
11915
|
+
loading: false,
|
|
11916
|
+
loadingMore: false,
|
|
11917
|
+
error: null,
|
|
11918
|
+
currentFilters: null
|
|
11919
|
+
});
|
|
11920
|
+
}, []);
|
|
11921
|
+
return {
|
|
11922
|
+
...state,
|
|
11923
|
+
fetchQuestions,
|
|
11924
|
+
loadMore,
|
|
11925
|
+
reset
|
|
11926
|
+
};
|
|
11927
|
+
};
|
|
11928
|
+
var createUseQuestionsList = (apiClient) => {
|
|
11929
|
+
return () => useQuestionsListImpl(apiClient);
|
|
11930
|
+
};
|
|
11931
|
+
var createQuestionsListHook = (apiClient) => {
|
|
11932
|
+
return createUseQuestionsList(apiClient);
|
|
11933
|
+
};
|
|
11934
|
+
|
|
11324
11935
|
// src/components/Filter/FilterModal.tsx
|
|
11325
11936
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
11326
11937
|
var FilterModal = ({
|
|
@@ -11464,10 +12075,10 @@ var FilterModal = ({
|
|
|
11464
12075
|
};
|
|
11465
12076
|
|
|
11466
12077
|
// src/components/Filter/useTableFilter.ts
|
|
11467
|
-
var
|
|
12078
|
+
var import_react37 = require("react");
|
|
11468
12079
|
var useTableFilter = (initialConfigs, options = {}) => {
|
|
11469
12080
|
const { syncWithUrl = false } = options;
|
|
11470
|
-
const getInitialState = (0,
|
|
12081
|
+
const getInitialState = (0, import_react37.useCallback)(() => {
|
|
11471
12082
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
11472
12083
|
return initialConfigs;
|
|
11473
12084
|
}
|
|
@@ -11485,8 +12096,8 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11485
12096
|
}));
|
|
11486
12097
|
return configsWithUrlState;
|
|
11487
12098
|
}, [initialConfigs, syncWithUrl]);
|
|
11488
|
-
const [filterConfigs, setFilterConfigs] = (0,
|
|
11489
|
-
const activeFilters = (0,
|
|
12099
|
+
const [filterConfigs, setFilterConfigs] = (0, import_react37.useState)(getInitialState);
|
|
12100
|
+
const activeFilters = (0, import_react37.useMemo)(() => {
|
|
11490
12101
|
const filters = {};
|
|
11491
12102
|
for (const config of filterConfigs) {
|
|
11492
12103
|
for (const category of config.categories) {
|
|
@@ -11498,10 +12109,10 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11498
12109
|
return filters;
|
|
11499
12110
|
}, [filterConfigs]);
|
|
11500
12111
|
const hasActiveFilters = Object.keys(activeFilters).length > 0;
|
|
11501
|
-
const updateFilters = (0,
|
|
12112
|
+
const updateFilters = (0, import_react37.useCallback)((configs) => {
|
|
11502
12113
|
setFilterConfigs(configs);
|
|
11503
12114
|
}, []);
|
|
11504
|
-
const applyFilters = (0,
|
|
12115
|
+
const applyFilters = (0, import_react37.useCallback)(() => {
|
|
11505
12116
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
11506
12117
|
return;
|
|
11507
12118
|
}
|
|
@@ -11519,7 +12130,7 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11519
12130
|
}
|
|
11520
12131
|
globalThis.window.history.replaceState({}, "", url.toString());
|
|
11521
12132
|
}, [filterConfigs, syncWithUrl]);
|
|
11522
|
-
const clearFilters = (0,
|
|
12133
|
+
const clearFilters = (0, import_react37.useCallback)(() => {
|
|
11523
12134
|
const clearedConfigs = filterConfigs.map((config) => ({
|
|
11524
12135
|
...config,
|
|
11525
12136
|
categories: config.categories.map((category) => ({
|
|
@@ -11539,7 +12150,7 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11539
12150
|
globalThis.window.history.replaceState({}, "", url.toString());
|
|
11540
12151
|
}
|
|
11541
12152
|
}, [filterConfigs, syncWithUrl]);
|
|
11542
|
-
(0,
|
|
12153
|
+
(0, import_react37.useEffect)(() => {
|
|
11543
12154
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
11544
12155
|
return;
|
|
11545
12156
|
}
|
|
@@ -11560,9 +12171,9 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11560
12171
|
};
|
|
11561
12172
|
|
|
11562
12173
|
// src/components/ActivityFilters/ActivityFilters.tsx
|
|
11563
|
-
var
|
|
12174
|
+
var import_react38 = require("react");
|
|
11564
12175
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
11565
|
-
var
|
|
12176
|
+
var questionTypesFallback = [
|
|
11566
12177
|
"ALTERNATIVA" /* ALTERNATIVA */,
|
|
11567
12178
|
"VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */,
|
|
11568
12179
|
"DISSERTATIVA" /* DISSERTATIVA */,
|
|
@@ -11576,7 +12187,7 @@ var QuestionTypeFilter = ({
|
|
|
11576
12187
|
onToggleType,
|
|
11577
12188
|
allowedQuestionTypes
|
|
11578
12189
|
}) => {
|
|
11579
|
-
const availableQuestionTypes = allowedQuestionTypes ||
|
|
12190
|
+
const availableQuestionTypes = allowedQuestionTypes || questionTypesFallback;
|
|
11580
12191
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { children: [
|
|
11581
12192
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tipo de quest\xE3o" }),
|
|
11582
12193
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "grid grid-cols-2 gap-2", children: availableQuestionTypes.map((questionType) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
@@ -11701,45 +12312,42 @@ var FilterActions = ({
|
|
|
11701
12312
|
] });
|
|
11702
12313
|
};
|
|
11703
12314
|
var ActivityFilters = ({
|
|
12315
|
+
apiClient,
|
|
11704
12316
|
onFiltersChange,
|
|
11705
12317
|
variant = "default",
|
|
11706
|
-
|
|
11707
|
-
banks = [],
|
|
11708
|
-
bankYears = [],
|
|
11709
|
-
knowledgeAreas = [],
|
|
11710
|
-
knowledgeStructure = {
|
|
11711
|
-
topics: [],
|
|
11712
|
-
subtopics: [],
|
|
11713
|
-
contents: [],
|
|
11714
|
-
loading: false,
|
|
11715
|
-
error: null
|
|
11716
|
-
},
|
|
11717
|
-
knowledgeCategories = [],
|
|
12318
|
+
institutionId = null,
|
|
11718
12319
|
// Question types
|
|
11719
12320
|
allowedQuestionTypes,
|
|
11720
|
-
// Loading states
|
|
11721
|
-
loadingBanks = false,
|
|
11722
|
-
loadingKnowledge: _loadingKnowledge = false,
|
|
11723
|
-
loadingSubjects = false,
|
|
11724
|
-
// Errors
|
|
11725
|
-
banksError = null,
|
|
11726
|
-
subjectsError = null,
|
|
11727
|
-
// Load functions
|
|
11728
|
-
loadBanks,
|
|
11729
|
-
loadKnowledge,
|
|
11730
|
-
loadTopics,
|
|
11731
|
-
loadSubtopics: _loadSubtopics,
|
|
11732
|
-
loadContents: _loadContents,
|
|
11733
|
-
// Handlers
|
|
11734
|
-
handleCategoriesChange,
|
|
11735
12321
|
// Action buttons
|
|
11736
12322
|
onClearFilters,
|
|
11737
12323
|
onApplyFilters
|
|
11738
12324
|
}) => {
|
|
11739
|
-
const
|
|
11740
|
-
const [
|
|
11741
|
-
const
|
|
11742
|
-
|
|
12325
|
+
const useActivityFiltersData = createUseActivityFiltersData(apiClient);
|
|
12326
|
+
const [selectedQuestionTypes, setSelectedQuestionTypes] = (0, import_react38.useState)([]);
|
|
12327
|
+
const [selectedSubject, setSelectedSubject] = (0, import_react38.useState)(null);
|
|
12328
|
+
const {
|
|
12329
|
+
banks,
|
|
12330
|
+
bankYears,
|
|
12331
|
+
loadingBanks,
|
|
12332
|
+
banksError,
|
|
12333
|
+
knowledgeAreas,
|
|
12334
|
+
loadingSubjects,
|
|
12335
|
+
subjectsError,
|
|
12336
|
+
knowledgeStructure,
|
|
12337
|
+
knowledgeCategories,
|
|
12338
|
+
handleCategoriesChange,
|
|
12339
|
+
loadBanks,
|
|
12340
|
+
loadKnowledgeAreas,
|
|
12341
|
+
loadQuestionTypes,
|
|
12342
|
+
questionTypes,
|
|
12343
|
+
loadingQuestionTypes,
|
|
12344
|
+
questionTypesError
|
|
12345
|
+
} = useActivityFiltersData({
|
|
12346
|
+
selectedSubjects: selectedSubject ? [selectedSubject] : [],
|
|
12347
|
+
institutionId
|
|
12348
|
+
});
|
|
12349
|
+
const prevAllowedQuestionTypesRef = (0, import_react38.useRef)(null);
|
|
12350
|
+
(0, import_react38.useEffect)(() => {
|
|
11743
12351
|
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
11744
12352
|
prevAllowedQuestionTypesRef.current = null;
|
|
11745
12353
|
return;
|
|
@@ -11772,8 +12380,8 @@ var ActivityFilters = ({
|
|
|
11772
12380
|
return prev;
|
|
11773
12381
|
});
|
|
11774
12382
|
}, [allowedQuestionTypes]);
|
|
11775
|
-
const [bankCategories, setBankCategories] = (0,
|
|
11776
|
-
const selectedSubjects = (0,
|
|
12383
|
+
const [bankCategories, setBankCategories] = (0, import_react38.useState)([]);
|
|
12384
|
+
const selectedSubjects = (0, import_react38.useMemo)(
|
|
11777
12385
|
() => selectedSubject ? [selectedSubject] : [],
|
|
11778
12386
|
[selectedSubject]
|
|
11779
12387
|
);
|
|
@@ -11786,7 +12394,7 @@ var ActivityFilters = ({
|
|
|
11786
12394
|
const handleBankCategoriesChange = (updatedCategories) => {
|
|
11787
12395
|
setBankCategories(updatedCategories);
|
|
11788
12396
|
};
|
|
11789
|
-
(0,
|
|
12397
|
+
(0, import_react38.useEffect)(() => {
|
|
11790
12398
|
setBankCategories((prevCategories) => {
|
|
11791
12399
|
const bankCategory = {
|
|
11792
12400
|
key: "banca",
|
|
@@ -11812,37 +12420,42 @@ var ActivityFilters = ({
|
|
|
11812
12420
|
return [bankCategory, yearCategory];
|
|
11813
12421
|
});
|
|
11814
12422
|
}, [banks, bankYears]);
|
|
11815
|
-
(0,
|
|
12423
|
+
(0, import_react38.useEffect)(() => {
|
|
11816
12424
|
if (loadBanks) {
|
|
11817
12425
|
loadBanks();
|
|
11818
12426
|
}
|
|
11819
|
-
if (
|
|
11820
|
-
|
|
12427
|
+
if (loadKnowledgeAreas) {
|
|
12428
|
+
loadKnowledgeAreas();
|
|
11821
12429
|
}
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
if (selectedSubject && loadTopics) {
|
|
11825
|
-
loadTopics([selectedSubject]);
|
|
12430
|
+
if (loadQuestionTypes) {
|
|
12431
|
+
loadQuestionTypes();
|
|
11826
12432
|
}
|
|
11827
|
-
}, [
|
|
11828
|
-
const
|
|
12433
|
+
}, [loadBanks, loadKnowledgeAreas, loadQuestionTypes, institutionId]);
|
|
12434
|
+
const availableQuestionTypes = (0, import_react38.useMemo)(() => {
|
|
12435
|
+
const source = questionTypes && questionTypes.length > 0 ? questionTypes : questionTypesFallback;
|
|
12436
|
+
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
12437
|
+
return source;
|
|
12438
|
+
}
|
|
12439
|
+
return source.filter((type) => allowedQuestionTypes.includes(type));
|
|
12440
|
+
}, [questionTypes, allowedQuestionTypes]);
|
|
12441
|
+
const getSelectedKnowledgeIds = (0, import_react38.useCallback)(() => {
|
|
11829
12442
|
return getSelectedIdsFromCategories(knowledgeCategories, {
|
|
11830
12443
|
topicIds: "tema",
|
|
11831
12444
|
subtopicIds: "subtema",
|
|
11832
12445
|
contentIds: "assunto"
|
|
11833
12446
|
});
|
|
11834
12447
|
}, [knowledgeCategories]);
|
|
11835
|
-
const getSelectedBankIds = (0,
|
|
12448
|
+
const getSelectedBankIds = (0, import_react38.useCallback)(() => {
|
|
11836
12449
|
return getSelectedIdsFromCategories(bankCategories, {
|
|
11837
12450
|
bankIds: "banca",
|
|
11838
12451
|
yearIds: "ano"
|
|
11839
12452
|
});
|
|
11840
12453
|
}, [bankCategories]);
|
|
11841
|
-
const onFiltersChangeRef = (0,
|
|
11842
|
-
(0,
|
|
12454
|
+
const onFiltersChangeRef = (0, import_react38.useRef)(onFiltersChange);
|
|
12455
|
+
(0, import_react38.useEffect)(() => {
|
|
11843
12456
|
onFiltersChangeRef.current = onFiltersChange;
|
|
11844
12457
|
}, [onFiltersChange]);
|
|
11845
|
-
(0,
|
|
12458
|
+
(0, import_react38.useEffect)(() => {
|
|
11846
12459
|
const knowledgeIds = getSelectedKnowledgeIds();
|
|
11847
12460
|
const bankIds = getSelectedBankIds();
|
|
11848
12461
|
const filters = {
|
|
@@ -11873,7 +12486,25 @@ var ActivityFilters = ({
|
|
|
11873
12486
|
{
|
|
11874
12487
|
selectedTypes: selectedQuestionTypes,
|
|
11875
12488
|
onToggleType: toggleQuestionType,
|
|
11876
|
-
allowedQuestionTypes
|
|
12489
|
+
allowedQuestionTypes: availableQuestionTypes
|
|
12490
|
+
}
|
|
12491
|
+
),
|
|
12492
|
+
loadingQuestionTypes && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
12493
|
+
Text_default,
|
|
12494
|
+
{
|
|
12495
|
+
size: "sm",
|
|
12496
|
+
className: "text-text-600",
|
|
12497
|
+
"data-testid": "question-types-loading",
|
|
12498
|
+
children: "Carregando tipos de quest\xE3o..."
|
|
12499
|
+
}
|
|
12500
|
+
),
|
|
12501
|
+
questionTypesError && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
12502
|
+
Text_default,
|
|
12503
|
+
{
|
|
12504
|
+
size: "sm",
|
|
12505
|
+
className: "text-error-500",
|
|
12506
|
+
"data-testid": "question-types-error",
|
|
12507
|
+
children: questionTypesError
|
|
11877
12508
|
}
|
|
11878
12509
|
),
|
|
11879
12510
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { children: [
|
|
@@ -11926,7 +12557,7 @@ var ActivityFiltersPopover = ({
|
|
|
11926
12557
|
triggerLabel = "Filtro de quest\xF5es",
|
|
11927
12558
|
...activityFiltersProps
|
|
11928
12559
|
}) => {
|
|
11929
|
-
const [open, setOpen] = (0,
|
|
12560
|
+
const [open, setOpen] = (0, import_react38.useState)(false);
|
|
11930
12561
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(DropdownMenu_default, { open, onOpenChange: setOpen, children: [
|
|
11931
12562
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DropdownMenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Button_default, { variant: "outline", children: triggerLabel }) }),
|
|
11932
12563
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
@@ -11948,7 +12579,7 @@ var ActivityFiltersPopover = ({
|
|
|
11948
12579
|
};
|
|
11949
12580
|
|
|
11950
12581
|
// src/components/TableProvider/TableProvider.tsx
|
|
11951
|
-
var
|
|
12582
|
+
var import_react39 = require("react");
|
|
11952
12583
|
var import_phosphor_react26 = require("phosphor-react");
|
|
11953
12584
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
11954
12585
|
function TableProvider({
|
|
@@ -11972,7 +12603,7 @@ function TableProvider({
|
|
|
11972
12603
|
onRowClick,
|
|
11973
12604
|
children
|
|
11974
12605
|
}) {
|
|
11975
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
12606
|
+
const [searchQuery, setSearchQuery] = (0, import_react39.useState)("");
|
|
11976
12607
|
const sortResultRaw = useTableSort(data, { syncWithUrl: true });
|
|
11977
12608
|
const sortResult = enableTableSort ? sortResultRaw : {
|
|
11978
12609
|
sortedData: data,
|
|
@@ -11983,7 +12614,7 @@ function TableProvider({
|
|
|
11983
12614
|
};
|
|
11984
12615
|
const { sortedData, sortColumn, sortDirection, handleSort } = sortResult;
|
|
11985
12616
|
const filterResultRaw = useTableFilter(initialFilters, { syncWithUrl: true });
|
|
11986
|
-
const disabledFilterResult = (0,
|
|
12617
|
+
const disabledFilterResult = (0, import_react39.useMemo)(
|
|
11987
12618
|
() => ({
|
|
11988
12619
|
filterConfigs: [],
|
|
11989
12620
|
activeFilters: {},
|
|
@@ -12013,10 +12644,10 @@ function TableProvider({
|
|
|
12013
12644
|
totalItems,
|
|
12014
12645
|
totalPages
|
|
12015
12646
|
} = paginationConfig;
|
|
12016
|
-
const [currentPage, setCurrentPage] = (0,
|
|
12017
|
-
const [itemsPerPage, setItemsPerPage] = (0,
|
|
12018
|
-
const [isFilterModalOpen, setIsFilterModalOpen] = (0,
|
|
12019
|
-
const combinedParams = (0,
|
|
12647
|
+
const [currentPage, setCurrentPage] = (0, import_react39.useState)(1);
|
|
12648
|
+
const [itemsPerPage, setItemsPerPage] = (0, import_react39.useState)(defaultItemsPerPage);
|
|
12649
|
+
const [isFilterModalOpen, setIsFilterModalOpen] = (0, import_react39.useState)(false);
|
|
12650
|
+
const combinedParams = (0, import_react39.useMemo)(() => {
|
|
12020
12651
|
const params = {
|
|
12021
12652
|
page: currentPage,
|
|
12022
12653
|
limit: itemsPerPage
|
|
@@ -12043,26 +12674,26 @@ function TableProvider({
|
|
|
12043
12674
|
enableFilters,
|
|
12044
12675
|
enableTableSort
|
|
12045
12676
|
]);
|
|
12046
|
-
(0,
|
|
12677
|
+
(0, import_react39.useEffect)(() => {
|
|
12047
12678
|
onParamsChange?.(combinedParams);
|
|
12048
12679
|
}, [combinedParams]);
|
|
12049
|
-
const handleSearchChange = (0,
|
|
12680
|
+
const handleSearchChange = (0, import_react39.useCallback)((value) => {
|
|
12050
12681
|
setSearchQuery(value);
|
|
12051
12682
|
setCurrentPage(1);
|
|
12052
12683
|
}, []);
|
|
12053
|
-
const handleFilterApply = (0,
|
|
12684
|
+
const handleFilterApply = (0, import_react39.useCallback)(() => {
|
|
12054
12685
|
applyFilters();
|
|
12055
12686
|
setIsFilterModalOpen(false);
|
|
12056
12687
|
setCurrentPage(1);
|
|
12057
12688
|
}, [applyFilters]);
|
|
12058
|
-
const handlePageChange = (0,
|
|
12689
|
+
const handlePageChange = (0, import_react39.useCallback)((page) => {
|
|
12059
12690
|
setCurrentPage(page);
|
|
12060
12691
|
}, []);
|
|
12061
|
-
const handleItemsPerPageChange = (0,
|
|
12692
|
+
const handleItemsPerPageChange = (0, import_react39.useCallback)((items) => {
|
|
12062
12693
|
setItemsPerPage(items);
|
|
12063
12694
|
setCurrentPage(1);
|
|
12064
12695
|
}, []);
|
|
12065
|
-
const handleRowClickInternal = (0,
|
|
12696
|
+
const handleRowClickInternal = (0, import_react39.useCallback)(
|
|
12066
12697
|
(row, index) => {
|
|
12067
12698
|
if (enableRowClick && onRowClick) {
|
|
12068
12699
|
onRowClick(row, index);
|
|
@@ -12070,7 +12701,7 @@ function TableProvider({
|
|
|
12070
12701
|
},
|
|
12071
12702
|
[enableRowClick, onRowClick]
|
|
12072
12703
|
);
|
|
12073
|
-
const useInternalPagination = (0,
|
|
12704
|
+
const useInternalPagination = (0, import_react39.useMemo)(
|
|
12074
12705
|
() => enablePagination && !onParamsChange && totalItems === void 0 && totalPages === void 0,
|
|
12075
12706
|
[enablePagination, onParamsChange, totalItems, totalPages]
|
|
12076
12707
|
);
|
|
@@ -12078,7 +12709,7 @@ function TableProvider({
|
|
|
12078
12709
|
(totalItems ?? (useInternalPagination ? sortedData.length : data.length)) / itemsPerPage
|
|
12079
12710
|
);
|
|
12080
12711
|
const calculatedTotalItems = totalItems ?? (useInternalPagination ? sortedData.length : data.length);
|
|
12081
|
-
const displayData = (0,
|
|
12712
|
+
const displayData = (0, import_react39.useMemo)(() => {
|
|
12082
12713
|
if (!useInternalPagination) {
|
|
12083
12714
|
return sortedData;
|
|
12084
12715
|
}
|
|
@@ -12245,7 +12876,7 @@ var TableProvider_default = TableProvider;
|
|
|
12245
12876
|
|
|
12246
12877
|
// src/components/Select/Select.tsx
|
|
12247
12878
|
var import_zustand10 = require("zustand");
|
|
12248
|
-
var
|
|
12879
|
+
var import_react40 = require("react");
|
|
12249
12880
|
var import_phosphor_react27 = require("phosphor-react");
|
|
12250
12881
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12251
12882
|
var VARIANT_CLASSES4 = {
|
|
@@ -12305,13 +12936,13 @@ function getLabelAsNode(children) {
|
|
|
12305
12936
|
if (typeof children === "string" || typeof children === "number") {
|
|
12306
12937
|
return children;
|
|
12307
12938
|
}
|
|
12308
|
-
const flattened =
|
|
12939
|
+
const flattened = import_react40.Children.toArray(children);
|
|
12309
12940
|
if (flattened.length === 1) return flattened[0];
|
|
12310
12941
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: flattened });
|
|
12311
12942
|
}
|
|
12312
12943
|
var injectStore5 = (children, store, size, selectId) => {
|
|
12313
|
-
return
|
|
12314
|
-
if ((0,
|
|
12944
|
+
return import_react40.Children.map(children, (child) => {
|
|
12945
|
+
if ((0, import_react40.isValidElement)(child)) {
|
|
12315
12946
|
const typedChild = child;
|
|
12316
12947
|
const newProps = {
|
|
12317
12948
|
store
|
|
@@ -12328,7 +12959,7 @@ var injectStore5 = (children, store, size, selectId) => {
|
|
|
12328
12959
|
selectId
|
|
12329
12960
|
);
|
|
12330
12961
|
}
|
|
12331
|
-
return (0,
|
|
12962
|
+
return (0, import_react40.cloneElement)(typedChild, newProps);
|
|
12332
12963
|
}
|
|
12333
12964
|
return child;
|
|
12334
12965
|
});
|
|
@@ -12345,18 +12976,18 @@ var Select = ({
|
|
|
12345
12976
|
errorMessage,
|
|
12346
12977
|
id
|
|
12347
12978
|
}) => {
|
|
12348
|
-
const storeRef = (0,
|
|
12979
|
+
const storeRef = (0, import_react40.useRef)(null);
|
|
12349
12980
|
storeRef.current ??= createSelectStore(onValueChange);
|
|
12350
12981
|
const store = storeRef.current;
|
|
12351
|
-
const selectRef = (0,
|
|
12982
|
+
const selectRef = (0, import_react40.useRef)(null);
|
|
12352
12983
|
const { open, setOpen, setValue, selectedLabel } = (0, import_zustand10.useStore)(store, (s) => s);
|
|
12353
|
-
const generatedId = (0,
|
|
12984
|
+
const generatedId = (0, import_react40.useId)();
|
|
12354
12985
|
const selectId = id ?? `select-${generatedId}`;
|
|
12355
12986
|
const findLabelForValue = (children2, targetValue) => {
|
|
12356
12987
|
let found = null;
|
|
12357
12988
|
const search = (nodes) => {
|
|
12358
|
-
|
|
12359
|
-
if (!(0,
|
|
12989
|
+
import_react40.Children.forEach(nodes, (child) => {
|
|
12990
|
+
if (!(0, import_react40.isValidElement)(child)) return;
|
|
12360
12991
|
const typedChild = child;
|
|
12361
12992
|
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
12362
12993
|
if (typeof typedChild.props.children === "string")
|
|
@@ -12369,13 +13000,13 @@ var Select = ({
|
|
|
12369
13000
|
search(children2);
|
|
12370
13001
|
return found;
|
|
12371
13002
|
};
|
|
12372
|
-
(0,
|
|
13003
|
+
(0, import_react40.useEffect)(() => {
|
|
12373
13004
|
if (!selectedLabel && defaultValue) {
|
|
12374
13005
|
const label2 = findLabelForValue(children, defaultValue);
|
|
12375
13006
|
if (label2) store.setState({ selectedLabel: label2 });
|
|
12376
13007
|
}
|
|
12377
13008
|
}, [children, defaultValue, selectedLabel]);
|
|
12378
|
-
(0,
|
|
13009
|
+
(0, import_react40.useEffect)(() => {
|
|
12379
13010
|
const handleClickOutside = (event) => {
|
|
12380
13011
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
12381
13012
|
setOpen(false);
|
|
@@ -12410,7 +13041,7 @@ var Select = ({
|
|
|
12410
13041
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
12411
13042
|
};
|
|
12412
13043
|
}, [open]);
|
|
12413
|
-
(0,
|
|
13044
|
+
(0, import_react40.useEffect)(() => {
|
|
12414
13045
|
if (propValue) {
|
|
12415
13046
|
setValue(propValue);
|
|
12416
13047
|
const label2 = findLabelForValue(children, propValue);
|
|
@@ -12447,7 +13078,7 @@ var SelectValue = ({
|
|
|
12447
13078
|
const value = (0, import_zustand10.useStore)(store, (s) => s.value);
|
|
12448
13079
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-inherit flex gap-2 items-center", children: selectedLabel || placeholder || value });
|
|
12449
13080
|
};
|
|
12450
|
-
var SelectTrigger = (0,
|
|
13081
|
+
var SelectTrigger = (0, import_react40.forwardRef)(
|
|
12451
13082
|
({
|
|
12452
13083
|
className,
|
|
12453
13084
|
invalid = false,
|
|
@@ -12501,7 +13132,7 @@ var SelectTrigger = (0, import_react38.forwardRef)(
|
|
|
12501
13132
|
}
|
|
12502
13133
|
);
|
|
12503
13134
|
SelectTrigger.displayName = "SelectTrigger";
|
|
12504
|
-
var SelectContent = (0,
|
|
13135
|
+
var SelectContent = (0, import_react40.forwardRef)(
|
|
12505
13136
|
({
|
|
12506
13137
|
children,
|
|
12507
13138
|
className,
|
|
@@ -12531,7 +13162,7 @@ var SelectContent = (0, import_react38.forwardRef)(
|
|
|
12531
13162
|
}
|
|
12532
13163
|
);
|
|
12533
13164
|
SelectContent.displayName = "SelectContent";
|
|
12534
|
-
var SelectItem = (0,
|
|
13165
|
+
var SelectItem = (0, import_react40.forwardRef)(
|
|
12535
13166
|
({
|
|
12536
13167
|
className,
|
|
12537
13168
|
children,
|
|
@@ -12590,7 +13221,7 @@ var Select_default = Select;
|
|
|
12590
13221
|
|
|
12591
13222
|
// src/components/Menu/Menu.tsx
|
|
12592
13223
|
var import_zustand11 = require("zustand");
|
|
12593
|
-
var
|
|
13224
|
+
var import_react41 = require("react");
|
|
12594
13225
|
var import_phosphor_react28 = require("phosphor-react");
|
|
12595
13226
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
12596
13227
|
var createMenuStore = (onValueChange) => (0, import_zustand11.create)((set) => ({
|
|
@@ -12611,7 +13242,7 @@ var VARIANT_CLASSES5 = {
|
|
|
12611
13242
|
"menu-overflow": "",
|
|
12612
13243
|
breadcrumb: "bg-transparent shadow-none !px-0"
|
|
12613
13244
|
};
|
|
12614
|
-
var Menu = (0,
|
|
13245
|
+
var Menu = (0, import_react41.forwardRef)(
|
|
12615
13246
|
({
|
|
12616
13247
|
className,
|
|
12617
13248
|
children,
|
|
@@ -12621,11 +13252,11 @@ var Menu = (0, import_react39.forwardRef)(
|
|
|
12621
13252
|
onValueChange,
|
|
12622
13253
|
...props
|
|
12623
13254
|
}, ref) => {
|
|
12624
|
-
const storeRef = (0,
|
|
13255
|
+
const storeRef = (0, import_react41.useRef)(null);
|
|
12625
13256
|
storeRef.current ??= createMenuStore(onValueChange);
|
|
12626
13257
|
const store = storeRef.current;
|
|
12627
13258
|
const { setValue } = (0, import_zustand11.useStore)(store, (s) => s);
|
|
12628
|
-
(0,
|
|
13259
|
+
(0, import_react41.useEffect)(() => {
|
|
12629
13260
|
setValue(propValue ?? defaultValue);
|
|
12630
13261
|
}, [defaultValue, propValue, setValue]);
|
|
12631
13262
|
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";
|
|
@@ -12646,7 +13277,7 @@ var Menu = (0, import_react39.forwardRef)(
|
|
|
12646
13277
|
}
|
|
12647
13278
|
);
|
|
12648
13279
|
Menu.displayName = "Menu";
|
|
12649
|
-
var MenuContent = (0,
|
|
13280
|
+
var MenuContent = (0, import_react41.forwardRef)(
|
|
12650
13281
|
({ className, children, variant = "menu", ...props }, ref) => {
|
|
12651
13282
|
const baseClasses = "w-full flex flex-row items-center gap-2";
|
|
12652
13283
|
const variantClasses = variant === "menu2" || variant === "menu-overflow" ? "overflow-x-auto scroll-smooth" : "";
|
|
@@ -12668,7 +13299,7 @@ var MenuContent = (0, import_react39.forwardRef)(
|
|
|
12668
13299
|
}
|
|
12669
13300
|
);
|
|
12670
13301
|
MenuContent.displayName = "MenuContent";
|
|
12671
|
-
var MenuItem = (0,
|
|
13302
|
+
var MenuItem = (0, import_react41.forwardRef)(
|
|
12672
13303
|
({
|
|
12673
13304
|
className,
|
|
12674
13305
|
children,
|
|
@@ -12826,10 +13457,10 @@ var MenuOverflow = ({
|
|
|
12826
13457
|
onValueChange,
|
|
12827
13458
|
...props
|
|
12828
13459
|
}) => {
|
|
12829
|
-
const containerRef = (0,
|
|
12830
|
-
const [showLeftArrow, setShowLeftArrow] = (0,
|
|
12831
|
-
const [showRightArrow, setShowRightArrow] = (0,
|
|
12832
|
-
(0,
|
|
13460
|
+
const containerRef = (0, import_react41.useRef)(null);
|
|
13461
|
+
const [showLeftArrow, setShowLeftArrow] = (0, import_react41.useState)(false);
|
|
13462
|
+
const [showRightArrow, setShowRightArrow] = (0, import_react41.useState)(false);
|
|
13463
|
+
(0, import_react41.useEffect)(() => {
|
|
12833
13464
|
const checkScroll = () => internalCheckScroll(
|
|
12834
13465
|
containerRef.current,
|
|
12835
13466
|
setShowLeftArrow,
|
|
@@ -12889,11 +13520,11 @@ var MenuOverflow = ({
|
|
|
12889
13520
|
}
|
|
12890
13521
|
);
|
|
12891
13522
|
};
|
|
12892
|
-
var injectStore6 = (children, store) =>
|
|
12893
|
-
if (!(0,
|
|
13523
|
+
var injectStore6 = (children, store) => import_react41.Children.map(children, (child) => {
|
|
13524
|
+
if (!(0, import_react41.isValidElement)(child)) return child;
|
|
12894
13525
|
const typedChild = child;
|
|
12895
13526
|
const shouldInject = typedChild.type === MenuItem;
|
|
12896
|
-
return (0,
|
|
13527
|
+
return (0, import_react41.cloneElement)(typedChild, {
|
|
12897
13528
|
...shouldInject ? { store } : {},
|
|
12898
13529
|
...typedChild.props.children ? { children: injectStore6(typedChild.props.children, store) } : {}
|
|
12899
13530
|
});
|
|
@@ -13152,12 +13783,12 @@ var NotFound = ({
|
|
|
13152
13783
|
var NotFound_default = NotFound;
|
|
13153
13784
|
|
|
13154
13785
|
// src/components/VideoPlayer/VideoPlayer.tsx
|
|
13155
|
-
var
|
|
13786
|
+
var import_react43 = require("react");
|
|
13156
13787
|
var import_react_dom = require("react-dom");
|
|
13157
13788
|
var import_phosphor_react31 = require("phosphor-react");
|
|
13158
13789
|
|
|
13159
13790
|
// src/components/DownloadButton/DownloadButton.tsx
|
|
13160
|
-
var
|
|
13791
|
+
var import_react42 = require("react");
|
|
13161
13792
|
var import_phosphor_react30 = require("phosphor-react");
|
|
13162
13793
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
13163
13794
|
var getMimeType = (url) => {
|
|
@@ -13234,13 +13865,13 @@ var DownloadButton = ({
|
|
|
13234
13865
|
lessonTitle = "aula",
|
|
13235
13866
|
disabled = false
|
|
13236
13867
|
}) => {
|
|
13237
|
-
const [isDownloading, setIsDownloading] = (0,
|
|
13238
|
-
const isValidUrl = (0,
|
|
13868
|
+
const [isDownloading, setIsDownloading] = (0, import_react42.useState)(false);
|
|
13869
|
+
const isValidUrl = (0, import_react42.useCallback)((url) => {
|
|
13239
13870
|
return Boolean(
|
|
13240
13871
|
url && url.trim() !== "" && url !== "undefined" && url !== "null"
|
|
13241
13872
|
);
|
|
13242
13873
|
}, []);
|
|
13243
|
-
const getAvailableContent = (0,
|
|
13874
|
+
const getAvailableContent = (0, import_react42.useCallback)(() => {
|
|
13244
13875
|
const downloads = [];
|
|
13245
13876
|
if (isValidUrl(content.urlDoc)) {
|
|
13246
13877
|
downloads.push({
|
|
@@ -13275,7 +13906,7 @@ var DownloadButton = ({
|
|
|
13275
13906
|
}
|
|
13276
13907
|
return downloads;
|
|
13277
13908
|
}, [content, isValidUrl]);
|
|
13278
|
-
const handleDownload = (0,
|
|
13909
|
+
const handleDownload = (0, import_react42.useCallback)(async () => {
|
|
13279
13910
|
if (disabled || isDownloading) return;
|
|
13280
13911
|
const availableContent = getAvailableContent();
|
|
13281
13912
|
if (availableContent.length === 0) {
|
|
@@ -13413,9 +14044,9 @@ var SpeedMenu = ({
|
|
|
13413
14044
|
iconSize = 24,
|
|
13414
14045
|
isTinyMobile = false
|
|
13415
14046
|
}) => {
|
|
13416
|
-
const buttonRef = (0,
|
|
13417
|
-
const speedMenuContainerRef = (0,
|
|
13418
|
-
const speedMenuRef = (0,
|
|
14047
|
+
const buttonRef = (0, import_react43.useRef)(null);
|
|
14048
|
+
const speedMenuContainerRef = (0, import_react43.useRef)(null);
|
|
14049
|
+
const speedMenuRef = (0, import_react43.useRef)(null);
|
|
13419
14050
|
const getMenuPosition = () => {
|
|
13420
14051
|
if (!buttonRef.current) return { top: 0, left: 0 };
|
|
13421
14052
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
@@ -13429,7 +14060,7 @@ var SpeedMenu = ({
|
|
|
13429
14060
|
};
|
|
13430
14061
|
};
|
|
13431
14062
|
const position = getMenuPosition();
|
|
13432
|
-
(0,
|
|
14063
|
+
(0, import_react43.useEffect)(() => {
|
|
13433
14064
|
const handleClickOutside = (event) => {
|
|
13434
14065
|
const target = event.target;
|
|
13435
14066
|
const isOutsideContainer = speedMenuContainerRef.current && !speedMenuContainerRef.current.contains(target);
|
|
@@ -13508,28 +14139,28 @@ var VideoPlayer = ({
|
|
|
13508
14139
|
onDownloadComplete,
|
|
13509
14140
|
onDownloadError
|
|
13510
14141
|
}) => {
|
|
13511
|
-
const videoRef = (0,
|
|
14142
|
+
const videoRef = (0, import_react43.useRef)(null);
|
|
13512
14143
|
const { isUltraSmallMobile, isTinyMobile } = useMobile();
|
|
13513
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
13514
|
-
const [currentTime, setCurrentTime] = (0,
|
|
13515
|
-
const [duration, setDuration] = (0,
|
|
13516
|
-
const [isMuted, setIsMuted] = (0,
|
|
13517
|
-
const [volume, setVolume] = (0,
|
|
13518
|
-
const [isFullscreen, setIsFullscreen] = (0,
|
|
13519
|
-
const [showControls, setShowControls] = (0,
|
|
13520
|
-
const [hasCompleted, setHasCompleted] = (0,
|
|
13521
|
-
const [showCaptions, setShowCaptions] = (0,
|
|
13522
|
-
const [subtitlesValidation, setSubtitlesValidation] = (0,
|
|
13523
|
-
(0,
|
|
14144
|
+
const [isPlaying, setIsPlaying] = (0, import_react43.useState)(false);
|
|
14145
|
+
const [currentTime, setCurrentTime] = (0, import_react43.useState)(0);
|
|
14146
|
+
const [duration, setDuration] = (0, import_react43.useState)(0);
|
|
14147
|
+
const [isMuted, setIsMuted] = (0, import_react43.useState)(false);
|
|
14148
|
+
const [volume, setVolume] = (0, import_react43.useState)(1);
|
|
14149
|
+
const [isFullscreen, setIsFullscreen] = (0, import_react43.useState)(false);
|
|
14150
|
+
const [showControls, setShowControls] = (0, import_react43.useState)(true);
|
|
14151
|
+
const [hasCompleted, setHasCompleted] = (0, import_react43.useState)(false);
|
|
14152
|
+
const [showCaptions, setShowCaptions] = (0, import_react43.useState)(false);
|
|
14153
|
+
const [subtitlesValidation, setSubtitlesValidation] = (0, import_react43.useState)("idle");
|
|
14154
|
+
(0, import_react43.useEffect)(() => {
|
|
13524
14155
|
setHasCompleted(false);
|
|
13525
14156
|
}, [src]);
|
|
13526
|
-
const [playbackRate, setPlaybackRate] = (0,
|
|
13527
|
-
const [showSpeedMenu, setShowSpeedMenu] = (0,
|
|
13528
|
-
const lastSaveTimeRef = (0,
|
|
13529
|
-
const trackRef = (0,
|
|
13530
|
-
const controlsTimeoutRef = (0,
|
|
13531
|
-
const lastMousePositionRef = (0,
|
|
13532
|
-
const isUserInteracting = (0,
|
|
14157
|
+
const [playbackRate, setPlaybackRate] = (0, import_react43.useState)(1);
|
|
14158
|
+
const [showSpeedMenu, setShowSpeedMenu] = (0, import_react43.useState)(false);
|
|
14159
|
+
const lastSaveTimeRef = (0, import_react43.useRef)(0);
|
|
14160
|
+
const trackRef = (0, import_react43.useRef)(null);
|
|
14161
|
+
const controlsTimeoutRef = (0, import_react43.useRef)(null);
|
|
14162
|
+
const lastMousePositionRef = (0, import_react43.useRef)({ x: 0, y: 0 });
|
|
14163
|
+
const isUserInteracting = (0, import_react43.useCallback)(() => {
|
|
13533
14164
|
if (showSpeedMenu) {
|
|
13534
14165
|
return true;
|
|
13535
14166
|
}
|
|
@@ -13546,13 +14177,13 @@ var VideoPlayer = ({
|
|
|
13546
14177
|
}
|
|
13547
14178
|
return false;
|
|
13548
14179
|
}, [showSpeedMenu]);
|
|
13549
|
-
const clearControlsTimeout = (0,
|
|
14180
|
+
const clearControlsTimeout = (0, import_react43.useCallback)(() => {
|
|
13550
14181
|
if (controlsTimeoutRef.current) {
|
|
13551
14182
|
clearTimeout(controlsTimeoutRef.current);
|
|
13552
14183
|
controlsTimeoutRef.current = null;
|
|
13553
14184
|
}
|
|
13554
14185
|
}, []);
|
|
13555
|
-
const showControlsWithTimer = (0,
|
|
14186
|
+
const showControlsWithTimer = (0, import_react43.useCallback)(() => {
|
|
13556
14187
|
setShowControls(true);
|
|
13557
14188
|
clearControlsTimeout();
|
|
13558
14189
|
if (isFullscreen) {
|
|
@@ -13567,7 +14198,7 @@ var VideoPlayer = ({
|
|
|
13567
14198
|
}, CONTROLS_HIDE_TIMEOUT);
|
|
13568
14199
|
}
|
|
13569
14200
|
}, [isFullscreen, isPlaying, clearControlsTimeout]);
|
|
13570
|
-
const handleMouseMove = (0,
|
|
14201
|
+
const handleMouseMove = (0, import_react43.useCallback)(
|
|
13571
14202
|
(event) => {
|
|
13572
14203
|
const currentX = event.clientX;
|
|
13573
14204
|
const currentY = event.clientY;
|
|
@@ -13580,10 +14211,10 @@ var VideoPlayer = ({
|
|
|
13580
14211
|
},
|
|
13581
14212
|
[showControlsWithTimer]
|
|
13582
14213
|
);
|
|
13583
|
-
const handleMouseEnter = (0,
|
|
14214
|
+
const handleMouseEnter = (0, import_react43.useCallback)(() => {
|
|
13584
14215
|
showControlsWithTimer();
|
|
13585
14216
|
}, [showControlsWithTimer]);
|
|
13586
|
-
const handleMouseLeave = (0,
|
|
14217
|
+
const handleMouseLeave = (0, import_react43.useCallback)(() => {
|
|
13587
14218
|
const userInteracting = isUserInteracting();
|
|
13588
14219
|
clearControlsTimeout();
|
|
13589
14220
|
if (!isFullscreen && !userInteracting) {
|
|
@@ -13592,13 +14223,13 @@ var VideoPlayer = ({
|
|
|
13592
14223
|
}, LEAVE_HIDE_TIMEOUT);
|
|
13593
14224
|
}
|
|
13594
14225
|
}, [isFullscreen, clearControlsTimeout, isUserInteracting]);
|
|
13595
|
-
(0,
|
|
14226
|
+
(0, import_react43.useEffect)(() => {
|
|
13596
14227
|
if (videoRef.current) {
|
|
13597
14228
|
videoRef.current.volume = volume;
|
|
13598
14229
|
videoRef.current.muted = isMuted;
|
|
13599
14230
|
}
|
|
13600
14231
|
}, [volume, isMuted]);
|
|
13601
|
-
(0,
|
|
14232
|
+
(0, import_react43.useEffect)(() => {
|
|
13602
14233
|
const video = videoRef.current;
|
|
13603
14234
|
if (!video) return;
|
|
13604
14235
|
const onPlay = () => setIsPlaying(true);
|
|
@@ -13613,13 +14244,13 @@ var VideoPlayer = ({
|
|
|
13613
14244
|
video.removeEventListener("ended", onEnded);
|
|
13614
14245
|
};
|
|
13615
14246
|
}, []);
|
|
13616
|
-
(0,
|
|
14247
|
+
(0, import_react43.useEffect)(() => {
|
|
13617
14248
|
const video = videoRef.current;
|
|
13618
14249
|
if (!video) return;
|
|
13619
14250
|
video.setAttribute("playsinline", "");
|
|
13620
14251
|
video.setAttribute("webkit-playsinline", "");
|
|
13621
14252
|
}, []);
|
|
13622
|
-
(0,
|
|
14253
|
+
(0, import_react43.useEffect)(() => {
|
|
13623
14254
|
if (isPlaying) {
|
|
13624
14255
|
showControlsWithTimer();
|
|
13625
14256
|
} else {
|
|
@@ -13631,7 +14262,7 @@ var VideoPlayer = ({
|
|
|
13631
14262
|
}
|
|
13632
14263
|
}
|
|
13633
14264
|
}, [isPlaying, isFullscreen, showControlsWithTimer, clearControlsTimeout]);
|
|
13634
|
-
(0,
|
|
14265
|
+
(0, import_react43.useEffect)(() => {
|
|
13635
14266
|
const video = videoRef.current;
|
|
13636
14267
|
if (!video) return;
|
|
13637
14268
|
const handleFullscreenChange = () => {
|
|
@@ -13666,7 +14297,7 @@ var VideoPlayer = ({
|
|
|
13666
14297
|
);
|
|
13667
14298
|
};
|
|
13668
14299
|
}, [showControlsWithTimer]);
|
|
13669
|
-
(0,
|
|
14300
|
+
(0, import_react43.useEffect)(() => {
|
|
13670
14301
|
const init = () => {
|
|
13671
14302
|
if (!isFullscreen) {
|
|
13672
14303
|
showControlsWithTimer();
|
|
@@ -13688,7 +14319,7 @@ var VideoPlayer = ({
|
|
|
13688
14319
|
};
|
|
13689
14320
|
}
|
|
13690
14321
|
}, []);
|
|
13691
|
-
const getInitialTime = (0,
|
|
14322
|
+
const getInitialTime = (0, import_react43.useCallback)(() => {
|
|
13692
14323
|
if (!autoSave || !storageKey) {
|
|
13693
14324
|
return Number.isFinite(initialTime) && initialTime >= 0 ? initialTime : void 0;
|
|
13694
14325
|
}
|
|
@@ -13701,14 +14332,14 @@ var VideoPlayer = ({
|
|
|
13701
14332
|
if (hasValidSaved) return saved;
|
|
13702
14333
|
return void 0;
|
|
13703
14334
|
}, [autoSave, storageKey, src, initialTime]);
|
|
13704
|
-
(0,
|
|
14335
|
+
(0, import_react43.useEffect)(() => {
|
|
13705
14336
|
const start = getInitialTime();
|
|
13706
14337
|
if (start !== void 0 && videoRef.current) {
|
|
13707
14338
|
videoRef.current.currentTime = start;
|
|
13708
14339
|
setCurrentTime(start);
|
|
13709
14340
|
}
|
|
13710
14341
|
}, [getInitialTime]);
|
|
13711
|
-
const saveProgress = (0,
|
|
14342
|
+
const saveProgress = (0, import_react43.useCallback)(
|
|
13712
14343
|
(time) => {
|
|
13713
14344
|
if (!autoSave || !storageKey) return;
|
|
13714
14345
|
const now = Date.now();
|
|
@@ -13719,7 +14350,7 @@ var VideoPlayer = ({
|
|
|
13719
14350
|
},
|
|
13720
14351
|
[autoSave, storageKey, src]
|
|
13721
14352
|
);
|
|
13722
|
-
const togglePlayPause = (0,
|
|
14353
|
+
const togglePlayPause = (0, import_react43.useCallback)(async () => {
|
|
13723
14354
|
const video = videoRef.current;
|
|
13724
14355
|
if (!video) return;
|
|
13725
14356
|
if (!video.paused) {
|
|
@@ -13731,7 +14362,7 @@ var VideoPlayer = ({
|
|
|
13731
14362
|
} catch {
|
|
13732
14363
|
}
|
|
13733
14364
|
}, []);
|
|
13734
|
-
const handleVolumeChange = (0,
|
|
14365
|
+
const handleVolumeChange = (0, import_react43.useCallback)(
|
|
13735
14366
|
(newVolume) => {
|
|
13736
14367
|
const video = videoRef.current;
|
|
13737
14368
|
if (!video) return;
|
|
@@ -13750,7 +14381,7 @@ var VideoPlayer = ({
|
|
|
13750
14381
|
},
|
|
13751
14382
|
[isMuted]
|
|
13752
14383
|
);
|
|
13753
|
-
const toggleMute = (0,
|
|
14384
|
+
const toggleMute = (0, import_react43.useCallback)(() => {
|
|
13754
14385
|
const video = videoRef.current;
|
|
13755
14386
|
if (!video) return;
|
|
13756
14387
|
if (isMuted) {
|
|
@@ -13764,20 +14395,20 @@ var VideoPlayer = ({
|
|
|
13764
14395
|
setIsMuted(true);
|
|
13765
14396
|
}
|
|
13766
14397
|
}, [isMuted, volume]);
|
|
13767
|
-
const handleSeek = (0,
|
|
14398
|
+
const handleSeek = (0, import_react43.useCallback)((newTime) => {
|
|
13768
14399
|
const video = videoRef.current;
|
|
13769
14400
|
if (video) {
|
|
13770
14401
|
video.currentTime = newTime;
|
|
13771
14402
|
}
|
|
13772
14403
|
}, []);
|
|
13773
|
-
const isSafariIOS = (0,
|
|
14404
|
+
const isSafariIOS = (0, import_react43.useCallback)(() => {
|
|
13774
14405
|
const ua = navigator.userAgent;
|
|
13775
14406
|
const isIOS = /iPad|iPhone|iPod/.test(ua);
|
|
13776
14407
|
const isWebKit = /WebKit/.test(ua);
|
|
13777
14408
|
const isNotChrome = !/CriOS|Chrome/.test(ua);
|
|
13778
14409
|
return isIOS && isWebKit && isNotChrome;
|
|
13779
14410
|
}, []);
|
|
13780
|
-
const toggleFullscreen = (0,
|
|
14411
|
+
const toggleFullscreen = (0, import_react43.useCallback)(() => {
|
|
13781
14412
|
const video = videoRef.current;
|
|
13782
14413
|
const container = video?.parentElement;
|
|
13783
14414
|
if (!video || !container) return;
|
|
@@ -13794,24 +14425,24 @@ var VideoPlayer = ({
|
|
|
13794
14425
|
document.exitFullscreen();
|
|
13795
14426
|
}
|
|
13796
14427
|
}, [isFullscreen, isSafariIOS]);
|
|
13797
|
-
const handleSpeedChange = (0,
|
|
14428
|
+
const handleSpeedChange = (0, import_react43.useCallback)((speed) => {
|
|
13798
14429
|
if (videoRef.current) {
|
|
13799
14430
|
videoRef.current.playbackRate = speed;
|
|
13800
14431
|
setPlaybackRate(speed);
|
|
13801
14432
|
setShowSpeedMenu(false);
|
|
13802
14433
|
}
|
|
13803
14434
|
}, []);
|
|
13804
|
-
const toggleSpeedMenu = (0,
|
|
14435
|
+
const toggleSpeedMenu = (0, import_react43.useCallback)(() => {
|
|
13805
14436
|
setShowSpeedMenu(!showSpeedMenu);
|
|
13806
14437
|
}, [showSpeedMenu]);
|
|
13807
|
-
const toggleCaptions = (0,
|
|
14438
|
+
const toggleCaptions = (0, import_react43.useCallback)(() => {
|
|
13808
14439
|
if (!trackRef.current?.track || !subtitles || subtitlesValidation !== "valid")
|
|
13809
14440
|
return;
|
|
13810
14441
|
const newShowCaptions = !showCaptions;
|
|
13811
14442
|
setShowCaptions(newShowCaptions);
|
|
13812
14443
|
trackRef.current.track.mode = newShowCaptions ? "showing" : "hidden";
|
|
13813
14444
|
}, [showCaptions, subtitles, subtitlesValidation]);
|
|
13814
|
-
const checkVideoCompletion = (0,
|
|
14445
|
+
const checkVideoCompletion = (0, import_react43.useCallback)(
|
|
13815
14446
|
(progressPercent) => {
|
|
13816
14447
|
if (progressPercent >= 95 && !hasCompleted) {
|
|
13817
14448
|
setHasCompleted(true);
|
|
@@ -13820,7 +14451,7 @@ var VideoPlayer = ({
|
|
|
13820
14451
|
},
|
|
13821
14452
|
[hasCompleted, onVideoComplete]
|
|
13822
14453
|
);
|
|
13823
|
-
const handleTimeUpdate = (0,
|
|
14454
|
+
const handleTimeUpdate = (0, import_react43.useCallback)(() => {
|
|
13824
14455
|
const video = videoRef.current;
|
|
13825
14456
|
if (!video) return;
|
|
13826
14457
|
const current = video.currentTime;
|
|
@@ -13833,12 +14464,12 @@ var VideoPlayer = ({
|
|
|
13833
14464
|
checkVideoCompletion(progressPercent);
|
|
13834
14465
|
}
|
|
13835
14466
|
}, [duration, saveProgress, onTimeUpdate, onProgress, checkVideoCompletion]);
|
|
13836
|
-
const handleLoadedMetadata = (0,
|
|
14467
|
+
const handleLoadedMetadata = (0, import_react43.useCallback)(() => {
|
|
13837
14468
|
if (videoRef.current) {
|
|
13838
14469
|
setDuration(videoRef.current.duration);
|
|
13839
14470
|
}
|
|
13840
14471
|
}, []);
|
|
13841
|
-
(0,
|
|
14472
|
+
(0, import_react43.useEffect)(() => {
|
|
13842
14473
|
const controller = new AbortController();
|
|
13843
14474
|
const validateSubtitles = async () => {
|
|
13844
14475
|
if (!subtitles) {
|
|
@@ -13885,12 +14516,12 @@ var VideoPlayer = ({
|
|
|
13885
14516
|
controller.abort();
|
|
13886
14517
|
};
|
|
13887
14518
|
}, [subtitles]);
|
|
13888
|
-
(0,
|
|
14519
|
+
(0, import_react43.useEffect)(() => {
|
|
13889
14520
|
if (trackRef.current?.track) {
|
|
13890
14521
|
trackRef.current.track.mode = showCaptions && subtitles && subtitlesValidation === "valid" ? "showing" : "hidden";
|
|
13891
14522
|
}
|
|
13892
14523
|
}, [subtitles, showCaptions, subtitlesValidation]);
|
|
13893
|
-
(0,
|
|
14524
|
+
(0, import_react43.useEffect)(() => {
|
|
13894
14525
|
const handleVisibilityChange = () => {
|
|
13895
14526
|
if (document.hidden && isPlaying && videoRef.current) {
|
|
13896
14527
|
videoRef.current.pause();
|
|
@@ -13912,54 +14543,54 @@ var VideoPlayer = ({
|
|
|
13912
14543
|
};
|
|
13913
14544
|
}, [isPlaying, clearControlsTimeout]);
|
|
13914
14545
|
const progressPercentage = duration > 0 ? currentTime / duration * 100 : 0;
|
|
13915
|
-
const getIconSize2 = (0,
|
|
14546
|
+
const getIconSize2 = (0, import_react43.useCallback)(() => {
|
|
13916
14547
|
if (isTinyMobile) return 18;
|
|
13917
14548
|
if (isUltraSmallMobile) return 20;
|
|
13918
14549
|
return 24;
|
|
13919
14550
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13920
|
-
const getControlsPadding = (0,
|
|
14551
|
+
const getControlsPadding = (0, import_react43.useCallback)(() => {
|
|
13921
14552
|
if (isTinyMobile) return "px-2 pb-2 pt-1";
|
|
13922
14553
|
if (isUltraSmallMobile) return "px-3 pb-3 pt-1";
|
|
13923
14554
|
return "px-4 pb-4";
|
|
13924
14555
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13925
|
-
const getControlsGap = (0,
|
|
14556
|
+
const getControlsGap = (0, import_react43.useCallback)(() => {
|
|
13926
14557
|
if (isTinyMobile) return "gap-1";
|
|
13927
14558
|
if (isUltraSmallMobile) return "gap-2";
|
|
13928
14559
|
return "gap-4";
|
|
13929
14560
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13930
|
-
const getProgressBarPadding = (0,
|
|
14561
|
+
const getProgressBarPadding = (0, import_react43.useCallback)(() => {
|
|
13931
14562
|
if (isTinyMobile) return "px-2 pb-1";
|
|
13932
14563
|
if (isUltraSmallMobile) return "px-3 pb-1";
|
|
13933
14564
|
return "px-4 pb-2";
|
|
13934
14565
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13935
|
-
const getCenterPlayButtonPosition = (0,
|
|
14566
|
+
const getCenterPlayButtonPosition = (0, import_react43.useCallback)(() => {
|
|
13936
14567
|
if (isTinyMobile) return "items-center justify-center -translate-y-12";
|
|
13937
14568
|
if (isUltraSmallMobile) return "items-center justify-center -translate-y-8";
|
|
13938
14569
|
return "items-center justify-center";
|
|
13939
14570
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
13940
|
-
const getTopControlsOpacity = (0,
|
|
14571
|
+
const getTopControlsOpacity = (0, import_react43.useCallback)(() => {
|
|
13941
14572
|
return showControls ? "opacity-100" : "opacity-0";
|
|
13942
14573
|
}, [showControls]);
|
|
13943
|
-
const getBottomControlsOpacity = (0,
|
|
14574
|
+
const getBottomControlsOpacity = (0, import_react43.useCallback)(() => {
|
|
13944
14575
|
return showControls ? "opacity-100" : "opacity-0";
|
|
13945
14576
|
}, [showControls]);
|
|
13946
|
-
const seekBackward = (0,
|
|
14577
|
+
const seekBackward = (0, import_react43.useCallback)(() => {
|
|
13947
14578
|
if (videoRef.current) {
|
|
13948
14579
|
videoRef.current.currentTime -= 10;
|
|
13949
14580
|
}
|
|
13950
14581
|
}, []);
|
|
13951
|
-
const seekForward = (0,
|
|
14582
|
+
const seekForward = (0, import_react43.useCallback)(() => {
|
|
13952
14583
|
if (videoRef.current) {
|
|
13953
14584
|
videoRef.current.currentTime += 10;
|
|
13954
14585
|
}
|
|
13955
14586
|
}, []);
|
|
13956
|
-
const increaseVolume = (0,
|
|
14587
|
+
const increaseVolume = (0, import_react43.useCallback)(() => {
|
|
13957
14588
|
handleVolumeChange(Math.min(100, volume * 100 + 10));
|
|
13958
14589
|
}, [handleVolumeChange, volume]);
|
|
13959
|
-
const decreaseVolume = (0,
|
|
14590
|
+
const decreaseVolume = (0, import_react43.useCallback)(() => {
|
|
13960
14591
|
handleVolumeChange(Math.max(0, volume * 100 - 10));
|
|
13961
14592
|
}, [handleVolumeChange, volume]);
|
|
13962
|
-
const handleVideoKeyDown = (0,
|
|
14593
|
+
const handleVideoKeyDown = (0, import_react43.useCallback)(
|
|
13963
14594
|
(e) => {
|
|
13964
14595
|
if (!e.key) return;
|
|
13965
14596
|
e.stopPropagation();
|
|
@@ -14202,7 +14833,7 @@ var VideoPlayer = ({
|
|
|
14202
14833
|
var VideoPlayer_default = VideoPlayer;
|
|
14203
14834
|
|
|
14204
14835
|
// src/components/Whiteboard/Whiteboard.tsx
|
|
14205
|
-
var
|
|
14836
|
+
var import_react44 = require("react");
|
|
14206
14837
|
var import_phosphor_react32 = require("phosphor-react");
|
|
14207
14838
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
14208
14839
|
var IMAGE_WIDTH = 225;
|
|
@@ -14215,8 +14846,8 @@ var Whiteboard = ({
|
|
|
14215
14846
|
imagesPerRow = 2,
|
|
14216
14847
|
...rest
|
|
14217
14848
|
}) => {
|
|
14218
|
-
const [imageErrors, setImageErrors] = (0,
|
|
14219
|
-
const handleDownload = (0,
|
|
14849
|
+
const [imageErrors, setImageErrors] = (0, import_react44.useState)(/* @__PURE__ */ new Set());
|
|
14850
|
+
const handleDownload = (0, import_react44.useCallback)(
|
|
14220
14851
|
(image) => {
|
|
14221
14852
|
if (onDownload) {
|
|
14222
14853
|
onDownload(image);
|
|
@@ -14233,7 +14864,7 @@ var Whiteboard = ({
|
|
|
14233
14864
|
},
|
|
14234
14865
|
[onDownload]
|
|
14235
14866
|
);
|
|
14236
|
-
const handleImageError = (0,
|
|
14867
|
+
const handleImageError = (0, import_react44.useCallback)((imageId) => {
|
|
14237
14868
|
setImageErrors((prev) => new Set(prev).add(imageId));
|
|
14238
14869
|
}, []);
|
|
14239
14870
|
const gridColsClass = images?.length === 1 ? "grid-cols-1" : {
|
|
@@ -14320,10 +14951,10 @@ var Whiteboard = ({
|
|
|
14320
14951
|
var Whiteboard_default = Whiteboard;
|
|
14321
14952
|
|
|
14322
14953
|
// src/components/Auth/Auth.tsx
|
|
14323
|
-
var
|
|
14954
|
+
var import_react45 = require("react");
|
|
14324
14955
|
var import_react_router_dom = require("react-router-dom");
|
|
14325
14956
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
14326
|
-
var AuthContext = (0,
|
|
14957
|
+
var AuthContext = (0, import_react45.createContext)(void 0);
|
|
14327
14958
|
var AuthProvider = ({
|
|
14328
14959
|
children,
|
|
14329
14960
|
checkAuthFn,
|
|
@@ -14333,12 +14964,12 @@ var AuthProvider = ({
|
|
|
14333
14964
|
getSessionFn,
|
|
14334
14965
|
getTokensFn
|
|
14335
14966
|
}) => {
|
|
14336
|
-
const [authState, setAuthState] = (0,
|
|
14967
|
+
const [authState, setAuthState] = (0, import_react45.useState)({
|
|
14337
14968
|
isAuthenticated: false,
|
|
14338
14969
|
isLoading: true,
|
|
14339
14970
|
...initialAuthState
|
|
14340
14971
|
});
|
|
14341
|
-
const checkAuth = (0,
|
|
14972
|
+
const checkAuth = (0, import_react45.useCallback)(async () => {
|
|
14342
14973
|
try {
|
|
14343
14974
|
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
14344
14975
|
if (!checkAuthFn) {
|
|
@@ -14369,7 +15000,7 @@ var AuthProvider = ({
|
|
|
14369
15000
|
return false;
|
|
14370
15001
|
}
|
|
14371
15002
|
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
14372
|
-
const signOut = (0,
|
|
15003
|
+
const signOut = (0, import_react45.useCallback)(() => {
|
|
14373
15004
|
if (signOutFn) {
|
|
14374
15005
|
signOutFn();
|
|
14375
15006
|
}
|
|
@@ -14381,10 +15012,10 @@ var AuthProvider = ({
|
|
|
14381
15012
|
tokens: void 0
|
|
14382
15013
|
}));
|
|
14383
15014
|
}, [signOutFn]);
|
|
14384
|
-
(0,
|
|
15015
|
+
(0, import_react45.useEffect)(() => {
|
|
14385
15016
|
checkAuth();
|
|
14386
15017
|
}, [checkAuth]);
|
|
14387
|
-
const contextValue = (0,
|
|
15018
|
+
const contextValue = (0, import_react45.useMemo)(
|
|
14388
15019
|
() => ({
|
|
14389
15020
|
...authState,
|
|
14390
15021
|
checkAuth,
|
|
@@ -14395,7 +15026,7 @@ var AuthProvider = ({
|
|
|
14395
15026
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AuthContext.Provider, { value: contextValue, children });
|
|
14396
15027
|
};
|
|
14397
15028
|
var useAuth = () => {
|
|
14398
|
-
const context = (0,
|
|
15029
|
+
const context = (0, import_react45.useContext)(AuthContext);
|
|
14399
15030
|
if (context === void 0) {
|
|
14400
15031
|
throw new Error("useAuth deve ser usado dentro de um AuthProvider");
|
|
14401
15032
|
}
|
|
@@ -14535,7 +15166,7 @@ function createZustandAuthAdapter(useAuthStore2) {
|
|
|
14535
15166
|
}
|
|
14536
15167
|
|
|
14537
15168
|
// src/components/Auth/useUrlAuthentication.ts
|
|
14538
|
-
var
|
|
15169
|
+
var import_react46 = require("react");
|
|
14539
15170
|
var import_react_router_dom2 = require("react-router-dom");
|
|
14540
15171
|
var getAuthParams = (location, extractParams) => {
|
|
14541
15172
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -14583,8 +15214,8 @@ var handleUserData = (responseData, setUser) => {
|
|
|
14583
15214
|
};
|
|
14584
15215
|
function useUrlAuthentication(options) {
|
|
14585
15216
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
14586
|
-
const processedRef = (0,
|
|
14587
|
-
(0,
|
|
15217
|
+
const processedRef = (0, import_react46.useRef)(false);
|
|
15218
|
+
(0, import_react46.useEffect)(() => {
|
|
14588
15219
|
const handleAuthentication = async () => {
|
|
14589
15220
|
if (processedRef.current) {
|
|
14590
15221
|
return;
|
|
@@ -14655,9 +15286,9 @@ function useUrlAuthentication(options) {
|
|
|
14655
15286
|
}
|
|
14656
15287
|
|
|
14657
15288
|
// src/components/Auth/useApiConfig.ts
|
|
14658
|
-
var
|
|
15289
|
+
var import_react47 = require("react");
|
|
14659
15290
|
function useApiConfig(api) {
|
|
14660
|
-
return (0,
|
|
15291
|
+
return (0, import_react47.useMemo)(
|
|
14661
15292
|
() => ({
|
|
14662
15293
|
get: (endpoint, config) => api.get(endpoint, config)
|
|
14663
15294
|
}),
|
|
@@ -14667,13 +15298,13 @@ function useApiConfig(api) {
|
|
|
14667
15298
|
|
|
14668
15299
|
// src/components/Quiz/Quiz.tsx
|
|
14669
15300
|
var import_phosphor_react35 = require("phosphor-react");
|
|
14670
|
-
var
|
|
15301
|
+
var import_react50 = require("react");
|
|
14671
15302
|
|
|
14672
15303
|
// src/components/Quiz/QuizContent.tsx
|
|
14673
|
-
var
|
|
15304
|
+
var import_react49 = require("react");
|
|
14674
15305
|
|
|
14675
15306
|
// src/components/MultipleChoice/MultipleChoice.tsx
|
|
14676
|
-
var
|
|
15307
|
+
var import_react48 = require("react");
|
|
14677
15308
|
var import_phosphor_react33 = require("phosphor-react");
|
|
14678
15309
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
14679
15310
|
var MultipleChoiceList = ({
|
|
@@ -14685,8 +15316,8 @@ var MultipleChoiceList = ({
|
|
|
14685
15316
|
onHandleSelectedValues,
|
|
14686
15317
|
mode = "interactive"
|
|
14687
15318
|
}) => {
|
|
14688
|
-
const [actualValue, setActualValue] = (0,
|
|
14689
|
-
(0,
|
|
15319
|
+
const [actualValue, setActualValue] = (0, import_react48.useState)(selectedValues);
|
|
15320
|
+
(0, import_react48.useEffect)(() => {
|
|
14690
15321
|
setActualValue(selectedValues);
|
|
14691
15322
|
}, [selectedValues]);
|
|
14692
15323
|
const getStatusBadge2 = (status) => {
|
|
@@ -14831,12 +15462,12 @@ var getStatusStyles = (variantCorrect) => {
|
|
|
14831
15462
|
return "bg-error-background border-error-300";
|
|
14832
15463
|
}
|
|
14833
15464
|
};
|
|
14834
|
-
var QuizSubTitle = (0,
|
|
15465
|
+
var QuizSubTitle = (0, import_react49.forwardRef)(
|
|
14835
15466
|
({ subTitle, ...props }, ref) => {
|
|
14836
15467
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "px-4 pb-2 pt-6", ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "font-bold text-lg text-text-950", children: subTitle }) });
|
|
14837
15468
|
}
|
|
14838
15469
|
);
|
|
14839
|
-
var QuizContainer = (0,
|
|
15470
|
+
var QuizContainer = (0, import_react49.forwardRef)(({ children, className, ...props }, ref) => {
|
|
14840
15471
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
14841
15472
|
"div",
|
|
14842
15473
|
{
|
|
@@ -14925,15 +15556,15 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
14925
15556
|
const currentQuestionResult = getQuestionResultByQuestionId(
|
|
14926
15557
|
currentQuestion?.id || ""
|
|
14927
15558
|
);
|
|
14928
|
-
const prevSelectedValuesRef = (0,
|
|
14929
|
-
const prevQuestionIdRef = (0,
|
|
14930
|
-
const allCurrentAnswerIds = (0,
|
|
15559
|
+
const prevSelectedValuesRef = (0, import_react49.useRef)([]);
|
|
15560
|
+
const prevQuestionIdRef = (0, import_react49.useRef)("");
|
|
15561
|
+
const allCurrentAnswerIds = (0, import_react49.useMemo)(() => {
|
|
14931
15562
|
return allCurrentAnswers?.map((answer) => answer.optionId) || [];
|
|
14932
15563
|
}, [allCurrentAnswers]);
|
|
14933
|
-
const selectedValues = (0,
|
|
15564
|
+
const selectedValues = (0, import_react49.useMemo)(() => {
|
|
14934
15565
|
return allCurrentAnswerIds?.filter((id) => id !== null) || [];
|
|
14935
15566
|
}, [allCurrentAnswerIds]);
|
|
14936
|
-
const stableSelectedValues = (0,
|
|
15567
|
+
const stableSelectedValues = (0, import_react49.useMemo)(() => {
|
|
14937
15568
|
const currentQuestionId = currentQuestion?.id || "";
|
|
14938
15569
|
const hasQuestionChanged = prevQuestionIdRef.current !== currentQuestionId;
|
|
14939
15570
|
if (hasQuestionChanged) {
|
|
@@ -14957,7 +15588,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
14957
15588
|
variant,
|
|
14958
15589
|
currentQuestionResult?.selectedOptions
|
|
14959
15590
|
]);
|
|
14960
|
-
const handleSelectedValues = (0,
|
|
15591
|
+
const handleSelectedValues = (0, import_react49.useCallback)(
|
|
14961
15592
|
(values) => {
|
|
14962
15593
|
if (currentQuestion) {
|
|
14963
15594
|
selectMultipleAnswer(currentQuestion.id, values);
|
|
@@ -14965,7 +15596,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
14965
15596
|
},
|
|
14966
15597
|
[currentQuestion, selectMultipleAnswer]
|
|
14967
15598
|
);
|
|
14968
|
-
const questionKey = (0,
|
|
15599
|
+
const questionKey = (0, import_react49.useMemo)(
|
|
14969
15600
|
() => `question-${currentQuestion?.id || "1"}`,
|
|
14970
15601
|
[currentQuestion?.id]
|
|
14971
15602
|
);
|
|
@@ -15026,14 +15657,14 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
15026
15657
|
currentQuestion?.id || ""
|
|
15027
15658
|
);
|
|
15028
15659
|
const currentAnswer = getCurrentAnswer();
|
|
15029
|
-
const textareaRef = (0,
|
|
15660
|
+
const textareaRef = (0, import_react49.useRef)(null);
|
|
15030
15661
|
const charLimit = getDissertativeCharLimit();
|
|
15031
15662
|
const handleAnswerChange = (value) => {
|
|
15032
15663
|
if (currentQuestion) {
|
|
15033
15664
|
selectDissertativeAnswer(currentQuestion.id, value);
|
|
15034
15665
|
}
|
|
15035
15666
|
};
|
|
15036
|
-
const adjustTextareaHeight = (0,
|
|
15667
|
+
const adjustTextareaHeight = (0, import_react49.useCallback)(() => {
|
|
15037
15668
|
if (textareaRef.current) {
|
|
15038
15669
|
textareaRef.current.style.height = "auto";
|
|
15039
15670
|
const scrollHeight = textareaRef.current.scrollHeight;
|
|
@@ -15043,7 +15674,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
15043
15674
|
textareaRef.current.style.height = `${newHeight}px`;
|
|
15044
15675
|
}
|
|
15045
15676
|
}, []);
|
|
15046
|
-
(0,
|
|
15677
|
+
(0, import_react49.useEffect)(() => {
|
|
15047
15678
|
adjustTextareaHeight();
|
|
15048
15679
|
}, [currentAnswer, adjustTextareaHeight]);
|
|
15049
15680
|
if (!currentQuestion) {
|
|
@@ -15184,7 +15815,7 @@ var QuizConnectDots = ({ paddingBottom }) => {
|
|
|
15184
15815
|
isCorrect: false
|
|
15185
15816
|
}
|
|
15186
15817
|
];
|
|
15187
|
-
const [userAnswers, setUserAnswers] = (0,
|
|
15818
|
+
const [userAnswers, setUserAnswers] = (0, import_react49.useState)(() => {
|
|
15188
15819
|
if (variant === "result") {
|
|
15189
15820
|
return mockUserAnswers;
|
|
15190
15821
|
}
|
|
@@ -15303,8 +15934,8 @@ var QuizFill = ({ paddingBottom }) => {
|
|
|
15303
15934
|
isCorrect: true
|
|
15304
15935
|
}
|
|
15305
15936
|
];
|
|
15306
|
-
const [answers, setAnswers] = (0,
|
|
15307
|
-
const baseId = (0,
|
|
15937
|
+
const [answers, setAnswers] = (0, import_react49.useState)({});
|
|
15938
|
+
const baseId = (0, import_react49.useId)();
|
|
15308
15939
|
const getAvailableOptionsForSelect = (selectId) => {
|
|
15309
15940
|
const usedOptions = new Set(
|
|
15310
15941
|
Object.entries(answers).filter(([key]) => key !== selectId).map(([, value]) => value)
|
|
@@ -15443,7 +16074,7 @@ var QuizImageQuestion = ({ paddingBottom }) => {
|
|
|
15443
16074
|
};
|
|
15444
16075
|
const correctRadiusRelative = calculateCorrectRadiusRelative();
|
|
15445
16076
|
const mockUserAnswerRelative = { x: 0.72, y: 0.348 };
|
|
15446
|
-
const [clickPositionRelative, setClickPositionRelative] = (0,
|
|
16077
|
+
const [clickPositionRelative, setClickPositionRelative] = (0, import_react49.useState)(variant == "result" ? mockUserAnswerRelative : null);
|
|
15447
16078
|
const convertToRelativeCoordinates = (x, y, rect) => {
|
|
15448
16079
|
const safeWidth = Math.max(rect.width, 1e-3);
|
|
15449
16080
|
const safeHeight = Math.max(rect.height, 1e-3);
|
|
@@ -15609,14 +16240,14 @@ var getFinishConfirmationText = (type) => {
|
|
|
15609
16240
|
const config = getQuizTypeConfig(type);
|
|
15610
16241
|
return `Tem certeza que deseja finalizar ${config.article} ${config.label.toLowerCase()}?`;
|
|
15611
16242
|
};
|
|
15612
|
-
var Quiz = (0,
|
|
16243
|
+
var Quiz = (0, import_react50.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
|
|
15613
16244
|
const { setVariant } = useQuizStore();
|
|
15614
|
-
(0,
|
|
16245
|
+
(0, import_react50.useEffect)(() => {
|
|
15615
16246
|
setVariant(variant);
|
|
15616
16247
|
}, [variant, setVariant]);
|
|
15617
16248
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
15618
16249
|
});
|
|
15619
|
-
var QuizTitle = (0,
|
|
16250
|
+
var QuizTitle = (0, import_react50.forwardRef)(({ className, onBack, ...props }, ref) => {
|
|
15620
16251
|
const {
|
|
15621
16252
|
quiz,
|
|
15622
16253
|
currentQuestionIndex,
|
|
@@ -15626,7 +16257,7 @@ var QuizTitle = (0, import_react48.forwardRef)(({ className, onBack, ...props },
|
|
|
15626
16257
|
formatTime: formatTime2,
|
|
15627
16258
|
isStarted
|
|
15628
16259
|
} = useQuizStore();
|
|
15629
|
-
const [showExitConfirmation, setShowExitConfirmation] = (0,
|
|
16260
|
+
const [showExitConfirmation, setShowExitConfirmation] = (0, import_react50.useState)(false);
|
|
15630
16261
|
const totalQuestions = getTotalQuestions();
|
|
15631
16262
|
const quizTitle = getQuizTitle();
|
|
15632
16263
|
const handleBackClick = () => {
|
|
@@ -15795,7 +16426,7 @@ var QuizQuestionList = ({
|
|
|
15795
16426
|
)
|
|
15796
16427
|
] });
|
|
15797
16428
|
};
|
|
15798
|
-
var QuizFooter = (0,
|
|
16429
|
+
var QuizFooter = (0, import_react50.forwardRef)(
|
|
15799
16430
|
({
|
|
15800
16431
|
className,
|
|
15801
16432
|
onGoToSimulated,
|
|
@@ -15829,8 +16460,8 @@ var QuizFooter = (0, import_react48.forwardRef)(
|
|
|
15829
16460
|
const currentAnswer = getCurrentAnswer();
|
|
15830
16461
|
const currentQuestion = getCurrentQuestion();
|
|
15831
16462
|
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
15832
|
-
const [activeModal, setActiveModal] = (0,
|
|
15833
|
-
const [filterType, setFilterType] = (0,
|
|
16463
|
+
const [activeModal, setActiveModal] = (0, import_react50.useState)(null);
|
|
16464
|
+
const [filterType, setFilterType] = (0, import_react50.useState)("all");
|
|
15834
16465
|
const openModal = (modalName) => setActiveModal(modalName);
|
|
15835
16466
|
const closeModal = () => setActiveModal(null);
|
|
15836
16467
|
const isModalOpen = (modalName) => activeModal === modalName;
|
|
@@ -16172,7 +16803,7 @@ var QuizFooter = (0, import_react48.forwardRef)(
|
|
|
16172
16803
|
);
|
|
16173
16804
|
|
|
16174
16805
|
// src/components/Quiz/QuizResult.tsx
|
|
16175
|
-
var
|
|
16806
|
+
var import_react51 = require("react");
|
|
16176
16807
|
var import_phosphor_react36 = require("phosphor-react");
|
|
16177
16808
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
16178
16809
|
var QuizBadge = ({
|
|
@@ -16194,15 +16825,15 @@ var QuizBadge = ({
|
|
|
16194
16825
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
|
|
16195
16826
|
}
|
|
16196
16827
|
};
|
|
16197
|
-
var QuizHeaderResult = (0,
|
|
16828
|
+
var QuizHeaderResult = (0, import_react51.forwardRef)(
|
|
16198
16829
|
({ className, ...props }, ref) => {
|
|
16199
16830
|
const {
|
|
16200
16831
|
getQuestionResultByQuestionId,
|
|
16201
16832
|
getCurrentQuestion,
|
|
16202
16833
|
questionsResult
|
|
16203
16834
|
} = useQuizStore();
|
|
16204
|
-
const [status, setStatus] = (0,
|
|
16205
|
-
(0,
|
|
16835
|
+
const [status, setStatus] = (0, import_react51.useState)(void 0);
|
|
16836
|
+
(0, import_react51.useEffect)(() => {
|
|
16206
16837
|
const cq = getCurrentQuestion();
|
|
16207
16838
|
if (!cq) {
|
|
16208
16839
|
setStatus(void 0);
|
|
@@ -16266,7 +16897,7 @@ var QuizHeaderResult = (0, import_react49.forwardRef)(
|
|
|
16266
16897
|
);
|
|
16267
16898
|
}
|
|
16268
16899
|
);
|
|
16269
|
-
var QuizResultHeaderTitle = (0,
|
|
16900
|
+
var QuizResultHeaderTitle = (0, import_react51.forwardRef)(({ className, showBadge = true, onRepeat, canRetry, ...props }, ref) => {
|
|
16270
16901
|
const { quiz } = useQuizStore();
|
|
16271
16902
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
16272
16903
|
"div",
|
|
@@ -16296,7 +16927,7 @@ var QuizResultHeaderTitle = (0, import_react49.forwardRef)(({ className, showBad
|
|
|
16296
16927
|
}
|
|
16297
16928
|
);
|
|
16298
16929
|
});
|
|
16299
|
-
var QuizResultTitle = (0,
|
|
16930
|
+
var QuizResultTitle = (0, import_react51.forwardRef)(({ className, ...props }, ref) => {
|
|
16300
16931
|
const { getQuizTitle } = useQuizStore();
|
|
16301
16932
|
const quizTitle = getQuizTitle();
|
|
16302
16933
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
@@ -16340,7 +16971,7 @@ var calculateAnswerStatistics = (answers) => {
|
|
|
16340
16971
|
}
|
|
16341
16972
|
return stats;
|
|
16342
16973
|
};
|
|
16343
|
-
var QuizResultPerformance = (0,
|
|
16974
|
+
var QuizResultPerformance = (0, import_react51.forwardRef)(({ showDetails = true, ...props }, ref) => {
|
|
16344
16975
|
const {
|
|
16345
16976
|
getTotalQuestions,
|
|
16346
16977
|
formatTime: formatTime2,
|
|
@@ -16445,7 +17076,7 @@ var QuizResultPerformance = (0, import_react49.forwardRef)(({ showDetails = true
|
|
|
16445
17076
|
}
|
|
16446
17077
|
);
|
|
16447
17078
|
});
|
|
16448
|
-
var QuizListResult = (0,
|
|
17079
|
+
var QuizListResult = (0, import_react51.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
|
|
16449
17080
|
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
16450
17081
|
const { isDark } = useTheme();
|
|
16451
17082
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
@@ -16575,7 +17206,7 @@ var BreadcrumbMenu = ({
|
|
|
16575
17206
|
};
|
|
16576
17207
|
|
|
16577
17208
|
// src/components/BreadcrumbMenu/useBreadcrumbBuilder.ts
|
|
16578
|
-
var
|
|
17209
|
+
var import_react52 = require("react");
|
|
16579
17210
|
|
|
16580
17211
|
// src/components/BreadcrumbMenu/breadcrumbStore.ts
|
|
16581
17212
|
var import_zustand12 = require("zustand");
|
|
@@ -16704,7 +17335,7 @@ var useBreadcrumbBuilder = (config) => {
|
|
|
16704
17335
|
(level) => isBreadcrumbWithData(level) ? level.data : null
|
|
16705
17336
|
);
|
|
16706
17337
|
const levelUrlIds = levels.map((level) => level.urlId);
|
|
16707
|
-
(0,
|
|
17338
|
+
(0, import_react52.useEffect)(() => {
|
|
16708
17339
|
const newBreadcrumbs = [root];
|
|
16709
17340
|
const previousIds = [];
|
|
16710
17341
|
for (const level of levels) {
|
|
@@ -16736,11 +17367,11 @@ var useBreadcrumbBuilder = (config) => {
|
|
|
16736
17367
|
};
|
|
16737
17368
|
|
|
16738
17369
|
// src/components/BreadcrumbMenu/useUrlParams.ts
|
|
16739
|
-
var
|
|
17370
|
+
var import_react53 = require("react");
|
|
16740
17371
|
var import_react_router_dom4 = require("react-router-dom");
|
|
16741
17372
|
var useUrlParams = (config) => {
|
|
16742
17373
|
const location = (0, import_react_router_dom4.useLocation)();
|
|
16743
|
-
return (0,
|
|
17374
|
+
return (0, import_react53.useMemo)(() => {
|
|
16744
17375
|
const segments = location.pathname.split("/").filter(Boolean);
|
|
16745
17376
|
const params = {};
|
|
16746
17377
|
for (const [key, index] of Object.entries(config)) {
|
|
@@ -16751,15 +17382,15 @@ var useUrlParams = (config) => {
|
|
|
16751
17382
|
};
|
|
16752
17383
|
|
|
16753
17384
|
// src/hooks/useAppInitialization.ts
|
|
16754
|
-
var
|
|
17385
|
+
var import_react55 = require("react");
|
|
16755
17386
|
|
|
16756
17387
|
// src/hooks/useInstitution.ts
|
|
16757
|
-
var
|
|
17388
|
+
var import_react54 = require("react");
|
|
16758
17389
|
function useInstitutionId() {
|
|
16759
|
-
const [institutionId, setInstitutionId] = (0,
|
|
17390
|
+
const [institutionId, setInstitutionId] = (0, import_react54.useState)(() => {
|
|
16760
17391
|
return document.querySelector('meta[name="institution-id"]')?.getAttribute("content") ?? null;
|
|
16761
17392
|
});
|
|
16762
|
-
(0,
|
|
17393
|
+
(0, import_react54.useEffect)(() => {
|
|
16763
17394
|
const metaTag = document.querySelector('meta[name="institution-id"]');
|
|
16764
17395
|
if (!metaTag) return;
|
|
16765
17396
|
const observer = new MutationObserver(() => {
|
|
@@ -16926,7 +17557,7 @@ var useAuthStore = (0, import_zustand14.create)()(
|
|
|
16926
17557
|
function useAppInitialization() {
|
|
16927
17558
|
const getInstitutionId = useInstitutionId();
|
|
16928
17559
|
const { initialize, initialized, institutionId } = useAppStore();
|
|
16929
|
-
const authFunctions = (0,
|
|
17560
|
+
const authFunctions = (0, import_react55.useMemo)(
|
|
16930
17561
|
() => ({
|
|
16931
17562
|
checkAuth: async () => {
|
|
16932
17563
|
const { sessionInfo, tokens } = useAuthStore.getState();
|
|
@@ -16963,7 +17594,7 @@ function useAppInitialization() {
|
|
|
16963
17594
|
}
|
|
16964
17595
|
|
|
16965
17596
|
// src/hooks/useAppContent.ts
|
|
16966
|
-
var
|
|
17597
|
+
var import_react56 = require("react");
|
|
16967
17598
|
var import_react_router_dom5 = require("react-router-dom");
|
|
16968
17599
|
function useAppContent(config) {
|
|
16969
17600
|
const navigate = (0, import_react_router_dom5.useNavigate)();
|
|
@@ -16989,20 +17620,20 @@ function useAppContent(config) {
|
|
|
16989
17620
|
navigate("/painel");
|
|
16990
17621
|
}
|
|
16991
17622
|
};
|
|
16992
|
-
const handleSetSelectedProfile = (0,
|
|
17623
|
+
const handleSetSelectedProfile = (0, import_react56.useCallback)(
|
|
16993
17624
|
(profile) => {
|
|
16994
17625
|
setSelectedProfile(profile);
|
|
16995
17626
|
},
|
|
16996
17627
|
[setSelectedProfile]
|
|
16997
17628
|
);
|
|
16998
|
-
const handleClearParamsFromURL = (0,
|
|
17629
|
+
const handleClearParamsFromURL = (0, import_react56.useCallback)(() => {
|
|
16999
17630
|
if (onClearParamsFromURL) {
|
|
17000
17631
|
onClearParamsFromURL();
|
|
17001
17632
|
} else {
|
|
17002
17633
|
globalThis.location.replace("/painel");
|
|
17003
17634
|
}
|
|
17004
17635
|
}, [onClearParamsFromURL]);
|
|
17005
|
-
const handleError = (0,
|
|
17636
|
+
const handleError = (0, import_react56.useCallback)(
|
|
17006
17637
|
(error) => {
|
|
17007
17638
|
if (onError) {
|
|
17008
17639
|
onError(error);
|
|
@@ -17013,7 +17644,7 @@ function useAppContent(config) {
|
|
|
17013
17644
|
},
|
|
17014
17645
|
[navigate, onError]
|
|
17015
17646
|
);
|
|
17016
|
-
const urlAuthConfig = (0,
|
|
17647
|
+
const urlAuthConfig = (0, import_react56.useMemo)(
|
|
17017
17648
|
() => ({
|
|
17018
17649
|
setTokens,
|
|
17019
17650
|
setSessionInfo,
|
|
@@ -17039,10 +17670,10 @@ function useAppContent(config) {
|
|
|
17039
17670
|
);
|
|
17040
17671
|
useUrlAuthentication(urlAuthConfig);
|
|
17041
17672
|
const { sessionInfo } = useAuth();
|
|
17042
|
-
const institutionIdToUse = (0,
|
|
17673
|
+
const institutionIdToUse = (0, import_react56.useMemo)(() => {
|
|
17043
17674
|
return sessionInfo?.institutionId || getInstitutionId;
|
|
17044
17675
|
}, [sessionInfo?.institutionId, getInstitutionId]);
|
|
17045
|
-
(0,
|
|
17676
|
+
(0, import_react56.useEffect)(() => {
|
|
17046
17677
|
if (institutionIdToUse && !initialized) {
|
|
17047
17678
|
initialize(institutionIdToUse);
|
|
17048
17679
|
}
|
|
@@ -17054,9 +17685,30 @@ function useAppContent(config) {
|
|
|
17054
17685
|
};
|
|
17055
17686
|
}
|
|
17056
17687
|
|
|
17688
|
+
// src/store/questionFiltersStore.ts
|
|
17689
|
+
var import_zustand15 = require("zustand");
|
|
17690
|
+
var useQuestionFiltersStore = (0, import_zustand15.create)((set) => ({
|
|
17691
|
+
draftFilters: null,
|
|
17692
|
+
appliedFilters: null,
|
|
17693
|
+
setDraftFilters: (filters) => {
|
|
17694
|
+
set({ draftFilters: filters });
|
|
17695
|
+
},
|
|
17696
|
+
applyFilters: () => {
|
|
17697
|
+
set((state) => ({
|
|
17698
|
+
appliedFilters: state.draftFilters
|
|
17699
|
+
}));
|
|
17700
|
+
},
|
|
17701
|
+
clearFilters: () => {
|
|
17702
|
+
set({
|
|
17703
|
+
draftFilters: null,
|
|
17704
|
+
appliedFilters: null
|
|
17705
|
+
});
|
|
17706
|
+
}
|
|
17707
|
+
}));
|
|
17708
|
+
|
|
17057
17709
|
// src/components/ActivityCardQuestionBanks/ActivityCardQuestionBanks.tsx
|
|
17058
17710
|
var import_phosphor_react37 = require("phosphor-react");
|
|
17059
|
-
var
|
|
17711
|
+
var import_react57 = require("react");
|
|
17060
17712
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
17061
17713
|
var ActivityCardQuestionBanks = ({
|
|
17062
17714
|
question,
|
|
@@ -17068,7 +17720,7 @@ var ActivityCardQuestionBanks = ({
|
|
|
17068
17720
|
assunto,
|
|
17069
17721
|
enunciado
|
|
17070
17722
|
} = {}) => {
|
|
17071
|
-
const alternatives = (0,
|
|
17723
|
+
const alternatives = (0, import_react57.useMemo)(() => {
|
|
17072
17724
|
if (!question?.options || questionType !== "ALTERNATIVA" /* ALTERNATIVA */)
|
|
17073
17725
|
return [];
|
|
17074
17726
|
const correctOptionIds2 = question.correctOptionIds || [];
|
|
@@ -17082,13 +17734,13 @@ var ActivityCardQuestionBanks = ({
|
|
|
17082
17734
|
};
|
|
17083
17735
|
});
|
|
17084
17736
|
}, [question, questionType]);
|
|
17085
|
-
const correctOptionId = (0,
|
|
17737
|
+
const correctOptionId = (0, import_react57.useMemo)(() => {
|
|
17086
17738
|
if (!question?.correctOptionIds || question.correctOptionIds.length === 0) {
|
|
17087
17739
|
return void 0;
|
|
17088
17740
|
}
|
|
17089
17741
|
return question.correctOptionIds[0];
|
|
17090
17742
|
}, [question]);
|
|
17091
|
-
const multipleChoices = (0,
|
|
17743
|
+
const multipleChoices = (0, import_react57.useMemo)(() => {
|
|
17092
17744
|
if (!question?.options || questionType !== "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */)
|
|
17093
17745
|
return [];
|
|
17094
17746
|
const correctOptionIds2 = question.correctOptionIds || [];
|
|
@@ -17102,7 +17754,7 @@ var ActivityCardQuestionBanks = ({
|
|
|
17102
17754
|
};
|
|
17103
17755
|
});
|
|
17104
17756
|
}, [question, questionType]);
|
|
17105
|
-
const correctOptionIds = (0,
|
|
17757
|
+
const correctOptionIds = (0, import_react57.useMemo)(() => {
|
|
17106
17758
|
return question?.correctOptionIds || [];
|
|
17107
17759
|
}, [question]);
|
|
17108
17760
|
const getStatusBadge2 = (status) => {
|
|
@@ -17285,7 +17937,7 @@ var formatDateToBrazilian = (dateString) => {
|
|
|
17285
17937
|
};
|
|
17286
17938
|
|
|
17287
17939
|
// src/components/ActivityDetails/ActivityDetails.tsx
|
|
17288
|
-
var
|
|
17940
|
+
var import_react58 = require("react");
|
|
17289
17941
|
var import_phosphor_react38 = require("phosphor-react");
|
|
17290
17942
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
17291
17943
|
var createTableColumns = (onCorrectActivity) => [
|
|
@@ -17383,20 +18035,20 @@ var ActivityDetails = ({
|
|
|
17383
18035
|
mapSubjectNameToEnum
|
|
17384
18036
|
}) => {
|
|
17385
18037
|
const { isMobile } = useMobile();
|
|
17386
|
-
const [page, setPage] = (0,
|
|
17387
|
-
const [limit, setLimit] = (0,
|
|
17388
|
-
const [sortBy, setSortBy] = (0,
|
|
17389
|
-
const [sortOrder, setSortOrder] = (0,
|
|
18038
|
+
const [page, setPage] = (0, import_react58.useState)(1);
|
|
18039
|
+
const [limit, setLimit] = (0, import_react58.useState)(10);
|
|
18040
|
+
const [sortBy, setSortBy] = (0, import_react58.useState)(void 0);
|
|
18041
|
+
const [sortOrder, setSortOrder] = (0, import_react58.useState)(
|
|
17390
18042
|
void 0
|
|
17391
18043
|
);
|
|
17392
|
-
const [data, setData] = (0,
|
|
17393
|
-
const [correctionData, setCorrectionData] = (0,
|
|
17394
|
-
const [loading, setLoading] = (0,
|
|
17395
|
-
const [error, setError] = (0,
|
|
17396
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
17397
|
-
const [isViewOnlyModal, setIsViewOnlyModal] = (0,
|
|
17398
|
-
const [correctionError, setCorrectionError] = (0,
|
|
17399
|
-
(0,
|
|
18044
|
+
const [data, setData] = (0, import_react58.useState)(null);
|
|
18045
|
+
const [correctionData, setCorrectionData] = (0, import_react58.useState)(null);
|
|
18046
|
+
const [loading, setLoading] = (0, import_react58.useState)(true);
|
|
18047
|
+
const [error, setError] = (0, import_react58.useState)(null);
|
|
18048
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react58.useState)(false);
|
|
18049
|
+
const [isViewOnlyModal, setIsViewOnlyModal] = (0, import_react58.useState)(false);
|
|
18050
|
+
const [correctionError, setCorrectionError] = (0, import_react58.useState)(null);
|
|
18051
|
+
(0, import_react58.useEffect)(() => {
|
|
17400
18052
|
const loadData = async () => {
|
|
17401
18053
|
if (!activityId) return;
|
|
17402
18054
|
setLoading(true);
|
|
@@ -17419,7 +18071,7 @@ var ActivityDetails = ({
|
|
|
17419
18071
|
};
|
|
17420
18072
|
loadData();
|
|
17421
18073
|
}, [activityId, page, limit, sortBy, sortOrder, fetchActivityDetails]);
|
|
17422
|
-
const handleCorrectActivity = (0,
|
|
18074
|
+
const handleCorrectActivity = (0, import_react58.useCallback)(
|
|
17423
18075
|
async (studentId) => {
|
|
17424
18076
|
const student = data?.students.find((s) => s.studentId === studentId);
|
|
17425
18077
|
if (!student || !activityId) return;
|
|
@@ -17439,10 +18091,10 @@ var ActivityDetails = ({
|
|
|
17439
18091
|
},
|
|
17440
18092
|
[data?.students, activityId, fetchStudentCorrection]
|
|
17441
18093
|
);
|
|
17442
|
-
const handleCloseModal = (0,
|
|
18094
|
+
const handleCloseModal = (0, import_react58.useCallback)(() => {
|
|
17443
18095
|
setIsModalOpen(false);
|
|
17444
18096
|
}, []);
|
|
17445
|
-
const handleObservationSubmit = (0,
|
|
18097
|
+
const handleObservationSubmit = (0, import_react58.useCallback)(
|
|
17446
18098
|
async (observation, files) => {
|
|
17447
18099
|
if (!activityId || !correctionData?.studentId) return;
|
|
17448
18100
|
try {
|
|
@@ -17459,7 +18111,7 @@ var ActivityDetails = ({
|
|
|
17459
18111
|
},
|
|
17460
18112
|
[activityId, correctionData?.studentId, submitObservation]
|
|
17461
18113
|
);
|
|
17462
|
-
const tableData = (0,
|
|
18114
|
+
const tableData = (0, import_react58.useMemo)(() => {
|
|
17463
18115
|
if (!data?.students) return [];
|
|
17464
18116
|
return data.students.map((student) => ({
|
|
17465
18117
|
id: student.studentId,
|
|
@@ -17471,7 +18123,7 @@ var ActivityDetails = ({
|
|
|
17471
18123
|
score: student.score
|
|
17472
18124
|
}));
|
|
17473
18125
|
}, [data?.students]);
|
|
17474
|
-
const columns = (0,
|
|
18126
|
+
const columns = (0, import_react58.useMemo)(
|
|
17475
18127
|
() => createTableColumns(handleCorrectActivity),
|
|
17476
18128
|
[handleCorrectActivity]
|
|
17477
18129
|
);
|
|
@@ -17728,10 +18380,10 @@ var ActivityDetails = ({
|
|
|
17728
18380
|
};
|
|
17729
18381
|
|
|
17730
18382
|
// src/components/Support/Support.tsx
|
|
17731
|
-
var
|
|
18383
|
+
var import_react61 = require("react");
|
|
17732
18384
|
var import_react_hook_form = require("react-hook-form");
|
|
17733
18385
|
var import_zod2 = require("@hookform/resolvers/zod");
|
|
17734
|
-
var
|
|
18386
|
+
var import_react62 = require("@phosphor-icons/react");
|
|
17735
18387
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
17736
18388
|
|
|
17737
18389
|
// src/components/Support/schema/index.ts
|
|
@@ -17754,7 +18406,7 @@ var supportSchema = import_zod.z.object({
|
|
|
17754
18406
|
});
|
|
17755
18407
|
|
|
17756
18408
|
// src/components/Support/components/TicketModal.tsx
|
|
17757
|
-
var
|
|
18409
|
+
var import_react60 = require("react");
|
|
17758
18410
|
var import_dayjs = __toESM(require("dayjs"));
|
|
17759
18411
|
var import_pt_br = require("dayjs/locale/pt-br");
|
|
17760
18412
|
|
|
@@ -17834,19 +18486,19 @@ var mapInternalStatusToApi = (internalStatus) => {
|
|
|
17834
18486
|
};
|
|
17835
18487
|
|
|
17836
18488
|
// src/components/Support/utils/supportUtils.tsx
|
|
17837
|
-
var
|
|
18489
|
+
var import_react59 = require("@phosphor-icons/react");
|
|
17838
18490
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
17839
18491
|
var getCategoryIcon = (category, size = 16) => {
|
|
17840
18492
|
if (!category) return null;
|
|
17841
18493
|
switch (category) {
|
|
17842
18494
|
case "acesso" /* ACESSO */:
|
|
17843
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.KeyIcon, { size });
|
|
17844
18496
|
case "tecnico" /* TECNICO */:
|
|
17845
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.BugIcon, { size });
|
|
17846
18498
|
case "outros" /* OUTROS */:
|
|
17847
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.InfoIcon, { size });
|
|
17848
18500
|
default:
|
|
17849
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.InfoIcon, { size });
|
|
17850
18502
|
}
|
|
17851
18503
|
};
|
|
17852
18504
|
|
|
@@ -17876,17 +18528,17 @@ var TicketModal = ({
|
|
|
17876
18528
|
apiClient,
|
|
17877
18529
|
userId
|
|
17878
18530
|
}) => {
|
|
17879
|
-
const [showCloseConfirmation, setShowCloseConfirmation] = (0,
|
|
17880
|
-
const [responseText, setResponseText] = (0,
|
|
17881
|
-
const [answers, setAnswers] = (0,
|
|
17882
|
-
const [isSubmittingAnswer, setIsSubmittingAnswer] = (0,
|
|
17883
|
-
const [isLoadingAnswers, setIsLoadingAnswers] = (0,
|
|
18531
|
+
const [showCloseConfirmation, setShowCloseConfirmation] = (0, import_react60.useState)(false);
|
|
18532
|
+
const [responseText, setResponseText] = (0, import_react60.useState)("");
|
|
18533
|
+
const [answers, setAnswers] = (0, import_react60.useState)([]);
|
|
18534
|
+
const [isSubmittingAnswer, setIsSubmittingAnswer] = (0, import_react60.useState)(false);
|
|
18535
|
+
const [isLoadingAnswers, setIsLoadingAnswers] = (0, import_react60.useState)(false);
|
|
17884
18536
|
const handleCloseTicket = () => {
|
|
17885
18537
|
onTicketClose?.(ticket.id);
|
|
17886
18538
|
setShowCloseConfirmation(false);
|
|
17887
18539
|
onClose();
|
|
17888
18540
|
};
|
|
17889
|
-
const fetchAnswers = (0,
|
|
18541
|
+
const fetchAnswers = (0, import_react60.useCallback)(async () => {
|
|
17890
18542
|
if (!ticket.id || ticket.status !== "respondido" /* RESPONDIDO */) return;
|
|
17891
18543
|
setIsLoadingAnswers(true);
|
|
17892
18544
|
try {
|
|
@@ -17925,7 +18577,7 @@ var TicketModal = ({
|
|
|
17925
18577
|
}
|
|
17926
18578
|
};
|
|
17927
18579
|
const canCloseTicket = ticket.status !== "encerrado" /* ENCERRADO */;
|
|
17928
|
-
(0,
|
|
18580
|
+
(0, import_react60.useEffect)(() => {
|
|
17929
18581
|
if (isOpen) {
|
|
17930
18582
|
setResponseText("");
|
|
17931
18583
|
(async () => {
|
|
@@ -18263,7 +18915,7 @@ var TicketCard = ({
|
|
|
18263
18915
|
getCategoryIcon(ticket.category, 18),
|
|
18264
18916
|
getCategoryText(ticket.category)
|
|
18265
18917
|
] }),
|
|
18266
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
18918
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.CaretRightIcon, { size: 24, className: "text-text-800" })
|
|
18267
18919
|
] })
|
|
18268
18920
|
]
|
|
18269
18921
|
},
|
|
@@ -18308,21 +18960,21 @@ var Support = ({
|
|
|
18308
18960
|
onTicketCreated,
|
|
18309
18961
|
onTicketClosed
|
|
18310
18962
|
}) => {
|
|
18311
|
-
const [activeTab, setActiveTab] = (0,
|
|
18312
|
-
const [selectedProblem, setSelectedProblem] = (0,
|
|
18313
|
-
const [statusFilter, setStatusFilter] = (0,
|
|
18314
|
-
const [categoryFilter, setCategoryFilter] = (0,
|
|
18315
|
-
const [selectedTicket, setSelectedTicket] = (0,
|
|
18963
|
+
const [activeTab, setActiveTab] = (0, import_react61.useState)("criar-pedido");
|
|
18964
|
+
const [selectedProblem, setSelectedProblem] = (0, import_react61.useState)(null);
|
|
18965
|
+
const [statusFilter, setStatusFilter] = (0, import_react61.useState)("todos");
|
|
18966
|
+
const [categoryFilter, setCategoryFilter] = (0, import_react61.useState)("todos");
|
|
18967
|
+
const [selectedTicket, setSelectedTicket] = (0, import_react61.useState)(
|
|
18316
18968
|
null
|
|
18317
18969
|
);
|
|
18318
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
18319
|
-
const [submitError, setSubmitError] = (0,
|
|
18320
|
-
const [showSuccessToast, setShowSuccessToast] = (0,
|
|
18321
|
-
const [showCloseSuccessToast, setShowCloseSuccessToast] = (0,
|
|
18322
|
-
const [showCloseErrorToast, setShowCloseErrorToast] = (0,
|
|
18323
|
-
const [allTickets, setAllTickets] = (0,
|
|
18324
|
-
const [loadingTickets, setLoadingTickets] = (0,
|
|
18325
|
-
const [currentPage, setCurrentPage] = (0,
|
|
18970
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react61.useState)(false);
|
|
18971
|
+
const [submitError, setSubmitError] = (0, import_react61.useState)(null);
|
|
18972
|
+
const [showSuccessToast, setShowSuccessToast] = (0, import_react61.useState)(false);
|
|
18973
|
+
const [showCloseSuccessToast, setShowCloseSuccessToast] = (0, import_react61.useState)(false);
|
|
18974
|
+
const [showCloseErrorToast, setShowCloseErrorToast] = (0, import_react61.useState)(false);
|
|
18975
|
+
const [allTickets, setAllTickets] = (0, import_react61.useState)([]);
|
|
18976
|
+
const [loadingTickets, setLoadingTickets] = (0, import_react61.useState)(false);
|
|
18977
|
+
const [currentPage, setCurrentPage] = (0, import_react61.useState)(1);
|
|
18326
18978
|
const ITEMS_PER_PAGE = 10;
|
|
18327
18979
|
const handlePrevPage = () => {
|
|
18328
18980
|
if (currentPage > 1) {
|
|
@@ -18335,13 +18987,13 @@ var Support = ({
|
|
|
18335
18987
|
setCurrentPage(currentPage + 1);
|
|
18336
18988
|
}
|
|
18337
18989
|
};
|
|
18338
|
-
(0,
|
|
18990
|
+
(0, import_react61.useEffect)(() => {
|
|
18339
18991
|
if (activeTab === "historico") {
|
|
18340
18992
|
fetchTickets(statusFilter);
|
|
18341
18993
|
setCurrentPage(1);
|
|
18342
18994
|
}
|
|
18343
18995
|
}, [activeTab, statusFilter]);
|
|
18344
|
-
(0,
|
|
18996
|
+
(0, import_react61.useEffect)(() => {
|
|
18345
18997
|
setCurrentPage(1);
|
|
18346
18998
|
}, [categoryFilter]);
|
|
18347
18999
|
const convertApiTicketToComponent = (apiTicket) => {
|
|
@@ -18471,17 +19123,17 @@ var Support = ({
|
|
|
18471
19123
|
{
|
|
18472
19124
|
id: "tecnico" /* TECNICO */,
|
|
18473
19125
|
title: "T\xE9cnico",
|
|
18474
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19126
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.BugIcon, { size: 24 })
|
|
18475
19127
|
},
|
|
18476
19128
|
{
|
|
18477
19129
|
id: "acesso" /* ACESSO */,
|
|
18478
19130
|
title: "Acesso",
|
|
18479
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19131
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.KeyIcon, { size: 24 })
|
|
18480
19132
|
},
|
|
18481
19133
|
{
|
|
18482
19134
|
id: "outros" /* OUTROS */,
|
|
18483
19135
|
title: "Outros",
|
|
18484
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19136
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.InfoIcon, { size: 24 })
|
|
18485
19137
|
}
|
|
18486
19138
|
];
|
|
18487
19139
|
const emptyImage = emptyStateImage || suporthistory_default;
|
|
@@ -18601,15 +19253,15 @@ var Support = ({
|
|
|
18601
19253
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectContent, { children: [
|
|
18602
19254
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SelectItem, { value: "todos", children: "Todos" }),
|
|
18603
19255
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectItem, { value: "tecnico" /* TECNICO */, children: [
|
|
18604
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19256
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.BugIcon, { size: 16 }),
|
|
18605
19257
|
" T\xE9cnico"
|
|
18606
19258
|
] }),
|
|
18607
19259
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectItem, { value: "acesso" /* ACESSO */, children: [
|
|
18608
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19260
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.KeyIcon, { size: 16 }),
|
|
18609
19261
|
" Acesso"
|
|
18610
19262
|
] }),
|
|
18611
19263
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectItem, { value: "outros" /* OUTROS */, children: [
|
|
18612
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19264
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.InfoIcon, { size: 16 }),
|
|
18613
19265
|
" Outros"
|
|
18614
19266
|
] })
|
|
18615
19267
|
] })
|
|
@@ -18852,10 +19504,14 @@ var Support_default = Support;
|
|
|
18852
19504
|
VideoPlayer,
|
|
18853
19505
|
Whiteboard,
|
|
18854
19506
|
cn,
|
|
19507
|
+
createActivityFiltersDataHook,
|
|
18855
19508
|
createNotificationStore,
|
|
18856
19509
|
createNotificationsHook,
|
|
19510
|
+
createQuestionsListHook,
|
|
19511
|
+
createUseActivityFiltersData,
|
|
18857
19512
|
createUseNotificationStore,
|
|
18858
19513
|
createUseNotifications,
|
|
19514
|
+
createUseQuestionsList,
|
|
18859
19515
|
createZustandAuthAdapter,
|
|
18860
19516
|
formatDateToBrazilian,
|
|
18861
19517
|
formatFileSize,
|
|
@@ -18897,6 +19553,7 @@ var Support_default = Support;
|
|
|
18897
19553
|
useBreadcrumbBuilder,
|
|
18898
19554
|
useInstitutionId,
|
|
18899
19555
|
useMobile,
|
|
19556
|
+
useQuestionFiltersStore,
|
|
18900
19557
|
useQuizStore,
|
|
18901
19558
|
useRouteAuth,
|
|
18902
19559
|
useTableFilter,
|