analytica-frontend-lib 1.2.36 → 1.2.38
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/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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +380 -267
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +254 -143
- package/dist/index.mjs.map +1 -1
- package/dist/types/questions.d.ts +47 -0
- package/dist/types/questions.d.ts.map +1 -0
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -175,9 +175,11 @@ __export(src_exports, {
|
|
|
175
175
|
createActivityFiltersDataHook: () => createActivityFiltersDataHook,
|
|
176
176
|
createNotificationStore: () => createNotificationStore,
|
|
177
177
|
createNotificationsHook: () => createNotificationsHook,
|
|
178
|
+
createQuestionsListHook: () => createQuestionsListHook,
|
|
178
179
|
createUseActivityFiltersData: () => createUseActivityFiltersData,
|
|
179
180
|
createUseNotificationStore: () => createUseNotificationStore,
|
|
180
181
|
createUseNotifications: () => createUseNotifications,
|
|
182
|
+
createUseQuestionsList: () => createUseQuestionsList,
|
|
181
183
|
createZustandAuthAdapter: () => createZustandAuthAdapter,
|
|
182
184
|
formatDateToBrazilian: () => formatDateToBrazilian,
|
|
183
185
|
formatFileSize: () => formatFileSize,
|
|
@@ -11821,6 +11823,115 @@ var createActivityFiltersDataHook = (apiClient) => {
|
|
|
11821
11823
|
return createUseActivityFiltersData(apiClient);
|
|
11822
11824
|
};
|
|
11823
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
|
+
|
|
11824
11935
|
// src/components/Filter/FilterModal.tsx
|
|
11825
11936
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
11826
11937
|
var FilterModal = ({
|
|
@@ -11964,10 +12075,10 @@ var FilterModal = ({
|
|
|
11964
12075
|
};
|
|
11965
12076
|
|
|
11966
12077
|
// src/components/Filter/useTableFilter.ts
|
|
11967
|
-
var
|
|
12078
|
+
var import_react37 = require("react");
|
|
11968
12079
|
var useTableFilter = (initialConfigs, options = {}) => {
|
|
11969
12080
|
const { syncWithUrl = false } = options;
|
|
11970
|
-
const getInitialState = (0,
|
|
12081
|
+
const getInitialState = (0, import_react37.useCallback)(() => {
|
|
11971
12082
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
11972
12083
|
return initialConfigs;
|
|
11973
12084
|
}
|
|
@@ -11985,8 +12096,8 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11985
12096
|
}));
|
|
11986
12097
|
return configsWithUrlState;
|
|
11987
12098
|
}, [initialConfigs, syncWithUrl]);
|
|
11988
|
-
const [filterConfigs, setFilterConfigs] = (0,
|
|
11989
|
-
const activeFilters = (0,
|
|
12099
|
+
const [filterConfigs, setFilterConfigs] = (0, import_react37.useState)(getInitialState);
|
|
12100
|
+
const activeFilters = (0, import_react37.useMemo)(() => {
|
|
11990
12101
|
const filters = {};
|
|
11991
12102
|
for (const config of filterConfigs) {
|
|
11992
12103
|
for (const category of config.categories) {
|
|
@@ -11998,10 +12109,10 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
11998
12109
|
return filters;
|
|
11999
12110
|
}, [filterConfigs]);
|
|
12000
12111
|
const hasActiveFilters = Object.keys(activeFilters).length > 0;
|
|
12001
|
-
const updateFilters = (0,
|
|
12112
|
+
const updateFilters = (0, import_react37.useCallback)((configs) => {
|
|
12002
12113
|
setFilterConfigs(configs);
|
|
12003
12114
|
}, []);
|
|
12004
|
-
const applyFilters = (0,
|
|
12115
|
+
const applyFilters = (0, import_react37.useCallback)(() => {
|
|
12005
12116
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
12006
12117
|
return;
|
|
12007
12118
|
}
|
|
@@ -12019,7 +12130,7 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
12019
12130
|
}
|
|
12020
12131
|
globalThis.window.history.replaceState({}, "", url.toString());
|
|
12021
12132
|
}, [filterConfigs, syncWithUrl]);
|
|
12022
|
-
const clearFilters = (0,
|
|
12133
|
+
const clearFilters = (0, import_react37.useCallback)(() => {
|
|
12023
12134
|
const clearedConfigs = filterConfigs.map((config) => ({
|
|
12024
12135
|
...config,
|
|
12025
12136
|
categories: config.categories.map((category) => ({
|
|
@@ -12039,7 +12150,7 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
12039
12150
|
globalThis.window.history.replaceState({}, "", url.toString());
|
|
12040
12151
|
}
|
|
12041
12152
|
}, [filterConfigs, syncWithUrl]);
|
|
12042
|
-
(0,
|
|
12153
|
+
(0, import_react37.useEffect)(() => {
|
|
12043
12154
|
if (!syncWithUrl || globalThis.window === void 0) {
|
|
12044
12155
|
return;
|
|
12045
12156
|
}
|
|
@@ -12060,7 +12171,7 @@ var useTableFilter = (initialConfigs, options = {}) => {
|
|
|
12060
12171
|
};
|
|
12061
12172
|
|
|
12062
12173
|
// src/components/ActivityFilters/ActivityFilters.tsx
|
|
12063
|
-
var
|
|
12174
|
+
var import_react38 = require("react");
|
|
12064
12175
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
12065
12176
|
var questionTypesFallback = [
|
|
12066
12177
|
"ALTERNATIVA" /* ALTERNATIVA */,
|
|
@@ -12212,8 +12323,8 @@ var ActivityFilters = ({
|
|
|
12212
12323
|
onApplyFilters
|
|
12213
12324
|
}) => {
|
|
12214
12325
|
const useActivityFiltersData = createUseActivityFiltersData(apiClient);
|
|
12215
|
-
const [selectedQuestionTypes, setSelectedQuestionTypes] = (0,
|
|
12216
|
-
const [selectedSubject, setSelectedSubject] = (0,
|
|
12326
|
+
const [selectedQuestionTypes, setSelectedQuestionTypes] = (0, import_react38.useState)([]);
|
|
12327
|
+
const [selectedSubject, setSelectedSubject] = (0, import_react38.useState)(null);
|
|
12217
12328
|
const {
|
|
12218
12329
|
banks,
|
|
12219
12330
|
bankYears,
|
|
@@ -12235,8 +12346,8 @@ var ActivityFilters = ({
|
|
|
12235
12346
|
selectedSubjects: selectedSubject ? [selectedSubject] : [],
|
|
12236
12347
|
institutionId
|
|
12237
12348
|
});
|
|
12238
|
-
const prevAllowedQuestionTypesRef = (0,
|
|
12239
|
-
(0,
|
|
12349
|
+
const prevAllowedQuestionTypesRef = (0, import_react38.useRef)(null);
|
|
12350
|
+
(0, import_react38.useEffect)(() => {
|
|
12240
12351
|
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
12241
12352
|
prevAllowedQuestionTypesRef.current = null;
|
|
12242
12353
|
return;
|
|
@@ -12269,8 +12380,8 @@ var ActivityFilters = ({
|
|
|
12269
12380
|
return prev;
|
|
12270
12381
|
});
|
|
12271
12382
|
}, [allowedQuestionTypes]);
|
|
12272
|
-
const [bankCategories, setBankCategories] = (0,
|
|
12273
|
-
const selectedSubjects = (0,
|
|
12383
|
+
const [bankCategories, setBankCategories] = (0, import_react38.useState)([]);
|
|
12384
|
+
const selectedSubjects = (0, import_react38.useMemo)(
|
|
12274
12385
|
() => selectedSubject ? [selectedSubject] : [],
|
|
12275
12386
|
[selectedSubject]
|
|
12276
12387
|
);
|
|
@@ -12283,7 +12394,7 @@ var ActivityFilters = ({
|
|
|
12283
12394
|
const handleBankCategoriesChange = (updatedCategories) => {
|
|
12284
12395
|
setBankCategories(updatedCategories);
|
|
12285
12396
|
};
|
|
12286
|
-
(0,
|
|
12397
|
+
(0, import_react38.useEffect)(() => {
|
|
12287
12398
|
setBankCategories((prevCategories) => {
|
|
12288
12399
|
const bankCategory = {
|
|
12289
12400
|
key: "banca",
|
|
@@ -12309,7 +12420,7 @@ var ActivityFilters = ({
|
|
|
12309
12420
|
return [bankCategory, yearCategory];
|
|
12310
12421
|
});
|
|
12311
12422
|
}, [banks, bankYears]);
|
|
12312
|
-
(0,
|
|
12423
|
+
(0, import_react38.useEffect)(() => {
|
|
12313
12424
|
if (loadBanks) {
|
|
12314
12425
|
loadBanks();
|
|
12315
12426
|
}
|
|
@@ -12320,31 +12431,31 @@ var ActivityFilters = ({
|
|
|
12320
12431
|
loadQuestionTypes();
|
|
12321
12432
|
}
|
|
12322
12433
|
}, [loadBanks, loadKnowledgeAreas, loadQuestionTypes, institutionId]);
|
|
12323
|
-
const availableQuestionTypes = (0,
|
|
12434
|
+
const availableQuestionTypes = (0, import_react38.useMemo)(() => {
|
|
12324
12435
|
const source = questionTypes && questionTypes.length > 0 ? questionTypes : questionTypesFallback;
|
|
12325
12436
|
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
12326
12437
|
return source;
|
|
12327
12438
|
}
|
|
12328
12439
|
return source.filter((type) => allowedQuestionTypes.includes(type));
|
|
12329
12440
|
}, [questionTypes, allowedQuestionTypes]);
|
|
12330
|
-
const getSelectedKnowledgeIds = (0,
|
|
12441
|
+
const getSelectedKnowledgeIds = (0, import_react38.useCallback)(() => {
|
|
12331
12442
|
return getSelectedIdsFromCategories(knowledgeCategories, {
|
|
12332
12443
|
topicIds: "tema",
|
|
12333
12444
|
subtopicIds: "subtema",
|
|
12334
12445
|
contentIds: "assunto"
|
|
12335
12446
|
});
|
|
12336
12447
|
}, [knowledgeCategories]);
|
|
12337
|
-
const getSelectedBankIds = (0,
|
|
12448
|
+
const getSelectedBankIds = (0, import_react38.useCallback)(() => {
|
|
12338
12449
|
return getSelectedIdsFromCategories(bankCategories, {
|
|
12339
12450
|
bankIds: "banca",
|
|
12340
12451
|
yearIds: "ano"
|
|
12341
12452
|
});
|
|
12342
12453
|
}, [bankCategories]);
|
|
12343
|
-
const onFiltersChangeRef = (0,
|
|
12344
|
-
(0,
|
|
12454
|
+
const onFiltersChangeRef = (0, import_react38.useRef)(onFiltersChange);
|
|
12455
|
+
(0, import_react38.useEffect)(() => {
|
|
12345
12456
|
onFiltersChangeRef.current = onFiltersChange;
|
|
12346
12457
|
}, [onFiltersChange]);
|
|
12347
|
-
(0,
|
|
12458
|
+
(0, import_react38.useEffect)(() => {
|
|
12348
12459
|
const knowledgeIds = getSelectedKnowledgeIds();
|
|
12349
12460
|
const bankIds = getSelectedBankIds();
|
|
12350
12461
|
const filters = {
|
|
@@ -12446,7 +12557,7 @@ var ActivityFiltersPopover = ({
|
|
|
12446
12557
|
triggerLabel = "Filtro de quest\xF5es",
|
|
12447
12558
|
...activityFiltersProps
|
|
12448
12559
|
}) => {
|
|
12449
|
-
const [open, setOpen] = (0,
|
|
12560
|
+
const [open, setOpen] = (0, import_react38.useState)(false);
|
|
12450
12561
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(DropdownMenu_default, { open, onOpenChange: setOpen, children: [
|
|
12451
12562
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DropdownMenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Button_default, { variant: "outline", children: triggerLabel }) }),
|
|
12452
12563
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
@@ -12468,7 +12579,7 @@ var ActivityFiltersPopover = ({
|
|
|
12468
12579
|
};
|
|
12469
12580
|
|
|
12470
12581
|
// src/components/TableProvider/TableProvider.tsx
|
|
12471
|
-
var
|
|
12582
|
+
var import_react39 = require("react");
|
|
12472
12583
|
var import_phosphor_react26 = require("phosphor-react");
|
|
12473
12584
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
12474
12585
|
function TableProvider({
|
|
@@ -12492,7 +12603,7 @@ function TableProvider({
|
|
|
12492
12603
|
onRowClick,
|
|
12493
12604
|
children
|
|
12494
12605
|
}) {
|
|
12495
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
12606
|
+
const [searchQuery, setSearchQuery] = (0, import_react39.useState)("");
|
|
12496
12607
|
const sortResultRaw = useTableSort(data, { syncWithUrl: true });
|
|
12497
12608
|
const sortResult = enableTableSort ? sortResultRaw : {
|
|
12498
12609
|
sortedData: data,
|
|
@@ -12503,7 +12614,7 @@ function TableProvider({
|
|
|
12503
12614
|
};
|
|
12504
12615
|
const { sortedData, sortColumn, sortDirection, handleSort } = sortResult;
|
|
12505
12616
|
const filterResultRaw = useTableFilter(initialFilters, { syncWithUrl: true });
|
|
12506
|
-
const disabledFilterResult = (0,
|
|
12617
|
+
const disabledFilterResult = (0, import_react39.useMemo)(
|
|
12507
12618
|
() => ({
|
|
12508
12619
|
filterConfigs: [],
|
|
12509
12620
|
activeFilters: {},
|
|
@@ -12533,10 +12644,10 @@ function TableProvider({
|
|
|
12533
12644
|
totalItems,
|
|
12534
12645
|
totalPages
|
|
12535
12646
|
} = paginationConfig;
|
|
12536
|
-
const [currentPage, setCurrentPage] = (0,
|
|
12537
|
-
const [itemsPerPage, setItemsPerPage] = (0,
|
|
12538
|
-
const [isFilterModalOpen, setIsFilterModalOpen] = (0,
|
|
12539
|
-
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)(() => {
|
|
12540
12651
|
const params = {
|
|
12541
12652
|
page: currentPage,
|
|
12542
12653
|
limit: itemsPerPage
|
|
@@ -12563,26 +12674,26 @@ function TableProvider({
|
|
|
12563
12674
|
enableFilters,
|
|
12564
12675
|
enableTableSort
|
|
12565
12676
|
]);
|
|
12566
|
-
(0,
|
|
12677
|
+
(0, import_react39.useEffect)(() => {
|
|
12567
12678
|
onParamsChange?.(combinedParams);
|
|
12568
12679
|
}, [combinedParams]);
|
|
12569
|
-
const handleSearchChange = (0,
|
|
12680
|
+
const handleSearchChange = (0, import_react39.useCallback)((value) => {
|
|
12570
12681
|
setSearchQuery(value);
|
|
12571
12682
|
setCurrentPage(1);
|
|
12572
12683
|
}, []);
|
|
12573
|
-
const handleFilterApply = (0,
|
|
12684
|
+
const handleFilterApply = (0, import_react39.useCallback)(() => {
|
|
12574
12685
|
applyFilters();
|
|
12575
12686
|
setIsFilterModalOpen(false);
|
|
12576
12687
|
setCurrentPage(1);
|
|
12577
12688
|
}, [applyFilters]);
|
|
12578
|
-
const handlePageChange = (0,
|
|
12689
|
+
const handlePageChange = (0, import_react39.useCallback)((page) => {
|
|
12579
12690
|
setCurrentPage(page);
|
|
12580
12691
|
}, []);
|
|
12581
|
-
const handleItemsPerPageChange = (0,
|
|
12692
|
+
const handleItemsPerPageChange = (0, import_react39.useCallback)((items) => {
|
|
12582
12693
|
setItemsPerPage(items);
|
|
12583
12694
|
setCurrentPage(1);
|
|
12584
12695
|
}, []);
|
|
12585
|
-
const handleRowClickInternal = (0,
|
|
12696
|
+
const handleRowClickInternal = (0, import_react39.useCallback)(
|
|
12586
12697
|
(row, index) => {
|
|
12587
12698
|
if (enableRowClick && onRowClick) {
|
|
12588
12699
|
onRowClick(row, index);
|
|
@@ -12590,7 +12701,7 @@ function TableProvider({
|
|
|
12590
12701
|
},
|
|
12591
12702
|
[enableRowClick, onRowClick]
|
|
12592
12703
|
);
|
|
12593
|
-
const useInternalPagination = (0,
|
|
12704
|
+
const useInternalPagination = (0, import_react39.useMemo)(
|
|
12594
12705
|
() => enablePagination && !onParamsChange && totalItems === void 0 && totalPages === void 0,
|
|
12595
12706
|
[enablePagination, onParamsChange, totalItems, totalPages]
|
|
12596
12707
|
);
|
|
@@ -12598,7 +12709,7 @@ function TableProvider({
|
|
|
12598
12709
|
(totalItems ?? (useInternalPagination ? sortedData.length : data.length)) / itemsPerPage
|
|
12599
12710
|
);
|
|
12600
12711
|
const calculatedTotalItems = totalItems ?? (useInternalPagination ? sortedData.length : data.length);
|
|
12601
|
-
const displayData = (0,
|
|
12712
|
+
const displayData = (0, import_react39.useMemo)(() => {
|
|
12602
12713
|
if (!useInternalPagination) {
|
|
12603
12714
|
return sortedData;
|
|
12604
12715
|
}
|
|
@@ -12765,7 +12876,7 @@ var TableProvider_default = TableProvider;
|
|
|
12765
12876
|
|
|
12766
12877
|
// src/components/Select/Select.tsx
|
|
12767
12878
|
var import_zustand10 = require("zustand");
|
|
12768
|
-
var
|
|
12879
|
+
var import_react40 = require("react");
|
|
12769
12880
|
var import_phosphor_react27 = require("phosphor-react");
|
|
12770
12881
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12771
12882
|
var VARIANT_CLASSES4 = {
|
|
@@ -12825,13 +12936,13 @@ function getLabelAsNode(children) {
|
|
|
12825
12936
|
if (typeof children === "string" || typeof children === "number") {
|
|
12826
12937
|
return children;
|
|
12827
12938
|
}
|
|
12828
|
-
const flattened =
|
|
12939
|
+
const flattened = import_react40.Children.toArray(children);
|
|
12829
12940
|
if (flattened.length === 1) return flattened[0];
|
|
12830
12941
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: flattened });
|
|
12831
12942
|
}
|
|
12832
12943
|
var injectStore5 = (children, store, size, selectId) => {
|
|
12833
|
-
return
|
|
12834
|
-
if ((0,
|
|
12944
|
+
return import_react40.Children.map(children, (child) => {
|
|
12945
|
+
if ((0, import_react40.isValidElement)(child)) {
|
|
12835
12946
|
const typedChild = child;
|
|
12836
12947
|
const newProps = {
|
|
12837
12948
|
store
|
|
@@ -12848,7 +12959,7 @@ var injectStore5 = (children, store, size, selectId) => {
|
|
|
12848
12959
|
selectId
|
|
12849
12960
|
);
|
|
12850
12961
|
}
|
|
12851
|
-
return (0,
|
|
12962
|
+
return (0, import_react40.cloneElement)(typedChild, newProps);
|
|
12852
12963
|
}
|
|
12853
12964
|
return child;
|
|
12854
12965
|
});
|
|
@@ -12865,18 +12976,18 @@ var Select = ({
|
|
|
12865
12976
|
errorMessage,
|
|
12866
12977
|
id
|
|
12867
12978
|
}) => {
|
|
12868
|
-
const storeRef = (0,
|
|
12979
|
+
const storeRef = (0, import_react40.useRef)(null);
|
|
12869
12980
|
storeRef.current ??= createSelectStore(onValueChange);
|
|
12870
12981
|
const store = storeRef.current;
|
|
12871
|
-
const selectRef = (0,
|
|
12982
|
+
const selectRef = (0, import_react40.useRef)(null);
|
|
12872
12983
|
const { open, setOpen, setValue, selectedLabel } = (0, import_zustand10.useStore)(store, (s) => s);
|
|
12873
|
-
const generatedId = (0,
|
|
12984
|
+
const generatedId = (0, import_react40.useId)();
|
|
12874
12985
|
const selectId = id ?? `select-${generatedId}`;
|
|
12875
12986
|
const findLabelForValue = (children2, targetValue) => {
|
|
12876
12987
|
let found = null;
|
|
12877
12988
|
const search = (nodes) => {
|
|
12878
|
-
|
|
12879
|
-
if (!(0,
|
|
12989
|
+
import_react40.Children.forEach(nodes, (child) => {
|
|
12990
|
+
if (!(0, import_react40.isValidElement)(child)) return;
|
|
12880
12991
|
const typedChild = child;
|
|
12881
12992
|
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
12882
12993
|
if (typeof typedChild.props.children === "string")
|
|
@@ -12889,13 +13000,13 @@ var Select = ({
|
|
|
12889
13000
|
search(children2);
|
|
12890
13001
|
return found;
|
|
12891
13002
|
};
|
|
12892
|
-
(0,
|
|
13003
|
+
(0, import_react40.useEffect)(() => {
|
|
12893
13004
|
if (!selectedLabel && defaultValue) {
|
|
12894
13005
|
const label2 = findLabelForValue(children, defaultValue);
|
|
12895
13006
|
if (label2) store.setState({ selectedLabel: label2 });
|
|
12896
13007
|
}
|
|
12897
13008
|
}, [children, defaultValue, selectedLabel]);
|
|
12898
|
-
(0,
|
|
13009
|
+
(0, import_react40.useEffect)(() => {
|
|
12899
13010
|
const handleClickOutside = (event) => {
|
|
12900
13011
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
12901
13012
|
setOpen(false);
|
|
@@ -12930,7 +13041,7 @@ var Select = ({
|
|
|
12930
13041
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
12931
13042
|
};
|
|
12932
13043
|
}, [open]);
|
|
12933
|
-
(0,
|
|
13044
|
+
(0, import_react40.useEffect)(() => {
|
|
12934
13045
|
if (propValue) {
|
|
12935
13046
|
setValue(propValue);
|
|
12936
13047
|
const label2 = findLabelForValue(children, propValue);
|
|
@@ -12967,7 +13078,7 @@ var SelectValue = ({
|
|
|
12967
13078
|
const value = (0, import_zustand10.useStore)(store, (s) => s.value);
|
|
12968
13079
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-inherit flex gap-2 items-center", children: selectedLabel || placeholder || value });
|
|
12969
13080
|
};
|
|
12970
|
-
var SelectTrigger = (0,
|
|
13081
|
+
var SelectTrigger = (0, import_react40.forwardRef)(
|
|
12971
13082
|
({
|
|
12972
13083
|
className,
|
|
12973
13084
|
invalid = false,
|
|
@@ -13021,7 +13132,7 @@ var SelectTrigger = (0, import_react39.forwardRef)(
|
|
|
13021
13132
|
}
|
|
13022
13133
|
);
|
|
13023
13134
|
SelectTrigger.displayName = "SelectTrigger";
|
|
13024
|
-
var SelectContent = (0,
|
|
13135
|
+
var SelectContent = (0, import_react40.forwardRef)(
|
|
13025
13136
|
({
|
|
13026
13137
|
children,
|
|
13027
13138
|
className,
|
|
@@ -13051,7 +13162,7 @@ var SelectContent = (0, import_react39.forwardRef)(
|
|
|
13051
13162
|
}
|
|
13052
13163
|
);
|
|
13053
13164
|
SelectContent.displayName = "SelectContent";
|
|
13054
|
-
var SelectItem = (0,
|
|
13165
|
+
var SelectItem = (0, import_react40.forwardRef)(
|
|
13055
13166
|
({
|
|
13056
13167
|
className,
|
|
13057
13168
|
children,
|
|
@@ -13110,7 +13221,7 @@ var Select_default = Select;
|
|
|
13110
13221
|
|
|
13111
13222
|
// src/components/Menu/Menu.tsx
|
|
13112
13223
|
var import_zustand11 = require("zustand");
|
|
13113
|
-
var
|
|
13224
|
+
var import_react41 = require("react");
|
|
13114
13225
|
var import_phosphor_react28 = require("phosphor-react");
|
|
13115
13226
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
13116
13227
|
var createMenuStore = (onValueChange) => (0, import_zustand11.create)((set) => ({
|
|
@@ -13131,7 +13242,7 @@ var VARIANT_CLASSES5 = {
|
|
|
13131
13242
|
"menu-overflow": "",
|
|
13132
13243
|
breadcrumb: "bg-transparent shadow-none !px-0"
|
|
13133
13244
|
};
|
|
13134
|
-
var Menu = (0,
|
|
13245
|
+
var Menu = (0, import_react41.forwardRef)(
|
|
13135
13246
|
({
|
|
13136
13247
|
className,
|
|
13137
13248
|
children,
|
|
@@ -13141,11 +13252,11 @@ var Menu = (0, import_react40.forwardRef)(
|
|
|
13141
13252
|
onValueChange,
|
|
13142
13253
|
...props
|
|
13143
13254
|
}, ref) => {
|
|
13144
|
-
const storeRef = (0,
|
|
13255
|
+
const storeRef = (0, import_react41.useRef)(null);
|
|
13145
13256
|
storeRef.current ??= createMenuStore(onValueChange);
|
|
13146
13257
|
const store = storeRef.current;
|
|
13147
13258
|
const { setValue } = (0, import_zustand11.useStore)(store, (s) => s);
|
|
13148
|
-
(0,
|
|
13259
|
+
(0, import_react41.useEffect)(() => {
|
|
13149
13260
|
setValue(propValue ?? defaultValue);
|
|
13150
13261
|
}, [defaultValue, propValue, setValue]);
|
|
13151
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";
|
|
@@ -13166,7 +13277,7 @@ var Menu = (0, import_react40.forwardRef)(
|
|
|
13166
13277
|
}
|
|
13167
13278
|
);
|
|
13168
13279
|
Menu.displayName = "Menu";
|
|
13169
|
-
var MenuContent = (0,
|
|
13280
|
+
var MenuContent = (0, import_react41.forwardRef)(
|
|
13170
13281
|
({ className, children, variant = "menu", ...props }, ref) => {
|
|
13171
13282
|
const baseClasses = "w-full flex flex-row items-center gap-2";
|
|
13172
13283
|
const variantClasses = variant === "menu2" || variant === "menu-overflow" ? "overflow-x-auto scroll-smooth" : "";
|
|
@@ -13188,7 +13299,7 @@ var MenuContent = (0, import_react40.forwardRef)(
|
|
|
13188
13299
|
}
|
|
13189
13300
|
);
|
|
13190
13301
|
MenuContent.displayName = "MenuContent";
|
|
13191
|
-
var MenuItem = (0,
|
|
13302
|
+
var MenuItem = (0, import_react41.forwardRef)(
|
|
13192
13303
|
({
|
|
13193
13304
|
className,
|
|
13194
13305
|
children,
|
|
@@ -13346,10 +13457,10 @@ var MenuOverflow = ({
|
|
|
13346
13457
|
onValueChange,
|
|
13347
13458
|
...props
|
|
13348
13459
|
}) => {
|
|
13349
|
-
const containerRef = (0,
|
|
13350
|
-
const [showLeftArrow, setShowLeftArrow] = (0,
|
|
13351
|
-
const [showRightArrow, setShowRightArrow] = (0,
|
|
13352
|
-
(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)(() => {
|
|
13353
13464
|
const checkScroll = () => internalCheckScroll(
|
|
13354
13465
|
containerRef.current,
|
|
13355
13466
|
setShowLeftArrow,
|
|
@@ -13409,11 +13520,11 @@ var MenuOverflow = ({
|
|
|
13409
13520
|
}
|
|
13410
13521
|
);
|
|
13411
13522
|
};
|
|
13412
|
-
var injectStore6 = (children, store) =>
|
|
13413
|
-
if (!(0,
|
|
13523
|
+
var injectStore6 = (children, store) => import_react41.Children.map(children, (child) => {
|
|
13524
|
+
if (!(0, import_react41.isValidElement)(child)) return child;
|
|
13414
13525
|
const typedChild = child;
|
|
13415
13526
|
const shouldInject = typedChild.type === MenuItem;
|
|
13416
|
-
return (0,
|
|
13527
|
+
return (0, import_react41.cloneElement)(typedChild, {
|
|
13417
13528
|
...shouldInject ? { store } : {},
|
|
13418
13529
|
...typedChild.props.children ? { children: injectStore6(typedChild.props.children, store) } : {}
|
|
13419
13530
|
});
|
|
@@ -13672,12 +13783,12 @@ var NotFound = ({
|
|
|
13672
13783
|
var NotFound_default = NotFound;
|
|
13673
13784
|
|
|
13674
13785
|
// src/components/VideoPlayer/VideoPlayer.tsx
|
|
13675
|
-
var
|
|
13786
|
+
var import_react43 = require("react");
|
|
13676
13787
|
var import_react_dom = require("react-dom");
|
|
13677
13788
|
var import_phosphor_react31 = require("phosphor-react");
|
|
13678
13789
|
|
|
13679
13790
|
// src/components/DownloadButton/DownloadButton.tsx
|
|
13680
|
-
var
|
|
13791
|
+
var import_react42 = require("react");
|
|
13681
13792
|
var import_phosphor_react30 = require("phosphor-react");
|
|
13682
13793
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
13683
13794
|
var getMimeType = (url) => {
|
|
@@ -13754,13 +13865,13 @@ var DownloadButton = ({
|
|
|
13754
13865
|
lessonTitle = "aula",
|
|
13755
13866
|
disabled = false
|
|
13756
13867
|
}) => {
|
|
13757
|
-
const [isDownloading, setIsDownloading] = (0,
|
|
13758
|
-
const isValidUrl = (0,
|
|
13868
|
+
const [isDownloading, setIsDownloading] = (0, import_react42.useState)(false);
|
|
13869
|
+
const isValidUrl = (0, import_react42.useCallback)((url) => {
|
|
13759
13870
|
return Boolean(
|
|
13760
13871
|
url && url.trim() !== "" && url !== "undefined" && url !== "null"
|
|
13761
13872
|
);
|
|
13762
13873
|
}, []);
|
|
13763
|
-
const getAvailableContent = (0,
|
|
13874
|
+
const getAvailableContent = (0, import_react42.useCallback)(() => {
|
|
13764
13875
|
const downloads = [];
|
|
13765
13876
|
if (isValidUrl(content.urlDoc)) {
|
|
13766
13877
|
downloads.push({
|
|
@@ -13795,7 +13906,7 @@ var DownloadButton = ({
|
|
|
13795
13906
|
}
|
|
13796
13907
|
return downloads;
|
|
13797
13908
|
}, [content, isValidUrl]);
|
|
13798
|
-
const handleDownload = (0,
|
|
13909
|
+
const handleDownload = (0, import_react42.useCallback)(async () => {
|
|
13799
13910
|
if (disabled || isDownloading) return;
|
|
13800
13911
|
const availableContent = getAvailableContent();
|
|
13801
13912
|
if (availableContent.length === 0) {
|
|
@@ -13933,9 +14044,9 @@ var SpeedMenu = ({
|
|
|
13933
14044
|
iconSize = 24,
|
|
13934
14045
|
isTinyMobile = false
|
|
13935
14046
|
}) => {
|
|
13936
|
-
const buttonRef = (0,
|
|
13937
|
-
const speedMenuContainerRef = (0,
|
|
13938
|
-
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);
|
|
13939
14050
|
const getMenuPosition = () => {
|
|
13940
14051
|
if (!buttonRef.current) return { top: 0, left: 0 };
|
|
13941
14052
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
@@ -13949,7 +14060,7 @@ var SpeedMenu = ({
|
|
|
13949
14060
|
};
|
|
13950
14061
|
};
|
|
13951
14062
|
const position = getMenuPosition();
|
|
13952
|
-
(0,
|
|
14063
|
+
(0, import_react43.useEffect)(() => {
|
|
13953
14064
|
const handleClickOutside = (event) => {
|
|
13954
14065
|
const target = event.target;
|
|
13955
14066
|
const isOutsideContainer = speedMenuContainerRef.current && !speedMenuContainerRef.current.contains(target);
|
|
@@ -14028,28 +14139,28 @@ var VideoPlayer = ({
|
|
|
14028
14139
|
onDownloadComplete,
|
|
14029
14140
|
onDownloadError
|
|
14030
14141
|
}) => {
|
|
14031
|
-
const videoRef = (0,
|
|
14142
|
+
const videoRef = (0, import_react43.useRef)(null);
|
|
14032
14143
|
const { isUltraSmallMobile, isTinyMobile } = useMobile();
|
|
14033
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
14034
|
-
const [currentTime, setCurrentTime] = (0,
|
|
14035
|
-
const [duration, setDuration] = (0,
|
|
14036
|
-
const [isMuted, setIsMuted] = (0,
|
|
14037
|
-
const [volume, setVolume] = (0,
|
|
14038
|
-
const [isFullscreen, setIsFullscreen] = (0,
|
|
14039
|
-
const [showControls, setShowControls] = (0,
|
|
14040
|
-
const [hasCompleted, setHasCompleted] = (0,
|
|
14041
|
-
const [showCaptions, setShowCaptions] = (0,
|
|
14042
|
-
const [subtitlesValidation, setSubtitlesValidation] = (0,
|
|
14043
|
-
(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)(() => {
|
|
14044
14155
|
setHasCompleted(false);
|
|
14045
14156
|
}, [src]);
|
|
14046
|
-
const [playbackRate, setPlaybackRate] = (0,
|
|
14047
|
-
const [showSpeedMenu, setShowSpeedMenu] = (0,
|
|
14048
|
-
const lastSaveTimeRef = (0,
|
|
14049
|
-
const trackRef = (0,
|
|
14050
|
-
const controlsTimeoutRef = (0,
|
|
14051
|
-
const lastMousePositionRef = (0,
|
|
14052
|
-
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)(() => {
|
|
14053
14164
|
if (showSpeedMenu) {
|
|
14054
14165
|
return true;
|
|
14055
14166
|
}
|
|
@@ -14066,13 +14177,13 @@ var VideoPlayer = ({
|
|
|
14066
14177
|
}
|
|
14067
14178
|
return false;
|
|
14068
14179
|
}, [showSpeedMenu]);
|
|
14069
|
-
const clearControlsTimeout = (0,
|
|
14180
|
+
const clearControlsTimeout = (0, import_react43.useCallback)(() => {
|
|
14070
14181
|
if (controlsTimeoutRef.current) {
|
|
14071
14182
|
clearTimeout(controlsTimeoutRef.current);
|
|
14072
14183
|
controlsTimeoutRef.current = null;
|
|
14073
14184
|
}
|
|
14074
14185
|
}, []);
|
|
14075
|
-
const showControlsWithTimer = (0,
|
|
14186
|
+
const showControlsWithTimer = (0, import_react43.useCallback)(() => {
|
|
14076
14187
|
setShowControls(true);
|
|
14077
14188
|
clearControlsTimeout();
|
|
14078
14189
|
if (isFullscreen) {
|
|
@@ -14087,7 +14198,7 @@ var VideoPlayer = ({
|
|
|
14087
14198
|
}, CONTROLS_HIDE_TIMEOUT);
|
|
14088
14199
|
}
|
|
14089
14200
|
}, [isFullscreen, isPlaying, clearControlsTimeout]);
|
|
14090
|
-
const handleMouseMove = (0,
|
|
14201
|
+
const handleMouseMove = (0, import_react43.useCallback)(
|
|
14091
14202
|
(event) => {
|
|
14092
14203
|
const currentX = event.clientX;
|
|
14093
14204
|
const currentY = event.clientY;
|
|
@@ -14100,10 +14211,10 @@ var VideoPlayer = ({
|
|
|
14100
14211
|
},
|
|
14101
14212
|
[showControlsWithTimer]
|
|
14102
14213
|
);
|
|
14103
|
-
const handleMouseEnter = (0,
|
|
14214
|
+
const handleMouseEnter = (0, import_react43.useCallback)(() => {
|
|
14104
14215
|
showControlsWithTimer();
|
|
14105
14216
|
}, [showControlsWithTimer]);
|
|
14106
|
-
const handleMouseLeave = (0,
|
|
14217
|
+
const handleMouseLeave = (0, import_react43.useCallback)(() => {
|
|
14107
14218
|
const userInteracting = isUserInteracting();
|
|
14108
14219
|
clearControlsTimeout();
|
|
14109
14220
|
if (!isFullscreen && !userInteracting) {
|
|
@@ -14112,13 +14223,13 @@ var VideoPlayer = ({
|
|
|
14112
14223
|
}, LEAVE_HIDE_TIMEOUT);
|
|
14113
14224
|
}
|
|
14114
14225
|
}, [isFullscreen, clearControlsTimeout, isUserInteracting]);
|
|
14115
|
-
(0,
|
|
14226
|
+
(0, import_react43.useEffect)(() => {
|
|
14116
14227
|
if (videoRef.current) {
|
|
14117
14228
|
videoRef.current.volume = volume;
|
|
14118
14229
|
videoRef.current.muted = isMuted;
|
|
14119
14230
|
}
|
|
14120
14231
|
}, [volume, isMuted]);
|
|
14121
|
-
(0,
|
|
14232
|
+
(0, import_react43.useEffect)(() => {
|
|
14122
14233
|
const video = videoRef.current;
|
|
14123
14234
|
if (!video) return;
|
|
14124
14235
|
const onPlay = () => setIsPlaying(true);
|
|
@@ -14133,13 +14244,13 @@ var VideoPlayer = ({
|
|
|
14133
14244
|
video.removeEventListener("ended", onEnded);
|
|
14134
14245
|
};
|
|
14135
14246
|
}, []);
|
|
14136
|
-
(0,
|
|
14247
|
+
(0, import_react43.useEffect)(() => {
|
|
14137
14248
|
const video = videoRef.current;
|
|
14138
14249
|
if (!video) return;
|
|
14139
14250
|
video.setAttribute("playsinline", "");
|
|
14140
14251
|
video.setAttribute("webkit-playsinline", "");
|
|
14141
14252
|
}, []);
|
|
14142
|
-
(0,
|
|
14253
|
+
(0, import_react43.useEffect)(() => {
|
|
14143
14254
|
if (isPlaying) {
|
|
14144
14255
|
showControlsWithTimer();
|
|
14145
14256
|
} else {
|
|
@@ -14151,7 +14262,7 @@ var VideoPlayer = ({
|
|
|
14151
14262
|
}
|
|
14152
14263
|
}
|
|
14153
14264
|
}, [isPlaying, isFullscreen, showControlsWithTimer, clearControlsTimeout]);
|
|
14154
|
-
(0,
|
|
14265
|
+
(0, import_react43.useEffect)(() => {
|
|
14155
14266
|
const video = videoRef.current;
|
|
14156
14267
|
if (!video) return;
|
|
14157
14268
|
const handleFullscreenChange = () => {
|
|
@@ -14186,7 +14297,7 @@ var VideoPlayer = ({
|
|
|
14186
14297
|
);
|
|
14187
14298
|
};
|
|
14188
14299
|
}, [showControlsWithTimer]);
|
|
14189
|
-
(0,
|
|
14300
|
+
(0, import_react43.useEffect)(() => {
|
|
14190
14301
|
const init = () => {
|
|
14191
14302
|
if (!isFullscreen) {
|
|
14192
14303
|
showControlsWithTimer();
|
|
@@ -14208,7 +14319,7 @@ var VideoPlayer = ({
|
|
|
14208
14319
|
};
|
|
14209
14320
|
}
|
|
14210
14321
|
}, []);
|
|
14211
|
-
const getInitialTime = (0,
|
|
14322
|
+
const getInitialTime = (0, import_react43.useCallback)(() => {
|
|
14212
14323
|
if (!autoSave || !storageKey) {
|
|
14213
14324
|
return Number.isFinite(initialTime) && initialTime >= 0 ? initialTime : void 0;
|
|
14214
14325
|
}
|
|
@@ -14221,14 +14332,14 @@ var VideoPlayer = ({
|
|
|
14221
14332
|
if (hasValidSaved) return saved;
|
|
14222
14333
|
return void 0;
|
|
14223
14334
|
}, [autoSave, storageKey, src, initialTime]);
|
|
14224
|
-
(0,
|
|
14335
|
+
(0, import_react43.useEffect)(() => {
|
|
14225
14336
|
const start = getInitialTime();
|
|
14226
14337
|
if (start !== void 0 && videoRef.current) {
|
|
14227
14338
|
videoRef.current.currentTime = start;
|
|
14228
14339
|
setCurrentTime(start);
|
|
14229
14340
|
}
|
|
14230
14341
|
}, [getInitialTime]);
|
|
14231
|
-
const saveProgress = (0,
|
|
14342
|
+
const saveProgress = (0, import_react43.useCallback)(
|
|
14232
14343
|
(time) => {
|
|
14233
14344
|
if (!autoSave || !storageKey) return;
|
|
14234
14345
|
const now = Date.now();
|
|
@@ -14239,7 +14350,7 @@ var VideoPlayer = ({
|
|
|
14239
14350
|
},
|
|
14240
14351
|
[autoSave, storageKey, src]
|
|
14241
14352
|
);
|
|
14242
|
-
const togglePlayPause = (0,
|
|
14353
|
+
const togglePlayPause = (0, import_react43.useCallback)(async () => {
|
|
14243
14354
|
const video = videoRef.current;
|
|
14244
14355
|
if (!video) return;
|
|
14245
14356
|
if (!video.paused) {
|
|
@@ -14251,7 +14362,7 @@ var VideoPlayer = ({
|
|
|
14251
14362
|
} catch {
|
|
14252
14363
|
}
|
|
14253
14364
|
}, []);
|
|
14254
|
-
const handleVolumeChange = (0,
|
|
14365
|
+
const handleVolumeChange = (0, import_react43.useCallback)(
|
|
14255
14366
|
(newVolume) => {
|
|
14256
14367
|
const video = videoRef.current;
|
|
14257
14368
|
if (!video) return;
|
|
@@ -14270,7 +14381,7 @@ var VideoPlayer = ({
|
|
|
14270
14381
|
},
|
|
14271
14382
|
[isMuted]
|
|
14272
14383
|
);
|
|
14273
|
-
const toggleMute = (0,
|
|
14384
|
+
const toggleMute = (0, import_react43.useCallback)(() => {
|
|
14274
14385
|
const video = videoRef.current;
|
|
14275
14386
|
if (!video) return;
|
|
14276
14387
|
if (isMuted) {
|
|
@@ -14284,20 +14395,20 @@ var VideoPlayer = ({
|
|
|
14284
14395
|
setIsMuted(true);
|
|
14285
14396
|
}
|
|
14286
14397
|
}, [isMuted, volume]);
|
|
14287
|
-
const handleSeek = (0,
|
|
14398
|
+
const handleSeek = (0, import_react43.useCallback)((newTime) => {
|
|
14288
14399
|
const video = videoRef.current;
|
|
14289
14400
|
if (video) {
|
|
14290
14401
|
video.currentTime = newTime;
|
|
14291
14402
|
}
|
|
14292
14403
|
}, []);
|
|
14293
|
-
const isSafariIOS = (0,
|
|
14404
|
+
const isSafariIOS = (0, import_react43.useCallback)(() => {
|
|
14294
14405
|
const ua = navigator.userAgent;
|
|
14295
14406
|
const isIOS = /iPad|iPhone|iPod/.test(ua);
|
|
14296
14407
|
const isWebKit = /WebKit/.test(ua);
|
|
14297
14408
|
const isNotChrome = !/CriOS|Chrome/.test(ua);
|
|
14298
14409
|
return isIOS && isWebKit && isNotChrome;
|
|
14299
14410
|
}, []);
|
|
14300
|
-
const toggleFullscreen = (0,
|
|
14411
|
+
const toggleFullscreen = (0, import_react43.useCallback)(() => {
|
|
14301
14412
|
const video = videoRef.current;
|
|
14302
14413
|
const container = video?.parentElement;
|
|
14303
14414
|
if (!video || !container) return;
|
|
@@ -14314,24 +14425,24 @@ var VideoPlayer = ({
|
|
|
14314
14425
|
document.exitFullscreen();
|
|
14315
14426
|
}
|
|
14316
14427
|
}, [isFullscreen, isSafariIOS]);
|
|
14317
|
-
const handleSpeedChange = (0,
|
|
14428
|
+
const handleSpeedChange = (0, import_react43.useCallback)((speed) => {
|
|
14318
14429
|
if (videoRef.current) {
|
|
14319
14430
|
videoRef.current.playbackRate = speed;
|
|
14320
14431
|
setPlaybackRate(speed);
|
|
14321
14432
|
setShowSpeedMenu(false);
|
|
14322
14433
|
}
|
|
14323
14434
|
}, []);
|
|
14324
|
-
const toggleSpeedMenu = (0,
|
|
14435
|
+
const toggleSpeedMenu = (0, import_react43.useCallback)(() => {
|
|
14325
14436
|
setShowSpeedMenu(!showSpeedMenu);
|
|
14326
14437
|
}, [showSpeedMenu]);
|
|
14327
|
-
const toggleCaptions = (0,
|
|
14438
|
+
const toggleCaptions = (0, import_react43.useCallback)(() => {
|
|
14328
14439
|
if (!trackRef.current?.track || !subtitles || subtitlesValidation !== "valid")
|
|
14329
14440
|
return;
|
|
14330
14441
|
const newShowCaptions = !showCaptions;
|
|
14331
14442
|
setShowCaptions(newShowCaptions);
|
|
14332
14443
|
trackRef.current.track.mode = newShowCaptions ? "showing" : "hidden";
|
|
14333
14444
|
}, [showCaptions, subtitles, subtitlesValidation]);
|
|
14334
|
-
const checkVideoCompletion = (0,
|
|
14445
|
+
const checkVideoCompletion = (0, import_react43.useCallback)(
|
|
14335
14446
|
(progressPercent) => {
|
|
14336
14447
|
if (progressPercent >= 95 && !hasCompleted) {
|
|
14337
14448
|
setHasCompleted(true);
|
|
@@ -14340,7 +14451,7 @@ var VideoPlayer = ({
|
|
|
14340
14451
|
},
|
|
14341
14452
|
[hasCompleted, onVideoComplete]
|
|
14342
14453
|
);
|
|
14343
|
-
const handleTimeUpdate = (0,
|
|
14454
|
+
const handleTimeUpdate = (0, import_react43.useCallback)(() => {
|
|
14344
14455
|
const video = videoRef.current;
|
|
14345
14456
|
if (!video) return;
|
|
14346
14457
|
const current = video.currentTime;
|
|
@@ -14353,12 +14464,12 @@ var VideoPlayer = ({
|
|
|
14353
14464
|
checkVideoCompletion(progressPercent);
|
|
14354
14465
|
}
|
|
14355
14466
|
}, [duration, saveProgress, onTimeUpdate, onProgress, checkVideoCompletion]);
|
|
14356
|
-
const handleLoadedMetadata = (0,
|
|
14467
|
+
const handleLoadedMetadata = (0, import_react43.useCallback)(() => {
|
|
14357
14468
|
if (videoRef.current) {
|
|
14358
14469
|
setDuration(videoRef.current.duration);
|
|
14359
14470
|
}
|
|
14360
14471
|
}, []);
|
|
14361
|
-
(0,
|
|
14472
|
+
(0, import_react43.useEffect)(() => {
|
|
14362
14473
|
const controller = new AbortController();
|
|
14363
14474
|
const validateSubtitles = async () => {
|
|
14364
14475
|
if (!subtitles) {
|
|
@@ -14405,12 +14516,12 @@ var VideoPlayer = ({
|
|
|
14405
14516
|
controller.abort();
|
|
14406
14517
|
};
|
|
14407
14518
|
}, [subtitles]);
|
|
14408
|
-
(0,
|
|
14519
|
+
(0, import_react43.useEffect)(() => {
|
|
14409
14520
|
if (trackRef.current?.track) {
|
|
14410
14521
|
trackRef.current.track.mode = showCaptions && subtitles && subtitlesValidation === "valid" ? "showing" : "hidden";
|
|
14411
14522
|
}
|
|
14412
14523
|
}, [subtitles, showCaptions, subtitlesValidation]);
|
|
14413
|
-
(0,
|
|
14524
|
+
(0, import_react43.useEffect)(() => {
|
|
14414
14525
|
const handleVisibilityChange = () => {
|
|
14415
14526
|
if (document.hidden && isPlaying && videoRef.current) {
|
|
14416
14527
|
videoRef.current.pause();
|
|
@@ -14432,54 +14543,54 @@ var VideoPlayer = ({
|
|
|
14432
14543
|
};
|
|
14433
14544
|
}, [isPlaying, clearControlsTimeout]);
|
|
14434
14545
|
const progressPercentage = duration > 0 ? currentTime / duration * 100 : 0;
|
|
14435
|
-
const getIconSize2 = (0,
|
|
14546
|
+
const getIconSize2 = (0, import_react43.useCallback)(() => {
|
|
14436
14547
|
if (isTinyMobile) return 18;
|
|
14437
14548
|
if (isUltraSmallMobile) return 20;
|
|
14438
14549
|
return 24;
|
|
14439
14550
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
14440
|
-
const getControlsPadding = (0,
|
|
14551
|
+
const getControlsPadding = (0, import_react43.useCallback)(() => {
|
|
14441
14552
|
if (isTinyMobile) return "px-2 pb-2 pt-1";
|
|
14442
14553
|
if (isUltraSmallMobile) return "px-3 pb-3 pt-1";
|
|
14443
14554
|
return "px-4 pb-4";
|
|
14444
14555
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
14445
|
-
const getControlsGap = (0,
|
|
14556
|
+
const getControlsGap = (0, import_react43.useCallback)(() => {
|
|
14446
14557
|
if (isTinyMobile) return "gap-1";
|
|
14447
14558
|
if (isUltraSmallMobile) return "gap-2";
|
|
14448
14559
|
return "gap-4";
|
|
14449
14560
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
14450
|
-
const getProgressBarPadding = (0,
|
|
14561
|
+
const getProgressBarPadding = (0, import_react43.useCallback)(() => {
|
|
14451
14562
|
if (isTinyMobile) return "px-2 pb-1";
|
|
14452
14563
|
if (isUltraSmallMobile) return "px-3 pb-1";
|
|
14453
14564
|
return "px-4 pb-2";
|
|
14454
14565
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
14455
|
-
const getCenterPlayButtonPosition = (0,
|
|
14566
|
+
const getCenterPlayButtonPosition = (0, import_react43.useCallback)(() => {
|
|
14456
14567
|
if (isTinyMobile) return "items-center justify-center -translate-y-12";
|
|
14457
14568
|
if (isUltraSmallMobile) return "items-center justify-center -translate-y-8";
|
|
14458
14569
|
return "items-center justify-center";
|
|
14459
14570
|
}, [isTinyMobile, isUltraSmallMobile]);
|
|
14460
|
-
const getTopControlsOpacity = (0,
|
|
14571
|
+
const getTopControlsOpacity = (0, import_react43.useCallback)(() => {
|
|
14461
14572
|
return showControls ? "opacity-100" : "opacity-0";
|
|
14462
14573
|
}, [showControls]);
|
|
14463
|
-
const getBottomControlsOpacity = (0,
|
|
14574
|
+
const getBottomControlsOpacity = (0, import_react43.useCallback)(() => {
|
|
14464
14575
|
return showControls ? "opacity-100" : "opacity-0";
|
|
14465
14576
|
}, [showControls]);
|
|
14466
|
-
const seekBackward = (0,
|
|
14577
|
+
const seekBackward = (0, import_react43.useCallback)(() => {
|
|
14467
14578
|
if (videoRef.current) {
|
|
14468
14579
|
videoRef.current.currentTime -= 10;
|
|
14469
14580
|
}
|
|
14470
14581
|
}, []);
|
|
14471
|
-
const seekForward = (0,
|
|
14582
|
+
const seekForward = (0, import_react43.useCallback)(() => {
|
|
14472
14583
|
if (videoRef.current) {
|
|
14473
14584
|
videoRef.current.currentTime += 10;
|
|
14474
14585
|
}
|
|
14475
14586
|
}, []);
|
|
14476
|
-
const increaseVolume = (0,
|
|
14587
|
+
const increaseVolume = (0, import_react43.useCallback)(() => {
|
|
14477
14588
|
handleVolumeChange(Math.min(100, volume * 100 + 10));
|
|
14478
14589
|
}, [handleVolumeChange, volume]);
|
|
14479
|
-
const decreaseVolume = (0,
|
|
14590
|
+
const decreaseVolume = (0, import_react43.useCallback)(() => {
|
|
14480
14591
|
handleVolumeChange(Math.max(0, volume * 100 - 10));
|
|
14481
14592
|
}, [handleVolumeChange, volume]);
|
|
14482
|
-
const handleVideoKeyDown = (0,
|
|
14593
|
+
const handleVideoKeyDown = (0, import_react43.useCallback)(
|
|
14483
14594
|
(e) => {
|
|
14484
14595
|
if (!e.key) return;
|
|
14485
14596
|
e.stopPropagation();
|
|
@@ -14722,7 +14833,7 @@ var VideoPlayer = ({
|
|
|
14722
14833
|
var VideoPlayer_default = VideoPlayer;
|
|
14723
14834
|
|
|
14724
14835
|
// src/components/Whiteboard/Whiteboard.tsx
|
|
14725
|
-
var
|
|
14836
|
+
var import_react44 = require("react");
|
|
14726
14837
|
var import_phosphor_react32 = require("phosphor-react");
|
|
14727
14838
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
14728
14839
|
var IMAGE_WIDTH = 225;
|
|
@@ -14735,8 +14846,8 @@ var Whiteboard = ({
|
|
|
14735
14846
|
imagesPerRow = 2,
|
|
14736
14847
|
...rest
|
|
14737
14848
|
}) => {
|
|
14738
|
-
const [imageErrors, setImageErrors] = (0,
|
|
14739
|
-
const handleDownload = (0,
|
|
14849
|
+
const [imageErrors, setImageErrors] = (0, import_react44.useState)(/* @__PURE__ */ new Set());
|
|
14850
|
+
const handleDownload = (0, import_react44.useCallback)(
|
|
14740
14851
|
(image) => {
|
|
14741
14852
|
if (onDownload) {
|
|
14742
14853
|
onDownload(image);
|
|
@@ -14753,7 +14864,7 @@ var Whiteboard = ({
|
|
|
14753
14864
|
},
|
|
14754
14865
|
[onDownload]
|
|
14755
14866
|
);
|
|
14756
|
-
const handleImageError = (0,
|
|
14867
|
+
const handleImageError = (0, import_react44.useCallback)((imageId) => {
|
|
14757
14868
|
setImageErrors((prev) => new Set(prev).add(imageId));
|
|
14758
14869
|
}, []);
|
|
14759
14870
|
const gridColsClass = images?.length === 1 ? "grid-cols-1" : {
|
|
@@ -14840,10 +14951,10 @@ var Whiteboard = ({
|
|
|
14840
14951
|
var Whiteboard_default = Whiteboard;
|
|
14841
14952
|
|
|
14842
14953
|
// src/components/Auth/Auth.tsx
|
|
14843
|
-
var
|
|
14954
|
+
var import_react45 = require("react");
|
|
14844
14955
|
var import_react_router_dom = require("react-router-dom");
|
|
14845
14956
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
14846
|
-
var AuthContext = (0,
|
|
14957
|
+
var AuthContext = (0, import_react45.createContext)(void 0);
|
|
14847
14958
|
var AuthProvider = ({
|
|
14848
14959
|
children,
|
|
14849
14960
|
checkAuthFn,
|
|
@@ -14853,12 +14964,12 @@ var AuthProvider = ({
|
|
|
14853
14964
|
getSessionFn,
|
|
14854
14965
|
getTokensFn
|
|
14855
14966
|
}) => {
|
|
14856
|
-
const [authState, setAuthState] = (0,
|
|
14967
|
+
const [authState, setAuthState] = (0, import_react45.useState)({
|
|
14857
14968
|
isAuthenticated: false,
|
|
14858
14969
|
isLoading: true,
|
|
14859
14970
|
...initialAuthState
|
|
14860
14971
|
});
|
|
14861
|
-
const checkAuth = (0,
|
|
14972
|
+
const checkAuth = (0, import_react45.useCallback)(async () => {
|
|
14862
14973
|
try {
|
|
14863
14974
|
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
14864
14975
|
if (!checkAuthFn) {
|
|
@@ -14889,7 +15000,7 @@ var AuthProvider = ({
|
|
|
14889
15000
|
return false;
|
|
14890
15001
|
}
|
|
14891
15002
|
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
14892
|
-
const signOut = (0,
|
|
15003
|
+
const signOut = (0, import_react45.useCallback)(() => {
|
|
14893
15004
|
if (signOutFn) {
|
|
14894
15005
|
signOutFn();
|
|
14895
15006
|
}
|
|
@@ -14901,10 +15012,10 @@ var AuthProvider = ({
|
|
|
14901
15012
|
tokens: void 0
|
|
14902
15013
|
}));
|
|
14903
15014
|
}, [signOutFn]);
|
|
14904
|
-
(0,
|
|
15015
|
+
(0, import_react45.useEffect)(() => {
|
|
14905
15016
|
checkAuth();
|
|
14906
15017
|
}, [checkAuth]);
|
|
14907
|
-
const contextValue = (0,
|
|
15018
|
+
const contextValue = (0, import_react45.useMemo)(
|
|
14908
15019
|
() => ({
|
|
14909
15020
|
...authState,
|
|
14910
15021
|
checkAuth,
|
|
@@ -14915,7 +15026,7 @@ var AuthProvider = ({
|
|
|
14915
15026
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AuthContext.Provider, { value: contextValue, children });
|
|
14916
15027
|
};
|
|
14917
15028
|
var useAuth = () => {
|
|
14918
|
-
const context = (0,
|
|
15029
|
+
const context = (0, import_react45.useContext)(AuthContext);
|
|
14919
15030
|
if (context === void 0) {
|
|
14920
15031
|
throw new Error("useAuth deve ser usado dentro de um AuthProvider");
|
|
14921
15032
|
}
|
|
@@ -15055,7 +15166,7 @@ function createZustandAuthAdapter(useAuthStore2) {
|
|
|
15055
15166
|
}
|
|
15056
15167
|
|
|
15057
15168
|
// src/components/Auth/useUrlAuthentication.ts
|
|
15058
|
-
var
|
|
15169
|
+
var import_react46 = require("react");
|
|
15059
15170
|
var import_react_router_dom2 = require("react-router-dom");
|
|
15060
15171
|
var getAuthParams = (location, extractParams) => {
|
|
15061
15172
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -15103,8 +15214,8 @@ var handleUserData = (responseData, setUser) => {
|
|
|
15103
15214
|
};
|
|
15104
15215
|
function useUrlAuthentication(options) {
|
|
15105
15216
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
15106
|
-
const processedRef = (0,
|
|
15107
|
-
(0,
|
|
15217
|
+
const processedRef = (0, import_react46.useRef)(false);
|
|
15218
|
+
(0, import_react46.useEffect)(() => {
|
|
15108
15219
|
const handleAuthentication = async () => {
|
|
15109
15220
|
if (processedRef.current) {
|
|
15110
15221
|
return;
|
|
@@ -15175,9 +15286,9 @@ function useUrlAuthentication(options) {
|
|
|
15175
15286
|
}
|
|
15176
15287
|
|
|
15177
15288
|
// src/components/Auth/useApiConfig.ts
|
|
15178
|
-
var
|
|
15289
|
+
var import_react47 = require("react");
|
|
15179
15290
|
function useApiConfig(api) {
|
|
15180
|
-
return (0,
|
|
15291
|
+
return (0, import_react47.useMemo)(
|
|
15181
15292
|
() => ({
|
|
15182
15293
|
get: (endpoint, config) => api.get(endpoint, config)
|
|
15183
15294
|
}),
|
|
@@ -15187,13 +15298,13 @@ function useApiConfig(api) {
|
|
|
15187
15298
|
|
|
15188
15299
|
// src/components/Quiz/Quiz.tsx
|
|
15189
15300
|
var import_phosphor_react35 = require("phosphor-react");
|
|
15190
|
-
var
|
|
15301
|
+
var import_react50 = require("react");
|
|
15191
15302
|
|
|
15192
15303
|
// src/components/Quiz/QuizContent.tsx
|
|
15193
|
-
var
|
|
15304
|
+
var import_react49 = require("react");
|
|
15194
15305
|
|
|
15195
15306
|
// src/components/MultipleChoice/MultipleChoice.tsx
|
|
15196
|
-
var
|
|
15307
|
+
var import_react48 = require("react");
|
|
15197
15308
|
var import_phosphor_react33 = require("phosphor-react");
|
|
15198
15309
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
15199
15310
|
var MultipleChoiceList = ({
|
|
@@ -15205,8 +15316,8 @@ var MultipleChoiceList = ({
|
|
|
15205
15316
|
onHandleSelectedValues,
|
|
15206
15317
|
mode = "interactive"
|
|
15207
15318
|
}) => {
|
|
15208
|
-
const [actualValue, setActualValue] = (0,
|
|
15209
|
-
(0,
|
|
15319
|
+
const [actualValue, setActualValue] = (0, import_react48.useState)(selectedValues);
|
|
15320
|
+
(0, import_react48.useEffect)(() => {
|
|
15210
15321
|
setActualValue(selectedValues);
|
|
15211
15322
|
}, [selectedValues]);
|
|
15212
15323
|
const getStatusBadge2 = (status) => {
|
|
@@ -15351,12 +15462,12 @@ var getStatusStyles = (variantCorrect) => {
|
|
|
15351
15462
|
return "bg-error-background border-error-300";
|
|
15352
15463
|
}
|
|
15353
15464
|
};
|
|
15354
|
-
var QuizSubTitle = (0,
|
|
15465
|
+
var QuizSubTitle = (0, import_react49.forwardRef)(
|
|
15355
15466
|
({ subTitle, ...props }, ref) => {
|
|
15356
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 }) });
|
|
15357
15468
|
}
|
|
15358
15469
|
);
|
|
15359
|
-
var QuizContainer = (0,
|
|
15470
|
+
var QuizContainer = (0, import_react49.forwardRef)(({ children, className, ...props }, ref) => {
|
|
15360
15471
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
15361
15472
|
"div",
|
|
15362
15473
|
{
|
|
@@ -15445,15 +15556,15 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
15445
15556
|
const currentQuestionResult = getQuestionResultByQuestionId(
|
|
15446
15557
|
currentQuestion?.id || ""
|
|
15447
15558
|
);
|
|
15448
|
-
const prevSelectedValuesRef = (0,
|
|
15449
|
-
const prevQuestionIdRef = (0,
|
|
15450
|
-
const allCurrentAnswerIds = (0,
|
|
15559
|
+
const prevSelectedValuesRef = (0, import_react49.useRef)([]);
|
|
15560
|
+
const prevQuestionIdRef = (0, import_react49.useRef)("");
|
|
15561
|
+
const allCurrentAnswerIds = (0, import_react49.useMemo)(() => {
|
|
15451
15562
|
return allCurrentAnswers?.map((answer) => answer.optionId) || [];
|
|
15452
15563
|
}, [allCurrentAnswers]);
|
|
15453
|
-
const selectedValues = (0,
|
|
15564
|
+
const selectedValues = (0, import_react49.useMemo)(() => {
|
|
15454
15565
|
return allCurrentAnswerIds?.filter((id) => id !== null) || [];
|
|
15455
15566
|
}, [allCurrentAnswerIds]);
|
|
15456
|
-
const stableSelectedValues = (0,
|
|
15567
|
+
const stableSelectedValues = (0, import_react49.useMemo)(() => {
|
|
15457
15568
|
const currentQuestionId = currentQuestion?.id || "";
|
|
15458
15569
|
const hasQuestionChanged = prevQuestionIdRef.current !== currentQuestionId;
|
|
15459
15570
|
if (hasQuestionChanged) {
|
|
@@ -15477,7 +15588,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
15477
15588
|
variant,
|
|
15478
15589
|
currentQuestionResult?.selectedOptions
|
|
15479
15590
|
]);
|
|
15480
|
-
const handleSelectedValues = (0,
|
|
15591
|
+
const handleSelectedValues = (0, import_react49.useCallback)(
|
|
15481
15592
|
(values) => {
|
|
15482
15593
|
if (currentQuestion) {
|
|
15483
15594
|
selectMultipleAnswer(currentQuestion.id, values);
|
|
@@ -15485,7 +15596,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
15485
15596
|
},
|
|
15486
15597
|
[currentQuestion, selectMultipleAnswer]
|
|
15487
15598
|
);
|
|
15488
|
-
const questionKey = (0,
|
|
15599
|
+
const questionKey = (0, import_react49.useMemo)(
|
|
15489
15600
|
() => `question-${currentQuestion?.id || "1"}`,
|
|
15490
15601
|
[currentQuestion?.id]
|
|
15491
15602
|
);
|
|
@@ -15546,14 +15657,14 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
15546
15657
|
currentQuestion?.id || ""
|
|
15547
15658
|
);
|
|
15548
15659
|
const currentAnswer = getCurrentAnswer();
|
|
15549
|
-
const textareaRef = (0,
|
|
15660
|
+
const textareaRef = (0, import_react49.useRef)(null);
|
|
15550
15661
|
const charLimit = getDissertativeCharLimit();
|
|
15551
15662
|
const handleAnswerChange = (value) => {
|
|
15552
15663
|
if (currentQuestion) {
|
|
15553
15664
|
selectDissertativeAnswer(currentQuestion.id, value);
|
|
15554
15665
|
}
|
|
15555
15666
|
};
|
|
15556
|
-
const adjustTextareaHeight = (0,
|
|
15667
|
+
const adjustTextareaHeight = (0, import_react49.useCallback)(() => {
|
|
15557
15668
|
if (textareaRef.current) {
|
|
15558
15669
|
textareaRef.current.style.height = "auto";
|
|
15559
15670
|
const scrollHeight = textareaRef.current.scrollHeight;
|
|
@@ -15563,7 +15674,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
15563
15674
|
textareaRef.current.style.height = `${newHeight}px`;
|
|
15564
15675
|
}
|
|
15565
15676
|
}, []);
|
|
15566
|
-
(0,
|
|
15677
|
+
(0, import_react49.useEffect)(() => {
|
|
15567
15678
|
adjustTextareaHeight();
|
|
15568
15679
|
}, [currentAnswer, adjustTextareaHeight]);
|
|
15569
15680
|
if (!currentQuestion) {
|
|
@@ -15704,7 +15815,7 @@ var QuizConnectDots = ({ paddingBottom }) => {
|
|
|
15704
15815
|
isCorrect: false
|
|
15705
15816
|
}
|
|
15706
15817
|
];
|
|
15707
|
-
const [userAnswers, setUserAnswers] = (0,
|
|
15818
|
+
const [userAnswers, setUserAnswers] = (0, import_react49.useState)(() => {
|
|
15708
15819
|
if (variant === "result") {
|
|
15709
15820
|
return mockUserAnswers;
|
|
15710
15821
|
}
|
|
@@ -15823,8 +15934,8 @@ var QuizFill = ({ paddingBottom }) => {
|
|
|
15823
15934
|
isCorrect: true
|
|
15824
15935
|
}
|
|
15825
15936
|
];
|
|
15826
|
-
const [answers, setAnswers] = (0,
|
|
15827
|
-
const baseId = (0,
|
|
15937
|
+
const [answers, setAnswers] = (0, import_react49.useState)({});
|
|
15938
|
+
const baseId = (0, import_react49.useId)();
|
|
15828
15939
|
const getAvailableOptionsForSelect = (selectId) => {
|
|
15829
15940
|
const usedOptions = new Set(
|
|
15830
15941
|
Object.entries(answers).filter(([key]) => key !== selectId).map(([, value]) => value)
|
|
@@ -15963,7 +16074,7 @@ var QuizImageQuestion = ({ paddingBottom }) => {
|
|
|
15963
16074
|
};
|
|
15964
16075
|
const correctRadiusRelative = calculateCorrectRadiusRelative();
|
|
15965
16076
|
const mockUserAnswerRelative = { x: 0.72, y: 0.348 };
|
|
15966
|
-
const [clickPositionRelative, setClickPositionRelative] = (0,
|
|
16077
|
+
const [clickPositionRelative, setClickPositionRelative] = (0, import_react49.useState)(variant == "result" ? mockUserAnswerRelative : null);
|
|
15967
16078
|
const convertToRelativeCoordinates = (x, y, rect) => {
|
|
15968
16079
|
const safeWidth = Math.max(rect.width, 1e-3);
|
|
15969
16080
|
const safeHeight = Math.max(rect.height, 1e-3);
|
|
@@ -16129,14 +16240,14 @@ var getFinishConfirmationText = (type) => {
|
|
|
16129
16240
|
const config = getQuizTypeConfig(type);
|
|
16130
16241
|
return `Tem certeza que deseja finalizar ${config.article} ${config.label.toLowerCase()}?`;
|
|
16131
16242
|
};
|
|
16132
|
-
var Quiz = (0,
|
|
16243
|
+
var Quiz = (0, import_react50.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
|
|
16133
16244
|
const { setVariant } = useQuizStore();
|
|
16134
|
-
(0,
|
|
16245
|
+
(0, import_react50.useEffect)(() => {
|
|
16135
16246
|
setVariant(variant);
|
|
16136
16247
|
}, [variant, setVariant]);
|
|
16137
16248
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
16138
16249
|
});
|
|
16139
|
-
var QuizTitle = (0,
|
|
16250
|
+
var QuizTitle = (0, import_react50.forwardRef)(({ className, onBack, ...props }, ref) => {
|
|
16140
16251
|
const {
|
|
16141
16252
|
quiz,
|
|
16142
16253
|
currentQuestionIndex,
|
|
@@ -16146,7 +16257,7 @@ var QuizTitle = (0, import_react49.forwardRef)(({ className, onBack, ...props },
|
|
|
16146
16257
|
formatTime: formatTime2,
|
|
16147
16258
|
isStarted
|
|
16148
16259
|
} = useQuizStore();
|
|
16149
|
-
const [showExitConfirmation, setShowExitConfirmation] = (0,
|
|
16260
|
+
const [showExitConfirmation, setShowExitConfirmation] = (0, import_react50.useState)(false);
|
|
16150
16261
|
const totalQuestions = getTotalQuestions();
|
|
16151
16262
|
const quizTitle = getQuizTitle();
|
|
16152
16263
|
const handleBackClick = () => {
|
|
@@ -16315,7 +16426,7 @@ var QuizQuestionList = ({
|
|
|
16315
16426
|
)
|
|
16316
16427
|
] });
|
|
16317
16428
|
};
|
|
16318
|
-
var QuizFooter = (0,
|
|
16429
|
+
var QuizFooter = (0, import_react50.forwardRef)(
|
|
16319
16430
|
({
|
|
16320
16431
|
className,
|
|
16321
16432
|
onGoToSimulated,
|
|
@@ -16349,8 +16460,8 @@ var QuizFooter = (0, import_react49.forwardRef)(
|
|
|
16349
16460
|
const currentAnswer = getCurrentAnswer();
|
|
16350
16461
|
const currentQuestion = getCurrentQuestion();
|
|
16351
16462
|
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
16352
|
-
const [activeModal, setActiveModal] = (0,
|
|
16353
|
-
const [filterType, setFilterType] = (0,
|
|
16463
|
+
const [activeModal, setActiveModal] = (0, import_react50.useState)(null);
|
|
16464
|
+
const [filterType, setFilterType] = (0, import_react50.useState)("all");
|
|
16354
16465
|
const openModal = (modalName) => setActiveModal(modalName);
|
|
16355
16466
|
const closeModal = () => setActiveModal(null);
|
|
16356
16467
|
const isModalOpen = (modalName) => activeModal === modalName;
|
|
@@ -16692,7 +16803,7 @@ var QuizFooter = (0, import_react49.forwardRef)(
|
|
|
16692
16803
|
);
|
|
16693
16804
|
|
|
16694
16805
|
// src/components/Quiz/QuizResult.tsx
|
|
16695
|
-
var
|
|
16806
|
+
var import_react51 = require("react");
|
|
16696
16807
|
var import_phosphor_react36 = require("phosphor-react");
|
|
16697
16808
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
16698
16809
|
var QuizBadge = ({
|
|
@@ -16714,15 +16825,15 @@ var QuizBadge = ({
|
|
|
16714
16825
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
|
|
16715
16826
|
}
|
|
16716
16827
|
};
|
|
16717
|
-
var QuizHeaderResult = (0,
|
|
16828
|
+
var QuizHeaderResult = (0, import_react51.forwardRef)(
|
|
16718
16829
|
({ className, ...props }, ref) => {
|
|
16719
16830
|
const {
|
|
16720
16831
|
getQuestionResultByQuestionId,
|
|
16721
16832
|
getCurrentQuestion,
|
|
16722
16833
|
questionsResult
|
|
16723
16834
|
} = useQuizStore();
|
|
16724
|
-
const [status, setStatus] = (0,
|
|
16725
|
-
(0,
|
|
16835
|
+
const [status, setStatus] = (0, import_react51.useState)(void 0);
|
|
16836
|
+
(0, import_react51.useEffect)(() => {
|
|
16726
16837
|
const cq = getCurrentQuestion();
|
|
16727
16838
|
if (!cq) {
|
|
16728
16839
|
setStatus(void 0);
|
|
@@ -16786,7 +16897,7 @@ var QuizHeaderResult = (0, import_react50.forwardRef)(
|
|
|
16786
16897
|
);
|
|
16787
16898
|
}
|
|
16788
16899
|
);
|
|
16789
|
-
var QuizResultHeaderTitle = (0,
|
|
16900
|
+
var QuizResultHeaderTitle = (0, import_react51.forwardRef)(({ className, showBadge = true, onRepeat, canRetry, ...props }, ref) => {
|
|
16790
16901
|
const { quiz } = useQuizStore();
|
|
16791
16902
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
16792
16903
|
"div",
|
|
@@ -16816,7 +16927,7 @@ var QuizResultHeaderTitle = (0, import_react50.forwardRef)(({ className, showBad
|
|
|
16816
16927
|
}
|
|
16817
16928
|
);
|
|
16818
16929
|
});
|
|
16819
|
-
var QuizResultTitle = (0,
|
|
16930
|
+
var QuizResultTitle = (0, import_react51.forwardRef)(({ className, ...props }, ref) => {
|
|
16820
16931
|
const { getQuizTitle } = useQuizStore();
|
|
16821
16932
|
const quizTitle = getQuizTitle();
|
|
16822
16933
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
@@ -16860,7 +16971,7 @@ var calculateAnswerStatistics = (answers) => {
|
|
|
16860
16971
|
}
|
|
16861
16972
|
return stats;
|
|
16862
16973
|
};
|
|
16863
|
-
var QuizResultPerformance = (0,
|
|
16974
|
+
var QuizResultPerformance = (0, import_react51.forwardRef)(({ showDetails = true, ...props }, ref) => {
|
|
16864
16975
|
const {
|
|
16865
16976
|
getTotalQuestions,
|
|
16866
16977
|
formatTime: formatTime2,
|
|
@@ -16965,7 +17076,7 @@ var QuizResultPerformance = (0, import_react50.forwardRef)(({ showDetails = true
|
|
|
16965
17076
|
}
|
|
16966
17077
|
);
|
|
16967
17078
|
});
|
|
16968
|
-
var QuizListResult = (0,
|
|
17079
|
+
var QuizListResult = (0, import_react51.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
|
|
16969
17080
|
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
16970
17081
|
const { isDark } = useTheme();
|
|
16971
17082
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
@@ -17095,7 +17206,7 @@ var BreadcrumbMenu = ({
|
|
|
17095
17206
|
};
|
|
17096
17207
|
|
|
17097
17208
|
// src/components/BreadcrumbMenu/useBreadcrumbBuilder.ts
|
|
17098
|
-
var
|
|
17209
|
+
var import_react52 = require("react");
|
|
17099
17210
|
|
|
17100
17211
|
// src/components/BreadcrumbMenu/breadcrumbStore.ts
|
|
17101
17212
|
var import_zustand12 = require("zustand");
|
|
@@ -17224,7 +17335,7 @@ var useBreadcrumbBuilder = (config) => {
|
|
|
17224
17335
|
(level) => isBreadcrumbWithData(level) ? level.data : null
|
|
17225
17336
|
);
|
|
17226
17337
|
const levelUrlIds = levels.map((level) => level.urlId);
|
|
17227
|
-
(0,
|
|
17338
|
+
(0, import_react52.useEffect)(() => {
|
|
17228
17339
|
const newBreadcrumbs = [root];
|
|
17229
17340
|
const previousIds = [];
|
|
17230
17341
|
for (const level of levels) {
|
|
@@ -17256,11 +17367,11 @@ var useBreadcrumbBuilder = (config) => {
|
|
|
17256
17367
|
};
|
|
17257
17368
|
|
|
17258
17369
|
// src/components/BreadcrumbMenu/useUrlParams.ts
|
|
17259
|
-
var
|
|
17370
|
+
var import_react53 = require("react");
|
|
17260
17371
|
var import_react_router_dom4 = require("react-router-dom");
|
|
17261
17372
|
var useUrlParams = (config) => {
|
|
17262
17373
|
const location = (0, import_react_router_dom4.useLocation)();
|
|
17263
|
-
return (0,
|
|
17374
|
+
return (0, import_react53.useMemo)(() => {
|
|
17264
17375
|
const segments = location.pathname.split("/").filter(Boolean);
|
|
17265
17376
|
const params = {};
|
|
17266
17377
|
for (const [key, index] of Object.entries(config)) {
|
|
@@ -17271,15 +17382,15 @@ var useUrlParams = (config) => {
|
|
|
17271
17382
|
};
|
|
17272
17383
|
|
|
17273
17384
|
// src/hooks/useAppInitialization.ts
|
|
17274
|
-
var
|
|
17385
|
+
var import_react55 = require("react");
|
|
17275
17386
|
|
|
17276
17387
|
// src/hooks/useInstitution.ts
|
|
17277
|
-
var
|
|
17388
|
+
var import_react54 = require("react");
|
|
17278
17389
|
function useInstitutionId() {
|
|
17279
|
-
const [institutionId, setInstitutionId] = (0,
|
|
17390
|
+
const [institutionId, setInstitutionId] = (0, import_react54.useState)(() => {
|
|
17280
17391
|
return document.querySelector('meta[name="institution-id"]')?.getAttribute("content") ?? null;
|
|
17281
17392
|
});
|
|
17282
|
-
(0,
|
|
17393
|
+
(0, import_react54.useEffect)(() => {
|
|
17283
17394
|
const metaTag = document.querySelector('meta[name="institution-id"]');
|
|
17284
17395
|
if (!metaTag) return;
|
|
17285
17396
|
const observer = new MutationObserver(() => {
|
|
@@ -17446,7 +17557,7 @@ var useAuthStore = (0, import_zustand14.create)()(
|
|
|
17446
17557
|
function useAppInitialization() {
|
|
17447
17558
|
const getInstitutionId = useInstitutionId();
|
|
17448
17559
|
const { initialize, initialized, institutionId } = useAppStore();
|
|
17449
|
-
const authFunctions = (0,
|
|
17560
|
+
const authFunctions = (0, import_react55.useMemo)(
|
|
17450
17561
|
() => ({
|
|
17451
17562
|
checkAuth: async () => {
|
|
17452
17563
|
const { sessionInfo, tokens } = useAuthStore.getState();
|
|
@@ -17483,7 +17594,7 @@ function useAppInitialization() {
|
|
|
17483
17594
|
}
|
|
17484
17595
|
|
|
17485
17596
|
// src/hooks/useAppContent.ts
|
|
17486
|
-
var
|
|
17597
|
+
var import_react56 = require("react");
|
|
17487
17598
|
var import_react_router_dom5 = require("react-router-dom");
|
|
17488
17599
|
function useAppContent(config) {
|
|
17489
17600
|
const navigate = (0, import_react_router_dom5.useNavigate)();
|
|
@@ -17509,20 +17620,20 @@ function useAppContent(config) {
|
|
|
17509
17620
|
navigate("/painel");
|
|
17510
17621
|
}
|
|
17511
17622
|
};
|
|
17512
|
-
const handleSetSelectedProfile = (0,
|
|
17623
|
+
const handleSetSelectedProfile = (0, import_react56.useCallback)(
|
|
17513
17624
|
(profile) => {
|
|
17514
17625
|
setSelectedProfile(profile);
|
|
17515
17626
|
},
|
|
17516
17627
|
[setSelectedProfile]
|
|
17517
17628
|
);
|
|
17518
|
-
const handleClearParamsFromURL = (0,
|
|
17629
|
+
const handleClearParamsFromURL = (0, import_react56.useCallback)(() => {
|
|
17519
17630
|
if (onClearParamsFromURL) {
|
|
17520
17631
|
onClearParamsFromURL();
|
|
17521
17632
|
} else {
|
|
17522
17633
|
globalThis.location.replace("/painel");
|
|
17523
17634
|
}
|
|
17524
17635
|
}, [onClearParamsFromURL]);
|
|
17525
|
-
const handleError = (0,
|
|
17636
|
+
const handleError = (0, import_react56.useCallback)(
|
|
17526
17637
|
(error) => {
|
|
17527
17638
|
if (onError) {
|
|
17528
17639
|
onError(error);
|
|
@@ -17533,7 +17644,7 @@ function useAppContent(config) {
|
|
|
17533
17644
|
},
|
|
17534
17645
|
[navigate, onError]
|
|
17535
17646
|
);
|
|
17536
|
-
const urlAuthConfig = (0,
|
|
17647
|
+
const urlAuthConfig = (0, import_react56.useMemo)(
|
|
17537
17648
|
() => ({
|
|
17538
17649
|
setTokens,
|
|
17539
17650
|
setSessionInfo,
|
|
@@ -17559,10 +17670,10 @@ function useAppContent(config) {
|
|
|
17559
17670
|
);
|
|
17560
17671
|
useUrlAuthentication(urlAuthConfig);
|
|
17561
17672
|
const { sessionInfo } = useAuth();
|
|
17562
|
-
const institutionIdToUse = (0,
|
|
17673
|
+
const institutionIdToUse = (0, import_react56.useMemo)(() => {
|
|
17563
17674
|
return sessionInfo?.institutionId || getInstitutionId;
|
|
17564
17675
|
}, [sessionInfo?.institutionId, getInstitutionId]);
|
|
17565
|
-
(0,
|
|
17676
|
+
(0, import_react56.useEffect)(() => {
|
|
17566
17677
|
if (institutionIdToUse && !initialized) {
|
|
17567
17678
|
initialize(institutionIdToUse);
|
|
17568
17679
|
}
|
|
@@ -17597,7 +17708,7 @@ var useQuestionFiltersStore = (0, import_zustand15.create)((set) => ({
|
|
|
17597
17708
|
|
|
17598
17709
|
// src/components/ActivityCardQuestionBanks/ActivityCardQuestionBanks.tsx
|
|
17599
17710
|
var import_phosphor_react37 = require("phosphor-react");
|
|
17600
|
-
var
|
|
17711
|
+
var import_react57 = require("react");
|
|
17601
17712
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
17602
17713
|
var ActivityCardQuestionBanks = ({
|
|
17603
17714
|
question,
|
|
@@ -17609,7 +17720,7 @@ var ActivityCardQuestionBanks = ({
|
|
|
17609
17720
|
assunto,
|
|
17610
17721
|
enunciado
|
|
17611
17722
|
} = {}) => {
|
|
17612
|
-
const alternatives = (0,
|
|
17723
|
+
const alternatives = (0, import_react57.useMemo)(() => {
|
|
17613
17724
|
if (!question?.options || questionType !== "ALTERNATIVA" /* ALTERNATIVA */)
|
|
17614
17725
|
return [];
|
|
17615
17726
|
const correctOptionIds2 = question.correctOptionIds || [];
|
|
@@ -17623,13 +17734,13 @@ var ActivityCardQuestionBanks = ({
|
|
|
17623
17734
|
};
|
|
17624
17735
|
});
|
|
17625
17736
|
}, [question, questionType]);
|
|
17626
|
-
const correctOptionId = (0,
|
|
17737
|
+
const correctOptionId = (0, import_react57.useMemo)(() => {
|
|
17627
17738
|
if (!question?.correctOptionIds || question.correctOptionIds.length === 0) {
|
|
17628
17739
|
return void 0;
|
|
17629
17740
|
}
|
|
17630
17741
|
return question.correctOptionIds[0];
|
|
17631
17742
|
}, [question]);
|
|
17632
|
-
const multipleChoices = (0,
|
|
17743
|
+
const multipleChoices = (0, import_react57.useMemo)(() => {
|
|
17633
17744
|
if (!question?.options || questionType !== "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */)
|
|
17634
17745
|
return [];
|
|
17635
17746
|
const correctOptionIds2 = question.correctOptionIds || [];
|
|
@@ -17643,7 +17754,7 @@ var ActivityCardQuestionBanks = ({
|
|
|
17643
17754
|
};
|
|
17644
17755
|
});
|
|
17645
17756
|
}, [question, questionType]);
|
|
17646
|
-
const correctOptionIds = (0,
|
|
17757
|
+
const correctOptionIds = (0, import_react57.useMemo)(() => {
|
|
17647
17758
|
return question?.correctOptionIds || [];
|
|
17648
17759
|
}, [question]);
|
|
17649
17760
|
const getStatusBadge2 = (status) => {
|
|
@@ -17826,7 +17937,7 @@ var formatDateToBrazilian = (dateString) => {
|
|
|
17826
17937
|
};
|
|
17827
17938
|
|
|
17828
17939
|
// src/components/ActivityDetails/ActivityDetails.tsx
|
|
17829
|
-
var
|
|
17940
|
+
var import_react58 = require("react");
|
|
17830
17941
|
var import_phosphor_react38 = require("phosphor-react");
|
|
17831
17942
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
17832
17943
|
var createTableColumns = (onCorrectActivity) => [
|
|
@@ -17924,20 +18035,20 @@ var ActivityDetails = ({
|
|
|
17924
18035
|
mapSubjectNameToEnum
|
|
17925
18036
|
}) => {
|
|
17926
18037
|
const { isMobile } = useMobile();
|
|
17927
|
-
const [page, setPage] = (0,
|
|
17928
|
-
const [limit, setLimit] = (0,
|
|
17929
|
-
const [sortBy, setSortBy] = (0,
|
|
17930
|
-
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)(
|
|
17931
18042
|
void 0
|
|
17932
18043
|
);
|
|
17933
|
-
const [data, setData] = (0,
|
|
17934
|
-
const [correctionData, setCorrectionData] = (0,
|
|
17935
|
-
const [loading, setLoading] = (0,
|
|
17936
|
-
const [error, setError] = (0,
|
|
17937
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
17938
|
-
const [isViewOnlyModal, setIsViewOnlyModal] = (0,
|
|
17939
|
-
const [correctionError, setCorrectionError] = (0,
|
|
17940
|
-
(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)(() => {
|
|
17941
18052
|
const loadData = async () => {
|
|
17942
18053
|
if (!activityId) return;
|
|
17943
18054
|
setLoading(true);
|
|
@@ -17960,7 +18071,7 @@ var ActivityDetails = ({
|
|
|
17960
18071
|
};
|
|
17961
18072
|
loadData();
|
|
17962
18073
|
}, [activityId, page, limit, sortBy, sortOrder, fetchActivityDetails]);
|
|
17963
|
-
const handleCorrectActivity = (0,
|
|
18074
|
+
const handleCorrectActivity = (0, import_react58.useCallback)(
|
|
17964
18075
|
async (studentId) => {
|
|
17965
18076
|
const student = data?.students.find((s) => s.studentId === studentId);
|
|
17966
18077
|
if (!student || !activityId) return;
|
|
@@ -17980,10 +18091,10 @@ var ActivityDetails = ({
|
|
|
17980
18091
|
},
|
|
17981
18092
|
[data?.students, activityId, fetchStudentCorrection]
|
|
17982
18093
|
);
|
|
17983
|
-
const handleCloseModal = (0,
|
|
18094
|
+
const handleCloseModal = (0, import_react58.useCallback)(() => {
|
|
17984
18095
|
setIsModalOpen(false);
|
|
17985
18096
|
}, []);
|
|
17986
|
-
const handleObservationSubmit = (0,
|
|
18097
|
+
const handleObservationSubmit = (0, import_react58.useCallback)(
|
|
17987
18098
|
async (observation, files) => {
|
|
17988
18099
|
if (!activityId || !correctionData?.studentId) return;
|
|
17989
18100
|
try {
|
|
@@ -18000,7 +18111,7 @@ var ActivityDetails = ({
|
|
|
18000
18111
|
},
|
|
18001
18112
|
[activityId, correctionData?.studentId, submitObservation]
|
|
18002
18113
|
);
|
|
18003
|
-
const tableData = (0,
|
|
18114
|
+
const tableData = (0, import_react58.useMemo)(() => {
|
|
18004
18115
|
if (!data?.students) return [];
|
|
18005
18116
|
return data.students.map((student) => ({
|
|
18006
18117
|
id: student.studentId,
|
|
@@ -18012,7 +18123,7 @@ var ActivityDetails = ({
|
|
|
18012
18123
|
score: student.score
|
|
18013
18124
|
}));
|
|
18014
18125
|
}, [data?.students]);
|
|
18015
|
-
const columns = (0,
|
|
18126
|
+
const columns = (0, import_react58.useMemo)(
|
|
18016
18127
|
() => createTableColumns(handleCorrectActivity),
|
|
18017
18128
|
[handleCorrectActivity]
|
|
18018
18129
|
);
|
|
@@ -18269,10 +18380,10 @@ var ActivityDetails = ({
|
|
|
18269
18380
|
};
|
|
18270
18381
|
|
|
18271
18382
|
// src/components/Support/Support.tsx
|
|
18272
|
-
var
|
|
18383
|
+
var import_react61 = require("react");
|
|
18273
18384
|
var import_react_hook_form = require("react-hook-form");
|
|
18274
18385
|
var import_zod2 = require("@hookform/resolvers/zod");
|
|
18275
|
-
var
|
|
18386
|
+
var import_react62 = require("@phosphor-icons/react");
|
|
18276
18387
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
18277
18388
|
|
|
18278
18389
|
// src/components/Support/schema/index.ts
|
|
@@ -18295,7 +18406,7 @@ var supportSchema = import_zod.z.object({
|
|
|
18295
18406
|
});
|
|
18296
18407
|
|
|
18297
18408
|
// src/components/Support/components/TicketModal.tsx
|
|
18298
|
-
var
|
|
18409
|
+
var import_react60 = require("react");
|
|
18299
18410
|
var import_dayjs = __toESM(require("dayjs"));
|
|
18300
18411
|
var import_pt_br = require("dayjs/locale/pt-br");
|
|
18301
18412
|
|
|
@@ -18375,19 +18486,19 @@ var mapInternalStatusToApi = (internalStatus) => {
|
|
|
18375
18486
|
};
|
|
18376
18487
|
|
|
18377
18488
|
// src/components/Support/utils/supportUtils.tsx
|
|
18378
|
-
var
|
|
18489
|
+
var import_react59 = require("@phosphor-icons/react");
|
|
18379
18490
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
18380
18491
|
var getCategoryIcon = (category, size = 16) => {
|
|
18381
18492
|
if (!category) return null;
|
|
18382
18493
|
switch (category) {
|
|
18383
18494
|
case "acesso" /* ACESSO */:
|
|
18384
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.KeyIcon, { size });
|
|
18385
18496
|
case "tecnico" /* TECNICO */:
|
|
18386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.BugIcon, { size });
|
|
18387
18498
|
case "outros" /* OUTROS */:
|
|
18388
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.InfoIcon, { size });
|
|
18389
18500
|
default:
|
|
18390
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react59.InfoIcon, { size });
|
|
18391
18502
|
}
|
|
18392
18503
|
};
|
|
18393
18504
|
|
|
@@ -18417,17 +18528,17 @@ var TicketModal = ({
|
|
|
18417
18528
|
apiClient,
|
|
18418
18529
|
userId
|
|
18419
18530
|
}) => {
|
|
18420
|
-
const [showCloseConfirmation, setShowCloseConfirmation] = (0,
|
|
18421
|
-
const [responseText, setResponseText] = (0,
|
|
18422
|
-
const [answers, setAnswers] = (0,
|
|
18423
|
-
const [isSubmittingAnswer, setIsSubmittingAnswer] = (0,
|
|
18424
|
-
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);
|
|
18425
18536
|
const handleCloseTicket = () => {
|
|
18426
18537
|
onTicketClose?.(ticket.id);
|
|
18427
18538
|
setShowCloseConfirmation(false);
|
|
18428
18539
|
onClose();
|
|
18429
18540
|
};
|
|
18430
|
-
const fetchAnswers = (0,
|
|
18541
|
+
const fetchAnswers = (0, import_react60.useCallback)(async () => {
|
|
18431
18542
|
if (!ticket.id || ticket.status !== "respondido" /* RESPONDIDO */) return;
|
|
18432
18543
|
setIsLoadingAnswers(true);
|
|
18433
18544
|
try {
|
|
@@ -18466,7 +18577,7 @@ var TicketModal = ({
|
|
|
18466
18577
|
}
|
|
18467
18578
|
};
|
|
18468
18579
|
const canCloseTicket = ticket.status !== "encerrado" /* ENCERRADO */;
|
|
18469
|
-
(0,
|
|
18580
|
+
(0, import_react60.useEffect)(() => {
|
|
18470
18581
|
if (isOpen) {
|
|
18471
18582
|
setResponseText("");
|
|
18472
18583
|
(async () => {
|
|
@@ -18804,7 +18915,7 @@ var TicketCard = ({
|
|
|
18804
18915
|
getCategoryIcon(ticket.category, 18),
|
|
18805
18916
|
getCategoryText(ticket.category)
|
|
18806
18917
|
] }),
|
|
18807
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
18918
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.CaretRightIcon, { size: 24, className: "text-text-800" })
|
|
18808
18919
|
] })
|
|
18809
18920
|
]
|
|
18810
18921
|
},
|
|
@@ -18849,21 +18960,21 @@ var Support = ({
|
|
|
18849
18960
|
onTicketCreated,
|
|
18850
18961
|
onTicketClosed
|
|
18851
18962
|
}) => {
|
|
18852
|
-
const [activeTab, setActiveTab] = (0,
|
|
18853
|
-
const [selectedProblem, setSelectedProblem] = (0,
|
|
18854
|
-
const [statusFilter, setStatusFilter] = (0,
|
|
18855
|
-
const [categoryFilter, setCategoryFilter] = (0,
|
|
18856
|
-
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)(
|
|
18857
18968
|
null
|
|
18858
18969
|
);
|
|
18859
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
18860
|
-
const [submitError, setSubmitError] = (0,
|
|
18861
|
-
const [showSuccessToast, setShowSuccessToast] = (0,
|
|
18862
|
-
const [showCloseSuccessToast, setShowCloseSuccessToast] = (0,
|
|
18863
|
-
const [showCloseErrorToast, setShowCloseErrorToast] = (0,
|
|
18864
|
-
const [allTickets, setAllTickets] = (0,
|
|
18865
|
-
const [loadingTickets, setLoadingTickets] = (0,
|
|
18866
|
-
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);
|
|
18867
18978
|
const ITEMS_PER_PAGE = 10;
|
|
18868
18979
|
const handlePrevPage = () => {
|
|
18869
18980
|
if (currentPage > 1) {
|
|
@@ -18876,13 +18987,13 @@ var Support = ({
|
|
|
18876
18987
|
setCurrentPage(currentPage + 1);
|
|
18877
18988
|
}
|
|
18878
18989
|
};
|
|
18879
|
-
(0,
|
|
18990
|
+
(0, import_react61.useEffect)(() => {
|
|
18880
18991
|
if (activeTab === "historico") {
|
|
18881
18992
|
fetchTickets(statusFilter);
|
|
18882
18993
|
setCurrentPage(1);
|
|
18883
18994
|
}
|
|
18884
18995
|
}, [activeTab, statusFilter]);
|
|
18885
|
-
(0,
|
|
18996
|
+
(0, import_react61.useEffect)(() => {
|
|
18886
18997
|
setCurrentPage(1);
|
|
18887
18998
|
}, [categoryFilter]);
|
|
18888
18999
|
const convertApiTicketToComponent = (apiTicket) => {
|
|
@@ -19012,17 +19123,17 @@ var Support = ({
|
|
|
19012
19123
|
{
|
|
19013
19124
|
id: "tecnico" /* TECNICO */,
|
|
19014
19125
|
title: "T\xE9cnico",
|
|
19015
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19126
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.BugIcon, { size: 24 })
|
|
19016
19127
|
},
|
|
19017
19128
|
{
|
|
19018
19129
|
id: "acesso" /* ACESSO */,
|
|
19019
19130
|
title: "Acesso",
|
|
19020
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19131
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.KeyIcon, { size: 24 })
|
|
19021
19132
|
},
|
|
19022
19133
|
{
|
|
19023
19134
|
id: "outros" /* OUTROS */,
|
|
19024
19135
|
title: "Outros",
|
|
19025
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19136
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.InfoIcon, { size: 24 })
|
|
19026
19137
|
}
|
|
19027
19138
|
];
|
|
19028
19139
|
const emptyImage = emptyStateImage || suporthistory_default;
|
|
@@ -19142,15 +19253,15 @@ var Support = ({
|
|
|
19142
19253
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectContent, { children: [
|
|
19143
19254
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SelectItem, { value: "todos", children: "Todos" }),
|
|
19144
19255
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectItem, { value: "tecnico" /* TECNICO */, children: [
|
|
19145
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19256
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.BugIcon, { size: 16 }),
|
|
19146
19257
|
" T\xE9cnico"
|
|
19147
19258
|
] }),
|
|
19148
19259
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectItem, { value: "acesso" /* ACESSO */, children: [
|
|
19149
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19260
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.KeyIcon, { size: 16 }),
|
|
19150
19261
|
" Acesso"
|
|
19151
19262
|
] }),
|
|
19152
19263
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(SelectItem, { value: "outros" /* OUTROS */, children: [
|
|
19153
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
19264
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react62.InfoIcon, { size: 16 }),
|
|
19154
19265
|
" Outros"
|
|
19155
19266
|
] })
|
|
19156
19267
|
] })
|
|
@@ -19396,9 +19507,11 @@ var Support_default = Support;
|
|
|
19396
19507
|
createActivityFiltersDataHook,
|
|
19397
19508
|
createNotificationStore,
|
|
19398
19509
|
createNotificationsHook,
|
|
19510
|
+
createQuestionsListHook,
|
|
19399
19511
|
createUseActivityFiltersData,
|
|
19400
19512
|
createUseNotificationStore,
|
|
19401
19513
|
createUseNotifications,
|
|
19514
|
+
createUseQuestionsList,
|
|
19402
19515
|
createZustandAuthAdapter,
|
|
19403
19516
|
formatDateToBrazilian,
|
|
19404
19517
|
formatFileSize,
|