analytica-frontend-lib 1.2.76 → 1.2.77
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/ActivitiesHistory/index.css +3 -0
- package/dist/ActivitiesHistory/index.css.map +1 -1
- package/dist/ActivityCardQuestionBanks/index.css +3 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.css +3 -0
- package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
- package/dist/ActivityDetails/index.css +3 -0
- package/dist/ActivityDetails/index.css.map +1 -1
- package/dist/ActivityDetails/index.d.ts +1 -3
- package/dist/ActivityDetails/index.d.ts.map +1 -1
- package/dist/ActivityDetails/index.js +2227 -691
- package/dist/ActivityDetails/index.js.map +1 -1
- package/dist/ActivityDetails/index.mjs +2212 -668
- package/dist/ActivityDetails/index.mjs.map +1 -1
- package/dist/ActivityFilters/index.css +3 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityFilters/index.d.ts +1 -1
- package/dist/ActivityFilters/index.d.ts.map +1 -1
- package/dist/ActivityFilters/index.js +343 -270
- package/dist/ActivityFilters/index.js.map +1 -1
- package/dist/ActivityFilters/index.mjs +335 -262
- package/dist/ActivityFilters/index.mjs.map +1 -1
- package/dist/ActivityPreview/index.css +3 -0
- package/dist/ActivityPreview/index.css.map +1 -1
- package/dist/AlertManager/index.css +3 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.css +3 -0
- package/dist/RecommendedLessonsHistory/index.css.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.css +3 -0
- package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
- package/dist/SendActivityModal/index.css +3 -0
- package/dist/SendActivityModal/index.css.map +1 -1
- package/dist/TableProvider/index.css +3 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +4160 -3823
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2648 -2305
- package/dist/index.mjs.map +1 -1
- package/dist/store/questionFiltersStore.d.ts +8 -1
- package/dist/store/questionFiltersStore.d.ts.map +1 -1
- package/dist/styles.css +3 -0
- package/dist/styles.css.map +1 -1
- package/dist/types/lessonFilters.d.ts +11 -0
- package/dist/types/lessonFilters.d.ts.map +1 -0
- package/dist/utils/activityFilters.d.ts.map +1 -1
- package/dist/utils/arraysEqual.d.ts +9 -0
- package/dist/utils/arraysEqual.d.ts.map +1 -0
- package/dist/utils/index.js +14 -11
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +14 -11
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/lessonFilters.d.ts +9 -0
- package/dist/utils/lessonFilters.d.ts.map +1 -0
- package/package.json +5 -1
|
@@ -34,12 +34,26 @@ __export(ActivityFilters_exports, {
|
|
|
34
34
|
ActivityFiltersPopover: () => ActivityFiltersPopover
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(ActivityFilters_exports);
|
|
37
|
-
var
|
|
37
|
+
var import_react16 = require("react");
|
|
38
38
|
|
|
39
39
|
// src/utils/utils.ts
|
|
40
40
|
var import_clsx = require("clsx");
|
|
41
41
|
var import_tailwind_merge = require("tailwind-merge");
|
|
42
42
|
|
|
43
|
+
// src/utils/arraysEqual.ts
|
|
44
|
+
function arraysEqual(a, b, comparator) {
|
|
45
|
+
if (a.length !== b.length) return false;
|
|
46
|
+
if (a.length === 0 && b.length === 0) return true;
|
|
47
|
+
if (comparator) {
|
|
48
|
+
const sortedA2 = [...a].sort(comparator);
|
|
49
|
+
const sortedB2 = [...b].sort(comparator);
|
|
50
|
+
return sortedA2.every((val, index) => val === sortedB2[index]);
|
|
51
|
+
}
|
|
52
|
+
const sortedA = [...a].sort((x, y) => String(x).localeCompare(String(y)));
|
|
53
|
+
const sortedB = [...b].sort((x, y) => String(x).localeCompare(String(y)));
|
|
54
|
+
return sortedA.every((val, index) => val === sortedB[index]);
|
|
55
|
+
}
|
|
56
|
+
|
|
43
57
|
// src/utils/activityFilters.ts
|
|
44
58
|
function getSelectedIdsFromCategories(categories, keys) {
|
|
45
59
|
const result = {};
|
|
@@ -55,17 +69,6 @@ function toggleArrayItem(array, item) {
|
|
|
55
69
|
function toggleSingleValue(currentValue, newValue) {
|
|
56
70
|
return currentValue === newValue ? null : newValue;
|
|
57
71
|
}
|
|
58
|
-
function arraysEqual(a, b, comparator) {
|
|
59
|
-
if (a.length !== b.length) return false;
|
|
60
|
-
if (comparator) {
|
|
61
|
-
const sortedA2 = [...a].sort(comparator);
|
|
62
|
-
const sortedB2 = [...b].sort(comparator);
|
|
63
|
-
return sortedA2.every((val, index) => val === sortedB2[index]);
|
|
64
|
-
}
|
|
65
|
-
const sortedA = [...a].sort((x, y) => String(x).localeCompare(String(y)));
|
|
66
|
-
const sortedB = [...b].sort((x, y) => String(x).localeCompare(String(y)));
|
|
67
|
-
return sortedA.every((val, index) => val === sortedB[index]);
|
|
68
|
-
}
|
|
69
72
|
function areFiltersEqual(filters1, filters2) {
|
|
70
73
|
if (filters1 === filters2) return true;
|
|
71
74
|
if (!filters1 || !filters2) return false;
|
|
@@ -5216,8 +5219,269 @@ var createUseActivityFiltersData = (apiClient) => {
|
|
|
5216
5219
|
return (options) => useActivityFiltersDataImpl(apiClient, options);
|
|
5217
5220
|
};
|
|
5218
5221
|
|
|
5219
|
-
// src/
|
|
5222
|
+
// src/store/questionFiltersStore.ts
|
|
5223
|
+
var import_zustand5 = require("zustand");
|
|
5224
|
+
var useQuestionFiltersStore = (0, import_zustand5.create)((set) => ({
|
|
5225
|
+
// Filter states
|
|
5226
|
+
draftFilters: null,
|
|
5227
|
+
appliedFilters: null,
|
|
5228
|
+
setDraftFilters: (filters) => {
|
|
5229
|
+
set({ draftFilters: filters });
|
|
5230
|
+
},
|
|
5231
|
+
applyFilters: () => {
|
|
5232
|
+
set((state) => ({
|
|
5233
|
+
appliedFilters: state.draftFilters
|
|
5234
|
+
}));
|
|
5235
|
+
},
|
|
5236
|
+
clearFilters: () => {
|
|
5237
|
+
set({
|
|
5238
|
+
draftFilters: null,
|
|
5239
|
+
appliedFilters: null,
|
|
5240
|
+
// Clear cached questions when filters are cleared
|
|
5241
|
+
cachedQuestions: [],
|
|
5242
|
+
cachedPagination: null,
|
|
5243
|
+
cachedFilters: null
|
|
5244
|
+
});
|
|
5245
|
+
},
|
|
5246
|
+
// Questions cache state
|
|
5247
|
+
cachedQuestions: [],
|
|
5248
|
+
cachedPagination: null,
|
|
5249
|
+
cachedFilters: null,
|
|
5250
|
+
setCachedQuestions: (questions, pagination, filters) => {
|
|
5251
|
+
set({
|
|
5252
|
+
cachedQuestions: questions,
|
|
5253
|
+
cachedPagination: pagination,
|
|
5254
|
+
cachedFilters: filters
|
|
5255
|
+
});
|
|
5256
|
+
},
|
|
5257
|
+
clearCachedQuestions: () => {
|
|
5258
|
+
set({
|
|
5259
|
+
cachedQuestions: [],
|
|
5260
|
+
cachedPagination: null,
|
|
5261
|
+
cachedFilters: null
|
|
5262
|
+
});
|
|
5263
|
+
}
|
|
5264
|
+
}));
|
|
5265
|
+
|
|
5266
|
+
// src/components/ActivityFilters/components/SubjectsFilter.tsx
|
|
5220
5267
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5268
|
+
var SubjectsFilter = ({
|
|
5269
|
+
knowledgeAreas,
|
|
5270
|
+
selectedSubject,
|
|
5271
|
+
onSubjectChange,
|
|
5272
|
+
loading = false,
|
|
5273
|
+
error = null
|
|
5274
|
+
}) => {
|
|
5275
|
+
const { isDark } = useTheme();
|
|
5276
|
+
if (loading) {
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Carregando mat\xE9rias..." });
|
|
5278
|
+
}
|
|
5279
|
+
if (error) {
|
|
5280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: error });
|
|
5281
|
+
}
|
|
5282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-3 gap-3", children: knowledgeAreas.map((area) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5283
|
+
Radio_default,
|
|
5284
|
+
{
|
|
5285
|
+
value: area.id,
|
|
5286
|
+
checked: selectedSubject === area.id,
|
|
5287
|
+
onChange: () => onSubjectChange(area.id),
|
|
5288
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 w-full min-w-0", children: [
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5290
|
+
"span",
|
|
5291
|
+
{
|
|
5292
|
+
className: "size-4 rounded-sm flex items-center justify-center shrink-0 text-text-950",
|
|
5293
|
+
style: {
|
|
5294
|
+
backgroundColor: getSubjectColorWithOpacity(
|
|
5295
|
+
area.color,
|
|
5296
|
+
isDark
|
|
5297
|
+
)
|
|
5298
|
+
},
|
|
5299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5300
|
+
IconRender_default,
|
|
5301
|
+
{
|
|
5302
|
+
iconName: area.icon || "BookOpen",
|
|
5303
|
+
size: 14,
|
|
5304
|
+
color: "currentColor"
|
|
5305
|
+
}
|
|
5306
|
+
)
|
|
5307
|
+
}
|
|
5308
|
+
),
|
|
5309
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate flex-1", children: area.name })
|
|
5310
|
+
] })
|
|
5311
|
+
},
|
|
5312
|
+
area.id
|
|
5313
|
+
)) });
|
|
5314
|
+
};
|
|
5315
|
+
|
|
5316
|
+
// src/components/ActivityFilters/components/KnowledgeStructureFilter.tsx
|
|
5317
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5318
|
+
var KnowledgeStructureFilter = ({
|
|
5319
|
+
knowledgeStructure,
|
|
5320
|
+
knowledgeCategories,
|
|
5321
|
+
handleCategoriesChange
|
|
5322
|
+
}) => {
|
|
5323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-4", children: [
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tema, Subtema e Assunto" }),
|
|
5325
|
+
knowledgeStructure.loading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { size: "sm", className: "text-text-600 mb-3", children: "Carregando estrutura de conhecimento..." }),
|
|
5326
|
+
knowledgeStructure.error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { size: "sm", className: "mb-3 text-error-500", children: knowledgeStructure.error }),
|
|
5327
|
+
knowledgeCategories.length > 0 && handleCategoriesChange && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
5328
|
+
CheckboxGroup,
|
|
5329
|
+
{
|
|
5330
|
+
categories: knowledgeCategories,
|
|
5331
|
+
onCategoriesChange: handleCategoriesChange,
|
|
5332
|
+
compactSingleItem: false,
|
|
5333
|
+
showSingleItem: true
|
|
5334
|
+
}
|
|
5335
|
+
),
|
|
5336
|
+
!knowledgeStructure.loading && knowledgeCategories.length === 0 && knowledgeStructure.topics.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Nenhum tema dispon\xEDvel para as mat\xE9rias selecionadas" })
|
|
5337
|
+
] });
|
|
5338
|
+
};
|
|
5339
|
+
|
|
5340
|
+
// src/components/ActivityFilters/components/FilterActions.tsx
|
|
5341
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5342
|
+
var FilterActions = ({
|
|
5343
|
+
onClearFilters,
|
|
5344
|
+
onApplyFilters
|
|
5345
|
+
}) => {
|
|
5346
|
+
if (!onClearFilters && !onApplyFilters) {
|
|
5347
|
+
return null;
|
|
5348
|
+
}
|
|
5349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-2 gap-2 justify-end mt-4 px-4 pt-4 border-t border-border-200", children: [
|
|
5350
|
+
onClearFilters && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button_default, { variant: "link", onClick: onClearFilters, size: "small", children: "Limpar filtros" }),
|
|
5351
|
+
onApplyFilters && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button_default, { variant: "outline", onClick: onApplyFilters, size: "small", children: "Filtrar" })
|
|
5352
|
+
] });
|
|
5353
|
+
};
|
|
5354
|
+
|
|
5355
|
+
// src/components/ActivityFilters/utils/useInitialFiltersLoader.ts
|
|
5356
|
+
var import_react14 = require("react");
|
|
5357
|
+
var useInitialFiltersLoader = ({
|
|
5358
|
+
initialFilters,
|
|
5359
|
+
loadTopics,
|
|
5360
|
+
loadSubtopics,
|
|
5361
|
+
loadContents
|
|
5362
|
+
}) => {
|
|
5363
|
+
const hasRequestedTopicsRef = (0, import_react14.useRef)(false);
|
|
5364
|
+
const hasRequestedSubtopicsRef = (0, import_react14.useRef)(false);
|
|
5365
|
+
const hasRequestedContentsRef = (0, import_react14.useRef)(false);
|
|
5366
|
+
(0, import_react14.useEffect)(() => {
|
|
5367
|
+
hasRequestedTopicsRef.current = false;
|
|
5368
|
+
hasRequestedSubtopicsRef.current = false;
|
|
5369
|
+
hasRequestedContentsRef.current = false;
|
|
5370
|
+
if (!initialFilters) {
|
|
5371
|
+
return;
|
|
5372
|
+
}
|
|
5373
|
+
const subjectIds = initialFilters.subjectIds || [];
|
|
5374
|
+
const topicIds = initialFilters.topicIds || [];
|
|
5375
|
+
const subtopicIds = initialFilters.subtopicIds || [];
|
|
5376
|
+
if (subjectIds.length > 0 && !hasRequestedTopicsRef.current) {
|
|
5377
|
+
if (loadTopics) {
|
|
5378
|
+
loadTopics(subjectIds);
|
|
5379
|
+
}
|
|
5380
|
+
hasRequestedTopicsRef.current = true;
|
|
5381
|
+
}
|
|
5382
|
+
if (topicIds.length > 0 && !hasRequestedSubtopicsRef.current) {
|
|
5383
|
+
if (loadSubtopics) {
|
|
5384
|
+
loadSubtopics(topicIds);
|
|
5385
|
+
}
|
|
5386
|
+
hasRequestedSubtopicsRef.current = true;
|
|
5387
|
+
}
|
|
5388
|
+
if (subtopicIds.length > 0 && !hasRequestedContentsRef.current) {
|
|
5389
|
+
if (loadContents) {
|
|
5390
|
+
loadContents(subtopicIds);
|
|
5391
|
+
}
|
|
5392
|
+
hasRequestedContentsRef.current = true;
|
|
5393
|
+
}
|
|
5394
|
+
}, [initialFilters, loadTopics, loadSubtopics, loadContents]);
|
|
5395
|
+
return {
|
|
5396
|
+
hasRequestedTopicsRef,
|
|
5397
|
+
hasRequestedSubtopicsRef,
|
|
5398
|
+
hasRequestedContentsRef
|
|
5399
|
+
};
|
|
5400
|
+
};
|
|
5401
|
+
|
|
5402
|
+
// src/components/ActivityFilters/utils/useKnowledgeStructureInitialFilters.ts
|
|
5403
|
+
var import_react15 = require("react");
|
|
5404
|
+
var useKnowledgeStructureInitialFilters = ({
|
|
5405
|
+
initialFilters,
|
|
5406
|
+
knowledgeCategories,
|
|
5407
|
+
handleCategoriesChange
|
|
5408
|
+
}) => {
|
|
5409
|
+
const hasAppliedKnowledgeInitialFiltersRef = (0, import_react15.useRef)(false);
|
|
5410
|
+
const hasAppliedTopicsRef = (0, import_react15.useRef)(false);
|
|
5411
|
+
const hasAppliedSubtopicsRef = (0, import_react15.useRef)(false);
|
|
5412
|
+
const hasAppliedContentsRef = (0, import_react15.useRef)(false);
|
|
5413
|
+
const knowledgeCategoriesRef = (0, import_react15.useRef)([]);
|
|
5414
|
+
(0, import_react15.useEffect)(() => {
|
|
5415
|
+
knowledgeCategoriesRef.current = knowledgeCategories;
|
|
5416
|
+
}, [knowledgeCategories]);
|
|
5417
|
+
(0, import_react15.useEffect)(() => {
|
|
5418
|
+
hasAppliedKnowledgeInitialFiltersRef.current = false;
|
|
5419
|
+
hasAppliedTopicsRef.current = false;
|
|
5420
|
+
hasAppliedSubtopicsRef.current = false;
|
|
5421
|
+
hasAppliedContentsRef.current = false;
|
|
5422
|
+
}, [initialFilters]);
|
|
5423
|
+
(0, import_react15.useEffect)(() => {
|
|
5424
|
+
if (!initialFilters || hasAppliedKnowledgeInitialFiltersRef.current || knowledgeCategoriesRef.current.length === 0 || !handleCategoriesChange) {
|
|
5425
|
+
return;
|
|
5426
|
+
}
|
|
5427
|
+
const topicIds = initialFilters.topicIds || [];
|
|
5428
|
+
const subtopicIds = initialFilters.subtopicIds || [];
|
|
5429
|
+
const contentIds = initialFilters.contentIds || [];
|
|
5430
|
+
const hasKnowledgeSelections = topicIds.length > 0 || subtopicIds.length > 0 || contentIds.length > 0;
|
|
5431
|
+
if (!hasKnowledgeSelections) {
|
|
5432
|
+
hasAppliedKnowledgeInitialFiltersRef.current = true;
|
|
5433
|
+
return;
|
|
5434
|
+
}
|
|
5435
|
+
const currentKnowledgeCategories = knowledgeCategoriesRef.current;
|
|
5436
|
+
let changed = false;
|
|
5437
|
+
const updatedCategories = currentKnowledgeCategories.map((category) => {
|
|
5438
|
+
if (category.key === "tema" && topicIds.length > 0 && !hasAppliedTopicsRef.current) {
|
|
5439
|
+
const selectedIds = (category.itens || []).filter((item) => topicIds.includes(item.id)).map((item) => item.id);
|
|
5440
|
+
if (selectedIds.length > 0) {
|
|
5441
|
+
hasAppliedTopicsRef.current = true;
|
|
5442
|
+
changed = true;
|
|
5443
|
+
return { ...category, selectedIds };
|
|
5444
|
+
}
|
|
5445
|
+
return category;
|
|
5446
|
+
}
|
|
5447
|
+
if (category.key === "subtema" && subtopicIds.length > 0 && !hasAppliedSubtopicsRef.current) {
|
|
5448
|
+
const selectedIds = (category.itens || []).filter((item) => subtopicIds.includes(item.id)).map((item) => item.id);
|
|
5449
|
+
if (selectedIds.length > 0) {
|
|
5450
|
+
hasAppliedSubtopicsRef.current = true;
|
|
5451
|
+
changed = true;
|
|
5452
|
+
return { ...category, selectedIds };
|
|
5453
|
+
}
|
|
5454
|
+
return category;
|
|
5455
|
+
}
|
|
5456
|
+
if (category.key === "assunto" && contentIds.length > 0 && !hasAppliedContentsRef.current) {
|
|
5457
|
+
const selectedIds = (category.itens || []).filter((item) => contentIds.includes(item.id)).map((item) => item.id);
|
|
5458
|
+
if (selectedIds.length > 0) {
|
|
5459
|
+
hasAppliedContentsRef.current = true;
|
|
5460
|
+
changed = true;
|
|
5461
|
+
return { ...category, selectedIds };
|
|
5462
|
+
}
|
|
5463
|
+
return category;
|
|
5464
|
+
}
|
|
5465
|
+
return category;
|
|
5466
|
+
});
|
|
5467
|
+
if (changed) {
|
|
5468
|
+
handleCategoriesChange(updatedCategories);
|
|
5469
|
+
}
|
|
5470
|
+
if ((topicIds.length === 0 || hasAppliedTopicsRef.current) && (subtopicIds.length === 0 || hasAppliedSubtopicsRef.current) && (contentIds.length === 0 || hasAppliedContentsRef.current)) {
|
|
5471
|
+
hasAppliedKnowledgeInitialFiltersRef.current = true;
|
|
5472
|
+
}
|
|
5473
|
+
}, [initialFilters, knowledgeCategories, handleCategoriesChange]);
|
|
5474
|
+
return {
|
|
5475
|
+
hasAppliedKnowledgeInitialFiltersRef,
|
|
5476
|
+
hasAppliedTopicsRef,
|
|
5477
|
+
hasAppliedSubtopicsRef,
|
|
5478
|
+
hasAppliedContentsRef,
|
|
5479
|
+
knowledgeCategoriesRef
|
|
5480
|
+
};
|
|
5481
|
+
};
|
|
5482
|
+
|
|
5483
|
+
// src/components/ActivityFilters/ActivityFilters.tsx
|
|
5484
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5221
5485
|
var questionTypesFallback = [
|
|
5222
5486
|
"ALTERNATIVA" /* ALTERNATIVA */,
|
|
5223
5487
|
"VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */,
|
|
@@ -5273,42 +5537,15 @@ var updateBankCategoriesWithInitialFilters = (prevCategories, bankIds, derivedYe
|
|
|
5273
5537
|
return category;
|
|
5274
5538
|
});
|
|
5275
5539
|
};
|
|
5276
|
-
var getSelectedIdsForKnowledgeCategory = (category, filterIds) => {
|
|
5277
|
-
return (category.itens || []).filter((item) => filterIds.includes(item.id)).map((item) => item.id);
|
|
5278
|
-
};
|
|
5279
|
-
var updateTopicCategory = (category, topicIds, hasAppliedTopicsRef) => {
|
|
5280
|
-
const selectedIds = getSelectedIdsForKnowledgeCategory(category, topicIds);
|
|
5281
|
-
if (selectedIds.length > 0) {
|
|
5282
|
-
hasAppliedTopicsRef.current = true;
|
|
5283
|
-
return { category: { ...category, selectedIds }, changed: true };
|
|
5284
|
-
}
|
|
5285
|
-
return { category, changed: false };
|
|
5286
|
-
};
|
|
5287
|
-
var updateSubtopicCategory = (category, subtopicIds, hasAppliedSubtopicsRef) => {
|
|
5288
|
-
const selectedIds = getSelectedIdsForKnowledgeCategory(category, subtopicIds);
|
|
5289
|
-
if (selectedIds.length > 0) {
|
|
5290
|
-
hasAppliedSubtopicsRef.current = true;
|
|
5291
|
-
return { category: { ...category, selectedIds }, changed: true };
|
|
5292
|
-
}
|
|
5293
|
-
return { category, changed: false };
|
|
5294
|
-
};
|
|
5295
|
-
var updateContentCategory = (category, contentIds, hasAppliedContentsRef) => {
|
|
5296
|
-
const selectedIds = getSelectedIdsForKnowledgeCategory(category, contentIds);
|
|
5297
|
-
if (selectedIds.length > 0) {
|
|
5298
|
-
hasAppliedContentsRef.current = true;
|
|
5299
|
-
return { category: { ...category, selectedIds }, changed: true };
|
|
5300
|
-
}
|
|
5301
|
-
return { category, changed: false };
|
|
5302
|
-
};
|
|
5303
5540
|
var QuestionTypeFilter = ({
|
|
5304
5541
|
selectedTypes,
|
|
5305
5542
|
onToggleType,
|
|
5306
5543
|
allowedQuestionTypes
|
|
5307
5544
|
}) => {
|
|
5308
5545
|
const availableQuestionTypes = allowedQuestionTypes || questionTypesFallback;
|
|
5309
|
-
return /* @__PURE__ */ (0,
|
|
5310
|
-
/* @__PURE__ */ (0,
|
|
5311
|
-
/* @__PURE__ */ (0,
|
|
5546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
5547
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tipo de quest\xE3o" }),
|
|
5548
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-2 gap-2", children: availableQuestionTypes.map((questionType) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5312
5549
|
Chips_default,
|
|
5313
5550
|
{
|
|
5314
5551
|
selected: selectedTypes.includes(questionType),
|
|
@@ -5328,16 +5565,16 @@ var BanksAndYearsFilter = ({
|
|
|
5328
5565
|
error = null
|
|
5329
5566
|
}) => {
|
|
5330
5567
|
if (loading) {
|
|
5331
|
-
return /* @__PURE__ */ (0,
|
|
5568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Carregando bancas..." });
|
|
5332
5569
|
}
|
|
5333
5570
|
if (error) {
|
|
5334
|
-
return /* @__PURE__ */ (0,
|
|
5571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { size: "sm", className: "text-text-600", children: error });
|
|
5335
5572
|
}
|
|
5336
5573
|
if (banks.length === 0 && bankYears.length === 0) {
|
|
5337
|
-
return /* @__PURE__ */ (0,
|
|
5574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Nenhuma banca encontrada" });
|
|
5338
5575
|
}
|
|
5339
5576
|
if (bankCategories.length > 0) {
|
|
5340
|
-
return /* @__PURE__ */ (0,
|
|
5577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5341
5578
|
CheckboxGroup,
|
|
5342
5579
|
{
|
|
5343
5580
|
categories: bankCategories,
|
|
@@ -5349,86 +5586,6 @@ var BanksAndYearsFilter = ({
|
|
|
5349
5586
|
}
|
|
5350
5587
|
return null;
|
|
5351
5588
|
};
|
|
5352
|
-
var SubjectsFilter = ({
|
|
5353
|
-
knowledgeAreas,
|
|
5354
|
-
selectedSubject,
|
|
5355
|
-
onSubjectChange,
|
|
5356
|
-
loading = false,
|
|
5357
|
-
error = null
|
|
5358
|
-
}) => {
|
|
5359
|
-
const { isDark } = useTheme();
|
|
5360
|
-
if (loading) {
|
|
5361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Carregando mat\xE9rias..." });
|
|
5362
|
-
}
|
|
5363
|
-
if (error) {
|
|
5364
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: error });
|
|
5365
|
-
}
|
|
5366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-3 gap-3", children: knowledgeAreas.map((area) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5367
|
-
Radio_default,
|
|
5368
|
-
{
|
|
5369
|
-
value: area.id,
|
|
5370
|
-
checked: selectedSubject === area.id,
|
|
5371
|
-
onChange: () => onSubjectChange(area.id),
|
|
5372
|
-
label: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 w-full min-w-0", children: [
|
|
5373
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5374
|
-
"span",
|
|
5375
|
-
{
|
|
5376
|
-
className: "size-4 rounded-sm flex items-center justify-center shrink-0 text-text-950",
|
|
5377
|
-
style: {
|
|
5378
|
-
backgroundColor: getSubjectColorWithOpacity(
|
|
5379
|
-
area.color,
|
|
5380
|
-
isDark
|
|
5381
|
-
)
|
|
5382
|
-
},
|
|
5383
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5384
|
-
IconRender_default,
|
|
5385
|
-
{
|
|
5386
|
-
iconName: area.icon || "BookOpen",
|
|
5387
|
-
size: 14,
|
|
5388
|
-
color: "currentColor"
|
|
5389
|
-
}
|
|
5390
|
-
)
|
|
5391
|
-
}
|
|
5392
|
-
),
|
|
5393
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate flex-1", children: area.name })
|
|
5394
|
-
] })
|
|
5395
|
-
},
|
|
5396
|
-
area.id
|
|
5397
|
-
)) });
|
|
5398
|
-
};
|
|
5399
|
-
var KnowledgeStructureFilter = ({
|
|
5400
|
-
knowledgeStructure,
|
|
5401
|
-
knowledgeCategories,
|
|
5402
|
-
handleCategoriesChange
|
|
5403
|
-
}) => {
|
|
5404
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-4", children: [
|
|
5405
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tema, Subtema e Assunto" }),
|
|
5406
|
-
knowledgeStructure.loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600 mb-3", children: "Carregando estrutura de conhecimento..." }),
|
|
5407
|
-
knowledgeStructure.error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "mb-3 text-error-500", children: knowledgeStructure.error }),
|
|
5408
|
-
knowledgeCategories.length > 0 && handleCategoriesChange && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5409
|
-
CheckboxGroup,
|
|
5410
|
-
{
|
|
5411
|
-
categories: knowledgeCategories,
|
|
5412
|
-
onCategoriesChange: handleCategoriesChange,
|
|
5413
|
-
compactSingleItem: false,
|
|
5414
|
-
showSingleItem: true
|
|
5415
|
-
}
|
|
5416
|
-
),
|
|
5417
|
-
!knowledgeStructure.loading && knowledgeCategories.length === 0 && knowledgeStructure.topics.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { size: "sm", className: "text-text-600", children: "Nenhum tema dispon\xEDvel para as mat\xE9rias selecionadas" })
|
|
5418
|
-
] });
|
|
5419
|
-
};
|
|
5420
|
-
var FilterActions = ({
|
|
5421
|
-
onClearFilters,
|
|
5422
|
-
onApplyFilters
|
|
5423
|
-
}) => {
|
|
5424
|
-
if (!onClearFilters && !onApplyFilters) {
|
|
5425
|
-
return null;
|
|
5426
|
-
}
|
|
5427
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "grid grid-cols-2 gap-2 justify-end mt-4 px-4 pt-4 border-t border-border-200", children: [
|
|
5428
|
-
onClearFilters && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default, { variant: "link", onClick: onClearFilters, size: "small", children: "Limpar filtros" }),
|
|
5429
|
-
onApplyFilters && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default, { variant: "outline", onClick: onApplyFilters, size: "small", children: "Filtrar" })
|
|
5430
|
-
] });
|
|
5431
|
-
};
|
|
5432
5589
|
var ActivityFilters = ({
|
|
5433
5590
|
apiClient,
|
|
5434
5591
|
onFiltersChange,
|
|
@@ -5440,8 +5597,8 @@ var ActivityFilters = ({
|
|
|
5440
5597
|
onApplyFilters
|
|
5441
5598
|
}) => {
|
|
5442
5599
|
const useActivityFiltersData = createUseActivityFiltersData(apiClient);
|
|
5443
|
-
const [selectedQuestionTypes, setSelectedQuestionTypes] = (0,
|
|
5444
|
-
const [selectedSubject, setSelectedSubject] = (0,
|
|
5600
|
+
const [selectedQuestionTypes, setSelectedQuestionTypes] = (0, import_react16.useState)([]);
|
|
5601
|
+
const [selectedSubject, setSelectedSubject] = (0, import_react16.useState)(null);
|
|
5445
5602
|
const {
|
|
5446
5603
|
banks,
|
|
5447
5604
|
bankYears,
|
|
@@ -5466,19 +5623,22 @@ var ActivityFilters = ({
|
|
|
5466
5623
|
selectedSubjects: selectedSubject ? [selectedSubject] : [],
|
|
5467
5624
|
institutionId
|
|
5468
5625
|
});
|
|
5469
|
-
const prevAllowedQuestionTypesRef = (0,
|
|
5470
|
-
const hasAppliedBasicInitialFiltersRef = (0,
|
|
5471
|
-
const hasAppliedBankInitialFiltersRef = (0,
|
|
5472
|
-
const
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5626
|
+
const prevAllowedQuestionTypesRef = (0, import_react16.useRef)(null);
|
|
5627
|
+
const hasAppliedBasicInitialFiltersRef = (0, import_react16.useRef)(false);
|
|
5628
|
+
const hasAppliedBankInitialFiltersRef = (0, import_react16.useRef)(false);
|
|
5629
|
+
const bankCategoriesRef = (0, import_react16.useRef)([]);
|
|
5630
|
+
useInitialFiltersLoader({
|
|
5631
|
+
initialFilters,
|
|
5632
|
+
loadTopics,
|
|
5633
|
+
loadSubtopics,
|
|
5634
|
+
loadContents
|
|
5635
|
+
});
|
|
5636
|
+
useKnowledgeStructureInitialFilters({
|
|
5637
|
+
initialFilters,
|
|
5638
|
+
knowledgeCategories,
|
|
5639
|
+
handleCategoriesChange
|
|
5640
|
+
});
|
|
5641
|
+
(0, import_react16.useEffect)(() => {
|
|
5482
5642
|
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
5483
5643
|
prevAllowedQuestionTypesRef.current = null;
|
|
5484
5644
|
return;
|
|
@@ -5511,11 +5671,11 @@ var ActivityFilters = ({
|
|
|
5511
5671
|
return prev;
|
|
5512
5672
|
});
|
|
5513
5673
|
}, [allowedQuestionTypes]);
|
|
5514
|
-
const [bankCategories, setBankCategories] = (0,
|
|
5515
|
-
(0,
|
|
5674
|
+
const [bankCategories, setBankCategories] = (0, import_react16.useState)([]);
|
|
5675
|
+
(0, import_react16.useEffect)(() => {
|
|
5516
5676
|
bankCategoriesRef.current = bankCategories;
|
|
5517
5677
|
}, [bankCategories]);
|
|
5518
|
-
const selectedSubjects = (0,
|
|
5678
|
+
const selectedSubjects = (0, import_react16.useMemo)(
|
|
5519
5679
|
() => selectedSubject ? [selectedSubject] : [],
|
|
5520
5680
|
[selectedSubject]
|
|
5521
5681
|
);
|
|
@@ -5528,7 +5688,7 @@ var ActivityFilters = ({
|
|
|
5528
5688
|
const handleBankCategoriesChange = (updatedCategories) => {
|
|
5529
5689
|
setBankCategories(updatedCategories);
|
|
5530
5690
|
};
|
|
5531
|
-
(0,
|
|
5691
|
+
(0, import_react16.useEffect)(() => {
|
|
5532
5692
|
setBankCategories((prevCategories) => {
|
|
5533
5693
|
const bankCategory = {
|
|
5534
5694
|
key: "banca",
|
|
@@ -5554,21 +5714,11 @@ var ActivityFilters = ({
|
|
|
5554
5714
|
return [bankCategory, yearCategory];
|
|
5555
5715
|
});
|
|
5556
5716
|
}, [banks, bankYears]);
|
|
5557
|
-
(0,
|
|
5558
|
-
knowledgeCategoriesRef.current = knowledgeCategories;
|
|
5559
|
-
}, [knowledgeCategories]);
|
|
5560
|
-
(0, import_react14.useEffect)(() => {
|
|
5717
|
+
(0, import_react16.useEffect)(() => {
|
|
5561
5718
|
hasAppliedBasicInitialFiltersRef.current = false;
|
|
5562
5719
|
hasAppliedBankInitialFiltersRef.current = false;
|
|
5563
|
-
hasAppliedKnowledgeInitialFiltersRef.current = false;
|
|
5564
|
-
hasRequestedTopicsRef.current = false;
|
|
5565
|
-
hasRequestedSubtopicsRef.current = false;
|
|
5566
|
-
hasRequestedContentsRef.current = false;
|
|
5567
|
-
hasAppliedTopicsRef.current = false;
|
|
5568
|
-
hasAppliedSubtopicsRef.current = false;
|
|
5569
|
-
hasAppliedContentsRef.current = false;
|
|
5570
5720
|
}, [initialFilters]);
|
|
5571
|
-
(0,
|
|
5721
|
+
(0, import_react16.useEffect)(() => {
|
|
5572
5722
|
if (!initialFilters || hasAppliedBasicInitialFiltersRef.current) {
|
|
5573
5723
|
return;
|
|
5574
5724
|
}
|
|
@@ -5580,7 +5730,7 @@ var ActivityFilters = ({
|
|
|
5580
5730
|
}
|
|
5581
5731
|
hasAppliedBasicInitialFiltersRef.current = true;
|
|
5582
5732
|
}, [initialFilters]);
|
|
5583
|
-
(0,
|
|
5733
|
+
(0, import_react16.useEffect)(() => {
|
|
5584
5734
|
if (!initialFilters || hasAppliedBankInitialFiltersRef.current || bankCategoriesRef.current.length === 0) {
|
|
5585
5735
|
return;
|
|
5586
5736
|
}
|
|
@@ -5612,90 +5762,7 @@ var ActivityFilters = ({
|
|
|
5612
5762
|
);
|
|
5613
5763
|
hasAppliedBankInitialFiltersRef.current = true;
|
|
5614
5764
|
}, [initialFilters, bankCategories]);
|
|
5615
|
-
(0,
|
|
5616
|
-
if (!initialFilters) {
|
|
5617
|
-
return;
|
|
5618
|
-
}
|
|
5619
|
-
const subjectIds = initialFilters.subjectIds || [];
|
|
5620
|
-
const topicIds = initialFilters.topicIds || [];
|
|
5621
|
-
const subtopicIds = initialFilters.subtopicIds || [];
|
|
5622
|
-
if (subjectIds.length > 0 && !hasRequestedTopicsRef.current) {
|
|
5623
|
-
if (loadTopics) {
|
|
5624
|
-
loadTopics(subjectIds);
|
|
5625
|
-
}
|
|
5626
|
-
hasRequestedTopicsRef.current = true;
|
|
5627
|
-
}
|
|
5628
|
-
if (topicIds.length > 0 && !hasRequestedSubtopicsRef.current) {
|
|
5629
|
-
if (loadSubtopics) {
|
|
5630
|
-
loadSubtopics(topicIds);
|
|
5631
|
-
}
|
|
5632
|
-
hasRequestedSubtopicsRef.current = true;
|
|
5633
|
-
}
|
|
5634
|
-
if (subtopicIds.length > 0 && !hasRequestedContentsRef.current) {
|
|
5635
|
-
if (loadContents) {
|
|
5636
|
-
loadContents(subtopicIds);
|
|
5637
|
-
}
|
|
5638
|
-
hasRequestedContentsRef.current = true;
|
|
5639
|
-
}
|
|
5640
|
-
}, [initialFilters, loadTopics, loadSubtopics, loadContents]);
|
|
5641
|
-
(0, import_react14.useEffect)(() => {
|
|
5642
|
-
if (!initialFilters || hasAppliedKnowledgeInitialFiltersRef.current || knowledgeCategoriesRef.current.length === 0 || !handleCategoriesChange) {
|
|
5643
|
-
return;
|
|
5644
|
-
}
|
|
5645
|
-
const topicIds = initialFilters.topicIds || [];
|
|
5646
|
-
const subtopicIds = initialFilters.subtopicIds || [];
|
|
5647
|
-
const contentIds = initialFilters.contentIds || [];
|
|
5648
|
-
const hasKnowledgeSelections = topicIds.length > 0 || subtopicIds.length > 0 || contentIds.length > 0;
|
|
5649
|
-
if (!hasKnowledgeSelections) {
|
|
5650
|
-
hasAppliedKnowledgeInitialFiltersRef.current = true;
|
|
5651
|
-
return;
|
|
5652
|
-
}
|
|
5653
|
-
const currentKnowledgeCategories = knowledgeCategoriesRef.current;
|
|
5654
|
-
let changed = false;
|
|
5655
|
-
const updatedCategories = currentKnowledgeCategories.map((category) => {
|
|
5656
|
-
if (category.key === "tema" && topicIds.length > 0 && !hasAppliedTopicsRef.current) {
|
|
5657
|
-
const result = updateTopicCategory(
|
|
5658
|
-
category,
|
|
5659
|
-
topicIds,
|
|
5660
|
-
hasAppliedTopicsRef
|
|
5661
|
-
);
|
|
5662
|
-
if (result.changed) {
|
|
5663
|
-
changed = true;
|
|
5664
|
-
}
|
|
5665
|
-
return result.category;
|
|
5666
|
-
}
|
|
5667
|
-
if (category.key === "subtema" && subtopicIds.length > 0 && !hasAppliedSubtopicsRef.current) {
|
|
5668
|
-
const result = updateSubtopicCategory(
|
|
5669
|
-
category,
|
|
5670
|
-
subtopicIds,
|
|
5671
|
-
hasAppliedSubtopicsRef
|
|
5672
|
-
);
|
|
5673
|
-
if (result.changed) {
|
|
5674
|
-
changed = true;
|
|
5675
|
-
}
|
|
5676
|
-
return result.category;
|
|
5677
|
-
}
|
|
5678
|
-
if (category.key === "assunto" && contentIds.length > 0 && !hasAppliedContentsRef.current) {
|
|
5679
|
-
const result = updateContentCategory(
|
|
5680
|
-
category,
|
|
5681
|
-
contentIds,
|
|
5682
|
-
hasAppliedContentsRef
|
|
5683
|
-
);
|
|
5684
|
-
if (result.changed) {
|
|
5685
|
-
changed = true;
|
|
5686
|
-
}
|
|
5687
|
-
return result.category;
|
|
5688
|
-
}
|
|
5689
|
-
return category;
|
|
5690
|
-
});
|
|
5691
|
-
if (changed) {
|
|
5692
|
-
handleCategoriesChange(updatedCategories);
|
|
5693
|
-
}
|
|
5694
|
-
if ((topicIds.length === 0 || hasAppliedTopicsRef.current) && (subtopicIds.length === 0 || hasAppliedSubtopicsRef.current) && (contentIds.length === 0 || hasAppliedContentsRef.current)) {
|
|
5695
|
-
hasAppliedKnowledgeInitialFiltersRef.current = true;
|
|
5696
|
-
}
|
|
5697
|
-
}, [initialFilters, knowledgeCategories, handleCategoriesChange]);
|
|
5698
|
-
(0, import_react14.useEffect)(() => {
|
|
5765
|
+
(0, import_react16.useEffect)(() => {
|
|
5699
5766
|
if (loadBanks) {
|
|
5700
5767
|
loadBanks();
|
|
5701
5768
|
}
|
|
@@ -5706,32 +5773,32 @@ var ActivityFilters = ({
|
|
|
5706
5773
|
loadQuestionTypes();
|
|
5707
5774
|
}
|
|
5708
5775
|
}, [loadBanks, loadKnowledgeAreas, loadQuestionTypes, institutionId]);
|
|
5709
|
-
const availableQuestionTypes = (0,
|
|
5776
|
+
const availableQuestionTypes = (0, import_react16.useMemo)(() => {
|
|
5710
5777
|
const source = questionTypes && questionTypes.length > 0 ? questionTypes : questionTypesFallback;
|
|
5711
5778
|
if (!allowedQuestionTypes || allowedQuestionTypes.length === 0) {
|
|
5712
5779
|
return source;
|
|
5713
5780
|
}
|
|
5714
5781
|
return source.filter((type) => allowedQuestionTypes.includes(type));
|
|
5715
5782
|
}, [questionTypes, allowedQuestionTypes]);
|
|
5716
|
-
const getSelectedKnowledgeIds = (0,
|
|
5783
|
+
const getSelectedKnowledgeIds = (0, import_react16.useCallback)(() => {
|
|
5717
5784
|
return getSelectedIdsFromCategories(knowledgeCategories, {
|
|
5718
5785
|
topicIds: "tema",
|
|
5719
5786
|
subtopicIds: "subtema",
|
|
5720
5787
|
contentIds: "assunto"
|
|
5721
5788
|
});
|
|
5722
5789
|
}, [knowledgeCategories]);
|
|
5723
|
-
const getSelectedBankIds = (0,
|
|
5790
|
+
const getSelectedBankIds = (0, import_react16.useCallback)(() => {
|
|
5724
5791
|
return getSelectedIdsFromCategories(bankCategories, {
|
|
5725
5792
|
bankIds: "banca",
|
|
5726
5793
|
yearIds: "ano"
|
|
5727
5794
|
});
|
|
5728
5795
|
}, [bankCategories]);
|
|
5729
|
-
const onFiltersChangeRef = (0,
|
|
5730
|
-
(0,
|
|
5796
|
+
const onFiltersChangeRef = (0, import_react16.useRef)(onFiltersChange);
|
|
5797
|
+
(0, import_react16.useEffect)(() => {
|
|
5731
5798
|
onFiltersChangeRef.current = onFiltersChange;
|
|
5732
5799
|
}, [onFiltersChange]);
|
|
5733
|
-
const prevFiltersRef = (0,
|
|
5734
|
-
(0,
|
|
5800
|
+
const prevFiltersRef = (0, import_react16.useRef)(null);
|
|
5801
|
+
(0, import_react16.useEffect)(() => {
|
|
5735
5802
|
const knowledgeIds = getSelectedKnowledgeIds();
|
|
5736
5803
|
const bankIds = getSelectedBankIds();
|
|
5737
5804
|
const filters = {
|
|
@@ -5757,10 +5824,10 @@ var ActivityFilters = ({
|
|
|
5757
5824
|
]);
|
|
5758
5825
|
const containerClassName = variant === "popover" ? "w-full bg-background" : "w-[400px] flex-shrink-0 p-4 bg-background";
|
|
5759
5826
|
const contentClassName = variant === "popover" ? "p-4" : "";
|
|
5760
|
-
return /* @__PURE__ */ (0,
|
|
5761
|
-
variant === "default" && /* @__PURE__ */ (0,
|
|
5762
|
-
/* @__PURE__ */ (0,
|
|
5763
|
-
/* @__PURE__ */ (0,
|
|
5827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: containerClassName, children: [
|
|
5828
|
+
variant === "default" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("section", { className: "flex flex-row items-center gap-2 text-text-950 mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { size: "lg", weight: "bold", children: "Filtro de quest\xF5es" }) }),
|
|
5829
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: contentClassName, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: "flex flex-col gap-4", children: [
|
|
5830
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5764
5831
|
QuestionTypeFilter,
|
|
5765
5832
|
{
|
|
5766
5833
|
selectedTypes: selectedQuestionTypes,
|
|
@@ -5768,7 +5835,7 @@ var ActivityFilters = ({
|
|
|
5768
5835
|
allowedQuestionTypes: availableQuestionTypes
|
|
5769
5836
|
}
|
|
5770
5837
|
),
|
|
5771
|
-
loadingQuestionTypes && /* @__PURE__ */ (0,
|
|
5838
|
+
loadingQuestionTypes && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5772
5839
|
Text_default,
|
|
5773
5840
|
{
|
|
5774
5841
|
size: "sm",
|
|
@@ -5777,7 +5844,7 @@ var ActivityFilters = ({
|
|
|
5777
5844
|
children: "Carregando tipos de quest\xE3o..."
|
|
5778
5845
|
}
|
|
5779
5846
|
),
|
|
5780
|
-
questionTypesError && /* @__PURE__ */ (0,
|
|
5847
|
+
questionTypesError && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5781
5848
|
Text_default,
|
|
5782
5849
|
{
|
|
5783
5850
|
size: "sm",
|
|
@@ -5786,9 +5853,9 @@ var ActivityFilters = ({
|
|
|
5786
5853
|
children: questionTypesError
|
|
5787
5854
|
}
|
|
5788
5855
|
),
|
|
5789
|
-
/* @__PURE__ */ (0,
|
|
5790
|
-
/* @__PURE__ */ (0,
|
|
5791
|
-
/* @__PURE__ */ (0,
|
|
5856
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Banca de vestibular" }),
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5792
5859
|
BanksAndYearsFilter,
|
|
5793
5860
|
{
|
|
5794
5861
|
banks,
|
|
@@ -5800,9 +5867,9 @@ var ActivityFilters = ({
|
|
|
5800
5867
|
}
|
|
5801
5868
|
)
|
|
5802
5869
|
] }),
|
|
5803
|
-
/* @__PURE__ */ (0,
|
|
5804
|
-
/* @__PURE__ */ (0,
|
|
5805
|
-
/* @__PURE__ */ (0,
|
|
5870
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
5871
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-row justify-between items-center mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { size: "sm", weight: "bold", children: "Mat\xE9ria" }) }),
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5806
5873
|
SubjectsFilter,
|
|
5807
5874
|
{
|
|
5808
5875
|
knowledgeAreas,
|
|
@@ -5813,7 +5880,7 @@ var ActivityFilters = ({
|
|
|
5813
5880
|
}
|
|
5814
5881
|
)
|
|
5815
5882
|
] }),
|
|
5816
|
-
selectedSubject && /* @__PURE__ */ (0,
|
|
5883
|
+
selectedSubject && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5817
5884
|
KnowledgeStructureFilter,
|
|
5818
5885
|
{
|
|
5819
5886
|
knowledgeStructure,
|
|
@@ -5821,7 +5888,7 @@ var ActivityFilters = ({
|
|
|
5821
5888
|
handleCategoriesChange
|
|
5822
5889
|
}
|
|
5823
5890
|
),
|
|
5824
|
-
/* @__PURE__ */ (0,
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5825
5892
|
FilterActions,
|
|
5826
5893
|
{
|
|
5827
5894
|
onClearFilters,
|
|
@@ -5834,22 +5901,28 @@ var ActivityFilters = ({
|
|
|
5834
5901
|
var ActivityFiltersPopover = ({
|
|
5835
5902
|
onFiltersChange,
|
|
5836
5903
|
triggerLabel = "Filtro de quest\xF5es",
|
|
5904
|
+
initialFilters,
|
|
5837
5905
|
...activityFiltersProps
|
|
5838
5906
|
}) => {
|
|
5839
|
-
const [open, setOpen] = (0,
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5907
|
+
const [open, setOpen] = (0, import_react16.useState)(false);
|
|
5908
|
+
const appliedFilters = useQuestionFiltersStore(
|
|
5909
|
+
(state) => state.appliedFilters
|
|
5910
|
+
);
|
|
5911
|
+
const effectiveInitialFilters = appliedFilters ?? initialFilters;
|
|
5912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DropdownMenu_default, { open, onOpenChange: setOpen, children: [
|
|
5913
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownMenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button_default, { variant: "outline", children: triggerLabel }) }),
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5843
5915
|
DropdownMenuContent,
|
|
5844
5916
|
{
|
|
5845
5917
|
className: "w-[90vw] max-w-[400px] max-h-[calc(100vh-8rem)] overflow-y-auto p-0",
|
|
5846
5918
|
align: "start",
|
|
5847
|
-
children: /* @__PURE__ */ (0,
|
|
5919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5848
5920
|
ActivityFilters,
|
|
5849
5921
|
{
|
|
5850
5922
|
onFiltersChange,
|
|
5851
5923
|
variant: "popover",
|
|
5852
|
-
...activityFiltersProps
|
|
5924
|
+
...activityFiltersProps,
|
|
5925
|
+
initialFilters: effectiveInitialFilters
|
|
5853
5926
|
}
|
|
5854
5927
|
)
|
|
5855
5928
|
}
|