analytica-frontend-lib 1.2.45 → 1.2.47

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