analytica-frontend-lib 1.2.81 → 1.2.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivitiesHistory/index.js +34 -43
- package/dist/ActivitiesHistory/index.js.map +1 -1
- package/dist/ActivitiesHistory/index.mjs +34 -43
- package/dist/ActivitiesHistory/index.mjs.map +1 -1
- package/dist/ActivityDetails/index.js +30 -38
- package/dist/ActivityDetails/index.js.map +1 -1
- package/dist/ActivityDetails/index.mjs +30 -38
- package/dist/ActivityDetails/index.mjs.map +1 -1
- package/dist/ActivityFilters/index.js +30 -38
- package/dist/ActivityFilters/index.js.map +1 -1
- package/dist/ActivityFilters/index.mjs +30 -38
- package/dist/ActivityFilters/index.mjs.map +1 -1
- package/dist/AlertManager/index.js +30 -38
- package/dist/AlertManager/index.js.map +1 -1
- package/dist/AlertManager/index.mjs +30 -38
- package/dist/AlertManager/index.mjs.map +1 -1
- package/dist/RecommendedLessonsHistory/index.js +34 -43
- package/dist/RecommendedLessonsHistory/index.js.map +1 -1
- package/dist/RecommendedLessonsHistory/index.mjs +34 -43
- package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.js +30 -38
- package/dist/SendActivityModal/SendActivityModal.js.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.mjs +30 -38
- package/dist/SendActivityModal/SendActivityModal.mjs.map +1 -1
- package/dist/SendActivityModal/index.js +30 -38
- package/dist/SendActivityModal/index.js.map +1 -1
- package/dist/SendActivityModal/index.mjs +30 -38
- package/dist/SendActivityModal/index.mjs.map +1 -1
- package/dist/TableProvider/index.js +30 -38
- package/dist/TableProvider/index.js.map +1 -1
- package/dist/TableProvider/index.mjs +30 -38
- package/dist/TableProvider/index.mjs.map +1 -1
- package/dist/hooks/useRecommendedLessonsPage/index.d.ts +218 -0
- package/dist/hooks/useRecommendedLessonsPage/index.d.ts.map +1 -0
- package/dist/hooks/useRecommendedLessonsPage/index.js +247 -0
- package/dist/hooks/useRecommendedLessonsPage/index.js.map +1 -0
- package/dist/hooks/useRecommendedLessonsPage/index.mjs +221 -0
- package/dist/hooks/useRecommendedLessonsPage/index.mjs.map +1 -0
- package/dist/hooks/useRecommendedLessonsPage.d.ts +218 -0
- package/dist/hooks/useRecommendedLessonsPage.d.ts.map +1 -0
- package/dist/hooks/useSendActivity/index.js +1 -1
- package/dist/hooks/useSendActivity/index.js.map +1 -1
- package/dist/hooks/useSendActivity/index.mjs +1 -1
- package/dist/hooks/useSendActivity/index.mjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +344 -133
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +333 -124
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -233,6 +233,7 @@ __export(src_exports, {
|
|
|
233
233
|
createQuestionsListHook: () => createQuestionsListHook,
|
|
234
234
|
createRecommendedLessonDetailsHook: () => createRecommendedLessonDetailsHook,
|
|
235
235
|
createRecommendedLessonsHistoryHook: () => createRecommendedLessonsHistoryHook,
|
|
236
|
+
createRecommendedLessonsPageHook: () => createRecommendedLessonsPageHook,
|
|
236
237
|
createUseActivitiesHistory: () => createUseActivitiesHistory,
|
|
237
238
|
createUseActivityFiltersData: () => createUseActivityFiltersData,
|
|
238
239
|
createUseActivityModels: () => createUseActivityModels,
|
|
@@ -244,6 +245,7 @@ __export(src_exports, {
|
|
|
244
245
|
createUseQuestionsList: () => createUseQuestionsList,
|
|
245
246
|
createUseRecommendedLessonDetails: () => createUseRecommendedLessonDetails,
|
|
246
247
|
createUseRecommendedLessonsHistory: () => createUseRecommendedLessonsHistory,
|
|
248
|
+
createUseRecommendedLessonsPage: () => createUseRecommendedLessonsPage,
|
|
247
249
|
createZustandAuthAdapter: () => createZustandAuthAdapter,
|
|
248
250
|
deriveStudentStatus: () => deriveStudentStatus,
|
|
249
251
|
determineGoalStatus: () => determineGoalStatus,
|
|
@@ -2342,9 +2344,9 @@ var CheckboxGroup = ({
|
|
|
2342
2344
|
showSingleItem = false
|
|
2343
2345
|
}) => {
|
|
2344
2346
|
const [openAccordion, setOpenAccordion] = (0, import_react7.useState)("");
|
|
2345
|
-
const autoSelectionAppliedRef = (0, import_react7.useRef)(false);
|
|
2346
2347
|
const onCategoriesChangeRef = (0, import_react7.useRef)(onCategoriesChange);
|
|
2347
2348
|
const previousCategoriesRef = (0, import_react7.useRef)(categories);
|
|
2349
|
+
const appliedAutoSelectionRef = (0, import_react7.useRef)("");
|
|
2348
2350
|
(0, import_react7.useEffect)(() => {
|
|
2349
2351
|
onCategoriesChangeRef.current = onCategoriesChange;
|
|
2350
2352
|
}, [onCategoriesChange]);
|
|
@@ -2365,9 +2367,6 @@ var CheckboxGroup = ({
|
|
|
2365
2367
|
}, [categories]);
|
|
2366
2368
|
(0, import_react7.useEffect)(() => {
|
|
2367
2369
|
const categoriesChanged = categories !== previousCategoriesRef.current;
|
|
2368
|
-
if (!categoriesChanged && autoSelectionAppliedRef.current) {
|
|
2369
|
-
return;
|
|
2370
|
-
}
|
|
2371
2370
|
previousCategoriesRef.current = categories;
|
|
2372
2371
|
const hasAutoSelectionChanges = categoriesWithAutoSelection.some(
|
|
2373
2372
|
(cat, index) => {
|
|
@@ -2375,11 +2374,18 @@ var CheckboxGroup = ({
|
|
|
2375
2374
|
return !areSelectedIdsEqual(cat.selectedIds, originalCat.selectedIds);
|
|
2376
2375
|
}
|
|
2377
2376
|
);
|
|
2378
|
-
if (hasAutoSelectionChanges) {
|
|
2379
|
-
|
|
2377
|
+
if (!hasAutoSelectionChanges) {
|
|
2378
|
+
if (categoriesChanged) {
|
|
2379
|
+
appliedAutoSelectionRef.current = "";
|
|
2380
|
+
}
|
|
2381
|
+
return;
|
|
2382
|
+
}
|
|
2383
|
+
const autoSelectionSignature = JSON.stringify(
|
|
2384
|
+
categoriesWithAutoSelection.map((c) => c.selectedIds)
|
|
2385
|
+
);
|
|
2386
|
+
if (appliedAutoSelectionRef.current !== autoSelectionSignature) {
|
|
2387
|
+
appliedAutoSelectionRef.current = autoSelectionSignature;
|
|
2380
2388
|
onCategoriesChangeRef.current(categoriesWithAutoSelection);
|
|
2381
|
-
} else if (categoriesChanged) {
|
|
2382
|
-
autoSelectionAppliedRef.current = false;
|
|
2383
2389
|
}
|
|
2384
2390
|
}, [categoriesWithAutoSelection, categories]);
|
|
2385
2391
|
const isCheckBoxIsSelected = (categoryKey, itemId) => {
|
|
@@ -2636,36 +2642,24 @@ var CheckboxGroup = ({
|
|
|
2636
2642
|
};
|
|
2637
2643
|
const renderCheckboxItem = (item, categoryKey) => {
|
|
2638
2644
|
const uniqueId = `${categoryKey}-${item.id}`;
|
|
2639
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2658
|
-
"label",
|
|
2659
|
-
{
|
|
2660
|
-
htmlFor: uniqueId,
|
|
2661
|
-
className: "text-sm text-text-950 cursor-pointer select-none",
|
|
2662
|
-
children: item.name
|
|
2663
|
-
}
|
|
2664
|
-
)
|
|
2665
|
-
]
|
|
2666
|
-
},
|
|
2667
|
-
item.id
|
|
2668
|
-
);
|
|
2645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-3 px-2", children: [
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2647
|
+
CheckBox_default,
|
|
2648
|
+
{
|
|
2649
|
+
id: uniqueId,
|
|
2650
|
+
checked: isCheckBoxIsSelected(categoryKey, item.id),
|
|
2651
|
+
onChange: () => toggleItem(categoryKey, item.id)
|
|
2652
|
+
}
|
|
2653
|
+
),
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2655
|
+
"label",
|
|
2656
|
+
{
|
|
2657
|
+
htmlFor: uniqueId,
|
|
2658
|
+
className: "text-sm text-text-950 cursor-pointer select-none",
|
|
2659
|
+
children: item.name
|
|
2660
|
+
}
|
|
2661
|
+
)
|
|
2662
|
+
] }, item.id);
|
|
2669
2663
|
};
|
|
2670
2664
|
const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2671
2665
|
"div",
|
|
@@ -25852,9 +25846,8 @@ var GoalPageTab = /* @__PURE__ */ ((GoalPageTab2) => {
|
|
|
25852
25846
|
GoalPageTab2["MODELS"] = "models";
|
|
25853
25847
|
return GoalPageTab2;
|
|
25854
25848
|
})(GoalPageTab || {});
|
|
25855
|
-
var isNonEmptyArray = (param) => Array.isArray(param) && param.length > 0;
|
|
25856
25849
|
var extractFilterValue = (param) => {
|
|
25857
|
-
if (!
|
|
25850
|
+
if (!Array.isArray(param) || param.length === 0) return {};
|
|
25858
25851
|
return param.length === 1 ? { single: param[0] } : { multiple: param };
|
|
25859
25852
|
};
|
|
25860
25853
|
var buildFiltersFromParams = (params) => {
|
|
@@ -25865,7 +25858,7 @@ var buildFiltersFromParams = (params) => {
|
|
|
25865
25858
|
if (params.search) {
|
|
25866
25859
|
filters.search = params.search;
|
|
25867
25860
|
}
|
|
25868
|
-
if (
|
|
25861
|
+
if (Array.isArray(params.status) && params.status.length > 0) {
|
|
25869
25862
|
filters.status = params.status[0];
|
|
25870
25863
|
}
|
|
25871
25864
|
const schoolFilter = extractFilterValue(params.school);
|
|
@@ -25874,10 +25867,10 @@ var buildFiltersFromParams = (params) => {
|
|
|
25874
25867
|
const classFilter = extractFilterValue(params.class);
|
|
25875
25868
|
if (classFilter.single) filters.classId = classFilter.single;
|
|
25876
25869
|
if (classFilter.multiple) filters.classIds = classFilter.multiple;
|
|
25877
|
-
if (
|
|
25870
|
+
if (Array.isArray(params.students) && params.students.length > 0) {
|
|
25878
25871
|
filters.studentIds = params.students;
|
|
25879
25872
|
}
|
|
25880
|
-
if (
|
|
25873
|
+
if (Array.isArray(params.subject) && params.subject.length > 0) {
|
|
25881
25874
|
filters.subjectId = params.subject[0];
|
|
25882
25875
|
}
|
|
25883
25876
|
if (params.startDate && typeof params.startDate === "string") {
|
|
@@ -27131,8 +27124,225 @@ var RecommendedLessonDetails = ({
|
|
|
27131
27124
|
};
|
|
27132
27125
|
var RecommendedLessonDetails_default = RecommendedLessonDetails;
|
|
27133
27126
|
|
|
27134
|
-
// src/hooks/
|
|
27127
|
+
// src/hooks/useRecommendedLessonsPage.ts
|
|
27135
27128
|
var import_react87 = require("react");
|
|
27129
|
+
var buildQueryParams2 = (filters) => {
|
|
27130
|
+
if (!filters) return {};
|
|
27131
|
+
const params = {};
|
|
27132
|
+
for (const key in filters) {
|
|
27133
|
+
const value = filters[key];
|
|
27134
|
+
if (value !== void 0 && value !== null) {
|
|
27135
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
27136
|
+
params[key] = value;
|
|
27137
|
+
}
|
|
27138
|
+
}
|
|
27139
|
+
}
|
|
27140
|
+
return params;
|
|
27141
|
+
};
|
|
27142
|
+
var getSchoolOptions2 = (userData) => {
|
|
27143
|
+
if (!userData?.userInstitutions) return [];
|
|
27144
|
+
const schoolMap = /* @__PURE__ */ new Map();
|
|
27145
|
+
userData.userInstitutions.forEach((inst) => {
|
|
27146
|
+
if (inst.school?.id && inst.school?.name) {
|
|
27147
|
+
schoolMap.set(inst.school.id, inst.school.name);
|
|
27148
|
+
}
|
|
27149
|
+
});
|
|
27150
|
+
return Array.from(schoolMap.entries()).map(([id, name]) => ({ id, name }));
|
|
27151
|
+
};
|
|
27152
|
+
var getClassOptions2 = (userData) => {
|
|
27153
|
+
if (!userData?.userInstitutions) return [];
|
|
27154
|
+
const classMap = /* @__PURE__ */ new Map();
|
|
27155
|
+
userData.userInstitutions.forEach((inst) => {
|
|
27156
|
+
if (inst.class?.id && inst.class?.name) {
|
|
27157
|
+
classMap.set(inst.class.id, inst.class.name);
|
|
27158
|
+
}
|
|
27159
|
+
});
|
|
27160
|
+
return Array.from(classMap.entries()).map(([id, name]) => ({ id, name }));
|
|
27161
|
+
};
|
|
27162
|
+
var getSubjectOptions3 = (userData) => {
|
|
27163
|
+
if (!userData?.subTeacherTopicClasses) return [];
|
|
27164
|
+
const subjectMap = /* @__PURE__ */ new Map();
|
|
27165
|
+
userData.subTeacherTopicClasses.forEach((stc) => {
|
|
27166
|
+
if (stc.subject?.id && stc.subject?.name) {
|
|
27167
|
+
subjectMap.set(stc.subject.id, stc.subject.name);
|
|
27168
|
+
}
|
|
27169
|
+
});
|
|
27170
|
+
return Array.from(subjectMap.entries()).map(([id, name]) => ({ id, name }));
|
|
27171
|
+
};
|
|
27172
|
+
var createUseRecommendedLessonsPage = (config) => {
|
|
27173
|
+
const {
|
|
27174
|
+
api,
|
|
27175
|
+
navigate,
|
|
27176
|
+
userData,
|
|
27177
|
+
paths,
|
|
27178
|
+
endpoints,
|
|
27179
|
+
texts,
|
|
27180
|
+
emptyStateImage,
|
|
27181
|
+
noSearchImage,
|
|
27182
|
+
mapSubjectNameToEnum: mapSubjectNameToEnum2
|
|
27183
|
+
} = config;
|
|
27184
|
+
return () => {
|
|
27185
|
+
const goalsMapRef = (0, import_react87.useRef)(/* @__PURE__ */ new Map());
|
|
27186
|
+
const [sendModalOpen, setSendModalOpen] = (0, import_react87.useState)(false);
|
|
27187
|
+
const [selectedModel, setSelectedModel] = (0, import_react87.useState)(null);
|
|
27188
|
+
const [sendModalLoading, setSendModalLoading] = (0, import_react87.useState)(false);
|
|
27189
|
+
const [sendModalCategories, setSendModalCategories] = (0, import_react87.useState)([]);
|
|
27190
|
+
const userFilterData = (0, import_react87.useMemo)(
|
|
27191
|
+
() => ({
|
|
27192
|
+
schools: getSchoolOptions2(userData),
|
|
27193
|
+
classes: getClassOptions2(userData),
|
|
27194
|
+
subjects: getSubjectOptions3(userData)
|
|
27195
|
+
}),
|
|
27196
|
+
[userData]
|
|
27197
|
+
);
|
|
27198
|
+
const subjectsMap = (0, import_react87.useMemo)(() => {
|
|
27199
|
+
const map = /* @__PURE__ */ new Map();
|
|
27200
|
+
const subjects = getSubjectOptions3(userData);
|
|
27201
|
+
subjects.forEach((s) => map.set(s.id, s.name));
|
|
27202
|
+
return map;
|
|
27203
|
+
}, [userData]);
|
|
27204
|
+
const fetchGoalsHistory = (0, import_react87.useCallback)(
|
|
27205
|
+
async (filters) => {
|
|
27206
|
+
const params = buildQueryParams2(filters);
|
|
27207
|
+
const response = await api.get(
|
|
27208
|
+
endpoints.goalsHistory,
|
|
27209
|
+
{ params }
|
|
27210
|
+
);
|
|
27211
|
+
const goals = response.data.data.goals;
|
|
27212
|
+
goals.forEach((goal) => {
|
|
27213
|
+
goalsMapRef.current.set(goal.goal.id, goal);
|
|
27214
|
+
});
|
|
27215
|
+
return response.data;
|
|
27216
|
+
},
|
|
27217
|
+
[api, endpoints.goalsHistory]
|
|
27218
|
+
);
|
|
27219
|
+
const fetchGoalModels = (0, import_react87.useCallback)(
|
|
27220
|
+
async (filters) => {
|
|
27221
|
+
const params = buildQueryParams2({
|
|
27222
|
+
...filters,
|
|
27223
|
+
type: "MODELO" /* MODELO */
|
|
27224
|
+
});
|
|
27225
|
+
const response = await api.get(
|
|
27226
|
+
endpoints.goalDrafts,
|
|
27227
|
+
{ params }
|
|
27228
|
+
);
|
|
27229
|
+
return response.data;
|
|
27230
|
+
},
|
|
27231
|
+
[api, endpoints.goalDrafts]
|
|
27232
|
+
);
|
|
27233
|
+
const deleteGoalModel = (0, import_react87.useCallback)(
|
|
27234
|
+
async (id) => {
|
|
27235
|
+
await api.delete(`${endpoints.goalDrafts}/${id}`);
|
|
27236
|
+
},
|
|
27237
|
+
[api, endpoints.goalDrafts]
|
|
27238
|
+
);
|
|
27239
|
+
const handleCreateLesson = (0, import_react87.useCallback)(() => {
|
|
27240
|
+
navigate(paths.createLesson);
|
|
27241
|
+
}, []);
|
|
27242
|
+
const handleCreateModel = (0, import_react87.useCallback)(() => {
|
|
27243
|
+
navigate(paths.createModel);
|
|
27244
|
+
}, []);
|
|
27245
|
+
const handleRowClick = (0, import_react87.useCallback)((row) => {
|
|
27246
|
+
const originalData = goalsMapRef.current.get(row.id);
|
|
27247
|
+
navigate(`${paths.lessonDetails}/${row.id}`, {
|
|
27248
|
+
state: { goalData: originalData }
|
|
27249
|
+
});
|
|
27250
|
+
}, []);
|
|
27251
|
+
const handleEditGoal = (0, import_react87.useCallback)((id) => {
|
|
27252
|
+
navigate(`${paths.editLesson}/${id}/editar`);
|
|
27253
|
+
}, []);
|
|
27254
|
+
const handleEditModel = (0, import_react87.useCallback)((model) => {
|
|
27255
|
+
navigate(`${paths.editModel}${model.id}`);
|
|
27256
|
+
}, []);
|
|
27257
|
+
const handleSendLesson = (0, import_react87.useCallback)(
|
|
27258
|
+
(model) => {
|
|
27259
|
+
setSelectedModel(model);
|
|
27260
|
+
const classes = getClassOptions2(userData);
|
|
27261
|
+
const categories = [];
|
|
27262
|
+
if (classes.length > 0) {
|
|
27263
|
+
categories.push({
|
|
27264
|
+
key: "students",
|
|
27265
|
+
label: "Turmas",
|
|
27266
|
+
selectedIds: [],
|
|
27267
|
+
itens: classes.map((cls) => ({
|
|
27268
|
+
id: cls.id,
|
|
27269
|
+
name: cls.name,
|
|
27270
|
+
studentId: cls.id,
|
|
27271
|
+
userInstitutionId: cls.id
|
|
27272
|
+
}))
|
|
27273
|
+
});
|
|
27274
|
+
}
|
|
27275
|
+
setSendModalCategories(categories);
|
|
27276
|
+
setSendModalOpen(true);
|
|
27277
|
+
},
|
|
27278
|
+
[userData]
|
|
27279
|
+
);
|
|
27280
|
+
const handleSendLessonSubmit = (0, import_react87.useCallback)(
|
|
27281
|
+
async (formData) => {
|
|
27282
|
+
if (!selectedModel) return;
|
|
27283
|
+
setSendModalLoading(true);
|
|
27284
|
+
try {
|
|
27285
|
+
await api.post(endpoints.submitGoal, {
|
|
27286
|
+
draftId: selectedModel.id,
|
|
27287
|
+
students: formData.students,
|
|
27288
|
+
startDate: `${formData.startDate}T${formData.startTime}:00`,
|
|
27289
|
+
finalDate: `${formData.finalDate}T${formData.finalTime}:00`
|
|
27290
|
+
});
|
|
27291
|
+
setSendModalOpen(false);
|
|
27292
|
+
setSelectedModel(null);
|
|
27293
|
+
} finally {
|
|
27294
|
+
setSendModalLoading(false);
|
|
27295
|
+
}
|
|
27296
|
+
},
|
|
27297
|
+
[api, endpoints.submitGoal, selectedModel]
|
|
27298
|
+
);
|
|
27299
|
+
const handleSendModalClose = (0, import_react87.useCallback)(() => {
|
|
27300
|
+
setSendModalOpen(false);
|
|
27301
|
+
setSelectedModel(null);
|
|
27302
|
+
}, []);
|
|
27303
|
+
const handleCategoriesChange = (0, import_react87.useCallback)(
|
|
27304
|
+
(categories) => {
|
|
27305
|
+
setSendModalCategories(categories);
|
|
27306
|
+
},
|
|
27307
|
+
[]
|
|
27308
|
+
);
|
|
27309
|
+
return {
|
|
27310
|
+
historyProps: {
|
|
27311
|
+
fetchGoalsHistory,
|
|
27312
|
+
fetchGoalModels,
|
|
27313
|
+
deleteGoalModel,
|
|
27314
|
+
onCreateLesson: handleCreateLesson,
|
|
27315
|
+
onCreateModel: handleCreateModel,
|
|
27316
|
+
onRowClick: handleRowClick,
|
|
27317
|
+
onEditGoal: handleEditGoal,
|
|
27318
|
+
onEditModel: handleEditModel,
|
|
27319
|
+
onSendLesson: handleSendLesson,
|
|
27320
|
+
emptyStateImage,
|
|
27321
|
+
noSearchImage,
|
|
27322
|
+
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
27323
|
+
userFilterData,
|
|
27324
|
+
subjectsMap,
|
|
27325
|
+
title: texts.title,
|
|
27326
|
+
createButtonText: texts.createButtonText,
|
|
27327
|
+
searchPlaceholder: texts.searchPlaceholder
|
|
27328
|
+
},
|
|
27329
|
+
modalProps: {
|
|
27330
|
+
isOpen: sendModalOpen,
|
|
27331
|
+
onClose: handleSendModalClose,
|
|
27332
|
+
onSubmit: handleSendLessonSubmit,
|
|
27333
|
+
categories: sendModalCategories,
|
|
27334
|
+
onCategoriesChange: handleCategoriesChange,
|
|
27335
|
+
isLoading: sendModalLoading,
|
|
27336
|
+
modalTitle: selectedModel?.title
|
|
27337
|
+
},
|
|
27338
|
+
navigate
|
|
27339
|
+
};
|
|
27340
|
+
};
|
|
27341
|
+
};
|
|
27342
|
+
var createRecommendedLessonsPageHook = createUseRecommendedLessonsPage;
|
|
27343
|
+
|
|
27344
|
+
// src/hooks/useRecommendedLessonDetails.ts
|
|
27345
|
+
var import_react88 = require("react");
|
|
27136
27346
|
var import_zod8 = require("zod");
|
|
27137
27347
|
var goalLessonSubjectSchema = import_zod8.z.object({
|
|
27138
27348
|
id: import_zod8.z.string(),
|
|
@@ -27235,12 +27445,12 @@ var handleLessonDetailsFetchError = (error) => {
|
|
|
27235
27445
|
};
|
|
27236
27446
|
var createUseRecommendedLessonDetails = (apiClient) => {
|
|
27237
27447
|
return (lessonId) => {
|
|
27238
|
-
const [state, setState] = (0,
|
|
27448
|
+
const [state, setState] = (0, import_react88.useState)({
|
|
27239
27449
|
data: null,
|
|
27240
27450
|
loading: true,
|
|
27241
27451
|
error: null
|
|
27242
27452
|
});
|
|
27243
|
-
const fetchLessonDetails = (0,
|
|
27453
|
+
const fetchLessonDetails = (0, import_react88.useCallback)(async () => {
|
|
27244
27454
|
if (!lessonId) {
|
|
27245
27455
|
setState({
|
|
27246
27456
|
data: null,
|
|
@@ -27286,7 +27496,7 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
27286
27496
|
});
|
|
27287
27497
|
}
|
|
27288
27498
|
}, [lessonId]);
|
|
27289
|
-
(0,
|
|
27499
|
+
(0, import_react88.useEffect)(() => {
|
|
27290
27500
|
fetchLessonDetails();
|
|
27291
27501
|
}, [fetchLessonDetails]);
|
|
27292
27502
|
return {
|
|
@@ -27298,10 +27508,10 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
27298
27508
|
var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
|
|
27299
27509
|
|
|
27300
27510
|
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
27301
|
-
var
|
|
27511
|
+
var import_react92 = require("react");
|
|
27302
27512
|
|
|
27303
27513
|
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
27304
|
-
var
|
|
27514
|
+
var import_react90 = require("react");
|
|
27305
27515
|
var import_phosphor_react52 = require("phosphor-react");
|
|
27306
27516
|
|
|
27307
27517
|
// src/components/ActivitiesHistory/config/historyTableColumns.tsx
|
|
@@ -27315,7 +27525,6 @@ var renderTruncatedText = (value) => {
|
|
|
27315
27525
|
};
|
|
27316
27526
|
|
|
27317
27527
|
// src/components/ActivitiesHistory/utils/filterBuilders.ts
|
|
27318
|
-
var isNonEmptyArray2 = (param) => Array.isArray(param) && param.length > 0;
|
|
27319
27528
|
var isValidApiStatus = (value) => Object.values(GenericApiStatus).includes(value);
|
|
27320
27529
|
var buildHistoryFiltersFromParams = (params) => {
|
|
27321
27530
|
const filters = {
|
|
@@ -27325,13 +27534,13 @@ var buildHistoryFiltersFromParams = (params) => {
|
|
|
27325
27534
|
if (params.search) {
|
|
27326
27535
|
filters.search = params.search;
|
|
27327
27536
|
}
|
|
27328
|
-
if (
|
|
27537
|
+
if (Array.isArray(params.status) && params.status.length > 0 && isValidApiStatus(params.status[0])) {
|
|
27329
27538
|
filters.status = params.status[0];
|
|
27330
27539
|
}
|
|
27331
|
-
if (
|
|
27540
|
+
if (Array.isArray(params.school) && params.school.length > 0) {
|
|
27332
27541
|
filters.schoolId = params.school[0];
|
|
27333
27542
|
}
|
|
27334
|
-
if (
|
|
27543
|
+
if (Array.isArray(params.subject) && params.subject.length > 0) {
|
|
27335
27544
|
filters.subjectId = params.subject[0];
|
|
27336
27545
|
}
|
|
27337
27546
|
return filters;
|
|
@@ -27344,21 +27553,21 @@ var buildModelsFiltersFromParams = (params) => {
|
|
|
27344
27553
|
if (params.search) {
|
|
27345
27554
|
filters.search = params.search;
|
|
27346
27555
|
}
|
|
27347
|
-
if (
|
|
27556
|
+
if (Array.isArray(params.subject) && params.subject.length > 0) {
|
|
27348
27557
|
filters.subjectId = params.subject[0];
|
|
27349
27558
|
}
|
|
27350
27559
|
return filters;
|
|
27351
27560
|
};
|
|
27352
27561
|
|
|
27353
27562
|
// src/components/ActivitiesHistory/utils/filterOptions.ts
|
|
27354
|
-
var
|
|
27563
|
+
var getSchoolOptions3 = (data) => {
|
|
27355
27564
|
if (!data?.schools) return [];
|
|
27356
27565
|
return data.schools.map((school) => ({
|
|
27357
27566
|
id: school.id,
|
|
27358
27567
|
name: school.name
|
|
27359
27568
|
}));
|
|
27360
27569
|
};
|
|
27361
|
-
var
|
|
27570
|
+
var getSubjectOptions4 = (data) => {
|
|
27362
27571
|
if (!data?.subjects) return [];
|
|
27363
27572
|
return data.subjects.map((subject) => ({
|
|
27364
27573
|
id: subject.id,
|
|
@@ -27494,7 +27703,7 @@ var createHistoryFiltersConfig = (userData) => [
|
|
|
27494
27703
|
key: "school",
|
|
27495
27704
|
label: "Escola",
|
|
27496
27705
|
selectedIds: [],
|
|
27497
|
-
itens:
|
|
27706
|
+
itens: getSchoolOptions3(userData)
|
|
27498
27707
|
}
|
|
27499
27708
|
]
|
|
27500
27709
|
},
|
|
@@ -27506,14 +27715,14 @@ var createHistoryFiltersConfig = (userData) => [
|
|
|
27506
27715
|
key: "subject",
|
|
27507
27716
|
label: "Mat\xE9ria",
|
|
27508
27717
|
selectedIds: [],
|
|
27509
|
-
itens:
|
|
27718
|
+
itens: getSubjectOptions4(userData)
|
|
27510
27719
|
}
|
|
27511
27720
|
]
|
|
27512
27721
|
}
|
|
27513
27722
|
];
|
|
27514
27723
|
|
|
27515
27724
|
// src/hooks/useActivitiesHistory.ts
|
|
27516
|
-
var
|
|
27725
|
+
var import_react89 = require("react");
|
|
27517
27726
|
var import_zod9 = require("zod");
|
|
27518
27727
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
27519
27728
|
var activityHistoryResponseSchema = import_zod9.z.object({
|
|
@@ -27572,13 +27781,13 @@ var handleActivityFetchError = createFetchErrorHandler(
|
|
|
27572
27781
|
);
|
|
27573
27782
|
var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
27574
27783
|
return () => {
|
|
27575
|
-
const [state, setState] = (0,
|
|
27784
|
+
const [state, setState] = (0, import_react89.useState)({
|
|
27576
27785
|
activities: [],
|
|
27577
27786
|
loading: false,
|
|
27578
27787
|
error: null,
|
|
27579
27788
|
pagination: DEFAULT_ACTIVITIES_PAGINATION
|
|
27580
27789
|
});
|
|
27581
|
-
const fetchActivities = (0,
|
|
27790
|
+
const fetchActivities = (0, import_react89.useCallback)(
|
|
27582
27791
|
async (filters) => {
|
|
27583
27792
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
27584
27793
|
try {
|
|
@@ -27623,9 +27832,9 @@ var HistoryTab = ({
|
|
|
27623
27832
|
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
27624
27833
|
userFilterData
|
|
27625
27834
|
}) => {
|
|
27626
|
-
const fetchActivitiesHistoryRef = (0,
|
|
27835
|
+
const fetchActivitiesHistoryRef = (0, import_react90.useRef)(fetchActivitiesHistory);
|
|
27627
27836
|
fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
|
|
27628
|
-
const useActivitiesHistory = (0,
|
|
27837
|
+
const useActivitiesHistory = (0, import_react90.useMemo)(
|
|
27629
27838
|
() => createUseActivitiesHistory(
|
|
27630
27839
|
(filters) => fetchActivitiesHistoryRef.current(filters)
|
|
27631
27840
|
),
|
|
@@ -27638,15 +27847,15 @@ var HistoryTab = ({
|
|
|
27638
27847
|
pagination,
|
|
27639
27848
|
fetchActivities
|
|
27640
27849
|
} = useActivitiesHistory();
|
|
27641
|
-
const historyFilterConfigs = (0,
|
|
27850
|
+
const historyFilterConfigs = (0, import_react90.useMemo)(
|
|
27642
27851
|
() => createHistoryFiltersConfig(userFilterData),
|
|
27643
27852
|
[userFilterData]
|
|
27644
27853
|
);
|
|
27645
|
-
const historyTableColumns = (0,
|
|
27854
|
+
const historyTableColumns = (0, import_react90.useMemo)(
|
|
27646
27855
|
() => createHistoryTableColumns(mapSubjectNameToEnum2),
|
|
27647
27856
|
[mapSubjectNameToEnum2]
|
|
27648
27857
|
);
|
|
27649
|
-
const handleParamsChange = (0,
|
|
27858
|
+
const handleParamsChange = (0, import_react90.useCallback)(
|
|
27650
27859
|
(params) => {
|
|
27651
27860
|
const filters = buildHistoryFiltersFromParams(params);
|
|
27652
27861
|
fetchActivities(filters);
|
|
@@ -27738,14 +27947,14 @@ var createModelsFiltersConfig = (userData) => [
|
|
|
27738
27947
|
key: "subject",
|
|
27739
27948
|
label: "Mat\xE9ria",
|
|
27740
27949
|
selectedIds: [],
|
|
27741
|
-
itens:
|
|
27950
|
+
itens: getSubjectOptions4(userData)
|
|
27742
27951
|
}
|
|
27743
27952
|
]
|
|
27744
27953
|
}
|
|
27745
27954
|
];
|
|
27746
27955
|
|
|
27747
27956
|
// src/hooks/useActivityModels.ts
|
|
27748
|
-
var
|
|
27957
|
+
var import_react91 = require("react");
|
|
27749
27958
|
var import_zod10 = require("zod");
|
|
27750
27959
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
27751
27960
|
var activityDraftFiltersSchema = import_zod10.z.object({
|
|
@@ -27795,13 +28004,13 @@ var handleModelFetchError = createFetchErrorHandler(
|
|
|
27795
28004
|
);
|
|
27796
28005
|
var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
27797
28006
|
return () => {
|
|
27798
|
-
const [state, setState] = (0,
|
|
28007
|
+
const [state, setState] = (0, import_react91.useState)({
|
|
27799
28008
|
models: [],
|
|
27800
28009
|
loading: false,
|
|
27801
28010
|
error: null,
|
|
27802
28011
|
pagination: DEFAULT_MODELS_PAGINATION
|
|
27803
28012
|
});
|
|
27804
|
-
const fetchModels = (0,
|
|
28013
|
+
const fetchModels = (0, import_react91.useCallback)(
|
|
27805
28014
|
async (filters, subjectsMap) => {
|
|
27806
28015
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
27807
28016
|
try {
|
|
@@ -27836,7 +28045,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
|
27836
28045
|
},
|
|
27837
28046
|
[fetchActivityModels]
|
|
27838
28047
|
);
|
|
27839
|
-
const deleteModel = (0,
|
|
28048
|
+
const deleteModel = (0, import_react91.useCallback)(
|
|
27840
28049
|
async (id) => {
|
|
27841
28050
|
try {
|
|
27842
28051
|
await deleteActivityModel(id);
|
|
@@ -27939,7 +28148,7 @@ var ActivitiesHistory = ({
|
|
|
27939
28148
|
userFilterData,
|
|
27940
28149
|
subjectsMap
|
|
27941
28150
|
}) => {
|
|
27942
|
-
const [activeTab, setActiveTab] = (0,
|
|
28151
|
+
const [activeTab, setActiveTab] = (0, import_react92.useState)("history" /* HISTORY */);
|
|
27943
28152
|
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
27944
28153
|
"div",
|
|
27945
28154
|
{
|
|
@@ -28178,7 +28387,7 @@ var buildUserFilterData = (userData) => ({
|
|
|
28178
28387
|
});
|
|
28179
28388
|
|
|
28180
28389
|
// src/hooks/useChat.ts
|
|
28181
|
-
var
|
|
28390
|
+
var import_react93 = require("react");
|
|
28182
28391
|
var WS_STATES = {
|
|
28183
28392
|
CONNECTING: 0,
|
|
28184
28393
|
OPEN: 1,
|
|
@@ -28197,25 +28406,25 @@ function useChat({
|
|
|
28197
28406
|
reconnectInterval = 3e3,
|
|
28198
28407
|
maxReconnectAttempts = 5
|
|
28199
28408
|
}) {
|
|
28200
|
-
const [isConnected, setIsConnected] = (0,
|
|
28201
|
-
const [messages, setMessages] = (0,
|
|
28202
|
-
const [participants, setParticipants] = (0,
|
|
28203
|
-
const [error, setError] = (0,
|
|
28204
|
-
const wsRef = (0,
|
|
28205
|
-
const reconnectAttemptsRef = (0,
|
|
28206
|
-
const reconnectTimeoutRef = (0,
|
|
28409
|
+
const [isConnected, setIsConnected] = (0, import_react93.useState)(false);
|
|
28410
|
+
const [messages, setMessages] = (0, import_react93.useState)([]);
|
|
28411
|
+
const [participants, setParticipants] = (0, import_react93.useState)([]);
|
|
28412
|
+
const [error, setError] = (0, import_react93.useState)(null);
|
|
28413
|
+
const wsRef = (0, import_react93.useRef)(null);
|
|
28414
|
+
const reconnectAttemptsRef = (0, import_react93.useRef)(0);
|
|
28415
|
+
const reconnectTimeoutRef = (0, import_react93.useRef)(
|
|
28207
28416
|
null
|
|
28208
28417
|
);
|
|
28209
|
-
const isManualDisconnectRef = (0,
|
|
28210
|
-
const isConnectingRef = (0,
|
|
28211
|
-
const connectRef = (0,
|
|
28418
|
+
const isManualDisconnectRef = (0, import_react93.useRef)(false);
|
|
28419
|
+
const isConnectingRef = (0, import_react93.useRef)(false);
|
|
28420
|
+
const connectRef = (0, import_react93.useRef)(() => {
|
|
28212
28421
|
});
|
|
28213
|
-
const sendWsMessage = (0,
|
|
28422
|
+
const sendWsMessage = (0, import_react93.useCallback)((message) => {
|
|
28214
28423
|
if (wsRef.current?.readyState === WS_STATES.OPEN) {
|
|
28215
28424
|
wsRef.current.send(JSON.stringify(message));
|
|
28216
28425
|
}
|
|
28217
28426
|
}, []);
|
|
28218
|
-
const sendMessage = (0,
|
|
28427
|
+
const sendMessage = (0, import_react93.useCallback)(
|
|
28219
28428
|
(content) => {
|
|
28220
28429
|
const trimmedContent = content.trim();
|
|
28221
28430
|
if (!trimmedContent) return;
|
|
@@ -28226,12 +28435,12 @@ function useChat({
|
|
|
28226
28435
|
},
|
|
28227
28436
|
[sendWsMessage]
|
|
28228
28437
|
);
|
|
28229
|
-
const leave = (0,
|
|
28438
|
+
const leave = (0, import_react93.useCallback)(() => {
|
|
28230
28439
|
isManualDisconnectRef.current = true;
|
|
28231
28440
|
sendWsMessage({ type: "leave" });
|
|
28232
28441
|
wsRef.current?.close(1e3, "User left");
|
|
28233
28442
|
}, [sendWsMessage]);
|
|
28234
|
-
const handleMessage = (0,
|
|
28443
|
+
const handleMessage = (0, import_react93.useCallback)(
|
|
28235
28444
|
(event) => {
|
|
28236
28445
|
try {
|
|
28237
28446
|
const data = JSON.parse(event.data);
|
|
@@ -28299,7 +28508,7 @@ function useChat({
|
|
|
28299
28508
|
},
|
|
28300
28509
|
[onError]
|
|
28301
28510
|
);
|
|
28302
|
-
const connect = (0,
|
|
28511
|
+
const connect = (0, import_react93.useCallback)(() => {
|
|
28303
28512
|
if (isConnectingRef.current) {
|
|
28304
28513
|
return;
|
|
28305
28514
|
}
|
|
@@ -28353,12 +28562,12 @@ function useChat({
|
|
|
28353
28562
|
maxReconnectAttempts
|
|
28354
28563
|
]);
|
|
28355
28564
|
connectRef.current = connect;
|
|
28356
|
-
const reconnect = (0,
|
|
28565
|
+
const reconnect = (0, import_react93.useCallback)(() => {
|
|
28357
28566
|
isManualDisconnectRef.current = false;
|
|
28358
28567
|
reconnectAttemptsRef.current = 0;
|
|
28359
28568
|
connectRef.current();
|
|
28360
28569
|
}, []);
|
|
28361
|
-
(0,
|
|
28570
|
+
(0, import_react93.useEffect)(() => {
|
|
28362
28571
|
if (!roomId) {
|
|
28363
28572
|
return;
|
|
28364
28573
|
}
|
|
@@ -28402,15 +28611,15 @@ function createUseChat(baseWsUrl) {
|
|
|
28402
28611
|
}
|
|
28403
28612
|
|
|
28404
28613
|
// src/hooks/useChatRooms.ts
|
|
28405
|
-
var
|
|
28614
|
+
var import_react94 = require("react");
|
|
28406
28615
|
function useChatRooms({
|
|
28407
28616
|
apiClient
|
|
28408
28617
|
}) {
|
|
28409
|
-
const [rooms, setRooms] = (0,
|
|
28410
|
-
const [availableUsers, setAvailableUsers] = (0,
|
|
28411
|
-
const [loading, setLoading] = (0,
|
|
28412
|
-
const [error, setError] = (0,
|
|
28413
|
-
const fetchRooms = (0,
|
|
28618
|
+
const [rooms, setRooms] = (0, import_react94.useState)([]);
|
|
28619
|
+
const [availableUsers, setAvailableUsers] = (0, import_react94.useState)([]);
|
|
28620
|
+
const [loading, setLoading] = (0, import_react94.useState)(false);
|
|
28621
|
+
const [error, setError] = (0, import_react94.useState)(null);
|
|
28622
|
+
const fetchRooms = (0, import_react94.useCallback)(async () => {
|
|
28414
28623
|
setLoading(true);
|
|
28415
28624
|
setError(null);
|
|
28416
28625
|
try {
|
|
@@ -28426,7 +28635,7 @@ function useChatRooms({
|
|
|
28426
28635
|
setLoading(false);
|
|
28427
28636
|
}
|
|
28428
28637
|
}, [apiClient]);
|
|
28429
|
-
const fetchAvailableUsers = (0,
|
|
28638
|
+
const fetchAvailableUsers = (0, import_react94.useCallback)(async () => {
|
|
28430
28639
|
setLoading(true);
|
|
28431
28640
|
setError(null);
|
|
28432
28641
|
try {
|
|
@@ -28442,7 +28651,7 @@ function useChatRooms({
|
|
|
28442
28651
|
setLoading(false);
|
|
28443
28652
|
}
|
|
28444
28653
|
}, [apiClient]);
|
|
28445
|
-
const createRoom = (0,
|
|
28654
|
+
const createRoom = (0, import_react94.useCallback)(
|
|
28446
28655
|
async (participantIds) => {
|
|
28447
28656
|
setLoading(true);
|
|
28448
28657
|
setError(null);
|
|
@@ -28466,7 +28675,7 @@ function useChatRooms({
|
|
|
28466
28675
|
},
|
|
28467
28676
|
[apiClient, fetchRooms]
|
|
28468
28677
|
);
|
|
28469
|
-
const clearError = (0,
|
|
28678
|
+
const clearError = (0, import_react94.useCallback)(() => {
|
|
28470
28679
|
setError(null);
|
|
28471
28680
|
}, []);
|
|
28472
28681
|
return {
|
|
@@ -28500,8 +28709,8 @@ var CHAT_MESSAGE_TYPES = {
|
|
|
28500
28709
|
};
|
|
28501
28710
|
|
|
28502
28711
|
// src/components/Chat/Chat.tsx
|
|
28503
|
-
var
|
|
28504
|
-
var
|
|
28712
|
+
var import_react95 = require("react");
|
|
28713
|
+
var import_react96 = require("@phosphor-icons/react");
|
|
28505
28714
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
28506
28715
|
var RoomItem = ({
|
|
28507
28716
|
room,
|
|
@@ -28518,7 +28727,7 @@ var RoomItem = ({
|
|
|
28518
28727
|
isActive && "bg-primary-50 border-l-4 border-primary-500"
|
|
28519
28728
|
),
|
|
28520
28729
|
children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex items-start gap-3 w-full", children: [
|
|
28521
|
-
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "w-10 h-10 rounded-full bg-primary-100 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
28730
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "w-10 h-10 rounded-full bg-primary-100 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_react96.UsersIcon, { size: 20, className: "text-primary-600" }) }),
|
|
28522
28731
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
28523
28732
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Text_default, { size: "sm", weight: "semibold", className: "text-text-900 truncate", children: room.name }),
|
|
28524
28733
|
room.lastMessage && /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(Text_default, { size: "xs", className: "text-text-500 truncate mt-1", children: [
|
|
@@ -28648,16 +28857,16 @@ function ChatContent({
|
|
|
28648
28857
|
onRoomChange,
|
|
28649
28858
|
onBackToList
|
|
28650
28859
|
}) {
|
|
28651
|
-
const [view, setView] = (0,
|
|
28652
|
-
const [selectedRoom, setSelectedRoom] = (0,
|
|
28860
|
+
const [view, setView] = (0, import_react95.useState)("list");
|
|
28861
|
+
const [selectedRoom, setSelectedRoom] = (0, import_react95.useState)(
|
|
28653
28862
|
null
|
|
28654
28863
|
);
|
|
28655
|
-
const [selectedUserIds, setSelectedUserIds] = (0,
|
|
28864
|
+
const [selectedUserIds, setSelectedUserIds] = (0, import_react95.useState)(
|
|
28656
28865
|
/* @__PURE__ */ new Set()
|
|
28657
28866
|
);
|
|
28658
|
-
const [messageInput, setMessageInput] = (0,
|
|
28659
|
-
const [showCreateModal, setShowCreateModal] = (0,
|
|
28660
|
-
const hasHandledInitialRoomRef = (0,
|
|
28867
|
+
const [messageInput, setMessageInput] = (0, import_react95.useState)("");
|
|
28868
|
+
const [showCreateModal, setShowCreateModal] = (0, import_react95.useState)(false);
|
|
28869
|
+
const hasHandledInitialRoomRef = (0, import_react95.useRef)(false);
|
|
28661
28870
|
const {
|
|
28662
28871
|
rooms,
|
|
28663
28872
|
availableUsers,
|
|
@@ -28685,10 +28894,10 @@ function ChatContent({
|
|
|
28685
28894
|
const getRoleLabel = () => {
|
|
28686
28895
|
return userRole === "TEACHER" /* TEACHER */ ? "Professor" : "Aluno";
|
|
28687
28896
|
};
|
|
28688
|
-
(0,
|
|
28897
|
+
(0, import_react95.useEffect)(() => {
|
|
28689
28898
|
fetchRooms();
|
|
28690
28899
|
}, [fetchRooms]);
|
|
28691
|
-
(0,
|
|
28900
|
+
(0, import_react95.useEffect)(() => {
|
|
28692
28901
|
if (hasHandledInitialRoomRef.current) {
|
|
28693
28902
|
return;
|
|
28694
28903
|
}
|
|
@@ -28710,7 +28919,7 @@ function ChatContent({
|
|
|
28710
28919
|
onBackToList?.();
|
|
28711
28920
|
}
|
|
28712
28921
|
}, [initialRoomId, rooms, roomsLoading, onBackToList]);
|
|
28713
|
-
const handleSelectRoom = (0,
|
|
28922
|
+
const handleSelectRoom = (0, import_react95.useCallback)(
|
|
28714
28923
|
(room) => {
|
|
28715
28924
|
setSelectedRoom(room);
|
|
28716
28925
|
setView("room");
|
|
@@ -28718,12 +28927,12 @@ function ChatContent({
|
|
|
28718
28927
|
},
|
|
28719
28928
|
[onRoomChange]
|
|
28720
28929
|
);
|
|
28721
|
-
const handleOpenCreateModal = (0,
|
|
28930
|
+
const handleOpenCreateModal = (0, import_react95.useCallback)(async () => {
|
|
28722
28931
|
await fetchAvailableUsers();
|
|
28723
28932
|
setSelectedUserIds(/* @__PURE__ */ new Set());
|
|
28724
28933
|
setShowCreateModal(true);
|
|
28725
28934
|
}, [fetchAvailableUsers]);
|
|
28726
|
-
const handleToggleUser = (0,
|
|
28935
|
+
const handleToggleUser = (0, import_react95.useCallback)((id) => {
|
|
28727
28936
|
setSelectedUserIds((prev) => {
|
|
28728
28937
|
const next = new Set(prev);
|
|
28729
28938
|
if (next.has(id)) {
|
|
@@ -28734,7 +28943,7 @@ function ChatContent({
|
|
|
28734
28943
|
return next;
|
|
28735
28944
|
});
|
|
28736
28945
|
}, []);
|
|
28737
|
-
const handleCreateRoom = (0,
|
|
28946
|
+
const handleCreateRoom = (0, import_react95.useCallback)(async () => {
|
|
28738
28947
|
if (selectedUserIds.size === 0) return;
|
|
28739
28948
|
const room = await createRoom(Array.from(selectedUserIds));
|
|
28740
28949
|
if (room) {
|
|
@@ -28743,12 +28952,12 @@ function ChatContent({
|
|
|
28743
28952
|
onRoomChange?.(room.id);
|
|
28744
28953
|
}
|
|
28745
28954
|
}, [selectedUserIds, createRoom, onRoomChange]);
|
|
28746
|
-
const handleSendMessage = (0,
|
|
28955
|
+
const handleSendMessage = (0, import_react95.useCallback)(() => {
|
|
28747
28956
|
if (!messageInput.trim()) return;
|
|
28748
28957
|
sendMessage(messageInput);
|
|
28749
28958
|
setMessageInput("");
|
|
28750
28959
|
}, [messageInput, sendMessage]);
|
|
28751
|
-
const handleBackToList = (0,
|
|
28960
|
+
const handleBackToList = (0, import_react95.useCallback)(() => {
|
|
28752
28961
|
setSelectedRoom(null);
|
|
28753
28962
|
setView("list");
|
|
28754
28963
|
onBackToList?.();
|
|
@@ -28801,7 +29010,7 @@ function ChatContent({
|
|
|
28801
29010
|
variant: "solid",
|
|
28802
29011
|
size: "small",
|
|
28803
29012
|
onClick: handleOpenCreateModal,
|
|
28804
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
29013
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_react96.PlusIcon, { size: 16 }),
|
|
28805
29014
|
children: "Nova conversa"
|
|
28806
29015
|
}
|
|
28807
29016
|
)
|
|
@@ -28841,7 +29050,7 @@ function ChatContent({
|
|
|
28841
29050
|
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex h-full", children: [
|
|
28842
29051
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex-1 flex flex-col", children: [
|
|
28843
29052
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "p-4 border-b border-background-200 flex items-center gap-3", children: [
|
|
28844
|
-
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Button_default, { variant: "link", size: "small", onClick: handleBackToList, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
29053
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Button_default, { variant: "link", size: "small", onClick: handleBackToList, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_react96.XIcon, { size: 20 }) }),
|
|
28845
29054
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex-1", children: [
|
|
28846
29055
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Text_default, { size: "md", weight: "semibold", className: "text-text-900", children: selectedRoom.name }),
|
|
28847
29056
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Text_default, { size: "xs", className: "text-text-500", children: isConnected ? "Conectado" : "Conectando..." })
|
|
@@ -28870,7 +29079,7 @@ function ChatContent({
|
|
|
28870
29079
|
variant: "solid",
|
|
28871
29080
|
onClick: handleSendMessage,
|
|
28872
29081
|
disabled: !messageInput.trim() || !isConnected,
|
|
28873
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
29082
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_react96.PaperPlaneTiltIcon, { size: 20 })
|
|
28874
29083
|
}
|
|
28875
29084
|
)
|
|
28876
29085
|
] }) })
|
|
@@ -28994,7 +29203,7 @@ var CalendarActivityStatus = /* @__PURE__ */ ((CalendarActivityStatus2) => {
|
|
|
28994
29203
|
})(CalendarActivityStatus || {});
|
|
28995
29204
|
|
|
28996
29205
|
// src/hooks/useSendActivity.ts
|
|
28997
|
-
var
|
|
29206
|
+
var import_react97 = require("react");
|
|
28998
29207
|
var import_dayjs7 = __toESM(require("dayjs"));
|
|
28999
29208
|
function transformToCategoryConfig(data) {
|
|
29000
29209
|
return [
|
|
@@ -29024,7 +29233,7 @@ function transformToCategoryConfig(data) {
|
|
|
29024
29233
|
selectedIds: []
|
|
29025
29234
|
},
|
|
29026
29235
|
{
|
|
29027
|
-
key: "
|
|
29236
|
+
key: "students",
|
|
29028
29237
|
label: "Aluno",
|
|
29029
29238
|
dependsOn: ["escola", "serie", "turma"],
|
|
29030
29239
|
itens: data.students,
|
|
@@ -29049,21 +29258,21 @@ function useSendActivity(config) {
|
|
|
29049
29258
|
onSuccess,
|
|
29050
29259
|
onError
|
|
29051
29260
|
} = config;
|
|
29052
|
-
const [isOpen, setIsOpen] = (0,
|
|
29053
|
-
const [selectedModel, setSelectedModel] = (0,
|
|
29261
|
+
const [isOpen, setIsOpen] = (0, import_react97.useState)(false);
|
|
29262
|
+
const [selectedModel, setSelectedModel] = (0, import_react97.useState)(
|
|
29054
29263
|
null
|
|
29055
29264
|
);
|
|
29056
|
-
const [categories, setCategories] = (0,
|
|
29057
|
-
const [isLoading, setIsLoading] = (0,
|
|
29058
|
-
const [isCategoriesLoading, setIsCategoriesLoading] = (0,
|
|
29059
|
-
const categoriesLoadedRef = (0,
|
|
29060
|
-
const initialData = (0,
|
|
29265
|
+
const [categories, setCategories] = (0, import_react97.useState)([]);
|
|
29266
|
+
const [isLoading, setIsLoading] = (0, import_react97.useState)(false);
|
|
29267
|
+
const [isCategoriesLoading, setIsCategoriesLoading] = (0, import_react97.useState)(false);
|
|
29268
|
+
const categoriesLoadedRef = (0, import_react97.useRef)(false);
|
|
29269
|
+
const initialData = (0, import_react97.useMemo)(() => {
|
|
29061
29270
|
if (!selectedModel) return void 0;
|
|
29062
29271
|
return {
|
|
29063
29272
|
title: selectedModel.title
|
|
29064
29273
|
};
|
|
29065
29274
|
}, [selectedModel]);
|
|
29066
|
-
const loadCategories = (0,
|
|
29275
|
+
const loadCategories = (0, import_react97.useCallback)(async () => {
|
|
29067
29276
|
if (categoriesLoadedRef.current) return;
|
|
29068
29277
|
setIsCategoriesLoading(true);
|
|
29069
29278
|
try {
|
|
@@ -29078,7 +29287,7 @@ function useSendActivity(config) {
|
|
|
29078
29287
|
setIsCategoriesLoading(false);
|
|
29079
29288
|
}
|
|
29080
29289
|
}, [fetchCategories, onError]);
|
|
29081
|
-
const openModal = (0,
|
|
29290
|
+
const openModal = (0, import_react97.useCallback)(
|
|
29082
29291
|
(model) => {
|
|
29083
29292
|
setSelectedModel(model);
|
|
29084
29293
|
setIsOpen(true);
|
|
@@ -29086,17 +29295,17 @@ function useSendActivity(config) {
|
|
|
29086
29295
|
},
|
|
29087
29296
|
[loadCategories]
|
|
29088
29297
|
);
|
|
29089
|
-
const closeModal = (0,
|
|
29298
|
+
const closeModal = (0, import_react97.useCallback)(() => {
|
|
29090
29299
|
setIsOpen(false);
|
|
29091
29300
|
setSelectedModel(null);
|
|
29092
29301
|
}, []);
|
|
29093
|
-
const onCategoriesChange = (0,
|
|
29302
|
+
const onCategoriesChange = (0, import_react97.useCallback)(
|
|
29094
29303
|
(updatedCategories) => {
|
|
29095
29304
|
setCategories(updatedCategories);
|
|
29096
29305
|
},
|
|
29097
29306
|
[]
|
|
29098
29307
|
);
|
|
29099
|
-
const handleSubmit = (0,
|
|
29308
|
+
const handleSubmit = (0, import_react97.useCallback)(
|
|
29100
29309
|
async (data) => {
|
|
29101
29310
|
if (!selectedModel) return;
|
|
29102
29311
|
setIsLoading(true);
|
|
@@ -29353,6 +29562,7 @@ function useSendActivity(config) {
|
|
|
29353
29562
|
createQuestionsListHook,
|
|
29354
29563
|
createRecommendedLessonDetailsHook,
|
|
29355
29564
|
createRecommendedLessonsHistoryHook,
|
|
29565
|
+
createRecommendedLessonsPageHook,
|
|
29356
29566
|
createUseActivitiesHistory,
|
|
29357
29567
|
createUseActivityFiltersData,
|
|
29358
29568
|
createUseActivityModels,
|
|
@@ -29364,6 +29574,7 @@ function useSendActivity(config) {
|
|
|
29364
29574
|
createUseQuestionsList,
|
|
29365
29575
|
createUseRecommendedLessonDetails,
|
|
29366
29576
|
createUseRecommendedLessonsHistory,
|
|
29577
|
+
createUseRecommendedLessonsPage,
|
|
29367
29578
|
createZustandAuthAdapter,
|
|
29368
29579
|
deriveStudentStatus,
|
|
29369
29580
|
determineGoalStatus,
|