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.
Files changed (51) hide show
  1. package/dist/ActivityCardQuestionBanks/index.css +20 -0
  2. package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
  3. package/dist/ActivityCardQuestionPreview/index.css +20 -0
  4. package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
  5. package/dist/ActivityDetails/index.css +20 -0
  6. package/dist/ActivityDetails/index.css.map +1 -1
  7. package/dist/ActivityFilters/index.css +20 -0
  8. package/dist/ActivityFilters/index.css.map +1 -1
  9. package/dist/ActivityPreview/index.css +20 -0
  10. package/dist/ActivityPreview/index.css.map +1 -1
  11. package/dist/AlertManager/index.css +20 -0
  12. package/dist/AlertManager/index.css.map +1 -1
  13. package/dist/RecommendedLessonsHistory/index.css +19327 -0
  14. package/dist/RecommendedLessonsHistory/index.css.map +1 -0
  15. package/dist/RecommendedLessonsHistory/index.d.ts +2 -0
  16. package/dist/RecommendedLessonsHistory/index.d.ts.map +1 -0
  17. package/dist/RecommendedLessonsHistory/index.js +6775 -0
  18. package/dist/RecommendedLessonsHistory/index.js.map +1 -0
  19. package/dist/RecommendedLessonsHistory/index.mjs +6815 -0
  20. package/dist/RecommendedLessonsHistory/index.mjs.map +1 -0
  21. package/dist/SendActivityModal/index.css +20 -0
  22. package/dist/SendActivityModal/index.css.map +1 -1
  23. package/dist/TableProvider/index.css +20 -0
  24. package/dist/TableProvider/index.css.map +1 -1
  25. package/dist/hooks/useRecommendedLessons/index.d.ts +355 -0
  26. package/dist/hooks/useRecommendedLessons/index.d.ts.map +1 -0
  27. package/dist/hooks/useRecommendedLessons/index.js +195 -0
  28. package/dist/hooks/useRecommendedLessons/index.js.map +1 -0
  29. package/dist/hooks/useRecommendedLessons/index.mjs +155 -0
  30. package/dist/hooks/useRecommendedLessons/index.mjs.map +1 -0
  31. package/dist/hooks/useRecommendedLessons.d.ts +355 -0
  32. package/dist/hooks/useRecommendedLessons.d.ts.map +1 -0
  33. package/dist/index.css +20 -0
  34. package/dist/index.css.map +1 -1
  35. package/dist/index.d.ts +6 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +698 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +685 -0
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/styles.css +20 -0
  42. package/dist/styles.css.map +1 -1
  43. package/dist/types/recommendedLessons/index.d.ts +182 -0
  44. package/dist/types/recommendedLessons/index.d.ts.map +1 -0
  45. package/dist/types/recommendedLessons/index.js +75 -0
  46. package/dist/types/recommendedLessons/index.js.map +1 -0
  47. package/dist/types/recommendedLessons/index.mjs +45 -0
  48. package/dist/types/recommendedLessons/index.mjs.map +1 -0
  49. package/dist/types/recommendedLessons.d.ts +182 -0
  50. package/dist/types/recommendedLessons.d.ts.map +1 -0
  51. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -81,6 +81,11 @@ __export(src_exports, {
81
81
  EmptyState: () => EmptyState_default,
82
82
  FileAttachment: () => FileAttachment_default,
83
83
  FilterModal: () => FilterModal,
84
+ GOAL_FILTER_STATUS_OPTIONS: () => GOAL_FILTER_STATUS_OPTIONS,
85
+ GOAL_STATUS_OPTIONS: () => GOAL_STATUS_OPTIONS,
86
+ GoalApiStatus: () => GoalApiStatus,
87
+ GoalBadgeActionType: () => GoalBadgeActionType,
88
+ GoalDisplayStatus: () => GoalDisplayStatus,
84
89
  IconButton: () => IconButton_default,
85
90
  IconRender: () => IconRender_default,
86
91
  IconRoundedButton: () => IconRoundedButton_default,
@@ -138,6 +143,7 @@ __export(src_exports, {
138
143
  Radio: () => Radio_default,
139
144
  RadioGroup: () => RadioGroup,
140
145
  RadioGroupItem: () => RadioGroupItem,
146
+ RecommendedLessonsHistory: () => RecommendedLessonsHistory,
141
147
  STUDENT_ACTIVITY_STATUS: () => STUDENT_ACTIVITY_STATUS,
142
148
  SUBTYPE_ENUM: () => SUBTYPE_ENUM,
143
149
  Search: () => Search_default,
@@ -186,11 +192,14 @@ __export(src_exports, {
186
192
  createNotificationStore: () => createNotificationStore,
187
193
  createNotificationsHook: () => createNotificationsHook,
188
194
  createQuestionsListHook: () => createQuestionsListHook,
195
+ createRecommendedLessonsHistoryHook: () => createRecommendedLessonsHistoryHook,
189
196
  createUseActivityFiltersData: () => createUseActivityFiltersData,
190
197
  createUseNotificationStore: () => createUseNotificationStore,
191
198
  createUseNotifications: () => createUseNotifications,
192
199
  createUseQuestionsList: () => createUseQuestionsList,
200
+ createUseRecommendedLessonsHistory: () => createUseRecommendedLessonsHistory,
193
201
  createZustandAuthAdapter: () => createZustandAuthAdapter,
202
+ determineGoalStatus: () => determineGoalStatus,
194
203
  formatDateToBrazilian: () => formatDateToBrazilian,
195
204
  formatFileSize: () => formatFileSize,
196
205
  formatQuestionNumbers: () => formatQuestionNumbers,
@@ -200,6 +209,7 @@ __export(src_exports, {
200
209
  getCategoryIcon: () => getCategoryIcon,
201
210
  getCategoryText: () => getCategoryText,
202
211
  getDeviceType: () => getDeviceType,
212
+ getGoalStatusBadgeAction: () => getGoalStatusBadgeAction,
203
213
  getQuestionStatusBadgeConfig: () => getQuestionStatusBadgeConfig,
204
214
  getRootDomain: () => getRootDomain,
205
215
  getSelectedIdsFromCategories: () => getSelectedIdsFromCategories,
@@ -212,6 +222,8 @@ __export(src_exports, {
212
222
  getSubjectIcon: () => getSubjectIcon,
213
223
  getSubjectInfo: () => getSubjectInfo,
214
224
  getSubjectName: () => getSubjectName,
225
+ goalsHistoryApiResponseSchema: () => goalsHistoryApiResponseSchema,
226
+ handleGoalFetchError: () => handleGoalFetchError,
215
227
  isFormValid: () => isFormValid,
216
228
  isStepValid: () => isStepValid,
217
229
  mapApiStatusToInternal: () => mapApiStatusToInternal,
@@ -221,6 +233,7 @@ __export(src_exports, {
221
233
  syncDropdownState: () => syncDropdownState,
222
234
  toggleArrayItem: () => toggleArrayItem,
223
235
  toggleSingleValue: () => toggleSingleValue,
236
+ transformGoalToTableItem: () => transformGoalToTableItem,
224
237
  useAlertFormStore: () => useAlertFormStore,
225
238
  useApiConfig: () => useApiConfig,
226
239
  useAppContent: () => useAppContent,
@@ -21030,6 +21043,678 @@ var SendActivityModal = ({
21030
21043
  );
21031
21044
  };
21032
21045
  var SendActivityModal_default = SendActivityModal;
21046
+
21047
+ // src/components/RecommendedLessonsHistory/RecommendedLessonsHistory.tsx
21048
+ var import_react69 = require("react");
21049
+ var import_phosphor_react41 = require("phosphor-react");
21050
+
21051
+ // src/types/recommendedLessons.ts
21052
+ var GoalApiStatus = /* @__PURE__ */ ((GoalApiStatus3) => {
21053
+ GoalApiStatus3["A_VENCER"] = "A_VENCER";
21054
+ GoalApiStatus3["VENCIDA"] = "VENCIDA";
21055
+ GoalApiStatus3["CONCLUIDA"] = "CONCLUIDA";
21056
+ return GoalApiStatus3;
21057
+ })(GoalApiStatus || {});
21058
+ var GoalDisplayStatus = /* @__PURE__ */ ((GoalDisplayStatus3) => {
21059
+ GoalDisplayStatus3["ATIVA"] = "ATIVA";
21060
+ GoalDisplayStatus3["VENCIDA"] = "VENCIDA";
21061
+ GoalDisplayStatus3["CONCLUIDA"] = "CONCLU\xCDDA";
21062
+ return GoalDisplayStatus3;
21063
+ })(GoalDisplayStatus || {});
21064
+ var GoalBadgeActionType = /* @__PURE__ */ ((GoalBadgeActionType2) => {
21065
+ GoalBadgeActionType2["SUCCESS"] = "success";
21066
+ GoalBadgeActionType2["WARNING"] = "warning";
21067
+ GoalBadgeActionType2["ERROR"] = "error";
21068
+ return GoalBadgeActionType2;
21069
+ })(GoalBadgeActionType || {});
21070
+ var getGoalStatusBadgeAction = (status) => {
21071
+ const actionMap = {
21072
+ ["CONCLU\xCDDA" /* CONCLUIDA */]: "success" /* SUCCESS */,
21073
+ ["ATIVA" /* ATIVA */]: "warning" /* WARNING */,
21074
+ ["VENCIDA" /* VENCIDA */]: "error" /* ERROR */
21075
+ };
21076
+ return actionMap[status] ?? "warning" /* WARNING */;
21077
+ };
21078
+ var GOAL_FILTER_STATUS_OPTIONS = [
21079
+ { id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
21080
+ { id: "A_VENCER" /* A_VENCER */, name: "Ativa" }
21081
+ ];
21082
+ var GOAL_STATUS_OPTIONS = [
21083
+ { id: "A_VENCER" /* A_VENCER */, name: "A Vencer" },
21084
+ { id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
21085
+ { id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" }
21086
+ ];
21087
+
21088
+ // src/hooks/useRecommendedLessons.ts
21089
+ var import_react68 = require("react");
21090
+ var import_zod4 = require("zod");
21091
+ var import_dayjs3 = __toESM(require("dayjs"));
21092
+ var goalSubjectSchema = import_zod4.z.object({
21093
+ id: import_zod4.z.string().uuid(),
21094
+ name: import_zod4.z.string()
21095
+ }).nullable();
21096
+ var goalCreatorSchema = import_zod4.z.object({
21097
+ id: import_zod4.z.string().uuid(),
21098
+ name: import_zod4.z.string()
21099
+ }).nullable();
21100
+ var goalStatsSchema = import_zod4.z.object({
21101
+ totalStudents: import_zod4.z.number(),
21102
+ completedCount: import_zod4.z.number(),
21103
+ completionPercentage: import_zod4.z.number()
21104
+ });
21105
+ var goalBreakdownSchema = import_zod4.z.object({
21106
+ classId: import_zod4.z.string().uuid(),
21107
+ className: import_zod4.z.string(),
21108
+ schoolId: import_zod4.z.string(),
21109
+ schoolName: import_zod4.z.string(),
21110
+ studentCount: import_zod4.z.number(),
21111
+ completedCount: import_zod4.z.number()
21112
+ });
21113
+ var goalDataSchema = import_zod4.z.object({
21114
+ id: import_zod4.z.string().uuid(),
21115
+ title: import_zod4.z.string(),
21116
+ startDate: import_zod4.z.string().nullable(),
21117
+ finalDate: import_zod4.z.string().nullable(),
21118
+ createdAt: import_zod4.z.string(),
21119
+ progress: import_zod4.z.number(),
21120
+ totalLessons: import_zod4.z.number()
21121
+ });
21122
+ var goalHistoryItemSchema = import_zod4.z.object({
21123
+ goal: goalDataSchema,
21124
+ subject: goalSubjectSchema,
21125
+ creator: goalCreatorSchema,
21126
+ stats: goalStatsSchema,
21127
+ breakdown: import_zod4.z.array(goalBreakdownSchema)
21128
+ });
21129
+ var goalsHistoryApiResponseSchema = import_zod4.z.object({
21130
+ message: import_zod4.z.string(),
21131
+ data: import_zod4.z.object({
21132
+ goals: import_zod4.z.array(goalHistoryItemSchema),
21133
+ total: import_zod4.z.number()
21134
+ })
21135
+ });
21136
+ var determineGoalStatus = (finalDate, completionPercentage) => {
21137
+ if (completionPercentage === 100) {
21138
+ return "CONCLU\xCDDA" /* CONCLUIDA */;
21139
+ }
21140
+ if (finalDate) {
21141
+ const now = (0, import_dayjs3.default)();
21142
+ const deadline = (0, import_dayjs3.default)(finalDate);
21143
+ if (deadline.isBefore(now)) {
21144
+ return "VENCIDA" /* VENCIDA */;
21145
+ }
21146
+ }
21147
+ return "ATIVA" /* ATIVA */;
21148
+ };
21149
+ var transformGoalToTableItem = (item) => {
21150
+ const firstBreakdown = item.breakdown[0];
21151
+ const schoolName = firstBreakdown?.schoolName || "-";
21152
+ const className = firstBreakdown?.className || "-";
21153
+ const classDisplay = item.breakdown.length > 1 ? `${item.breakdown.length} turmas` : className;
21154
+ return {
21155
+ id: item.goal.id,
21156
+ startDate: item.goal.startDate ? (0, import_dayjs3.default)(item.goal.startDate).format("DD/MM") : "-",
21157
+ deadline: item.goal.finalDate ? (0, import_dayjs3.default)(item.goal.finalDate).format("DD/MM") : "-",
21158
+ title: item.goal.title,
21159
+ school: schoolName,
21160
+ year: "-",
21161
+ // API doesn't provide year directly
21162
+ subject: item.subject?.name || "-",
21163
+ class: classDisplay,
21164
+ status: determineGoalStatus(
21165
+ item.goal.finalDate,
21166
+ item.stats.completionPercentage
21167
+ ),
21168
+ completionPercentage: item.stats.completionPercentage
21169
+ };
21170
+ };
21171
+ var handleGoalFetchError = (error) => {
21172
+ if (error instanceof import_zod4.z.ZodError) {
21173
+ console.error("Erro ao validar dados de hist\xF3rico de aulas:", error);
21174
+ return "Erro ao validar dados de hist\xF3rico de aulas";
21175
+ }
21176
+ console.error("Erro ao carregar hist\xF3rico de aulas:", error);
21177
+ return "Erro ao carregar hist\xF3rico de aulas";
21178
+ };
21179
+ var createUseRecommendedLessonsHistory = (fetchGoalsHistory) => {
21180
+ return () => {
21181
+ const [state, setState] = (0, import_react68.useState)({
21182
+ goals: [],
21183
+ loading: false,
21184
+ error: null,
21185
+ pagination: {
21186
+ total: 0,
21187
+ page: 1,
21188
+ limit: 10,
21189
+ totalPages: 0
21190
+ }
21191
+ });
21192
+ const fetchGoals = (0, import_react68.useCallback)(
21193
+ async (filters) => {
21194
+ setState((prev) => ({ ...prev, loading: true, error: null }));
21195
+ try {
21196
+ const responseData = await fetchGoalsHistory(filters);
21197
+ const validatedData = goalsHistoryApiResponseSchema.parse(responseData);
21198
+ const tableItems = validatedData.data.goals.map(
21199
+ transformGoalToTableItem
21200
+ );
21201
+ const page = filters?.page || 1;
21202
+ const limit = filters?.limit || 10;
21203
+ const total = validatedData.data.total;
21204
+ const totalPages = Math.ceil(total / limit);
21205
+ setState({
21206
+ goals: tableItems,
21207
+ loading: false,
21208
+ error: null,
21209
+ pagination: {
21210
+ total,
21211
+ page,
21212
+ limit,
21213
+ totalPages
21214
+ }
21215
+ });
21216
+ } catch (error) {
21217
+ const errorMessage = handleGoalFetchError(error);
21218
+ setState((prev) => ({
21219
+ ...prev,
21220
+ loading: false,
21221
+ error: errorMessage
21222
+ }));
21223
+ }
21224
+ },
21225
+ [fetchGoalsHistory]
21226
+ );
21227
+ return {
21228
+ ...state,
21229
+ fetchGoals
21230
+ };
21231
+ };
21232
+ };
21233
+ var createRecommendedLessonsHistoryHook = createUseRecommendedLessonsHistory;
21234
+
21235
+ // src/components/RecommendedLessonsHistory/RecommendedLessonsHistory.tsx
21236
+ var import_jsx_runtime83 = require("react/jsx-runtime");
21237
+ var isNonEmptyArray = (param) => Array.isArray(param) && param.length > 0;
21238
+ var extractFilterValue = (param) => {
21239
+ if (!isNonEmptyArray(param)) return {};
21240
+ return param.length === 1 ? { single: param[0] } : { multiple: param };
21241
+ };
21242
+ var buildFiltersFromParams = (params) => {
21243
+ const filters = {
21244
+ page: params.page,
21245
+ limit: params.limit
21246
+ };
21247
+ if (params.search) {
21248
+ filters.search = params.search;
21249
+ }
21250
+ if (isNonEmptyArray(params.status)) {
21251
+ filters.status = params.status[0];
21252
+ }
21253
+ const schoolFilter = extractFilterValue(params.school);
21254
+ if (schoolFilter.single) filters.schoolId = schoolFilter.single;
21255
+ if (schoolFilter.multiple) filters.schoolIds = schoolFilter.multiple;
21256
+ const classFilter = extractFilterValue(params.class);
21257
+ if (classFilter.single) filters.classId = classFilter.single;
21258
+ if (classFilter.multiple) filters.classIds = classFilter.multiple;
21259
+ if (isNonEmptyArray(params.students)) {
21260
+ filters.studentIds = params.students;
21261
+ }
21262
+ if (isNonEmptyArray(params.subject)) {
21263
+ filters.subjectId = params.subject[0];
21264
+ }
21265
+ if (params.startDate && typeof params.startDate === "string") {
21266
+ filters.startDate = params.startDate;
21267
+ }
21268
+ return filters;
21269
+ };
21270
+ var getSchoolOptions = (data) => {
21271
+ if (!data?.schools) return [];
21272
+ return data.schools.map((school) => ({
21273
+ id: school.id,
21274
+ name: school.name
21275
+ }));
21276
+ };
21277
+ var getSubjectOptions = (data) => {
21278
+ if (!data?.subjects) return [];
21279
+ return data.subjects.map((subject) => ({
21280
+ id: subject.id,
21281
+ name: subject.name
21282
+ }));
21283
+ };
21284
+ var getSchoolYearOptions = (data) => {
21285
+ if (!data?.schoolYears) return [];
21286
+ return data.schoolYears.map((year) => ({
21287
+ id: year.id,
21288
+ name: year.name
21289
+ }));
21290
+ };
21291
+ var getClassOptions = (data) => {
21292
+ if (!data?.classes) return [];
21293
+ return data.classes.map((cls) => ({
21294
+ id: cls.id,
21295
+ name: cls.name
21296
+ }));
21297
+ };
21298
+ var createGoalFiltersConfig = (userData) => [
21299
+ {
21300
+ key: "academic",
21301
+ label: "DADOS ACAD\xCAMICOS",
21302
+ categories: [
21303
+ {
21304
+ key: "school",
21305
+ label: "Escola",
21306
+ selectedIds: [],
21307
+ itens: getSchoolOptions(userData)
21308
+ },
21309
+ {
21310
+ key: "schoolYear",
21311
+ label: "S\xE9rie",
21312
+ selectedIds: [],
21313
+ itens: getSchoolYearOptions(userData)
21314
+ },
21315
+ {
21316
+ key: "class",
21317
+ label: "Turma",
21318
+ selectedIds: [],
21319
+ itens: getClassOptions(userData)
21320
+ },
21321
+ {
21322
+ key: "students",
21323
+ label: "Alunos",
21324
+ selectedIds: [],
21325
+ itens: []
21326
+ }
21327
+ ]
21328
+ },
21329
+ {
21330
+ key: "content",
21331
+ label: "CONTE\xDADO",
21332
+ categories: [
21333
+ {
21334
+ key: "knowledgeArea",
21335
+ label: "\xC1rea de conhecimento",
21336
+ selectedIds: [],
21337
+ itens: []
21338
+ },
21339
+ {
21340
+ key: "subject",
21341
+ label: "Mat\xE9ria",
21342
+ selectedIds: [],
21343
+ itens: getSubjectOptions(userData)
21344
+ },
21345
+ {
21346
+ key: "theme",
21347
+ label: "Tema",
21348
+ selectedIds: [],
21349
+ itens: []
21350
+ },
21351
+ {
21352
+ key: "subtheme",
21353
+ label: "Subtema",
21354
+ selectedIds: [],
21355
+ itens: []
21356
+ },
21357
+ {
21358
+ key: "topic",
21359
+ label: "Assunto",
21360
+ selectedIds: [],
21361
+ itens: []
21362
+ }
21363
+ ]
21364
+ },
21365
+ {
21366
+ key: "lesson",
21367
+ label: "AULA",
21368
+ categories: [
21369
+ {
21370
+ key: "status",
21371
+ label: "Status",
21372
+ selectedIds: [],
21373
+ itens: GOAL_FILTER_STATUS_OPTIONS
21374
+ }
21375
+ ]
21376
+ }
21377
+ ];
21378
+ var createTableColumns2 = (mapSubjectNameToEnum, onDeleteGoal, onEditGoal) => [
21379
+ {
21380
+ key: "startDate",
21381
+ label: "In\xEDcio",
21382
+ sortable: true
21383
+ },
21384
+ {
21385
+ key: "deadline",
21386
+ label: "Prazo",
21387
+ sortable: true
21388
+ },
21389
+ {
21390
+ key: "title",
21391
+ label: "T\xEDtulo",
21392
+ sortable: true,
21393
+ className: "max-w-[200px] truncate",
21394
+ render: (value) => {
21395
+ const title = typeof value === "string" ? value : "";
21396
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "sm", title, children: title });
21397
+ }
21398
+ },
21399
+ {
21400
+ key: "school",
21401
+ label: "Escola",
21402
+ sortable: true,
21403
+ className: "max-w-[150px] truncate",
21404
+ render: (value) => {
21405
+ const school = typeof value === "string" ? value : "";
21406
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "sm", title: school, children: school });
21407
+ }
21408
+ },
21409
+ {
21410
+ key: "year",
21411
+ label: "Ano",
21412
+ sortable: true
21413
+ },
21414
+ {
21415
+ key: "subject",
21416
+ label: "Mat\xE9ria",
21417
+ sortable: true,
21418
+ className: "max-w-[140px]",
21419
+ render: (value) => {
21420
+ const subjectName = typeof value === "string" ? value : "";
21421
+ const subjectEnum = mapSubjectNameToEnum?.(subjectName);
21422
+ if (!subjectEnum) {
21423
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
21424
+ }
21425
+ const subjectInfo = getSubjectInfo(subjectEnum);
21426
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center gap-2", title: subjectName, children: [
21427
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21428
+ "span",
21429
+ {
21430
+ className: cn(
21431
+ "w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
21432
+ subjectInfo.colorClass
21433
+ ),
21434
+ children: subjectInfo.icon
21435
+ }
21436
+ ),
21437
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "sm", className: "truncate", children: subjectName })
21438
+ ] });
21439
+ }
21440
+ },
21441
+ {
21442
+ key: "class",
21443
+ label: "Turma",
21444
+ sortable: true
21445
+ },
21446
+ {
21447
+ key: "status",
21448
+ label: "Status",
21449
+ sortable: true,
21450
+ render: (value) => {
21451
+ const status = typeof value === "string" ? value : "";
21452
+ if (!status) {
21453
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "sm", color: "text-text-500", children: "-" });
21454
+ }
21455
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21456
+ Badge_default,
21457
+ {
21458
+ variant: "solid",
21459
+ action: getGoalStatusBadgeAction(status),
21460
+ size: "small",
21461
+ children: status
21462
+ }
21463
+ );
21464
+ }
21465
+ },
21466
+ {
21467
+ key: "completionPercentage",
21468
+ label: "Conclus\xE3o",
21469
+ sortable: true,
21470
+ render: (value) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21471
+ ProgressBar_default,
21472
+ {
21473
+ value: Number(value),
21474
+ variant: "blue",
21475
+ size: "medium",
21476
+ layout: "compact",
21477
+ showPercentage: true,
21478
+ compactWidth: "w-[100px]"
21479
+ }
21480
+ )
21481
+ },
21482
+ {
21483
+ key: "actions",
21484
+ label: "",
21485
+ sortable: false,
21486
+ className: "w-20",
21487
+ render: (_value, row) => {
21488
+ const handleDelete = (e) => {
21489
+ e.stopPropagation();
21490
+ onDeleteGoal?.(row.id);
21491
+ };
21492
+ const handleEdit = (e) => {
21493
+ e.stopPropagation();
21494
+ onEditGoal?.(row.id);
21495
+ };
21496
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex justify-center gap-2", children: [
21497
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21498
+ IconButton_default,
21499
+ {
21500
+ icon: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_phosphor_react41.Trash, { size: 20 }),
21501
+ size: "sm",
21502
+ title: "Excluir",
21503
+ onClick: handleDelete
21504
+ }
21505
+ ),
21506
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21507
+ IconButton_default,
21508
+ {
21509
+ icon: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_phosphor_react41.PencilSimple, { size: 20 }),
21510
+ size: "sm",
21511
+ title: "Editar",
21512
+ onClick: handleEdit
21513
+ }
21514
+ )
21515
+ ] });
21516
+ }
21517
+ },
21518
+ {
21519
+ key: "navigation",
21520
+ label: "",
21521
+ sortable: false,
21522
+ className: "w-12",
21523
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_phosphor_react41.CaretRight, { size: 20, className: "text-text-600" }) })
21524
+ }
21525
+ ];
21526
+ var RecommendedLessonsHistory = ({
21527
+ fetchGoalsHistory,
21528
+ onCreateLesson,
21529
+ onRowClick,
21530
+ onDeleteGoal,
21531
+ onEditGoal,
21532
+ emptyStateImage,
21533
+ noSearchImage,
21534
+ mapSubjectNameToEnum,
21535
+ userFilterData,
21536
+ title = "Hist\xF3rico de aulas recomendadas",
21537
+ createButtonText = "Criar aula",
21538
+ searchPlaceholder = "Buscar aula"
21539
+ }) => {
21540
+ const [activeTab, setActiveTab] = (0, import_react69.useState)("history" /* HISTORY */);
21541
+ const fetchGoalsHistoryRef = (0, import_react69.useRef)(fetchGoalsHistory);
21542
+ fetchGoalsHistoryRef.current = fetchGoalsHistory;
21543
+ const useGoalsHistory = (0, import_react69.useMemo)(
21544
+ () => createUseRecommendedLessonsHistory(
21545
+ (filters) => fetchGoalsHistoryRef.current(filters)
21546
+ ),
21547
+ []
21548
+ );
21549
+ const {
21550
+ goals,
21551
+ loading,
21552
+ error,
21553
+ pagination,
21554
+ fetchGoals
21555
+ } = useGoalsHistory();
21556
+ const initialFilterConfigs = (0, import_react69.useMemo)(
21557
+ () => createGoalFiltersConfig(userFilterData),
21558
+ [userFilterData]
21559
+ );
21560
+ const tableColumns = (0, import_react69.useMemo)(
21561
+ () => createTableColumns2(mapSubjectNameToEnum, onDeleteGoal, onEditGoal),
21562
+ [mapSubjectNameToEnum, onDeleteGoal, onEditGoal]
21563
+ );
21564
+ const handleParamsChange = (0, import_react69.useCallback)(
21565
+ (params) => {
21566
+ const filters = buildFiltersFromParams(params);
21567
+ fetchGoals(filters);
21568
+ },
21569
+ [fetchGoals]
21570
+ );
21571
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
21572
+ "div",
21573
+ {
21574
+ "data-testid": "recommended-lessons-history",
21575
+ className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden",
21576
+ children: [
21577
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
21578
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("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: [
21579
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("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: [
21580
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21581
+ Text_default,
21582
+ {
21583
+ as: "h1",
21584
+ weight: "bold",
21585
+ className: "leading-[28px] tracking-[0.2px] text-xl lg:text-2xl",
21586
+ children: title
21587
+ }
21588
+ ),
21589
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21590
+ Menu,
21591
+ {
21592
+ defaultValue: "history" /* HISTORY */,
21593
+ value: activeTab,
21594
+ onValueChange: (value) => setActiveTab(value),
21595
+ variant: "menu2",
21596
+ className: "bg-transparent shadow-none px-0",
21597
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
21598
+ MenuContent,
21599
+ {
21600
+ variant: "menu2",
21601
+ className: "w-full lg:w-auto max-w-full min-w-0",
21602
+ children: [
21603
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21604
+ MenuItem,
21605
+ {
21606
+ variant: "menu2",
21607
+ value: "history" /* HISTORY */,
21608
+ "data-testid": "menu-item-history",
21609
+ className: "whitespace-nowrap flex-1 lg:flex-none",
21610
+ children: "Hist\xF3rico"
21611
+ }
21612
+ ),
21613
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21614
+ MenuItem,
21615
+ {
21616
+ variant: "menu2",
21617
+ value: "drafts" /* DRAFTS */,
21618
+ "data-testid": "menu-item-drafts",
21619
+ className: "whitespace-nowrap flex-1 lg:flex-none",
21620
+ children: "Rascunhos"
21621
+ }
21622
+ ),
21623
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21624
+ MenuItem,
21625
+ {
21626
+ variant: "menu2",
21627
+ value: "models" /* MODELS */,
21628
+ "data-testid": "menu-item-models",
21629
+ className: "whitespace-nowrap flex-1 lg:flex-none",
21630
+ children: "Modelos"
21631
+ }
21632
+ )
21633
+ ]
21634
+ }
21635
+ )
21636
+ }
21637
+ ) })
21638
+ ] }),
21639
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
21640
+ activeTab === "history" /* HISTORY */ && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_jsx_runtime83.Fragment, { children: error ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "lg", color: "text-error-500", children: error }) }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21641
+ TableProvider,
21642
+ {
21643
+ data: goals,
21644
+ headers: tableColumns,
21645
+ loading,
21646
+ variant: "borderless",
21647
+ enableSearch: true,
21648
+ enableFilters: true,
21649
+ enableTableSort: true,
21650
+ enablePagination: true,
21651
+ enableRowClick: true,
21652
+ initialFilters: initialFilterConfigs,
21653
+ paginationConfig: {
21654
+ itemLabel: "aulas",
21655
+ itemsPerPageOptions: [10, 20, 50, 100],
21656
+ defaultItemsPerPage: 10,
21657
+ totalItems: pagination.total,
21658
+ totalPages: pagination.totalPages
21659
+ },
21660
+ searchPlaceholder,
21661
+ noSearchResultState: {
21662
+ image: noSearchImage
21663
+ },
21664
+ emptyState: {
21665
+ component: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21666
+ EmptyState_default,
21667
+ {
21668
+ image: emptyStateImage,
21669
+ title: "Crie uma nova aula",
21670
+ description: "Selecione um conjunto de aulas organizadas por tema e ajude seus alunos a estudarem de forma estruturada e eficiente!",
21671
+ buttonText: createButtonText,
21672
+ buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_phosphor_react41.Plus, { size: 18 }),
21673
+ buttonVariant: "outline",
21674
+ buttonAction: "primary",
21675
+ onButtonClick: onCreateLesson
21676
+ }
21677
+ )
21678
+ },
21679
+ onParamsChange: handleParamsChange,
21680
+ onRowClick,
21681
+ children: (renderProps) => {
21682
+ const {
21683
+ controls,
21684
+ table,
21685
+ pagination: paginationComponent
21686
+ } = renderProps;
21687
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "space-y-4", children: [
21688
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
21689
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
21690
+ Button_default,
21691
+ {
21692
+ variant: "solid",
21693
+ action: "primary",
21694
+ size: "medium",
21695
+ onClick: onCreateLesson,
21696
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_phosphor_react41.Plus, { size: 18, weight: "bold" }),
21697
+ children: createButtonText
21698
+ }
21699
+ ),
21700
+ controls
21701
+ ] }),
21702
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
21703
+ table,
21704
+ paginationComponent
21705
+ ] })
21706
+ ] });
21707
+ }
21708
+ }
21709
+ ) }) }),
21710
+ activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) }),
21711
+ activeTab === "models" /* MODELS */ && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text_default, { size: "lg", color: "text-text-600", children: "Modelos em desenvolvimento" }) })
21712
+ ] })
21713
+ ] })
21714
+ ]
21715
+ }
21716
+ );
21717
+ };
21033
21718
  // Annotate the CommonJS export names for ESM import in node:
21034
21719
  0 && (module.exports = {
21035
21720
  ACTIVITY_AVAILABILITY,
@@ -21083,6 +21768,11 @@ var SendActivityModal_default = SendActivityModal;
21083
21768
  EmptyState,
21084
21769
  FileAttachment,
21085
21770
  FilterModal,
21771
+ GOAL_FILTER_STATUS_OPTIONS,
21772
+ GOAL_STATUS_OPTIONS,
21773
+ GoalApiStatus,
21774
+ GoalBadgeActionType,
21775
+ GoalDisplayStatus,
21086
21776
  IconButton,
21087
21777
  IconRender,
21088
21778
  IconRoundedButton,
@@ -21140,6 +21830,7 @@ var SendActivityModal_default = SendActivityModal;
21140
21830
  Radio,
21141
21831
  RadioGroup,
21142
21832
  RadioGroupItem,
21833
+ RecommendedLessonsHistory,
21143
21834
  STUDENT_ACTIVITY_STATUS,
21144
21835
  SUBTYPE_ENUM,
21145
21836
  Search,
@@ -21188,11 +21879,14 @@ var SendActivityModal_default = SendActivityModal;
21188
21879
  createNotificationStore,
21189
21880
  createNotificationsHook,
21190
21881
  createQuestionsListHook,
21882
+ createRecommendedLessonsHistoryHook,
21191
21883
  createUseActivityFiltersData,
21192
21884
  createUseNotificationStore,
21193
21885
  createUseNotifications,
21194
21886
  createUseQuestionsList,
21887
+ createUseRecommendedLessonsHistory,
21195
21888
  createZustandAuthAdapter,
21889
+ determineGoalStatus,
21196
21890
  formatDateToBrazilian,
21197
21891
  formatFileSize,
21198
21892
  formatQuestionNumbers,
@@ -21202,6 +21896,7 @@ var SendActivityModal_default = SendActivityModal;
21202
21896
  getCategoryIcon,
21203
21897
  getCategoryText,
21204
21898
  getDeviceType,
21899
+ getGoalStatusBadgeAction,
21205
21900
  getQuestionStatusBadgeConfig,
21206
21901
  getRootDomain,
21207
21902
  getSelectedIdsFromCategories,
@@ -21214,6 +21909,8 @@ var SendActivityModal_default = SendActivityModal;
21214
21909
  getSubjectIcon,
21215
21910
  getSubjectInfo,
21216
21911
  getSubjectName,
21912
+ goalsHistoryApiResponseSchema,
21913
+ handleGoalFetchError,
21217
21914
  isFormValid,
21218
21915
  isStepValid,
21219
21916
  mapApiStatusToInternal,
@@ -21223,6 +21920,7 @@ var SendActivityModal_default = SendActivityModal;
21223
21920
  syncDropdownState,
21224
21921
  toggleArrayItem,
21225
21922
  toggleSingleValue,
21923
+ transformGoalToTableItem,
21226
21924
  useAlertFormStore,
21227
21925
  useApiConfig,
21228
21926
  useAppContent,