analytica-frontend-lib 1.2.45 → 1.2.46
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/ActivityCardQuestionBanks/index.css +20 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.css +20 -0
- package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
- package/dist/ActivityDetails/index.css +20 -0
- package/dist/ActivityDetails/index.css.map +1 -1
- package/dist/ActivityFilters/index.css +20 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityPreview/index.css +20 -0
- package/dist/ActivityPreview/index.css.map +1 -1
- package/dist/AlertManager/index.css +20 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.css +19327 -0
- package/dist/RecommendedLessonsHistory/index.css.map +1 -0
- package/dist/RecommendedLessonsHistory/index.d.ts +2 -0
- package/dist/RecommendedLessonsHistory/index.d.ts.map +1 -0
- package/dist/RecommendedLessonsHistory/index.js +6775 -0
- package/dist/RecommendedLessonsHistory/index.js.map +1 -0
- package/dist/RecommendedLessonsHistory/index.mjs +6815 -0
- package/dist/RecommendedLessonsHistory/index.mjs.map +1 -0
- package/dist/SendActivityModal/index.css +20 -0
- package/dist/SendActivityModal/index.css.map +1 -1
- package/dist/TableProvider/index.css +20 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/hooks/useRecommendedLessons/index.d.ts +355 -0
- package/dist/hooks/useRecommendedLessons/index.d.ts.map +1 -0
- package/dist/hooks/useRecommendedLessons/index.js +195 -0
- package/dist/hooks/useRecommendedLessons/index.js.map +1 -0
- package/dist/hooks/useRecommendedLessons/index.mjs +155 -0
- package/dist/hooks/useRecommendedLessons/index.mjs.map +1 -0
- package/dist/hooks/useRecommendedLessons.d.ts +355 -0
- package/dist/hooks/useRecommendedLessons.d.ts.map +1 -0
- package/dist/index.css +20 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +698 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +685 -0
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +20 -0
- package/dist/styles.css.map +1 -1
- package/dist/types/recommendedLessons/index.d.ts +182 -0
- package/dist/types/recommendedLessons/index.d.ts.map +1 -0
- package/dist/types/recommendedLessons/index.js +75 -0
- package/dist/types/recommendedLessons/index.js.map +1 -0
- package/dist/types/recommendedLessons/index.mjs +45 -0
- package/dist/types/recommendedLessons/index.mjs.map +1 -0
- package/dist/types/recommendedLessons.d.ts +182 -0
- package/dist/types/recommendedLessons.d.ts.map +1 -0
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -20958,6 +20958,678 @@ var SendActivityModal = ({
|
|
|
20958
20958
|
);
|
|
20959
20959
|
};
|
|
20960
20960
|
var SendActivityModal_default = SendActivityModal;
|
|
20961
|
+
|
|
20962
|
+
// src/components/RecommendedLessonsHistory/RecommendedLessonsHistory.tsx
|
|
20963
|
+
import { useState as useState42, useCallback as useCallback19, useMemo as useMemo23, useRef as useRef23 } from "react";
|
|
20964
|
+
import { Plus as Plus3, CaretRight as CaretRight10, Trash, PencilSimple as PencilSimple2 } from "phosphor-react";
|
|
20965
|
+
|
|
20966
|
+
// src/types/recommendedLessons.ts
|
|
20967
|
+
var GoalApiStatus = /* @__PURE__ */ ((GoalApiStatus3) => {
|
|
20968
|
+
GoalApiStatus3["A_VENCER"] = "A_VENCER";
|
|
20969
|
+
GoalApiStatus3["VENCIDA"] = "VENCIDA";
|
|
20970
|
+
GoalApiStatus3["CONCLUIDA"] = "CONCLUIDA";
|
|
20971
|
+
return GoalApiStatus3;
|
|
20972
|
+
})(GoalApiStatus || {});
|
|
20973
|
+
var GoalDisplayStatus = /* @__PURE__ */ ((GoalDisplayStatus3) => {
|
|
20974
|
+
GoalDisplayStatus3["ATIVA"] = "ATIVA";
|
|
20975
|
+
GoalDisplayStatus3["VENCIDA"] = "VENCIDA";
|
|
20976
|
+
GoalDisplayStatus3["CONCLUIDA"] = "CONCLU\xCDDA";
|
|
20977
|
+
return GoalDisplayStatus3;
|
|
20978
|
+
})(GoalDisplayStatus || {});
|
|
20979
|
+
var GoalBadgeActionType = /* @__PURE__ */ ((GoalBadgeActionType2) => {
|
|
20980
|
+
GoalBadgeActionType2["SUCCESS"] = "success";
|
|
20981
|
+
GoalBadgeActionType2["WARNING"] = "warning";
|
|
20982
|
+
GoalBadgeActionType2["ERROR"] = "error";
|
|
20983
|
+
return GoalBadgeActionType2;
|
|
20984
|
+
})(GoalBadgeActionType || {});
|
|
20985
|
+
var getGoalStatusBadgeAction = (status) => {
|
|
20986
|
+
const actionMap = {
|
|
20987
|
+
["CONCLU\xCDDA" /* CONCLUIDA */]: "success" /* SUCCESS */,
|
|
20988
|
+
["ATIVA" /* ATIVA */]: "warning" /* WARNING */,
|
|
20989
|
+
["VENCIDA" /* VENCIDA */]: "error" /* ERROR */
|
|
20990
|
+
};
|
|
20991
|
+
return actionMap[status] ?? "warning" /* WARNING */;
|
|
20992
|
+
};
|
|
20993
|
+
var GOAL_FILTER_STATUS_OPTIONS = [
|
|
20994
|
+
{ id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
|
|
20995
|
+
{ id: "A_VENCER" /* A_VENCER */, name: "Ativa" }
|
|
20996
|
+
];
|
|
20997
|
+
var GOAL_STATUS_OPTIONS = [
|
|
20998
|
+
{ id: "A_VENCER" /* A_VENCER */, name: "A Vencer" },
|
|
20999
|
+
{ id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
|
|
21000
|
+
{ id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" }
|
|
21001
|
+
];
|
|
21002
|
+
|
|
21003
|
+
// src/hooks/useRecommendedLessons.ts
|
|
21004
|
+
import { useState as useState41, useCallback as useCallback18 } from "react";
|
|
21005
|
+
import { z as z3 } from "zod";
|
|
21006
|
+
import dayjs3 from "dayjs";
|
|
21007
|
+
var goalSubjectSchema = z3.object({
|
|
21008
|
+
id: z3.string().uuid(),
|
|
21009
|
+
name: z3.string()
|
|
21010
|
+
}).nullable();
|
|
21011
|
+
var goalCreatorSchema = z3.object({
|
|
21012
|
+
id: z3.string().uuid(),
|
|
21013
|
+
name: z3.string()
|
|
21014
|
+
}).nullable();
|
|
21015
|
+
var goalStatsSchema = z3.object({
|
|
21016
|
+
totalStudents: z3.number(),
|
|
21017
|
+
completedCount: z3.number(),
|
|
21018
|
+
completionPercentage: z3.number()
|
|
21019
|
+
});
|
|
21020
|
+
var goalBreakdownSchema = z3.object({
|
|
21021
|
+
classId: z3.string().uuid(),
|
|
21022
|
+
className: z3.string(),
|
|
21023
|
+
schoolId: z3.string(),
|
|
21024
|
+
schoolName: z3.string(),
|
|
21025
|
+
studentCount: z3.number(),
|
|
21026
|
+
completedCount: z3.number()
|
|
21027
|
+
});
|
|
21028
|
+
var goalDataSchema = z3.object({
|
|
21029
|
+
id: z3.string().uuid(),
|
|
21030
|
+
title: z3.string(),
|
|
21031
|
+
startDate: z3.string().nullable(),
|
|
21032
|
+
finalDate: z3.string().nullable(),
|
|
21033
|
+
createdAt: z3.string(),
|
|
21034
|
+
progress: z3.number(),
|
|
21035
|
+
totalLessons: z3.number()
|
|
21036
|
+
});
|
|
21037
|
+
var goalHistoryItemSchema = z3.object({
|
|
21038
|
+
goal: goalDataSchema,
|
|
21039
|
+
subject: goalSubjectSchema,
|
|
21040
|
+
creator: goalCreatorSchema,
|
|
21041
|
+
stats: goalStatsSchema,
|
|
21042
|
+
breakdown: z3.array(goalBreakdownSchema)
|
|
21043
|
+
});
|
|
21044
|
+
var goalsHistoryApiResponseSchema = z3.object({
|
|
21045
|
+
message: z3.string(),
|
|
21046
|
+
data: z3.object({
|
|
21047
|
+
goals: z3.array(goalHistoryItemSchema),
|
|
21048
|
+
total: z3.number()
|
|
21049
|
+
})
|
|
21050
|
+
});
|
|
21051
|
+
var determineGoalStatus = (finalDate, completionPercentage) => {
|
|
21052
|
+
if (completionPercentage === 100) {
|
|
21053
|
+
return "CONCLU\xCDDA" /* CONCLUIDA */;
|
|
21054
|
+
}
|
|
21055
|
+
if (finalDate) {
|
|
21056
|
+
const now = dayjs3();
|
|
21057
|
+
const deadline = dayjs3(finalDate);
|
|
21058
|
+
if (deadline.isBefore(now)) {
|
|
21059
|
+
return "VENCIDA" /* VENCIDA */;
|
|
21060
|
+
}
|
|
21061
|
+
}
|
|
21062
|
+
return "ATIVA" /* ATIVA */;
|
|
21063
|
+
};
|
|
21064
|
+
var transformGoalToTableItem = (item) => {
|
|
21065
|
+
const firstBreakdown = item.breakdown[0];
|
|
21066
|
+
const schoolName = firstBreakdown?.schoolName || "-";
|
|
21067
|
+
const className = firstBreakdown?.className || "-";
|
|
21068
|
+
const classDisplay = item.breakdown.length > 1 ? `${item.breakdown.length} turmas` : className;
|
|
21069
|
+
return {
|
|
21070
|
+
id: item.goal.id,
|
|
21071
|
+
startDate: item.goal.startDate ? dayjs3(item.goal.startDate).format("DD/MM") : "-",
|
|
21072
|
+
deadline: item.goal.finalDate ? dayjs3(item.goal.finalDate).format("DD/MM") : "-",
|
|
21073
|
+
title: item.goal.title,
|
|
21074
|
+
school: schoolName,
|
|
21075
|
+
year: "-",
|
|
21076
|
+
// API doesn't provide year directly
|
|
21077
|
+
subject: item.subject?.name || "-",
|
|
21078
|
+
class: classDisplay,
|
|
21079
|
+
status: determineGoalStatus(
|
|
21080
|
+
item.goal.finalDate,
|
|
21081
|
+
item.stats.completionPercentage
|
|
21082
|
+
),
|
|
21083
|
+
completionPercentage: item.stats.completionPercentage
|
|
21084
|
+
};
|
|
21085
|
+
};
|
|
21086
|
+
var handleGoalFetchError = (error) => {
|
|
21087
|
+
if (error instanceof z3.ZodError) {
|
|
21088
|
+
console.error("Erro ao validar dados de hist\xF3rico de aulas:", error);
|
|
21089
|
+
return "Erro ao validar dados de hist\xF3rico de aulas";
|
|
21090
|
+
}
|
|
21091
|
+
console.error("Erro ao carregar hist\xF3rico de aulas:", error);
|
|
21092
|
+
return "Erro ao carregar hist\xF3rico de aulas";
|
|
21093
|
+
};
|
|
21094
|
+
var createUseRecommendedLessonsHistory = (fetchGoalsHistory) => {
|
|
21095
|
+
return () => {
|
|
21096
|
+
const [state, setState] = useState41({
|
|
21097
|
+
goals: [],
|
|
21098
|
+
loading: false,
|
|
21099
|
+
error: null,
|
|
21100
|
+
pagination: {
|
|
21101
|
+
total: 0,
|
|
21102
|
+
page: 1,
|
|
21103
|
+
limit: 10,
|
|
21104
|
+
totalPages: 0
|
|
21105
|
+
}
|
|
21106
|
+
});
|
|
21107
|
+
const fetchGoals = useCallback18(
|
|
21108
|
+
async (filters) => {
|
|
21109
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
21110
|
+
try {
|
|
21111
|
+
const responseData = await fetchGoalsHistory(filters);
|
|
21112
|
+
const validatedData = goalsHistoryApiResponseSchema.parse(responseData);
|
|
21113
|
+
const tableItems = validatedData.data.goals.map(
|
|
21114
|
+
transformGoalToTableItem
|
|
21115
|
+
);
|
|
21116
|
+
const page = filters?.page || 1;
|
|
21117
|
+
const limit = filters?.limit || 10;
|
|
21118
|
+
const total = validatedData.data.total;
|
|
21119
|
+
const totalPages = Math.ceil(total / limit);
|
|
21120
|
+
setState({
|
|
21121
|
+
goals: tableItems,
|
|
21122
|
+
loading: false,
|
|
21123
|
+
error: null,
|
|
21124
|
+
pagination: {
|
|
21125
|
+
total,
|
|
21126
|
+
page,
|
|
21127
|
+
limit,
|
|
21128
|
+
totalPages
|
|
21129
|
+
}
|
|
21130
|
+
});
|
|
21131
|
+
} catch (error) {
|
|
21132
|
+
const errorMessage = handleGoalFetchError(error);
|
|
21133
|
+
setState((prev) => ({
|
|
21134
|
+
...prev,
|
|
21135
|
+
loading: false,
|
|
21136
|
+
error: errorMessage
|
|
21137
|
+
}));
|
|
21138
|
+
}
|
|
21139
|
+
},
|
|
21140
|
+
[fetchGoalsHistory]
|
|
21141
|
+
);
|
|
21142
|
+
return {
|
|
21143
|
+
...state,
|
|
21144
|
+
fetchGoals
|
|
21145
|
+
};
|
|
21146
|
+
};
|
|
21147
|
+
};
|
|
21148
|
+
var createRecommendedLessonsHistoryHook = createUseRecommendedLessonsHistory;
|
|
21149
|
+
|
|
21150
|
+
// src/components/RecommendedLessonsHistory/RecommendedLessonsHistory.tsx
|
|
21151
|
+
import { Fragment as Fragment20, jsx as jsx83, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
21152
|
+
var isNonEmptyArray = (param) => Array.isArray(param) && param.length > 0;
|
|
21153
|
+
var extractFilterValue = (param) => {
|
|
21154
|
+
if (!isNonEmptyArray(param)) return {};
|
|
21155
|
+
return param.length === 1 ? { single: param[0] } : { multiple: param };
|
|
21156
|
+
};
|
|
21157
|
+
var buildFiltersFromParams = (params) => {
|
|
21158
|
+
const filters = {
|
|
21159
|
+
page: params.page,
|
|
21160
|
+
limit: params.limit
|
|
21161
|
+
};
|
|
21162
|
+
if (params.search) {
|
|
21163
|
+
filters.search = params.search;
|
|
21164
|
+
}
|
|
21165
|
+
if (isNonEmptyArray(params.status)) {
|
|
21166
|
+
filters.status = params.status[0];
|
|
21167
|
+
}
|
|
21168
|
+
const schoolFilter = extractFilterValue(params.school);
|
|
21169
|
+
if (schoolFilter.single) filters.schoolId = schoolFilter.single;
|
|
21170
|
+
if (schoolFilter.multiple) filters.schoolIds = schoolFilter.multiple;
|
|
21171
|
+
const classFilter = extractFilterValue(params.class);
|
|
21172
|
+
if (classFilter.single) filters.classId = classFilter.single;
|
|
21173
|
+
if (classFilter.multiple) filters.classIds = classFilter.multiple;
|
|
21174
|
+
if (isNonEmptyArray(params.students)) {
|
|
21175
|
+
filters.studentIds = params.students;
|
|
21176
|
+
}
|
|
21177
|
+
if (isNonEmptyArray(params.subject)) {
|
|
21178
|
+
filters.subjectId = params.subject[0];
|
|
21179
|
+
}
|
|
21180
|
+
if (params.startDate && typeof params.startDate === "string") {
|
|
21181
|
+
filters.startDate = params.startDate;
|
|
21182
|
+
}
|
|
21183
|
+
return filters;
|
|
21184
|
+
};
|
|
21185
|
+
var getSchoolOptions = (data) => {
|
|
21186
|
+
if (!data?.schools) return [];
|
|
21187
|
+
return data.schools.map((school) => ({
|
|
21188
|
+
id: school.id,
|
|
21189
|
+
name: school.name
|
|
21190
|
+
}));
|
|
21191
|
+
};
|
|
21192
|
+
var getSubjectOptions = (data) => {
|
|
21193
|
+
if (!data?.subjects) return [];
|
|
21194
|
+
return data.subjects.map((subject) => ({
|
|
21195
|
+
id: subject.id,
|
|
21196
|
+
name: subject.name
|
|
21197
|
+
}));
|
|
21198
|
+
};
|
|
21199
|
+
var getSchoolYearOptions = (data) => {
|
|
21200
|
+
if (!data?.schoolYears) return [];
|
|
21201
|
+
return data.schoolYears.map((year) => ({
|
|
21202
|
+
id: year.id,
|
|
21203
|
+
name: year.name
|
|
21204
|
+
}));
|
|
21205
|
+
};
|
|
21206
|
+
var getClassOptions = (data) => {
|
|
21207
|
+
if (!data?.classes) return [];
|
|
21208
|
+
return data.classes.map((cls) => ({
|
|
21209
|
+
id: cls.id,
|
|
21210
|
+
name: cls.name
|
|
21211
|
+
}));
|
|
21212
|
+
};
|
|
21213
|
+
var createGoalFiltersConfig = (userData) => [
|
|
21214
|
+
{
|
|
21215
|
+
key: "academic",
|
|
21216
|
+
label: "DADOS ACAD\xCAMICOS",
|
|
21217
|
+
categories: [
|
|
21218
|
+
{
|
|
21219
|
+
key: "school",
|
|
21220
|
+
label: "Escola",
|
|
21221
|
+
selectedIds: [],
|
|
21222
|
+
itens: getSchoolOptions(userData)
|
|
21223
|
+
},
|
|
21224
|
+
{
|
|
21225
|
+
key: "schoolYear",
|
|
21226
|
+
label: "S\xE9rie",
|
|
21227
|
+
selectedIds: [],
|
|
21228
|
+
itens: getSchoolYearOptions(userData)
|
|
21229
|
+
},
|
|
21230
|
+
{
|
|
21231
|
+
key: "class",
|
|
21232
|
+
label: "Turma",
|
|
21233
|
+
selectedIds: [],
|
|
21234
|
+
itens: getClassOptions(userData)
|
|
21235
|
+
},
|
|
21236
|
+
{
|
|
21237
|
+
key: "students",
|
|
21238
|
+
label: "Alunos",
|
|
21239
|
+
selectedIds: [],
|
|
21240
|
+
itens: []
|
|
21241
|
+
}
|
|
21242
|
+
]
|
|
21243
|
+
},
|
|
21244
|
+
{
|
|
21245
|
+
key: "content",
|
|
21246
|
+
label: "CONTE\xDADO",
|
|
21247
|
+
categories: [
|
|
21248
|
+
{
|
|
21249
|
+
key: "knowledgeArea",
|
|
21250
|
+
label: "\xC1rea de conhecimento",
|
|
21251
|
+
selectedIds: [],
|
|
21252
|
+
itens: []
|
|
21253
|
+
},
|
|
21254
|
+
{
|
|
21255
|
+
key: "subject",
|
|
21256
|
+
label: "Mat\xE9ria",
|
|
21257
|
+
selectedIds: [],
|
|
21258
|
+
itens: getSubjectOptions(userData)
|
|
21259
|
+
},
|
|
21260
|
+
{
|
|
21261
|
+
key: "theme",
|
|
21262
|
+
label: "Tema",
|
|
21263
|
+
selectedIds: [],
|
|
21264
|
+
itens: []
|
|
21265
|
+
},
|
|
21266
|
+
{
|
|
21267
|
+
key: "subtheme",
|
|
21268
|
+
label: "Subtema",
|
|
21269
|
+
selectedIds: [],
|
|
21270
|
+
itens: []
|
|
21271
|
+
},
|
|
21272
|
+
{
|
|
21273
|
+
key: "topic",
|
|
21274
|
+
label: "Assunto",
|
|
21275
|
+
selectedIds: [],
|
|
21276
|
+
itens: []
|
|
21277
|
+
}
|
|
21278
|
+
]
|
|
21279
|
+
},
|
|
21280
|
+
{
|
|
21281
|
+
key: "lesson",
|
|
21282
|
+
label: "AULA",
|
|
21283
|
+
categories: [
|
|
21284
|
+
{
|
|
21285
|
+
key: "status",
|
|
21286
|
+
label: "Status",
|
|
21287
|
+
selectedIds: [],
|
|
21288
|
+
itens: GOAL_FILTER_STATUS_OPTIONS
|
|
21289
|
+
}
|
|
21290
|
+
]
|
|
21291
|
+
}
|
|
21292
|
+
];
|
|
21293
|
+
var createTableColumns2 = (mapSubjectNameToEnum, onDeleteGoal, onEditGoal) => [
|
|
21294
|
+
{
|
|
21295
|
+
key: "startDate",
|
|
21296
|
+
label: "In\xEDcio",
|
|
21297
|
+
sortable: true
|
|
21298
|
+
},
|
|
21299
|
+
{
|
|
21300
|
+
key: "deadline",
|
|
21301
|
+
label: "Prazo",
|
|
21302
|
+
sortable: true
|
|
21303
|
+
},
|
|
21304
|
+
{
|
|
21305
|
+
key: "title",
|
|
21306
|
+
label: "T\xEDtulo",
|
|
21307
|
+
sortable: true,
|
|
21308
|
+
className: "max-w-[200px] truncate",
|
|
21309
|
+
render: (value) => {
|
|
21310
|
+
const title = typeof value === "string" ? value : "";
|
|
21311
|
+
return /* @__PURE__ */ jsx83(Text_default, { size: "sm", title, children: title });
|
|
21312
|
+
}
|
|
21313
|
+
},
|
|
21314
|
+
{
|
|
21315
|
+
key: "school",
|
|
21316
|
+
label: "Escola",
|
|
21317
|
+
sortable: true,
|
|
21318
|
+
className: "max-w-[150px] truncate",
|
|
21319
|
+
render: (value) => {
|
|
21320
|
+
const school = typeof value === "string" ? value : "";
|
|
21321
|
+
return /* @__PURE__ */ jsx83(Text_default, { size: "sm", title: school, children: school });
|
|
21322
|
+
}
|
|
21323
|
+
},
|
|
21324
|
+
{
|
|
21325
|
+
key: "year",
|
|
21326
|
+
label: "Ano",
|
|
21327
|
+
sortable: true
|
|
21328
|
+
},
|
|
21329
|
+
{
|
|
21330
|
+
key: "subject",
|
|
21331
|
+
label: "Mat\xE9ria",
|
|
21332
|
+
sortable: true,
|
|
21333
|
+
className: "max-w-[140px]",
|
|
21334
|
+
render: (value) => {
|
|
21335
|
+
const subjectName = typeof value === "string" ? value : "";
|
|
21336
|
+
const subjectEnum = mapSubjectNameToEnum?.(subjectName);
|
|
21337
|
+
if (!subjectEnum) {
|
|
21338
|
+
return /* @__PURE__ */ jsx83(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
|
|
21339
|
+
}
|
|
21340
|
+
const subjectInfo = getSubjectInfo(subjectEnum);
|
|
21341
|
+
return /* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-2", title: subjectName, children: [
|
|
21342
|
+
/* @__PURE__ */ jsx83(
|
|
21343
|
+
"span",
|
|
21344
|
+
{
|
|
21345
|
+
className: cn(
|
|
21346
|
+
"w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
|
|
21347
|
+
subjectInfo.colorClass
|
|
21348
|
+
),
|
|
21349
|
+
children: subjectInfo.icon
|
|
21350
|
+
}
|
|
21351
|
+
),
|
|
21352
|
+
/* @__PURE__ */ jsx83(Text_default, { size: "sm", className: "truncate", children: subjectName })
|
|
21353
|
+
] });
|
|
21354
|
+
}
|
|
21355
|
+
},
|
|
21356
|
+
{
|
|
21357
|
+
key: "class",
|
|
21358
|
+
label: "Turma",
|
|
21359
|
+
sortable: true
|
|
21360
|
+
},
|
|
21361
|
+
{
|
|
21362
|
+
key: "status",
|
|
21363
|
+
label: "Status",
|
|
21364
|
+
sortable: true,
|
|
21365
|
+
render: (value) => {
|
|
21366
|
+
const status = typeof value === "string" ? value : "";
|
|
21367
|
+
if (!status) {
|
|
21368
|
+
return /* @__PURE__ */ jsx83(Text_default, { size: "sm", color: "text-text-500", children: "-" });
|
|
21369
|
+
}
|
|
21370
|
+
return /* @__PURE__ */ jsx83(
|
|
21371
|
+
Badge_default,
|
|
21372
|
+
{
|
|
21373
|
+
variant: "solid",
|
|
21374
|
+
action: getGoalStatusBadgeAction(status),
|
|
21375
|
+
size: "small",
|
|
21376
|
+
children: status
|
|
21377
|
+
}
|
|
21378
|
+
);
|
|
21379
|
+
}
|
|
21380
|
+
},
|
|
21381
|
+
{
|
|
21382
|
+
key: "completionPercentage",
|
|
21383
|
+
label: "Conclus\xE3o",
|
|
21384
|
+
sortable: true,
|
|
21385
|
+
render: (value) => /* @__PURE__ */ jsx83(
|
|
21386
|
+
ProgressBar_default,
|
|
21387
|
+
{
|
|
21388
|
+
value: Number(value),
|
|
21389
|
+
variant: "blue",
|
|
21390
|
+
size: "medium",
|
|
21391
|
+
layout: "compact",
|
|
21392
|
+
showPercentage: true,
|
|
21393
|
+
compactWidth: "w-[100px]"
|
|
21394
|
+
}
|
|
21395
|
+
)
|
|
21396
|
+
},
|
|
21397
|
+
{
|
|
21398
|
+
key: "actions",
|
|
21399
|
+
label: "",
|
|
21400
|
+
sortable: false,
|
|
21401
|
+
className: "w-20",
|
|
21402
|
+
render: (_value, row) => {
|
|
21403
|
+
const handleDelete = (e) => {
|
|
21404
|
+
e.stopPropagation();
|
|
21405
|
+
onDeleteGoal?.(row.id);
|
|
21406
|
+
};
|
|
21407
|
+
const handleEdit = (e) => {
|
|
21408
|
+
e.stopPropagation();
|
|
21409
|
+
onEditGoal?.(row.id);
|
|
21410
|
+
};
|
|
21411
|
+
return /* @__PURE__ */ jsxs66("div", { className: "flex justify-center gap-2", children: [
|
|
21412
|
+
/* @__PURE__ */ jsx83(
|
|
21413
|
+
IconButton_default,
|
|
21414
|
+
{
|
|
21415
|
+
icon: /* @__PURE__ */ jsx83(Trash, { size: 20 }),
|
|
21416
|
+
size: "sm",
|
|
21417
|
+
title: "Excluir",
|
|
21418
|
+
onClick: handleDelete
|
|
21419
|
+
}
|
|
21420
|
+
),
|
|
21421
|
+
/* @__PURE__ */ jsx83(
|
|
21422
|
+
IconButton_default,
|
|
21423
|
+
{
|
|
21424
|
+
icon: /* @__PURE__ */ jsx83(PencilSimple2, { size: 20 }),
|
|
21425
|
+
size: "sm",
|
|
21426
|
+
title: "Editar",
|
|
21427
|
+
onClick: handleEdit
|
|
21428
|
+
}
|
|
21429
|
+
)
|
|
21430
|
+
] });
|
|
21431
|
+
}
|
|
21432
|
+
},
|
|
21433
|
+
{
|
|
21434
|
+
key: "navigation",
|
|
21435
|
+
label: "",
|
|
21436
|
+
sortable: false,
|
|
21437
|
+
className: "w-12",
|
|
21438
|
+
render: () => /* @__PURE__ */ jsx83("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx83(CaretRight10, { size: 20, className: "text-text-600" }) })
|
|
21439
|
+
}
|
|
21440
|
+
];
|
|
21441
|
+
var RecommendedLessonsHistory = ({
|
|
21442
|
+
fetchGoalsHistory,
|
|
21443
|
+
onCreateLesson,
|
|
21444
|
+
onRowClick,
|
|
21445
|
+
onDeleteGoal,
|
|
21446
|
+
onEditGoal,
|
|
21447
|
+
emptyStateImage,
|
|
21448
|
+
noSearchImage,
|
|
21449
|
+
mapSubjectNameToEnum,
|
|
21450
|
+
userFilterData,
|
|
21451
|
+
title = "Hist\xF3rico de aulas recomendadas",
|
|
21452
|
+
createButtonText = "Criar aula",
|
|
21453
|
+
searchPlaceholder = "Buscar aula"
|
|
21454
|
+
}) => {
|
|
21455
|
+
const [activeTab, setActiveTab] = useState42("history" /* HISTORY */);
|
|
21456
|
+
const fetchGoalsHistoryRef = useRef23(fetchGoalsHistory);
|
|
21457
|
+
fetchGoalsHistoryRef.current = fetchGoalsHistory;
|
|
21458
|
+
const useGoalsHistory = useMemo23(
|
|
21459
|
+
() => createUseRecommendedLessonsHistory(
|
|
21460
|
+
(filters) => fetchGoalsHistoryRef.current(filters)
|
|
21461
|
+
),
|
|
21462
|
+
[]
|
|
21463
|
+
);
|
|
21464
|
+
const {
|
|
21465
|
+
goals,
|
|
21466
|
+
loading,
|
|
21467
|
+
error,
|
|
21468
|
+
pagination,
|
|
21469
|
+
fetchGoals
|
|
21470
|
+
} = useGoalsHistory();
|
|
21471
|
+
const initialFilterConfigs = useMemo23(
|
|
21472
|
+
() => createGoalFiltersConfig(userFilterData),
|
|
21473
|
+
[userFilterData]
|
|
21474
|
+
);
|
|
21475
|
+
const tableColumns = useMemo23(
|
|
21476
|
+
() => createTableColumns2(mapSubjectNameToEnum, onDeleteGoal, onEditGoal),
|
|
21477
|
+
[mapSubjectNameToEnum, onDeleteGoal, onEditGoal]
|
|
21478
|
+
);
|
|
21479
|
+
const handleParamsChange = useCallback19(
|
|
21480
|
+
(params) => {
|
|
21481
|
+
const filters = buildFiltersFromParams(params);
|
|
21482
|
+
fetchGoals(filters);
|
|
21483
|
+
},
|
|
21484
|
+
[fetchGoals]
|
|
21485
|
+
);
|
|
21486
|
+
return /* @__PURE__ */ jsxs66(
|
|
21487
|
+
"div",
|
|
21488
|
+
{
|
|
21489
|
+
"data-testid": "recommended-lessons-history",
|
|
21490
|
+
className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden",
|
|
21491
|
+
children: [
|
|
21492
|
+
/* @__PURE__ */ jsx83("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
|
|
21493
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex flex-col w-full h-full max-w-[1350px] mx-auto z-10 lg:px-0 px-4 pt-4 sm:pt-0", children: [
|
|
21494
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex flex-col sm:flex-row w-full mb-6 items-start sm:items-center sm:justify-between gap-0 sm:gap-4", children: [
|
|
21495
|
+
/* @__PURE__ */ jsx83(
|
|
21496
|
+
Text_default,
|
|
21497
|
+
{
|
|
21498
|
+
as: "h1",
|
|
21499
|
+
weight: "bold",
|
|
21500
|
+
className: "leading-[28px] tracking-[0.2px] text-xl lg:text-2xl",
|
|
21501
|
+
children: title
|
|
21502
|
+
}
|
|
21503
|
+
),
|
|
21504
|
+
/* @__PURE__ */ jsx83("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ jsx83(
|
|
21505
|
+
Menu,
|
|
21506
|
+
{
|
|
21507
|
+
defaultValue: "history" /* HISTORY */,
|
|
21508
|
+
value: activeTab,
|
|
21509
|
+
onValueChange: (value) => setActiveTab(value),
|
|
21510
|
+
variant: "menu2",
|
|
21511
|
+
className: "bg-transparent shadow-none px-0",
|
|
21512
|
+
children: /* @__PURE__ */ jsxs66(
|
|
21513
|
+
MenuContent,
|
|
21514
|
+
{
|
|
21515
|
+
variant: "menu2",
|
|
21516
|
+
className: "w-full lg:w-auto max-w-full min-w-0",
|
|
21517
|
+
children: [
|
|
21518
|
+
/* @__PURE__ */ jsx83(
|
|
21519
|
+
MenuItem,
|
|
21520
|
+
{
|
|
21521
|
+
variant: "menu2",
|
|
21522
|
+
value: "history" /* HISTORY */,
|
|
21523
|
+
"data-testid": "menu-item-history",
|
|
21524
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
21525
|
+
children: "Hist\xF3rico"
|
|
21526
|
+
}
|
|
21527
|
+
),
|
|
21528
|
+
/* @__PURE__ */ jsx83(
|
|
21529
|
+
MenuItem,
|
|
21530
|
+
{
|
|
21531
|
+
variant: "menu2",
|
|
21532
|
+
value: "drafts" /* DRAFTS */,
|
|
21533
|
+
"data-testid": "menu-item-drafts",
|
|
21534
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
21535
|
+
children: "Rascunhos"
|
|
21536
|
+
}
|
|
21537
|
+
),
|
|
21538
|
+
/* @__PURE__ */ jsx83(
|
|
21539
|
+
MenuItem,
|
|
21540
|
+
{
|
|
21541
|
+
variant: "menu2",
|
|
21542
|
+
value: "models" /* MODELS */,
|
|
21543
|
+
"data-testid": "menu-item-models",
|
|
21544
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
21545
|
+
children: "Modelos"
|
|
21546
|
+
}
|
|
21547
|
+
)
|
|
21548
|
+
]
|
|
21549
|
+
}
|
|
21550
|
+
)
|
|
21551
|
+
}
|
|
21552
|
+
) })
|
|
21553
|
+
] }),
|
|
21554
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
|
|
21555
|
+
activeTab === "history" /* HISTORY */ && /* @__PURE__ */ jsx83(Fragment20, { children: error ? /* @__PURE__ */ jsx83("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx83(Text_default, { size: "lg", color: "text-error-500", children: error }) }) : /* @__PURE__ */ jsx83("div", { className: "w-full", children: /* @__PURE__ */ jsx83(
|
|
21556
|
+
TableProvider,
|
|
21557
|
+
{
|
|
21558
|
+
data: goals,
|
|
21559
|
+
headers: tableColumns,
|
|
21560
|
+
loading,
|
|
21561
|
+
variant: "borderless",
|
|
21562
|
+
enableSearch: true,
|
|
21563
|
+
enableFilters: true,
|
|
21564
|
+
enableTableSort: true,
|
|
21565
|
+
enablePagination: true,
|
|
21566
|
+
enableRowClick: true,
|
|
21567
|
+
initialFilters: initialFilterConfigs,
|
|
21568
|
+
paginationConfig: {
|
|
21569
|
+
itemLabel: "aulas",
|
|
21570
|
+
itemsPerPageOptions: [10, 20, 50, 100],
|
|
21571
|
+
defaultItemsPerPage: 10,
|
|
21572
|
+
totalItems: pagination.total,
|
|
21573
|
+
totalPages: pagination.totalPages
|
|
21574
|
+
},
|
|
21575
|
+
searchPlaceholder,
|
|
21576
|
+
noSearchResultState: {
|
|
21577
|
+
image: noSearchImage
|
|
21578
|
+
},
|
|
21579
|
+
emptyState: {
|
|
21580
|
+
component: /* @__PURE__ */ jsx83(
|
|
21581
|
+
EmptyState_default,
|
|
21582
|
+
{
|
|
21583
|
+
image: emptyStateImage,
|
|
21584
|
+
title: "Crie uma nova aula",
|
|
21585
|
+
description: "Selecione um conjunto de aulas organizadas por tema e ajude seus alunos a estudarem de forma estruturada e eficiente!",
|
|
21586
|
+
buttonText: createButtonText,
|
|
21587
|
+
buttonIcon: /* @__PURE__ */ jsx83(Plus3, { size: 18 }),
|
|
21588
|
+
buttonVariant: "outline",
|
|
21589
|
+
buttonAction: "primary",
|
|
21590
|
+
onButtonClick: onCreateLesson
|
|
21591
|
+
}
|
|
21592
|
+
)
|
|
21593
|
+
},
|
|
21594
|
+
onParamsChange: handleParamsChange,
|
|
21595
|
+
onRowClick,
|
|
21596
|
+
children: (renderProps) => {
|
|
21597
|
+
const {
|
|
21598
|
+
controls,
|
|
21599
|
+
table,
|
|
21600
|
+
pagination: paginationComponent
|
|
21601
|
+
} = renderProps;
|
|
21602
|
+
return /* @__PURE__ */ jsxs66("div", { className: "space-y-4", children: [
|
|
21603
|
+
/* @__PURE__ */ jsxs66("div", { className: "flex items-center justify-between gap-4", children: [
|
|
21604
|
+
/* @__PURE__ */ jsx83(
|
|
21605
|
+
Button_default,
|
|
21606
|
+
{
|
|
21607
|
+
variant: "solid",
|
|
21608
|
+
action: "primary",
|
|
21609
|
+
size: "medium",
|
|
21610
|
+
onClick: onCreateLesson,
|
|
21611
|
+
iconLeft: /* @__PURE__ */ jsx83(Plus3, { size: 18, weight: "bold" }),
|
|
21612
|
+
children: createButtonText
|
|
21613
|
+
}
|
|
21614
|
+
),
|
|
21615
|
+
controls
|
|
21616
|
+
] }),
|
|
21617
|
+
/* @__PURE__ */ jsxs66("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
21618
|
+
table,
|
|
21619
|
+
paginationComponent
|
|
21620
|
+
] })
|
|
21621
|
+
] });
|
|
21622
|
+
}
|
|
21623
|
+
}
|
|
21624
|
+
) }) }),
|
|
21625
|
+
activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ jsx83("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx83(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) }),
|
|
21626
|
+
activeTab === "models" /* MODELS */ && /* @__PURE__ */ jsx83("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx83(Text_default, { size: "lg", color: "text-text-600", children: "Modelos em desenvolvimento" }) })
|
|
21627
|
+
] })
|
|
21628
|
+
] })
|
|
21629
|
+
]
|
|
21630
|
+
}
|
|
21631
|
+
);
|
|
21632
|
+
};
|
|
20961
21633
|
export {
|
|
20962
21634
|
ACTIVITY_AVAILABILITY,
|
|
20963
21635
|
ANSWER_STATUS,
|
|
@@ -21010,6 +21682,11 @@ export {
|
|
|
21010
21682
|
EmptyState_default as EmptyState,
|
|
21011
21683
|
FileAttachment_default as FileAttachment,
|
|
21012
21684
|
FilterModal,
|
|
21685
|
+
GOAL_FILTER_STATUS_OPTIONS,
|
|
21686
|
+
GOAL_STATUS_OPTIONS,
|
|
21687
|
+
GoalApiStatus,
|
|
21688
|
+
GoalBadgeActionType,
|
|
21689
|
+
GoalDisplayStatus,
|
|
21013
21690
|
IconButton_default as IconButton,
|
|
21014
21691
|
IconRender_default as IconRender,
|
|
21015
21692
|
IconRoundedButton_default as IconRoundedButton,
|
|
@@ -21067,6 +21744,7 @@ export {
|
|
|
21067
21744
|
Radio_default as Radio,
|
|
21068
21745
|
RadioGroup,
|
|
21069
21746
|
RadioGroupItem,
|
|
21747
|
+
RecommendedLessonsHistory,
|
|
21070
21748
|
STUDENT_ACTIVITY_STATUS,
|
|
21071
21749
|
SUBTYPE_ENUM,
|
|
21072
21750
|
Search_default as Search,
|
|
@@ -21115,11 +21793,14 @@ export {
|
|
|
21115
21793
|
createNotificationStore,
|
|
21116
21794
|
createNotificationsHook,
|
|
21117
21795
|
createQuestionsListHook,
|
|
21796
|
+
createRecommendedLessonsHistoryHook,
|
|
21118
21797
|
createUseActivityFiltersData,
|
|
21119
21798
|
createUseNotificationStore,
|
|
21120
21799
|
createUseNotifications,
|
|
21121
21800
|
createUseQuestionsList,
|
|
21801
|
+
createUseRecommendedLessonsHistory,
|
|
21122
21802
|
createZustandAuthAdapter,
|
|
21803
|
+
determineGoalStatus,
|
|
21123
21804
|
formatDateToBrazilian,
|
|
21124
21805
|
formatFileSize,
|
|
21125
21806
|
formatQuestionNumbers,
|
|
@@ -21129,6 +21810,7 @@ export {
|
|
|
21129
21810
|
getCategoryIcon,
|
|
21130
21811
|
getCategoryText,
|
|
21131
21812
|
getDeviceType,
|
|
21813
|
+
getGoalStatusBadgeAction,
|
|
21132
21814
|
getQuestionStatusBadgeConfig,
|
|
21133
21815
|
getRootDomain,
|
|
21134
21816
|
getSelectedIdsFromCategories,
|
|
@@ -21141,6 +21823,8 @@ export {
|
|
|
21141
21823
|
getSubjectIcon,
|
|
21142
21824
|
getSubjectInfo,
|
|
21143
21825
|
getSubjectName,
|
|
21826
|
+
goalsHistoryApiResponseSchema,
|
|
21827
|
+
handleGoalFetchError,
|
|
21144
21828
|
isFormValid,
|
|
21145
21829
|
isStepValid,
|
|
21146
21830
|
mapApiStatusToInternal,
|
|
@@ -21150,6 +21834,7 @@ export {
|
|
|
21150
21834
|
syncDropdownState,
|
|
21151
21835
|
toggleArrayItem,
|
|
21152
21836
|
toggleSingleValue,
|
|
21837
|
+
transformGoalToTableItem,
|
|
21153
21838
|
useAlertFormStore,
|
|
21154
21839
|
useApiConfig,
|
|
21155
21840
|
useAppContent,
|