analytica-frontend-lib 1.2.65 → 1.2.67
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 +4 -0
- package/dist/ActivitiesHistory/index.css.map +1 -1
- package/dist/ActivityCardQuestionBanks/index.css +4 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.css +4 -0
- package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
- package/dist/ActivityDetails/index.css +4 -0
- package/dist/ActivityDetails/index.css.map +1 -1
- package/dist/ActivityFilters/index.css +4 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityPreview/index.css +4 -0
- package/dist/ActivityPreview/index.css.map +1 -1
- package/dist/AlertManager/index.css +4 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.css +4 -0
- package/dist/RecommendedLessonsHistory/index.css.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.css +4 -0
- package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
- package/dist/SendActivityModal/index.css +4 -0
- package/dist/SendActivityModal/index.css.map +1 -1
- package/dist/TableProvider/index.css +4 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +104 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +162 -102
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +4 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13065,8 +13065,10 @@ var CreateActivity = ({
|
|
|
13065
13065
|
onCreateActivity,
|
|
13066
13066
|
onSaveModel
|
|
13067
13067
|
}) => {
|
|
13068
|
-
const
|
|
13068
|
+
const [searchParams] = (0, import_react_router_dom.useSearchParams)();
|
|
13069
13069
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
13070
|
+
const typeParam = searchParams.get("type") || void 0;
|
|
13071
|
+
const idParam = searchParams.get("id") || void 0;
|
|
13070
13072
|
const applyFilters = useQuestionFiltersStore(
|
|
13071
13073
|
(state) => state.applyFilters
|
|
13072
13074
|
);
|
|
@@ -13087,9 +13089,9 @@ var CreateActivity = ({
|
|
|
13087
13089
|
const [loading, setLoading] = (0, import_react38.useState)(false);
|
|
13088
13090
|
const [questions, setQuestions] = (0, import_react38.useState)([]);
|
|
13089
13091
|
const [loadingInitialQuestions, setLoadingInitialQuestions] = (0, import_react38.useState)(false);
|
|
13090
|
-
const [draftId, setDraftId] = (0, import_react38.useState)(
|
|
13092
|
+
const [draftId, setDraftId] = (0, import_react38.useState)(idParam ?? null);
|
|
13091
13093
|
const [activityType, setActivityType] = (0, import_react38.useState)(
|
|
13092
|
-
getTypeFromUrlString(
|
|
13094
|
+
getTypeFromUrlString(typeParam)
|
|
13093
13095
|
);
|
|
13094
13096
|
const [lastSavedAt, setLastSavedAt] = (0, import_react38.useState)(null);
|
|
13095
13097
|
const [isSaving, setIsSaving] = (0, import_react38.useState)(false);
|
|
@@ -13139,10 +13141,10 @@ var CreateActivity = ({
|
|
|
13139
13141
|
}, [activity?.id, activity?.filters, resolvedPreFilters]);
|
|
13140
13142
|
(0, import_react38.useEffect)(() => {
|
|
13141
13143
|
const fetchActivityDraft = async () => {
|
|
13142
|
-
if (
|
|
13144
|
+
if (idParam && idParam !== lastFetchedActivityIdRef.current) {
|
|
13143
13145
|
setLoading(true);
|
|
13144
13146
|
try {
|
|
13145
|
-
const response = await apiClient.get(`/activity-drafts/${
|
|
13147
|
+
const response = await apiClient.get(`/activity-drafts/${idParam}`);
|
|
13146
13148
|
const activityData = "data" in response.data ? response.data.data : response.data;
|
|
13147
13149
|
setActivity(activityData);
|
|
13148
13150
|
setPreFilters(activityData.filters);
|
|
@@ -13151,7 +13153,7 @@ var CreateActivity = ({
|
|
|
13151
13153
|
if (activityData.updatedAt) {
|
|
13152
13154
|
setLastSavedAt(new Date(activityData.updatedAt));
|
|
13153
13155
|
}
|
|
13154
|
-
lastFetchedActivityIdRef.current =
|
|
13156
|
+
lastFetchedActivityIdRef.current = idParam;
|
|
13155
13157
|
} catch (error) {
|
|
13156
13158
|
console.error("Erro ao buscar rascunho da atividade:", error);
|
|
13157
13159
|
addToast({
|
|
@@ -13167,19 +13169,19 @@ var CreateActivity = ({
|
|
|
13167
13169
|
}
|
|
13168
13170
|
};
|
|
13169
13171
|
fetchActivityDraft();
|
|
13170
|
-
}, [
|
|
13172
|
+
}, [idParam, apiClient, addToast]);
|
|
13171
13173
|
(0, import_react38.useEffect)(() => {
|
|
13172
13174
|
if (activity?.id && activity?.type) {
|
|
13173
13175
|
const urlType = getTypeFromUrl(activity.type);
|
|
13174
|
-
const currentUrlType =
|
|
13175
|
-
const currentUrlId =
|
|
13176
|
+
const currentUrlType = typeParam;
|
|
13177
|
+
const currentUrlId = idParam;
|
|
13176
13178
|
if (!currentUrlType || !currentUrlId || currentUrlId !== activity.id || currentUrlType !== urlType) {
|
|
13177
|
-
navigate(`/criar-atividade
|
|
13179
|
+
navigate(`/criar-atividade?type=${urlType}&id=${activity.id}`, {
|
|
13178
13180
|
replace: true
|
|
13179
13181
|
});
|
|
13180
13182
|
}
|
|
13181
13183
|
}
|
|
13182
|
-
}, [activity?.id, activity?.type,
|
|
13184
|
+
}, [activity?.id, activity?.type, typeParam, idParam, navigate]);
|
|
13183
13185
|
const validateSaveConditions = (0, import_react38.useCallback)(() => {
|
|
13184
13186
|
if (questions.length === 0 && !hasFirstSaveBeenDone.current) {
|
|
13185
13187
|
return false;
|
|
@@ -13300,7 +13302,7 @@ var CreateActivity = ({
|
|
|
13300
13302
|
lastFetchedActivityIdRef.current = savedDraft.id;
|
|
13301
13303
|
if (wasNewDraft && savedDraft.id) {
|
|
13302
13304
|
const urlType = getTypeFromUrl(savedDraft.type);
|
|
13303
|
-
navigate(`/criar-atividade
|
|
13305
|
+
navigate(`/criar-atividade?type=${urlType}&id=${savedDraft.id}`, {
|
|
13304
13306
|
replace: true
|
|
13305
13307
|
});
|
|
13306
13308
|
}
|
|
@@ -24108,6 +24110,17 @@ var LoadingSkeleton2 = () => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div
|
|
|
24108
24110
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "h-44 bg-background-200 rounded-xl" })
|
|
24109
24111
|
] })
|
|
24110
24112
|
] });
|
|
24113
|
+
var ErrorContent = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex flex-col items-center justify-center py-8 gap-3", children: [
|
|
24114
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
24115
|
+
Text_default,
|
|
24116
|
+
{
|
|
24117
|
+
as: "span",
|
|
24118
|
+
className: "size-12 rounded-full bg-error-100 flex items-center justify-center",
|
|
24119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react78.WarningCircleIcon, { size: 24, className: "text-error-700" })
|
|
24120
|
+
}
|
|
24121
|
+
),
|
|
24122
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text_default, { size: "md", className: "text-error-700 text-center", children: message })
|
|
24123
|
+
] });
|
|
24111
24124
|
var PerformanceContent = ({
|
|
24112
24125
|
data,
|
|
24113
24126
|
labels
|
|
@@ -24166,10 +24179,13 @@ var PerformanceContent = ({
|
|
|
24166
24179
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "flex flex-col gap-2", children: data.lessons.map((lesson) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(LessonAccordionItem, { lesson }, lesson.id)) })
|
|
24167
24180
|
] })
|
|
24168
24181
|
] });
|
|
24169
|
-
var renderModalContent = (loading, data, labels) => {
|
|
24182
|
+
var renderModalContent = (loading, error, data, labels) => {
|
|
24170
24183
|
if (loading) {
|
|
24171
24184
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(LoadingSkeleton2, {});
|
|
24172
24185
|
}
|
|
24186
|
+
if (error) {
|
|
24187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ErrorContent, { message: error });
|
|
24188
|
+
}
|
|
24173
24189
|
if (data) {
|
|
24174
24190
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(PerformanceContent, { data, labels });
|
|
24175
24191
|
}
|
|
@@ -24180,13 +24196,14 @@ var StudentPerformanceModal = ({
|
|
|
24180
24196
|
onClose,
|
|
24181
24197
|
data,
|
|
24182
24198
|
loading = false,
|
|
24199
|
+
error = null,
|
|
24183
24200
|
labels: customLabels
|
|
24184
24201
|
}) => {
|
|
24185
24202
|
const labels = (0, import_react77.useMemo)(
|
|
24186
24203
|
() => ({ ...DEFAULT_PERFORMANCE_LABELS, ...customLabels }),
|
|
24187
24204
|
[customLabels]
|
|
24188
24205
|
);
|
|
24189
|
-
if (!data && !loading) {
|
|
24206
|
+
if (!data && !loading && !error) {
|
|
24190
24207
|
return null;
|
|
24191
24208
|
}
|
|
24192
24209
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
@@ -24197,7 +24214,7 @@ var StudentPerformanceModal = ({
|
|
|
24197
24214
|
title: labels.title,
|
|
24198
24215
|
size: "lg",
|
|
24199
24216
|
contentClassName: "max-h-[70vh] overflow-y-auto",
|
|
24200
|
-
children: renderModalContent(loading, data, labels)
|
|
24217
|
+
children: renderModalContent(loading, error, data, labels)
|
|
24201
24218
|
}
|
|
24202
24219
|
);
|
|
24203
24220
|
};
|
|
@@ -24205,11 +24222,12 @@ var StudentPerformanceModal = ({
|
|
|
24205
24222
|
// src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
|
|
24206
24223
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
24207
24224
|
var RecommendedLessonDetails = ({
|
|
24225
|
+
goalId,
|
|
24208
24226
|
data,
|
|
24209
24227
|
loading = false,
|
|
24210
24228
|
error = null,
|
|
24211
24229
|
onViewLesson,
|
|
24212
|
-
|
|
24230
|
+
fetchStudentPerformance,
|
|
24213
24231
|
onBreadcrumbClick,
|
|
24214
24232
|
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
24215
24233
|
breadcrumbs,
|
|
@@ -24220,6 +24238,36 @@ var RecommendedLessonDetails = ({
|
|
|
24220
24238
|
() => ({ ...DEFAULT_LABELS, ...customLabels }),
|
|
24221
24239
|
[customLabels]
|
|
24222
24240
|
);
|
|
24241
|
+
const [performanceModalOpen, setPerformanceModalOpen] = (0, import_react79.useState)(false);
|
|
24242
|
+
const [performanceData, setPerformanceData] = (0, import_react79.useState)(null);
|
|
24243
|
+
const [performanceLoading, setPerformanceLoading] = (0, import_react79.useState)(false);
|
|
24244
|
+
const [performanceError, setPerformanceError] = (0, import_react79.useState)(null);
|
|
24245
|
+
const handleViewStudentPerformance = (0, import_react79.useCallback)(
|
|
24246
|
+
async (studentId) => {
|
|
24247
|
+
if (!fetchStudentPerformance || !goalId) return;
|
|
24248
|
+
setPerformanceModalOpen(true);
|
|
24249
|
+
setPerformanceLoading(true);
|
|
24250
|
+
setPerformanceData(null);
|
|
24251
|
+
setPerformanceError(null);
|
|
24252
|
+
try {
|
|
24253
|
+
const result = await fetchStudentPerformance(goalId, studentId);
|
|
24254
|
+
setPerformanceData(result);
|
|
24255
|
+
} catch (err) {
|
|
24256
|
+
console.error("Error fetching student performance:", err);
|
|
24257
|
+
setPerformanceError(
|
|
24258
|
+
err instanceof Error ? err.message : "Erro ao carregar desempenho do aluno"
|
|
24259
|
+
);
|
|
24260
|
+
} finally {
|
|
24261
|
+
setPerformanceLoading(false);
|
|
24262
|
+
}
|
|
24263
|
+
},
|
|
24264
|
+
[fetchStudentPerformance, goalId]
|
|
24265
|
+
);
|
|
24266
|
+
const handleClosePerformanceModal = (0, import_react79.useCallback)(() => {
|
|
24267
|
+
setPerformanceModalOpen(false);
|
|
24268
|
+
setPerformanceData(null);
|
|
24269
|
+
setPerformanceError(null);
|
|
24270
|
+
}, []);
|
|
24223
24271
|
const defaultBreadcrumbs = (0, import_react79.useMemo)(
|
|
24224
24272
|
() => [
|
|
24225
24273
|
{ label: "Aulas recomendadas", path: "/aulas-recomendadas" },
|
|
@@ -24261,34 +24309,46 @@ var RecommendedLessonDetails = ({
|
|
|
24261
24309
|
if (!data) {
|
|
24262
24310
|
return null;
|
|
24263
24311
|
}
|
|
24264
|
-
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
24265
|
-
|
|
24266
|
-
|
|
24267
|
-
|
|
24268
|
-
|
|
24269
|
-
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
24275
|
-
|
|
24276
|
-
|
|
24277
|
-
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
|
|
24283
|
-
|
|
24284
|
-
|
|
24285
|
-
|
|
24286
|
-
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
|
|
24290
|
-
|
|
24291
|
-
|
|
24312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
24313
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
24314
|
+
"div",
|
|
24315
|
+
{
|
|
24316
|
+
className: cn("flex flex-col gap-6", className),
|
|
24317
|
+
"data-testid": "recommended-lesson-details",
|
|
24318
|
+
children: [
|
|
24319
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Breadcrumb, { items: breadcrumbItems, onItemClick: onBreadcrumbClick }),
|
|
24320
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
24321
|
+
LessonHeader,
|
|
24322
|
+
{
|
|
24323
|
+
data,
|
|
24324
|
+
onViewLesson,
|
|
24325
|
+
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
24326
|
+
viewLessonLabel: labels.viewLesson
|
|
24327
|
+
}
|
|
24328
|
+
),
|
|
24329
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ResultsSection, { data, labels }),
|
|
24330
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
24331
|
+
StudentsTable,
|
|
24332
|
+
{
|
|
24333
|
+
students: displayStudents,
|
|
24334
|
+
onViewPerformance: fetchStudentPerformance ? handleViewStudentPerformance : void 0,
|
|
24335
|
+
labels
|
|
24336
|
+
}
|
|
24337
|
+
)
|
|
24338
|
+
]
|
|
24339
|
+
}
|
|
24340
|
+
),
|
|
24341
|
+
fetchStudentPerformance && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
24342
|
+
StudentPerformanceModal,
|
|
24343
|
+
{
|
|
24344
|
+
isOpen: performanceModalOpen,
|
|
24345
|
+
onClose: handleClosePerformanceModal,
|
|
24346
|
+
data: performanceData,
|
|
24347
|
+
loading: performanceLoading,
|
|
24348
|
+
error: performanceError
|
|
24349
|
+
}
|
|
24350
|
+
)
|
|
24351
|
+
] });
|
|
24292
24352
|
};
|
|
24293
24353
|
var RecommendedLessonDetails_default = RecommendedLessonDetails;
|
|
24294
24354
|
|