analytica-frontend-lib 1.2.51 → 1.2.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivitiesHistory/index.css +19387 -0
- package/dist/ActivitiesHistory/index.css.map +1 -0
- package/dist/ActivitiesHistory/index.d.ts +2 -0
- package/dist/ActivitiesHistory/index.d.ts.map +1 -0
- package/dist/ActivitiesHistory/index.js +7381 -0
- package/dist/ActivitiesHistory/index.js.map +1 -0
- package/dist/ActivitiesHistory/index.mjs +7424 -0
- package/dist/ActivitiesHistory/index.mjs.map +1 -0
- package/dist/ActivityCardQuestionBanks/index.css +13 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.css +13 -0
- package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
- package/dist/ActivityDetails/index.css +13 -0
- package/dist/ActivityDetails/index.css.map +1 -1
- package/dist/ActivityFilters/index.css +13 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityPreview/index.css +13 -0
- package/dist/ActivityPreview/index.css.map +1 -1
- package/dist/AlertManager/index.css +13 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.css +13 -0
- package/dist/RecommendedLessonsHistory/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.js +10 -2
- package/dist/RecommendedLessonsHistory/index.js.map +1 -1
- package/dist/RecommendedLessonsHistory/index.mjs +10 -2
- package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.css +13 -0
- package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
- package/dist/SendActivityModal/index.css +13 -0
- package/dist/SendActivityModal/index.css.map +1 -1
- package/dist/TableProvider/index.css +13 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/hooks/useActivitiesHistory/index.d.ts +210 -0
- package/dist/hooks/useActivitiesHistory/index.d.ts.map +1 -0
- package/dist/hooks/useActivitiesHistory/index.js +181 -0
- package/dist/hooks/useActivitiesHistory/index.js.map +1 -0
- package/dist/hooks/useActivitiesHistory/index.mjs +141 -0
- package/dist/hooks/useActivitiesHistory/index.mjs.map +1 -0
- package/dist/hooks/useActivitiesHistory.d.ts +210 -0
- package/dist/hooks/useActivitiesHistory.d.ts.map +1 -0
- package/dist/hooks/useActivityModels/index.d.ts +220 -0
- package/dist/hooks/useActivityModels/index.d.ts.map +1 -0
- package/dist/hooks/useActivityModels/index.js +186 -0
- package/dist/hooks/useActivityModels/index.js.map +1 -0
- package/dist/hooks/useActivityModels/index.mjs +146 -0
- package/dist/hooks/useActivityModels/index.mjs.map +1 -0
- package/dist/hooks/useActivityModels.d.ts +220 -0
- package/dist/hooks/useActivityModels.d.ts.map +1 -0
- package/dist/index.css +13 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1069 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1049 -23
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +13 -0
- package/dist/styles.css.map +1 -1
- package/dist/types/activitiesHistory/index.d.ts +196 -0
- package/dist/types/activitiesHistory/index.d.ts.map +1 -0
- package/dist/types/activitiesHistory/index.js +92 -0
- package/dist/types/activitiesHistory/index.js.map +1 -0
- package/dist/types/activitiesHistory/index.mjs +59 -0
- package/dist/types/activitiesHistory/index.mjs.map +1 -0
- package/dist/types/activitiesHistory.d.ts +196 -0
- package/dist/types/activitiesHistory.d.ts.map +1 -0
- package/dist/types/common.d.ts +44 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/recommendedLessons/index.d.ts +10 -18
- package/dist/types/recommendedLessons/index.d.ts.map +1 -1
- package/dist/types/recommendedLessons/index.js +27 -22
- package/dist/types/recommendedLessons/index.js.map +1 -1
- package/dist/types/recommendedLessons/index.mjs +26 -23
- package/dist/types/recommendedLessons/index.mjs.map +1 -1
- package/dist/types/recommendedLessons.d.ts +10 -18
- package/dist/types/recommendedLessons.d.ts.map +1 -1
- package/dist/utils/hookErrorHandler.d.ts +24 -0
- package/dist/utils/hookErrorHandler.d.ts.map +1 -0
- package/package.json +7 -1
- package/dist/RecommendedLessonDetails/index.d.ts +0 -5
- package/dist/RecommendedLessonDetails/index.d.ts.map +0 -1
- package/dist/RecommendedLessonDetails/index.js +0 -4854
- package/dist/RecommendedLessonDetails/index.js.map +0 -1
- package/dist/RecommendedLessonDetails/index.mjs +0 -4872
- package/dist/RecommendedLessonDetails/index.mjs.map +0 -1
- package/dist/hooks/useRecommendedLessonDetails/index.d.ts +0 -780
- package/dist/hooks/useRecommendedLessonDetails/index.d.ts.map +0 -1
- package/dist/hooks/useRecommendedLessonDetails/index.js +0 -204
- package/dist/hooks/useRecommendedLessonDetails/index.js.map +0 -1
- package/dist/hooks/useRecommendedLessonDetails/index.mjs +0 -174
- package/dist/hooks/useRecommendedLessonDetails/index.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4985,6 +4985,11 @@ var Toaster = () => {
|
|
|
4985
4985
|
toast.id
|
|
4986
4986
|
)) });
|
|
4987
4987
|
};
|
|
4988
|
+
var useToast = () => {
|
|
4989
|
+
const addToast = ToastStore_default((state) => state.addToast);
|
|
4990
|
+
const removeToast = ToastStore_default((state) => state.removeToast);
|
|
4991
|
+
return { addToast, removeToast };
|
|
4992
|
+
};
|
|
4988
4993
|
var Toaster_default = Toaster;
|
|
4989
4994
|
|
|
4990
4995
|
// src/components/Search/Search.tsx
|
|
@@ -22421,26 +22426,26 @@ var SendActivityModal_default = SendActivityModal;
|
|
|
22421
22426
|
import { useState as useState44, useCallback as useCallback20, useMemo as useMemo25, useRef as useRef25 } from "react";
|
|
22422
22427
|
import { Plus as Plus3, CaretRight as CaretRight10, Trash as Trash2, PencilSimple as PencilSimple2 } from "phosphor-react";
|
|
22423
22428
|
|
|
22424
|
-
// src/types/
|
|
22425
|
-
var
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
return
|
|
22430
|
-
})(
|
|
22431
|
-
var
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
return
|
|
22436
|
-
})(
|
|
22437
|
-
var
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
return
|
|
22442
|
-
})(
|
|
22443
|
-
var
|
|
22429
|
+
// src/types/common.ts
|
|
22430
|
+
var GenericApiStatus = /* @__PURE__ */ ((GenericApiStatus2) => {
|
|
22431
|
+
GenericApiStatus2["A_VENCER"] = "A_VENCER";
|
|
22432
|
+
GenericApiStatus2["VENCIDA"] = "VENCIDA";
|
|
22433
|
+
GenericApiStatus2["CONCLUIDA"] = "CONCLUIDA";
|
|
22434
|
+
return GenericApiStatus2;
|
|
22435
|
+
})(GenericApiStatus || {});
|
|
22436
|
+
var GenericDisplayStatus = /* @__PURE__ */ ((GenericDisplayStatus4) => {
|
|
22437
|
+
GenericDisplayStatus4["ATIVA"] = "ATIVA";
|
|
22438
|
+
GenericDisplayStatus4["VENCIDA"] = "VENCIDA";
|
|
22439
|
+
GenericDisplayStatus4["CONCLUIDA"] = "CONCLU\xCDDA";
|
|
22440
|
+
return GenericDisplayStatus4;
|
|
22441
|
+
})(GenericDisplayStatus || {});
|
|
22442
|
+
var BadgeActionType = /* @__PURE__ */ ((BadgeActionType4) => {
|
|
22443
|
+
BadgeActionType4["SUCCESS"] = "success";
|
|
22444
|
+
BadgeActionType4["WARNING"] = "warning";
|
|
22445
|
+
BadgeActionType4["ERROR"] = "error";
|
|
22446
|
+
return BadgeActionType4;
|
|
22447
|
+
})(BadgeActionType || {});
|
|
22448
|
+
var getStatusBadgeAction2 = (status) => {
|
|
22444
22449
|
const actionMap = {
|
|
22445
22450
|
["CONCLU\xCDDA" /* CONCLUIDA */]: "success" /* SUCCESS */,
|
|
22446
22451
|
["ATIVA" /* ATIVA */]: "warning" /* WARNING */,
|
|
@@ -22448,6 +22453,17 @@ var getGoalStatusBadgeAction = (status) => {
|
|
|
22448
22453
|
};
|
|
22449
22454
|
return actionMap[status] ?? "warning" /* WARNING */;
|
|
22450
22455
|
};
|
|
22456
|
+
var mapApiStatusToDisplay = (apiStatus) => {
|
|
22457
|
+
const statusMap = {
|
|
22458
|
+
["A_VENCER" /* A_VENCER */]: "ATIVA" /* ATIVA */,
|
|
22459
|
+
["VENCIDA" /* VENCIDA */]: "VENCIDA" /* VENCIDA */,
|
|
22460
|
+
["CONCLUIDA" /* CONCLUIDA */]: "CONCLU\xCDDA" /* CONCLUIDA */
|
|
22461
|
+
};
|
|
22462
|
+
return statusMap[apiStatus];
|
|
22463
|
+
};
|
|
22464
|
+
|
|
22465
|
+
// src/types/recommendedLessons.ts
|
|
22466
|
+
var getGoalStatusBadgeAction = (status) => getStatusBadgeAction2(status);
|
|
22451
22467
|
var GOAL_FILTER_STATUS_OPTIONS = [
|
|
22452
22468
|
{ id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
|
|
22453
22469
|
{ id: "A_VENCER" /* A_VENCER */, name: "Ativa" }
|
|
@@ -23997,13 +24013,1009 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
23997
24013
|
};
|
|
23998
24014
|
};
|
|
23999
24015
|
var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
|
|
24016
|
+
|
|
24017
|
+
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
24018
|
+
import { useState as useState49 } from "react";
|
|
24019
|
+
|
|
24020
|
+
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
24021
|
+
import { useCallback as useCallback24, useMemo as useMemo28, useRef as useRef26 } from "react";
|
|
24022
|
+
import { Plus as Plus4 } from "phosphor-react";
|
|
24023
|
+
|
|
24024
|
+
// src/components/ActivitiesHistory/components/ErrorDisplay.tsx
|
|
24025
|
+
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
24026
|
+
var ErrorDisplay = ({ error }) => /* @__PURE__ */ jsx95("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx95(Text_default, { size: "lg", color: "text-error-500", children: error }) });
|
|
24027
|
+
|
|
24028
|
+
// src/components/ActivitiesHistory/config/historyTableColumns.tsx
|
|
24029
|
+
import { CaretRight as CaretRight11 } from "phosphor-react";
|
|
24030
|
+
|
|
24031
|
+
// src/components/ActivitiesHistory/utils/renderSubjectCell.tsx
|
|
24032
|
+
import { jsx as jsx96, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
24033
|
+
var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
|
|
24034
|
+
if (!subjectName) {
|
|
24035
|
+
return showEmptyDash ? /* @__PURE__ */ jsx96(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
|
|
24036
|
+
}
|
|
24037
|
+
const subjectEnum = mapSubjectNameToEnum?.(subjectName);
|
|
24038
|
+
if (!subjectEnum) {
|
|
24039
|
+
return /* @__PURE__ */ jsx96(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
|
|
24040
|
+
}
|
|
24041
|
+
const subjectInfo = getSubjectInfo(subjectEnum);
|
|
24042
|
+
return /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-2", title: subjectName, children: [
|
|
24043
|
+
/* @__PURE__ */ jsx96(
|
|
24044
|
+
"span",
|
|
24045
|
+
{
|
|
24046
|
+
className: cn(
|
|
24047
|
+
"w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
|
|
24048
|
+
subjectInfo.colorClass
|
|
24049
|
+
),
|
|
24050
|
+
children: subjectInfo.icon
|
|
24051
|
+
}
|
|
24052
|
+
),
|
|
24053
|
+
/* @__PURE__ */ jsx96(Text_default, { size: "sm", className: "truncate", children: subjectName })
|
|
24054
|
+
] });
|
|
24055
|
+
};
|
|
24056
|
+
|
|
24057
|
+
// src/components/ActivitiesHistory/utils/renderTruncatedText.tsx
|
|
24058
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
24059
|
+
var renderTruncatedText = (value) => {
|
|
24060
|
+
const text = typeof value === "string" ? value : "";
|
|
24061
|
+
return /* @__PURE__ */ jsx97(Text_default, { size: "sm", title: text, children: text });
|
|
24062
|
+
};
|
|
24063
|
+
|
|
24064
|
+
// src/components/ActivitiesHistory/utils/filterBuilders.ts
|
|
24065
|
+
var isNonEmptyArray2 = (param) => Array.isArray(param) && param.length > 0;
|
|
24066
|
+
var isValidApiStatus = (value) => Object.values(GenericApiStatus).includes(value);
|
|
24067
|
+
var buildHistoryFiltersFromParams = (params) => {
|
|
24068
|
+
const filters = {
|
|
24069
|
+
page: params.page,
|
|
24070
|
+
limit: params.limit
|
|
24071
|
+
};
|
|
24072
|
+
if (params.search) {
|
|
24073
|
+
filters.search = params.search;
|
|
24074
|
+
}
|
|
24075
|
+
if (isNonEmptyArray2(params.status) && isValidApiStatus(params.status[0])) {
|
|
24076
|
+
filters.status = params.status[0];
|
|
24077
|
+
}
|
|
24078
|
+
if (isNonEmptyArray2(params.school)) {
|
|
24079
|
+
filters.schoolId = params.school[0];
|
|
24080
|
+
}
|
|
24081
|
+
if (isNonEmptyArray2(params.subject)) {
|
|
24082
|
+
filters.subjectId = params.subject[0];
|
|
24083
|
+
}
|
|
24084
|
+
return filters;
|
|
24085
|
+
};
|
|
24086
|
+
var buildModelsFiltersFromParams = (params) => {
|
|
24087
|
+
const filters = {
|
|
24088
|
+
page: params.page,
|
|
24089
|
+
limit: params.limit
|
|
24090
|
+
};
|
|
24091
|
+
if (params.search) {
|
|
24092
|
+
filters.search = params.search;
|
|
24093
|
+
}
|
|
24094
|
+
if (isNonEmptyArray2(params.subject)) {
|
|
24095
|
+
filters.subjectId = params.subject[0];
|
|
24096
|
+
}
|
|
24097
|
+
return filters;
|
|
24098
|
+
};
|
|
24099
|
+
|
|
24100
|
+
// src/components/ActivitiesHistory/utils/filterOptions.ts
|
|
24101
|
+
var getSchoolOptions2 = (data) => {
|
|
24102
|
+
if (!data?.schools) return [];
|
|
24103
|
+
return data.schools.map((school) => ({
|
|
24104
|
+
id: school.id,
|
|
24105
|
+
name: school.name
|
|
24106
|
+
}));
|
|
24107
|
+
};
|
|
24108
|
+
var getSubjectOptions2 = (data) => {
|
|
24109
|
+
if (!data?.subjects) return [];
|
|
24110
|
+
return data.subjects.map((subject) => ({
|
|
24111
|
+
id: subject.id,
|
|
24112
|
+
name: subject.name
|
|
24113
|
+
}));
|
|
24114
|
+
};
|
|
24115
|
+
|
|
24116
|
+
// src/types/activitiesHistory.ts
|
|
24117
|
+
var ActivityDraftType = /* @__PURE__ */ ((ActivityDraftType2) => {
|
|
24118
|
+
ActivityDraftType2["MODELO"] = "MODELO";
|
|
24119
|
+
ActivityDraftType2["RASCUNHO"] = "RASCUNHO";
|
|
24120
|
+
return ActivityDraftType2;
|
|
24121
|
+
})(ActivityDraftType || {});
|
|
24122
|
+
var getActivityStatusBadgeAction = (status) => getStatusBadgeAction2(status);
|
|
24123
|
+
var ACTIVITY_FILTER_STATUS_OPTIONS = [
|
|
24124
|
+
{ id: "A_VENCER" /* A_VENCER */, name: "A Vencer" },
|
|
24125
|
+
{ id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
|
|
24126
|
+
{ id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" }
|
|
24127
|
+
];
|
|
24128
|
+
var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus);
|
|
24129
|
+
|
|
24130
|
+
// src/components/ActivitiesHistory/config/historyTableColumns.tsx
|
|
24131
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
24132
|
+
var createHistoryTableColumns = (mapSubjectNameToEnum) => [
|
|
24133
|
+
{
|
|
24134
|
+
key: "startDate",
|
|
24135
|
+
label: "In\xEDcio",
|
|
24136
|
+
sortable: true
|
|
24137
|
+
},
|
|
24138
|
+
{
|
|
24139
|
+
key: "deadline",
|
|
24140
|
+
label: "Prazo",
|
|
24141
|
+
sortable: true
|
|
24142
|
+
},
|
|
24143
|
+
{
|
|
24144
|
+
key: "title",
|
|
24145
|
+
label: "T\xEDtulo",
|
|
24146
|
+
sortable: true,
|
|
24147
|
+
className: "max-w-[200px] truncate",
|
|
24148
|
+
render: renderTruncatedText
|
|
24149
|
+
},
|
|
24150
|
+
{
|
|
24151
|
+
key: "school",
|
|
24152
|
+
label: "Escola",
|
|
24153
|
+
sortable: true,
|
|
24154
|
+
className: "max-w-[150px] truncate",
|
|
24155
|
+
render: renderTruncatedText
|
|
24156
|
+
},
|
|
24157
|
+
{
|
|
24158
|
+
key: "year",
|
|
24159
|
+
label: "Ano",
|
|
24160
|
+
sortable: true
|
|
24161
|
+
},
|
|
24162
|
+
{
|
|
24163
|
+
key: "subject",
|
|
24164
|
+
label: "Mat\xE9ria",
|
|
24165
|
+
sortable: true,
|
|
24166
|
+
className: "max-w-[140px]",
|
|
24167
|
+
render: (value) => {
|
|
24168
|
+
const subjectName = typeof value === "string" ? value : "";
|
|
24169
|
+
return renderSubjectCell(subjectName, mapSubjectNameToEnum, false);
|
|
24170
|
+
}
|
|
24171
|
+
},
|
|
24172
|
+
{
|
|
24173
|
+
key: "class",
|
|
24174
|
+
label: "Turma",
|
|
24175
|
+
sortable: true
|
|
24176
|
+
},
|
|
24177
|
+
{
|
|
24178
|
+
key: "status",
|
|
24179
|
+
label: "Status",
|
|
24180
|
+
sortable: true,
|
|
24181
|
+
render: (value) => {
|
|
24182
|
+
const status = typeof value === "string" ? value : "";
|
|
24183
|
+
if (!status) {
|
|
24184
|
+
return /* @__PURE__ */ jsx98(Text_default, { size: "sm", color: "text-text-500", children: "-" });
|
|
24185
|
+
}
|
|
24186
|
+
return /* @__PURE__ */ jsx98(
|
|
24187
|
+
Badge_default,
|
|
24188
|
+
{
|
|
24189
|
+
variant: "solid",
|
|
24190
|
+
action: getActivityStatusBadgeAction(status),
|
|
24191
|
+
size: "small",
|
|
24192
|
+
children: status
|
|
24193
|
+
}
|
|
24194
|
+
);
|
|
24195
|
+
}
|
|
24196
|
+
},
|
|
24197
|
+
{
|
|
24198
|
+
key: "completionPercentage",
|
|
24199
|
+
label: "Conclus\xE3o",
|
|
24200
|
+
sortable: true,
|
|
24201
|
+
render: (value) => /* @__PURE__ */ jsx98(
|
|
24202
|
+
ProgressBar_default,
|
|
24203
|
+
{
|
|
24204
|
+
value: Number(value),
|
|
24205
|
+
variant: "blue",
|
|
24206
|
+
size: "medium",
|
|
24207
|
+
layout: "compact",
|
|
24208
|
+
showPercentage: true,
|
|
24209
|
+
compactWidth: "w-[100px]"
|
|
24210
|
+
}
|
|
24211
|
+
)
|
|
24212
|
+
},
|
|
24213
|
+
{
|
|
24214
|
+
key: "navigation",
|
|
24215
|
+
label: "",
|
|
24216
|
+
sortable: false,
|
|
24217
|
+
className: "w-12",
|
|
24218
|
+
render: () => /* @__PURE__ */ jsx98("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx98(CaretRight11, { size: 20, className: "text-text-600" }) })
|
|
24219
|
+
}
|
|
24220
|
+
];
|
|
24221
|
+
|
|
24222
|
+
// src/components/ActivitiesHistory/config/historyFiltersConfig.ts
|
|
24223
|
+
var createHistoryFiltersConfig = (userData) => [
|
|
24224
|
+
{
|
|
24225
|
+
key: "status",
|
|
24226
|
+
label: "STATUS",
|
|
24227
|
+
categories: [
|
|
24228
|
+
{
|
|
24229
|
+
key: "status",
|
|
24230
|
+
label: "Status da Atividade",
|
|
24231
|
+
selectedIds: [],
|
|
24232
|
+
itens: ACTIVITY_FILTER_STATUS_OPTIONS
|
|
24233
|
+
}
|
|
24234
|
+
]
|
|
24235
|
+
},
|
|
24236
|
+
{
|
|
24237
|
+
key: "academic",
|
|
24238
|
+
label: "DADOS ACAD\xCAMICOS",
|
|
24239
|
+
categories: [
|
|
24240
|
+
{
|
|
24241
|
+
key: "school",
|
|
24242
|
+
label: "Escola",
|
|
24243
|
+
selectedIds: [],
|
|
24244
|
+
itens: getSchoolOptions2(userData)
|
|
24245
|
+
}
|
|
24246
|
+
]
|
|
24247
|
+
},
|
|
24248
|
+
{
|
|
24249
|
+
key: "content",
|
|
24250
|
+
label: "CONTE\xDADO",
|
|
24251
|
+
categories: [
|
|
24252
|
+
{
|
|
24253
|
+
key: "subject",
|
|
24254
|
+
label: "Mat\xE9ria",
|
|
24255
|
+
selectedIds: [],
|
|
24256
|
+
itens: getSubjectOptions2(userData)
|
|
24257
|
+
}
|
|
24258
|
+
]
|
|
24259
|
+
}
|
|
24260
|
+
];
|
|
24261
|
+
|
|
24262
|
+
// src/hooks/useActivitiesHistory.ts
|
|
24263
|
+
import { useState as useState46, useCallback as useCallback23 } from "react";
|
|
24264
|
+
import { z as z6 } from "zod";
|
|
24265
|
+
import dayjs4 from "dayjs";
|
|
24266
|
+
|
|
24267
|
+
// src/utils/hookErrorHandler.ts
|
|
24268
|
+
import { z as z5 } from "zod";
|
|
24269
|
+
var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
|
|
24270
|
+
if (error instanceof z5.ZodError) {
|
|
24271
|
+
console.error(validationErrorMessage, error);
|
|
24272
|
+
return validationErrorMessage;
|
|
24273
|
+
}
|
|
24274
|
+
console.error(genericErrorMessage, error);
|
|
24275
|
+
return genericErrorMessage;
|
|
24276
|
+
};
|
|
24277
|
+
|
|
24278
|
+
// src/hooks/useActivitiesHistory.ts
|
|
24279
|
+
var activityHistoryResponseSchema = z6.object({
|
|
24280
|
+
id: z6.string().uuid(),
|
|
24281
|
+
title: z6.string(),
|
|
24282
|
+
startDate: z6.string().nullable(),
|
|
24283
|
+
finalDate: z6.string().nullable(),
|
|
24284
|
+
status: z6.nativeEnum(GenericApiStatus),
|
|
24285
|
+
completionPercentage: z6.number().min(0).max(100),
|
|
24286
|
+
subjectId: z6.string().uuid(),
|
|
24287
|
+
schoolId: z6.string().optional(),
|
|
24288
|
+
schoolName: z6.string().optional(),
|
|
24289
|
+
year: z6.string().optional(),
|
|
24290
|
+
className: z6.string().optional(),
|
|
24291
|
+
subjectName: z6.string().optional()
|
|
24292
|
+
});
|
|
24293
|
+
var activitiesHistoryApiResponseSchema = z6.object({
|
|
24294
|
+
message: z6.string(),
|
|
24295
|
+
data: z6.object({
|
|
24296
|
+
activities: z6.array(activityHistoryResponseSchema),
|
|
24297
|
+
pagination: z6.object({
|
|
24298
|
+
total: z6.number(),
|
|
24299
|
+
page: z6.number(),
|
|
24300
|
+
limit: z6.number(),
|
|
24301
|
+
totalPages: z6.number()
|
|
24302
|
+
})
|
|
24303
|
+
})
|
|
24304
|
+
});
|
|
24305
|
+
var DEFAULT_ACTIVITIES_PAGINATION = {
|
|
24306
|
+
total: 0,
|
|
24307
|
+
page: 1,
|
|
24308
|
+
limit: 10,
|
|
24309
|
+
totalPages: 0
|
|
24310
|
+
};
|
|
24311
|
+
var transformActivityToTableItem = (activity) => {
|
|
24312
|
+
return {
|
|
24313
|
+
id: activity.id,
|
|
24314
|
+
startDate: activity.startDate ? dayjs4(activity.startDate).format("DD/MM") : "-",
|
|
24315
|
+
deadline: activity.finalDate ? dayjs4(activity.finalDate).format("DD/MM") : "-",
|
|
24316
|
+
title: activity.title,
|
|
24317
|
+
school: activity.schoolName || "-",
|
|
24318
|
+
year: activity.year || "-",
|
|
24319
|
+
subject: activity.subjectName || "-",
|
|
24320
|
+
class: activity.className || "-",
|
|
24321
|
+
status: mapActivityStatusToDisplay(activity.status),
|
|
24322
|
+
completionPercentage: activity.completionPercentage
|
|
24323
|
+
};
|
|
24324
|
+
};
|
|
24325
|
+
var handleActivityFetchError = createFetchErrorHandler(
|
|
24326
|
+
"Erro ao validar dados de hist\xF3rico de atividades",
|
|
24327
|
+
"Erro ao carregar hist\xF3rico de atividades"
|
|
24328
|
+
);
|
|
24329
|
+
var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
24330
|
+
return () => {
|
|
24331
|
+
const [state, setState] = useState46({
|
|
24332
|
+
activities: [],
|
|
24333
|
+
loading: false,
|
|
24334
|
+
error: null,
|
|
24335
|
+
pagination: DEFAULT_ACTIVITIES_PAGINATION
|
|
24336
|
+
});
|
|
24337
|
+
const fetchActivities = useCallback23(
|
|
24338
|
+
async (filters) => {
|
|
24339
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24340
|
+
try {
|
|
24341
|
+
const responseData = await fetchActivitiesHistory(filters);
|
|
24342
|
+
const validatedData = activitiesHistoryApiResponseSchema.parse(responseData);
|
|
24343
|
+
const tableItems = validatedData.data.activities.map(
|
|
24344
|
+
transformActivityToTableItem
|
|
24345
|
+
);
|
|
24346
|
+
setState({
|
|
24347
|
+
activities: tableItems,
|
|
24348
|
+
loading: false,
|
|
24349
|
+
error: null,
|
|
24350
|
+
pagination: validatedData.data.pagination
|
|
24351
|
+
});
|
|
24352
|
+
} catch (error) {
|
|
24353
|
+
const errorMessage = handleActivityFetchError(error);
|
|
24354
|
+
setState((prev) => ({
|
|
24355
|
+
...prev,
|
|
24356
|
+
loading: false,
|
|
24357
|
+
error: errorMessage
|
|
24358
|
+
}));
|
|
24359
|
+
}
|
|
24360
|
+
},
|
|
24361
|
+
[fetchActivitiesHistory]
|
|
24362
|
+
);
|
|
24363
|
+
return {
|
|
24364
|
+
...state,
|
|
24365
|
+
fetchActivities
|
|
24366
|
+
};
|
|
24367
|
+
};
|
|
24368
|
+
};
|
|
24369
|
+
var createActivitiesHistoryHook = createUseActivitiesHistory;
|
|
24370
|
+
|
|
24371
|
+
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
24372
|
+
import { jsx as jsx99, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
24373
|
+
var HistoryTab = ({
|
|
24374
|
+
fetchActivitiesHistory,
|
|
24375
|
+
onCreateActivity,
|
|
24376
|
+
onRowClick,
|
|
24377
|
+
emptyStateImage,
|
|
24378
|
+
noSearchImage,
|
|
24379
|
+
mapSubjectNameToEnum,
|
|
24380
|
+
userFilterData
|
|
24381
|
+
}) => {
|
|
24382
|
+
const fetchActivitiesHistoryRef = useRef26(fetchActivitiesHistory);
|
|
24383
|
+
fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
|
|
24384
|
+
const useActivitiesHistory = useMemo28(
|
|
24385
|
+
() => createUseActivitiesHistory(
|
|
24386
|
+
(filters) => fetchActivitiesHistoryRef.current(filters)
|
|
24387
|
+
),
|
|
24388
|
+
[]
|
|
24389
|
+
);
|
|
24390
|
+
const {
|
|
24391
|
+
activities,
|
|
24392
|
+
loading,
|
|
24393
|
+
error,
|
|
24394
|
+
pagination,
|
|
24395
|
+
fetchActivities
|
|
24396
|
+
} = useActivitiesHistory();
|
|
24397
|
+
const historyFilterConfigs = useMemo28(
|
|
24398
|
+
() => createHistoryFiltersConfig(userFilterData),
|
|
24399
|
+
[userFilterData]
|
|
24400
|
+
);
|
|
24401
|
+
const historyTableColumns = useMemo28(
|
|
24402
|
+
() => createHistoryTableColumns(mapSubjectNameToEnum),
|
|
24403
|
+
[mapSubjectNameToEnum]
|
|
24404
|
+
);
|
|
24405
|
+
const handleParamsChange = useCallback24(
|
|
24406
|
+
(params) => {
|
|
24407
|
+
const filters = buildHistoryFiltersFromParams(params);
|
|
24408
|
+
fetchActivities(filters);
|
|
24409
|
+
},
|
|
24410
|
+
[fetchActivities]
|
|
24411
|
+
);
|
|
24412
|
+
if (error) {
|
|
24413
|
+
return /* @__PURE__ */ jsx99(ErrorDisplay, { error });
|
|
24414
|
+
}
|
|
24415
|
+
return /* @__PURE__ */ jsx99("div", { className: "w-full", children: /* @__PURE__ */ jsx99(
|
|
24416
|
+
TableProvider,
|
|
24417
|
+
{
|
|
24418
|
+
data: activities,
|
|
24419
|
+
headers: historyTableColumns,
|
|
24420
|
+
loading,
|
|
24421
|
+
variant: "borderless",
|
|
24422
|
+
enableSearch: true,
|
|
24423
|
+
enableFilters: true,
|
|
24424
|
+
enableTableSort: true,
|
|
24425
|
+
enablePagination: true,
|
|
24426
|
+
enableRowClick: true,
|
|
24427
|
+
initialFilters: historyFilterConfigs,
|
|
24428
|
+
paginationConfig: {
|
|
24429
|
+
itemLabel: "atividades",
|
|
24430
|
+
itemsPerPageOptions: [10, 20, 50, 100],
|
|
24431
|
+
defaultItemsPerPage: 10,
|
|
24432
|
+
totalItems: pagination.total,
|
|
24433
|
+
totalPages: pagination.totalPages
|
|
24434
|
+
},
|
|
24435
|
+
searchPlaceholder: "Buscar atividade",
|
|
24436
|
+
noSearchResultState: {
|
|
24437
|
+
image: noSearchImage
|
|
24438
|
+
},
|
|
24439
|
+
emptyState: {
|
|
24440
|
+
component: /* @__PURE__ */ jsx99(
|
|
24441
|
+
EmptyState_default,
|
|
24442
|
+
{
|
|
24443
|
+
image: emptyStateImage,
|
|
24444
|
+
title: "Incentive sua turma ao aprendizado",
|
|
24445
|
+
description: "Crie uma nova atividade e ajude seus alunos a colocarem o conte\xFAdo em pr\xE1tica!",
|
|
24446
|
+
buttonText: "Criar atividade",
|
|
24447
|
+
buttonIcon: /* @__PURE__ */ jsx99(Plus4, { size: 18 }),
|
|
24448
|
+
buttonVariant: "outline",
|
|
24449
|
+
buttonAction: "primary",
|
|
24450
|
+
onButtonClick: onCreateActivity
|
|
24451
|
+
}
|
|
24452
|
+
)
|
|
24453
|
+
},
|
|
24454
|
+
onParamsChange: handleParamsChange,
|
|
24455
|
+
onRowClick,
|
|
24456
|
+
children: (renderProps) => {
|
|
24457
|
+
const {
|
|
24458
|
+
controls,
|
|
24459
|
+
table,
|
|
24460
|
+
pagination: paginationComponent
|
|
24461
|
+
} = renderProps;
|
|
24462
|
+
return /* @__PURE__ */ jsxs79("div", { className: "space-y-4", children: [
|
|
24463
|
+
/* @__PURE__ */ jsxs79("div", { className: "flex items-center justify-between gap-4", children: [
|
|
24464
|
+
/* @__PURE__ */ jsx99(
|
|
24465
|
+
Button_default,
|
|
24466
|
+
{
|
|
24467
|
+
variant: "solid",
|
|
24468
|
+
action: "primary",
|
|
24469
|
+
size: "medium",
|
|
24470
|
+
onClick: onCreateActivity,
|
|
24471
|
+
iconLeft: /* @__PURE__ */ jsx99(Plus4, { size: 18, weight: "bold" }),
|
|
24472
|
+
children: "Criar atividade"
|
|
24473
|
+
}
|
|
24474
|
+
),
|
|
24475
|
+
controls
|
|
24476
|
+
] }),
|
|
24477
|
+
/* @__PURE__ */ jsxs79("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
24478
|
+
table,
|
|
24479
|
+
paginationComponent
|
|
24480
|
+
] })
|
|
24481
|
+
] });
|
|
24482
|
+
}
|
|
24483
|
+
}
|
|
24484
|
+
) });
|
|
24485
|
+
};
|
|
24486
|
+
|
|
24487
|
+
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
24488
|
+
import { useState as useState48, useCallback as useCallback26, useMemo as useMemo29, useRef as useRef27, useEffect as useEffect45 } from "react";
|
|
24489
|
+
import { Plus as Plus5 } from "phosphor-react";
|
|
24490
|
+
|
|
24491
|
+
// src/components/ActivitiesHistory/config/modelsTableColumns.tsx
|
|
24492
|
+
import { Trash as Trash3, PencilSimple as PencilSimple3, PaperPlaneTilt as PaperPlaneTilt3 } from "phosphor-react";
|
|
24493
|
+
import { jsx as jsx100, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
24494
|
+
var createModelsTableColumns = (mapSubjectNameToEnum, onSendActivity, onEditModel, onDeleteModel) => [
|
|
24495
|
+
{
|
|
24496
|
+
key: "title",
|
|
24497
|
+
label: "T\xEDtulo",
|
|
24498
|
+
sortable: true,
|
|
24499
|
+
className: "max-w-[400px]",
|
|
24500
|
+
render: (value) => {
|
|
24501
|
+
const title = typeof value === "string" ? value : "";
|
|
24502
|
+
return /* @__PURE__ */ jsx100(Text_default, { size: "sm", title, className: "truncate block", children: title });
|
|
24503
|
+
}
|
|
24504
|
+
},
|
|
24505
|
+
{
|
|
24506
|
+
key: "savedAt",
|
|
24507
|
+
label: "Salvo em",
|
|
24508
|
+
sortable: true,
|
|
24509
|
+
className: "w-[120px]"
|
|
24510
|
+
},
|
|
24511
|
+
{
|
|
24512
|
+
key: "subject",
|
|
24513
|
+
label: "Mat\xE9ria",
|
|
24514
|
+
sortable: true,
|
|
24515
|
+
className: "max-w-[160px]",
|
|
24516
|
+
render: (value) => {
|
|
24517
|
+
const subjectName = typeof value === "string" ? value : "";
|
|
24518
|
+
return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
|
|
24519
|
+
}
|
|
24520
|
+
},
|
|
24521
|
+
{
|
|
24522
|
+
key: "actions",
|
|
24523
|
+
label: "",
|
|
24524
|
+
sortable: false,
|
|
24525
|
+
className: "w-[220px]",
|
|
24526
|
+
render: (_value, row) => {
|
|
24527
|
+
const handleSend = (e) => {
|
|
24528
|
+
e.stopPropagation();
|
|
24529
|
+
onSendActivity?.(row);
|
|
24530
|
+
};
|
|
24531
|
+
const handleEdit = (e) => {
|
|
24532
|
+
e.stopPropagation();
|
|
24533
|
+
onEditModel?.(row);
|
|
24534
|
+
};
|
|
24535
|
+
const handleDelete = (e) => {
|
|
24536
|
+
e.stopPropagation();
|
|
24537
|
+
onDeleteModel(row);
|
|
24538
|
+
};
|
|
24539
|
+
return /* @__PURE__ */ jsxs80("div", { className: "flex items-center gap-2 justify-end", children: [
|
|
24540
|
+
onSendActivity && /* @__PURE__ */ jsx100(
|
|
24541
|
+
Button_default,
|
|
24542
|
+
{
|
|
24543
|
+
variant: "outline",
|
|
24544
|
+
action: "primary",
|
|
24545
|
+
size: "small",
|
|
24546
|
+
iconLeft: /* @__PURE__ */ jsx100(PaperPlaneTilt3, { size: 16 }),
|
|
24547
|
+
onClick: handleSend,
|
|
24548
|
+
"aria-label": "Enviar atividade",
|
|
24549
|
+
children: "Enviar atividade"
|
|
24550
|
+
}
|
|
24551
|
+
),
|
|
24552
|
+
/* @__PURE__ */ jsx100(
|
|
24553
|
+
IconButton_default,
|
|
24554
|
+
{
|
|
24555
|
+
icon: /* @__PURE__ */ jsx100(Trash3, { size: 20 }),
|
|
24556
|
+
size: "md",
|
|
24557
|
+
onClick: handleDelete,
|
|
24558
|
+
"aria-label": "Deletar modelo",
|
|
24559
|
+
className: "text-text-600 hover:text-error-500 hover:bg-transparent"
|
|
24560
|
+
}
|
|
24561
|
+
),
|
|
24562
|
+
onEditModel && /* @__PURE__ */ jsx100(
|
|
24563
|
+
IconButton_default,
|
|
24564
|
+
{
|
|
24565
|
+
icon: /* @__PURE__ */ jsx100(PencilSimple3, { size: 20 }),
|
|
24566
|
+
size: "md",
|
|
24567
|
+
onClick: handleEdit,
|
|
24568
|
+
"aria-label": "Editar modelo",
|
|
24569
|
+
className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
|
|
24570
|
+
}
|
|
24571
|
+
)
|
|
24572
|
+
] });
|
|
24573
|
+
}
|
|
24574
|
+
}
|
|
24575
|
+
];
|
|
24576
|
+
|
|
24577
|
+
// src/components/ActivitiesHistory/config/modelsFiltersConfig.ts
|
|
24578
|
+
var createModelsFiltersConfig = (userData) => [
|
|
24579
|
+
{
|
|
24580
|
+
key: "content",
|
|
24581
|
+
label: "CONTE\xDADO",
|
|
24582
|
+
categories: [
|
|
24583
|
+
{
|
|
24584
|
+
key: "subject",
|
|
24585
|
+
label: "Mat\xE9ria",
|
|
24586
|
+
selectedIds: [],
|
|
24587
|
+
itens: getSubjectOptions2(userData)
|
|
24588
|
+
}
|
|
24589
|
+
]
|
|
24590
|
+
}
|
|
24591
|
+
];
|
|
24592
|
+
|
|
24593
|
+
// src/hooks/useActivityModels.ts
|
|
24594
|
+
import { useState as useState47, useCallback as useCallback25 } from "react";
|
|
24595
|
+
import { z as z7 } from "zod";
|
|
24596
|
+
import dayjs5 from "dayjs";
|
|
24597
|
+
var activityDraftFiltersSchema = z7.object({
|
|
24598
|
+
questionTypes: z7.array(z7.string()).optional(),
|
|
24599
|
+
questionBanks: z7.array(z7.string()).optional(),
|
|
24600
|
+
subjects: z7.array(z7.string()).optional(),
|
|
24601
|
+
topics: z7.array(z7.string()).optional(),
|
|
24602
|
+
subtopics: z7.array(z7.string()).optional(),
|
|
24603
|
+
contents: z7.array(z7.string()).optional()
|
|
24604
|
+
}).nullable();
|
|
24605
|
+
var activityModelResponseSchema = z7.object({
|
|
24606
|
+
id: z7.string().uuid(),
|
|
24607
|
+
type: z7.nativeEnum(ActivityDraftType),
|
|
24608
|
+
title: z7.string().nullable(),
|
|
24609
|
+
creatorUserInstitutionId: z7.string().uuid().nullable(),
|
|
24610
|
+
subjectId: z7.string().uuid().nullable(),
|
|
24611
|
+
filters: activityDraftFiltersSchema,
|
|
24612
|
+
createdAt: z7.string(),
|
|
24613
|
+
updatedAt: z7.string()
|
|
24614
|
+
});
|
|
24615
|
+
var activityModelsApiResponseSchema = z7.object({
|
|
24616
|
+
message: z7.string(),
|
|
24617
|
+
data: z7.object({
|
|
24618
|
+
activityDrafts: z7.array(activityModelResponseSchema),
|
|
24619
|
+
total: z7.number()
|
|
24620
|
+
})
|
|
24621
|
+
});
|
|
24622
|
+
var DEFAULT_MODELS_PAGINATION = {
|
|
24623
|
+
total: 0,
|
|
24624
|
+
page: 1,
|
|
24625
|
+
limit: 10,
|
|
24626
|
+
totalPages: 0
|
|
24627
|
+
};
|
|
24628
|
+
var transformModelToTableItem = (model, subjectsMap) => {
|
|
24629
|
+
const subjectName = model.subjectId ? subjectsMap?.get(model.subjectId) || "" : "";
|
|
24630
|
+
return {
|
|
24631
|
+
id: model.id,
|
|
24632
|
+
title: model.title || "Sem t\xEDtulo",
|
|
24633
|
+
savedAt: dayjs5(model.createdAt).format("DD/MM/YYYY"),
|
|
24634
|
+
subject: subjectName,
|
|
24635
|
+
subjectId: model.subjectId
|
|
24636
|
+
};
|
|
24637
|
+
};
|
|
24638
|
+
var handleModelFetchError = createFetchErrorHandler(
|
|
24639
|
+
"Erro ao validar dados de modelos de atividades",
|
|
24640
|
+
"Erro ao carregar modelos de atividades"
|
|
24641
|
+
);
|
|
24642
|
+
var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
24643
|
+
return () => {
|
|
24644
|
+
const [state, setState] = useState47({
|
|
24645
|
+
models: [],
|
|
24646
|
+
loading: false,
|
|
24647
|
+
error: null,
|
|
24648
|
+
pagination: DEFAULT_MODELS_PAGINATION
|
|
24649
|
+
});
|
|
24650
|
+
const fetchModels = useCallback25(
|
|
24651
|
+
async (filters, subjectsMap) => {
|
|
24652
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24653
|
+
try {
|
|
24654
|
+
const responseData = await fetchActivityModels(filters);
|
|
24655
|
+
const validatedData = activityModelsApiResponseSchema.parse(responseData);
|
|
24656
|
+
const tableItems = validatedData.data.activityDrafts.map(
|
|
24657
|
+
(model) => transformModelToTableItem(model, subjectsMap)
|
|
24658
|
+
);
|
|
24659
|
+
const limit = filters?.limit || 10;
|
|
24660
|
+
const page = filters?.page || 1;
|
|
24661
|
+
const total = validatedData.data.total;
|
|
24662
|
+
const totalPages = Math.ceil(total / limit);
|
|
24663
|
+
setState({
|
|
24664
|
+
models: tableItems,
|
|
24665
|
+
loading: false,
|
|
24666
|
+
error: null,
|
|
24667
|
+
pagination: {
|
|
24668
|
+
total,
|
|
24669
|
+
page,
|
|
24670
|
+
limit,
|
|
24671
|
+
totalPages
|
|
24672
|
+
}
|
|
24673
|
+
});
|
|
24674
|
+
} catch (error) {
|
|
24675
|
+
const errorMessage = handleModelFetchError(error);
|
|
24676
|
+
setState((prev) => ({
|
|
24677
|
+
...prev,
|
|
24678
|
+
loading: false,
|
|
24679
|
+
error: errorMessage
|
|
24680
|
+
}));
|
|
24681
|
+
}
|
|
24682
|
+
},
|
|
24683
|
+
[fetchActivityModels]
|
|
24684
|
+
);
|
|
24685
|
+
const deleteModel = useCallback25(
|
|
24686
|
+
async (id) => {
|
|
24687
|
+
try {
|
|
24688
|
+
await deleteActivityModel(id);
|
|
24689
|
+
return true;
|
|
24690
|
+
} catch (error) {
|
|
24691
|
+
console.error("Erro ao deletar modelo:", error);
|
|
24692
|
+
return false;
|
|
24693
|
+
}
|
|
24694
|
+
},
|
|
24695
|
+
[deleteActivityModel]
|
|
24696
|
+
);
|
|
24697
|
+
return {
|
|
24698
|
+
...state,
|
|
24699
|
+
fetchModels,
|
|
24700
|
+
deleteModel
|
|
24701
|
+
};
|
|
24702
|
+
};
|
|
24703
|
+
};
|
|
24704
|
+
var createActivityModelsHook = createUseActivityModels;
|
|
24705
|
+
|
|
24706
|
+
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
24707
|
+
import { Fragment as Fragment23, jsx as jsx101, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
24708
|
+
var ModelsTab = ({
|
|
24709
|
+
fetchActivityModels,
|
|
24710
|
+
deleteActivityModel,
|
|
24711
|
+
onCreateModel,
|
|
24712
|
+
onSendActivity,
|
|
24713
|
+
onEditModel,
|
|
24714
|
+
emptyStateImage,
|
|
24715
|
+
noSearchImage,
|
|
24716
|
+
mapSubjectNameToEnum,
|
|
24717
|
+
userFilterData,
|
|
24718
|
+
subjectsMap
|
|
24719
|
+
}) => {
|
|
24720
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState48(false);
|
|
24721
|
+
const [modelToDelete, setModelToDelete] = useState48(null);
|
|
24722
|
+
const { addToast } = useToast();
|
|
24723
|
+
const fetchActivityModelsRef = useRef27(fetchActivityModels);
|
|
24724
|
+
fetchActivityModelsRef.current = fetchActivityModels;
|
|
24725
|
+
const deleteActivityModelRef = useRef27(deleteActivityModel);
|
|
24726
|
+
deleteActivityModelRef.current = deleteActivityModel;
|
|
24727
|
+
const subjectsMapRef = useRef27(subjectsMap);
|
|
24728
|
+
subjectsMapRef.current = subjectsMap;
|
|
24729
|
+
const useActivityModels = useMemo29(
|
|
24730
|
+
() => createUseActivityModels(
|
|
24731
|
+
(filters) => fetchActivityModelsRef.current(filters),
|
|
24732
|
+
(id) => deleteActivityModelRef.current(id)
|
|
24733
|
+
),
|
|
24734
|
+
[]
|
|
24735
|
+
);
|
|
24736
|
+
const {
|
|
24737
|
+
models,
|
|
24738
|
+
loading: modelsLoading,
|
|
24739
|
+
error: modelsError,
|
|
24740
|
+
pagination: modelsPagination,
|
|
24741
|
+
fetchModels,
|
|
24742
|
+
deleteModel
|
|
24743
|
+
} = useActivityModels();
|
|
24744
|
+
const modelsFilterConfigs = useMemo29(
|
|
24745
|
+
() => createModelsFiltersConfig(userFilterData),
|
|
24746
|
+
[userFilterData]
|
|
24747
|
+
);
|
|
24748
|
+
const handleDeleteClick = useCallback26((model) => {
|
|
24749
|
+
setModelToDelete(model);
|
|
24750
|
+
setDeleteDialogOpen(true);
|
|
24751
|
+
}, []);
|
|
24752
|
+
const modelsTableColumns = useMemo29(
|
|
24753
|
+
() => createModelsTableColumns(
|
|
24754
|
+
mapSubjectNameToEnum,
|
|
24755
|
+
onSendActivity,
|
|
24756
|
+
onEditModel,
|
|
24757
|
+
handleDeleteClick
|
|
24758
|
+
),
|
|
24759
|
+
[mapSubjectNameToEnum, onSendActivity, onEditModel, handleDeleteClick]
|
|
24760
|
+
);
|
|
24761
|
+
const handleParamsChange = useCallback26(
|
|
24762
|
+
(params) => {
|
|
24763
|
+
const filters = buildModelsFiltersFromParams(params);
|
|
24764
|
+
fetchModels(filters, subjectsMapRef.current);
|
|
24765
|
+
},
|
|
24766
|
+
[fetchModels]
|
|
24767
|
+
);
|
|
24768
|
+
useEffect45(() => {
|
|
24769
|
+
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
24770
|
+
}, [fetchModels]);
|
|
24771
|
+
const handleConfirmDelete = useCallback26(async () => {
|
|
24772
|
+
if (modelToDelete) {
|
|
24773
|
+
const success = await deleteModel(modelToDelete.id);
|
|
24774
|
+
if (success) {
|
|
24775
|
+
addToast({ title: "Modelo deletado com sucesso", action: "success" });
|
|
24776
|
+
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
24777
|
+
} else {
|
|
24778
|
+
addToast({ title: "Erro ao deletar modelo", action: "warning" });
|
|
24779
|
+
}
|
|
24780
|
+
}
|
|
24781
|
+
setDeleteDialogOpen(false);
|
|
24782
|
+
setModelToDelete(null);
|
|
24783
|
+
}, [modelToDelete, deleteModel, fetchModels, addToast]);
|
|
24784
|
+
const handleCancelDelete = useCallback26(() => {
|
|
24785
|
+
setDeleteDialogOpen(false);
|
|
24786
|
+
setModelToDelete(null);
|
|
24787
|
+
}, []);
|
|
24788
|
+
return /* @__PURE__ */ jsxs81(Fragment23, { children: [
|
|
24789
|
+
/* @__PURE__ */ jsx101(Toaster_default, {}),
|
|
24790
|
+
modelsError ? /* @__PURE__ */ jsx101(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx101("div", { className: "w-full", "data-testid": "activity-models-tab", children: /* @__PURE__ */ jsx101(
|
|
24791
|
+
TableProvider,
|
|
24792
|
+
{
|
|
24793
|
+
data: models,
|
|
24794
|
+
headers: modelsTableColumns,
|
|
24795
|
+
loading: modelsLoading,
|
|
24796
|
+
variant: "borderless",
|
|
24797
|
+
enableSearch: true,
|
|
24798
|
+
enableFilters: true,
|
|
24799
|
+
enableTableSort: true,
|
|
24800
|
+
enablePagination: true,
|
|
24801
|
+
initialFilters: modelsFilterConfigs,
|
|
24802
|
+
paginationConfig: {
|
|
24803
|
+
itemLabel: "modelos",
|
|
24804
|
+
itemsPerPageOptions: [10, 20, 50, 100],
|
|
24805
|
+
defaultItemsPerPage: 10,
|
|
24806
|
+
totalItems: modelsPagination.total,
|
|
24807
|
+
totalPages: modelsPagination.totalPages
|
|
24808
|
+
},
|
|
24809
|
+
searchPlaceholder: "Buscar modelo",
|
|
24810
|
+
noSearchResultState: {
|
|
24811
|
+
image: noSearchImage
|
|
24812
|
+
},
|
|
24813
|
+
emptyState: {
|
|
24814
|
+
component: /* @__PURE__ */ jsx101(
|
|
24815
|
+
EmptyState_default,
|
|
24816
|
+
{
|
|
24817
|
+
image: emptyStateImage,
|
|
24818
|
+
title: "Crie modelos para agilizar suas atividades",
|
|
24819
|
+
description: "Salve modelos de atividades para reutilizar e enviar rapidamente para suas turmas!",
|
|
24820
|
+
buttonText: "Criar modelo",
|
|
24821
|
+
buttonIcon: /* @__PURE__ */ jsx101(Plus5, { size: 18 }),
|
|
24822
|
+
buttonVariant: "outline",
|
|
24823
|
+
buttonAction: "primary",
|
|
24824
|
+
onButtonClick: onCreateModel
|
|
24825
|
+
}
|
|
24826
|
+
)
|
|
24827
|
+
},
|
|
24828
|
+
onParamsChange: handleParamsChange,
|
|
24829
|
+
children: (renderProps) => {
|
|
24830
|
+
const {
|
|
24831
|
+
controls,
|
|
24832
|
+
table,
|
|
24833
|
+
pagination: paginationComponent
|
|
24834
|
+
} = renderProps;
|
|
24835
|
+
return /* @__PURE__ */ jsxs81("div", { className: "space-y-4", children: [
|
|
24836
|
+
/* @__PURE__ */ jsxs81("div", { className: "flex items-center justify-between gap-4", children: [
|
|
24837
|
+
/* @__PURE__ */ jsx101(
|
|
24838
|
+
Button_default,
|
|
24839
|
+
{
|
|
24840
|
+
variant: "solid",
|
|
24841
|
+
action: "primary",
|
|
24842
|
+
size: "medium",
|
|
24843
|
+
onClick: onCreateModel,
|
|
24844
|
+
iconLeft: /* @__PURE__ */ jsx101(Plus5, { size: 18, weight: "bold" }),
|
|
24845
|
+
children: "Criar modelo"
|
|
24846
|
+
}
|
|
24847
|
+
),
|
|
24848
|
+
controls
|
|
24849
|
+
] }),
|
|
24850
|
+
/* @__PURE__ */ jsxs81("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
24851
|
+
table,
|
|
24852
|
+
paginationComponent
|
|
24853
|
+
] })
|
|
24854
|
+
] });
|
|
24855
|
+
}
|
|
24856
|
+
}
|
|
24857
|
+
) }),
|
|
24858
|
+
/* @__PURE__ */ jsx101(
|
|
24859
|
+
AlertDialog,
|
|
24860
|
+
{
|
|
24861
|
+
isOpen: deleteDialogOpen,
|
|
24862
|
+
onChangeOpen: setDeleteDialogOpen,
|
|
24863
|
+
title: "Deletar modelo",
|
|
24864
|
+
description: `Tem certeza que deseja deletar o modelo "${modelToDelete?.title}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
|
|
24865
|
+
submitButtonLabel: "Deletar",
|
|
24866
|
+
cancelButtonLabel: "Cancelar",
|
|
24867
|
+
onSubmit: handleConfirmDelete,
|
|
24868
|
+
onCancel: handleCancelDelete
|
|
24869
|
+
}
|
|
24870
|
+
)
|
|
24871
|
+
] });
|
|
24872
|
+
};
|
|
24873
|
+
|
|
24874
|
+
// src/components/ActivitiesHistory/tabs/DraftsTab.tsx
|
|
24875
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
24876
|
+
var DraftsTab = () => {
|
|
24877
|
+
return /* @__PURE__ */ jsx102("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx102(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) });
|
|
24878
|
+
};
|
|
24879
|
+
|
|
24880
|
+
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
24881
|
+
import { jsx as jsx103, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
24882
|
+
var PAGE_TITLES = {
|
|
24883
|
+
["history" /* HISTORY */]: "Hist\xF3rico de atividades",
|
|
24884
|
+
["drafts" /* DRAFTS */]: "Rascunhos",
|
|
24885
|
+
["models" /* MODELS */]: "Modelos de atividades"
|
|
24886
|
+
};
|
|
24887
|
+
var ActivitiesHistory = ({
|
|
24888
|
+
fetchActivitiesHistory,
|
|
24889
|
+
fetchActivityModels,
|
|
24890
|
+
deleteActivityModel,
|
|
24891
|
+
onCreateActivity,
|
|
24892
|
+
onCreateModel,
|
|
24893
|
+
onRowClick,
|
|
24894
|
+
onSendActivity,
|
|
24895
|
+
onEditModel,
|
|
24896
|
+
emptyStateImage,
|
|
24897
|
+
noSearchImage,
|
|
24898
|
+
mapSubjectNameToEnum,
|
|
24899
|
+
userFilterData,
|
|
24900
|
+
subjectsMap
|
|
24901
|
+
}) => {
|
|
24902
|
+
const [activeTab, setActiveTab] = useState49("history" /* HISTORY */);
|
|
24903
|
+
return /* @__PURE__ */ jsxs82(
|
|
24904
|
+
"div",
|
|
24905
|
+
{
|
|
24906
|
+
"data-testid": "activities-history",
|
|
24907
|
+
className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden",
|
|
24908
|
+
children: [
|
|
24909
|
+
/* @__PURE__ */ jsx103("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
|
|
24910
|
+
/* @__PURE__ */ jsxs82("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: [
|
|
24911
|
+
/* @__PURE__ */ jsxs82("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: [
|
|
24912
|
+
/* @__PURE__ */ jsx103(
|
|
24913
|
+
Text_default,
|
|
24914
|
+
{
|
|
24915
|
+
as: "h1",
|
|
24916
|
+
weight: "bold",
|
|
24917
|
+
className: "leading-[28px] tracking-[0.2px] text-xl lg:text-2xl",
|
|
24918
|
+
children: PAGE_TITLES[activeTab]
|
|
24919
|
+
}
|
|
24920
|
+
),
|
|
24921
|
+
/* @__PURE__ */ jsx103("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ jsx103(
|
|
24922
|
+
Menu,
|
|
24923
|
+
{
|
|
24924
|
+
defaultValue: "history" /* HISTORY */,
|
|
24925
|
+
value: activeTab,
|
|
24926
|
+
onValueChange: (value) => setActiveTab(value),
|
|
24927
|
+
variant: "menu2",
|
|
24928
|
+
className: "bg-transparent shadow-none px-0",
|
|
24929
|
+
children: /* @__PURE__ */ jsxs82(
|
|
24930
|
+
MenuContent,
|
|
24931
|
+
{
|
|
24932
|
+
variant: "menu2",
|
|
24933
|
+
className: "w-full lg:w-auto max-w-full min-w-0",
|
|
24934
|
+
children: [
|
|
24935
|
+
/* @__PURE__ */ jsx103(
|
|
24936
|
+
MenuItem,
|
|
24937
|
+
{
|
|
24938
|
+
variant: "menu2",
|
|
24939
|
+
value: "history" /* HISTORY */,
|
|
24940
|
+
"data-testid": "menu-item-history",
|
|
24941
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
24942
|
+
children: "Hist\xF3rico"
|
|
24943
|
+
}
|
|
24944
|
+
),
|
|
24945
|
+
/* @__PURE__ */ jsx103(
|
|
24946
|
+
MenuItem,
|
|
24947
|
+
{
|
|
24948
|
+
variant: "menu2",
|
|
24949
|
+
value: "drafts" /* DRAFTS */,
|
|
24950
|
+
"data-testid": "menu-item-drafts",
|
|
24951
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
24952
|
+
children: "Rascunhos"
|
|
24953
|
+
}
|
|
24954
|
+
),
|
|
24955
|
+
/* @__PURE__ */ jsx103(
|
|
24956
|
+
MenuItem,
|
|
24957
|
+
{
|
|
24958
|
+
variant: "menu2",
|
|
24959
|
+
value: "models" /* MODELS */,
|
|
24960
|
+
"data-testid": "menu-item-models",
|
|
24961
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
24962
|
+
children: "Modelos"
|
|
24963
|
+
}
|
|
24964
|
+
)
|
|
24965
|
+
]
|
|
24966
|
+
}
|
|
24967
|
+
)
|
|
24968
|
+
}
|
|
24969
|
+
) })
|
|
24970
|
+
] }),
|
|
24971
|
+
/* @__PURE__ */ jsxs82("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
|
|
24972
|
+
activeTab === "history" /* HISTORY */ && /* @__PURE__ */ jsx103(
|
|
24973
|
+
HistoryTab,
|
|
24974
|
+
{
|
|
24975
|
+
fetchActivitiesHistory,
|
|
24976
|
+
onCreateActivity,
|
|
24977
|
+
onRowClick,
|
|
24978
|
+
emptyStateImage,
|
|
24979
|
+
noSearchImage,
|
|
24980
|
+
mapSubjectNameToEnum,
|
|
24981
|
+
userFilterData
|
|
24982
|
+
}
|
|
24983
|
+
),
|
|
24984
|
+
activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ jsx103(DraftsTab, {}),
|
|
24985
|
+
activeTab === "models" /* MODELS */ && /* @__PURE__ */ jsx103(
|
|
24986
|
+
ModelsTab,
|
|
24987
|
+
{
|
|
24988
|
+
fetchActivityModels,
|
|
24989
|
+
deleteActivityModel,
|
|
24990
|
+
onCreateModel,
|
|
24991
|
+
onSendActivity,
|
|
24992
|
+
onEditModel,
|
|
24993
|
+
emptyStateImage,
|
|
24994
|
+
noSearchImage,
|
|
24995
|
+
mapSubjectNameToEnum,
|
|
24996
|
+
userFilterData,
|
|
24997
|
+
subjectsMap
|
|
24998
|
+
}
|
|
24999
|
+
)
|
|
25000
|
+
] })
|
|
25001
|
+
] })
|
|
25002
|
+
]
|
|
25003
|
+
}
|
|
25004
|
+
);
|
|
25005
|
+
};
|
|
24000
25006
|
export {
|
|
24001
25007
|
ACTIVITY_AVAILABILITY,
|
|
25008
|
+
ACTIVITY_FILTER_STATUS_OPTIONS,
|
|
24002
25009
|
ANSWER_STATUS,
|
|
24003
25010
|
AccordionGroup,
|
|
25011
|
+
ActivitiesHistory,
|
|
25012
|
+
GenericApiStatus as ActivityApiStatus,
|
|
25013
|
+
BadgeActionType as ActivityBadgeActionType,
|
|
24004
25014
|
ActivityCardQuestionBanks,
|
|
24005
25015
|
ActivityCardQuestionPreview,
|
|
24006
25016
|
ActivityDetails,
|
|
25017
|
+
GenericDisplayStatus as ActivityDisplayStatus,
|
|
25018
|
+
ActivityDraftType,
|
|
24007
25019
|
ActivityFilters,
|
|
24008
25020
|
ActivityFiltersPopover,
|
|
24009
25021
|
ActivityPreview,
|
|
@@ -24037,6 +25049,8 @@ export {
|
|
|
24037
25049
|
Chips_default as Chips,
|
|
24038
25050
|
CorrectActivityModal_default as CorrectActivityModal,
|
|
24039
25051
|
CreateActivity,
|
|
25052
|
+
DEFAULT_ACTIVITIES_PAGINATION,
|
|
25053
|
+
DEFAULT_MODELS_PAGINATION,
|
|
24040
25054
|
DIFFICULTY_LEVEL_ENUM,
|
|
24041
25055
|
DateTimeInput_default as DateTimeInput,
|
|
24042
25056
|
Divider_default as Divider,
|
|
@@ -24052,9 +25066,9 @@ export {
|
|
|
24052
25066
|
FilterModal,
|
|
24053
25067
|
GOAL_FILTER_STATUS_OPTIONS,
|
|
24054
25068
|
GOAL_STATUS_OPTIONS,
|
|
24055
|
-
GoalApiStatus,
|
|
24056
|
-
GoalBadgeActionType,
|
|
24057
|
-
GoalDisplayStatus,
|
|
25069
|
+
GenericApiStatus as GoalApiStatus,
|
|
25070
|
+
BadgeActionType as GoalBadgeActionType,
|
|
25071
|
+
GenericDisplayStatus as GoalDisplayStatus,
|
|
24058
25072
|
IconButton_default as IconButton,
|
|
24059
25073
|
IconRender_default as IconRender,
|
|
24060
25074
|
IconRoundedButton_default as IconRoundedButton,
|
|
@@ -24159,15 +25173,21 @@ export {
|
|
|
24159
25173
|
Toaster_default as Toaster,
|
|
24160
25174
|
VideoPlayer_default as VideoPlayer,
|
|
24161
25175
|
Whiteboard_default as Whiteboard,
|
|
25176
|
+
activitiesHistoryApiResponseSchema,
|
|
25177
|
+
activityModelsApiResponseSchema,
|
|
24162
25178
|
cn,
|
|
24163
25179
|
convertActivityFiltersToQuestionsFilter,
|
|
25180
|
+
createActivitiesHistoryHook,
|
|
24164
25181
|
createActivityFiltersDataHook,
|
|
25182
|
+
createActivityModelsHook,
|
|
24165
25183
|
createNotificationStore,
|
|
24166
25184
|
createNotificationsHook,
|
|
24167
25185
|
createQuestionsListHook,
|
|
24168
25186
|
createRecommendedLessonDetailsHook,
|
|
24169
25187
|
createRecommendedLessonsHistoryHook,
|
|
25188
|
+
createUseActivitiesHistory,
|
|
24170
25189
|
createUseActivityFiltersData,
|
|
25190
|
+
createUseActivityModels,
|
|
24171
25191
|
createUseNotificationStore,
|
|
24172
25192
|
createUseNotifications,
|
|
24173
25193
|
createUseQuestionsList,
|
|
@@ -24183,6 +25203,7 @@ export {
|
|
|
24183
25203
|
formatTimeAgo,
|
|
24184
25204
|
formatTimeSpent,
|
|
24185
25205
|
generateFileId,
|
|
25206
|
+
getActivityStatusBadgeAction,
|
|
24186
25207
|
getCategoryIcon,
|
|
24187
25208
|
getCategoryText,
|
|
24188
25209
|
getDeviceType,
|
|
@@ -24203,12 +25224,15 @@ export {
|
|
|
24203
25224
|
goalApiResponseSchema,
|
|
24204
25225
|
goalDetailsApiResponseSchema,
|
|
24205
25226
|
goalsHistoryApiResponseSchema,
|
|
25227
|
+
handleActivityFetchError,
|
|
24206
25228
|
handleGoalFetchError,
|
|
24207
25229
|
handleLessonDetailsFetchError,
|
|
25230
|
+
handleModelFetchError,
|
|
24208
25231
|
historyApiResponseSchema,
|
|
24209
25232
|
isDeadlinePassed,
|
|
24210
25233
|
isFormValid,
|
|
24211
25234
|
isStepValid,
|
|
25235
|
+
mapActivityStatusToDisplay,
|
|
24212
25236
|
mapApiStatusToInternal,
|
|
24213
25237
|
mapInternalStatusToApi,
|
|
24214
25238
|
mapQuestionTypeToEnum,
|
|
@@ -24218,7 +25242,9 @@ export {
|
|
|
24218
25242
|
syncDropdownState,
|
|
24219
25243
|
toggleArrayItem,
|
|
24220
25244
|
toggleSingleValue,
|
|
25245
|
+
transformActivityToTableItem,
|
|
24221
25246
|
transformGoalToTableItem,
|
|
25247
|
+
transformModelToTableItem,
|
|
24222
25248
|
useAlertFormStore,
|
|
24223
25249
|
useApiConfig,
|
|
24224
25250
|
useAppContent,
|