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