analytica-frontend-lib 1.2.70 → 1.2.72
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.js +14 -3
- package/dist/ActivitiesHistory/index.js.map +1 -1
- package/dist/ActivitiesHistory/index.mjs +14 -3
- package/dist/ActivitiesHistory/index.mjs.map +1 -1
- package/dist/ActivityDetails/index.d.ts +4 -11
- package/dist/ActivityDetails/index.d.ts.map +1 -1
- package/dist/ActivityDetails/index.js +176 -69
- package/dist/ActivityDetails/index.js.map +1 -1
- package/dist/ActivityDetails/index.mjs +143 -36
- package/dist/ActivityDetails/index.mjs.map +1 -1
- package/dist/ActivityFilters/index.js +5 -5
- package/dist/ActivityFilters/index.js.map +1 -1
- package/dist/ActivityFilters/index.mjs +5 -5
- package/dist/ActivityFilters/index.mjs.map +1 -1
- package/dist/CorrectActivityModal/index.d.ts.map +1 -1
- package/dist/CorrectActivityModal/index.js +1 -2
- package/dist/CorrectActivityModal/index.js.map +1 -1
- package/dist/CorrectActivityModal/index.mjs +1 -2
- package/dist/CorrectActivityModal/index.mjs.map +1 -1
- package/dist/RecommendedLessonsHistory/index.js +14 -3
- package/dist/RecommendedLessonsHistory/index.js.map +1 -1
- package/dist/RecommendedLessonsHistory/index.mjs +14 -3
- package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
- package/dist/TableProvider/index.d.ts +10 -1
- package/dist/TableProvider/index.d.ts.map +1 -1
- package/dist/TableProvider/index.js +14 -3
- package/dist/TableProvider/index.js.map +1 -1
- package/dist/TableProvider/index.mjs +14 -3
- package/dist/TableProvider/index.mjs.map +1 -1
- package/dist/hooks/useActivitiesHistory/index.d.ts +14 -14
- package/dist/hooks/useActivitiesHistory.d.ts +14 -14
- package/dist/hooks/useActivityDetails.d.ts +59 -0
- package/dist/hooks/useActivityDetails.d.ts.map +1 -0
- package/dist/hooks/useActivityModels/index.d.ts +6 -6
- package/dist/hooks/useActivityModels.d.ts +6 -6
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +537 -421
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +390 -276
- package/dist/index.mjs.map +1 -1
- package/dist/types/activityDetails.d.ts +29 -0
- package/dist/types/activityDetails.d.ts.map +1 -1
- package/dist/types/activityFilters.d.ts +1 -1
- package/dist/types/activityFilters.d.ts.map +1 -1
- package/dist/types/questions.d.ts +6 -7
- package/dist/types/questions.d.ts.map +1 -1
- package/dist/utils/activityDetailsUtils.d.ts +4 -4
- package/dist/utils/activityDetailsUtils.d.ts.map +1 -1
- package/dist/utils/index.js +13 -10
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +13 -10
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/questionFiltersConverter.d.ts.map +1 -1
- package/dist/utils/studentActivityCorrection/types.d.ts +5 -5
- package/dist/utils/studentActivityCorrection/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -287,6 +287,7 @@ __export(src_exports, {
|
|
|
287
287
|
mapSubjectEnumToName: () => mapSubjectEnumToName,
|
|
288
288
|
mapSubjectNameToEnum: () => mapSubjectNameToEnum,
|
|
289
289
|
questionTypeLabels: () => questionTypeLabels,
|
|
290
|
+
studentActivityStatusSchema: () => studentActivityStatusSchema,
|
|
290
291
|
supportSchema: () => supportSchema,
|
|
291
292
|
syncDropdownState: () => syncDropdownState,
|
|
292
293
|
toggleArrayItem: () => toggleArrayItem,
|
|
@@ -294,6 +295,7 @@ __export(src_exports, {
|
|
|
294
295
|
transformActivityToTableItem: () => transformActivityToTableItem,
|
|
295
296
|
transformGoalToTableItem: () => transformGoalToTableItem,
|
|
296
297
|
transformModelToTableItem: () => transformModelToTableItem,
|
|
298
|
+
useActivityDetails: () => useActivityDetails,
|
|
297
299
|
useAlertFormStore: () => useAlertFormStore,
|
|
298
300
|
useApiConfig: () => useApiConfig,
|
|
299
301
|
useAppContent: () => useAppContent,
|
|
@@ -369,7 +371,7 @@ function arraysEqual(a, b, comparator) {
|
|
|
369
371
|
function areFiltersEqual(filters1, filters2) {
|
|
370
372
|
if (filters1 === filters2) return true;
|
|
371
373
|
if (!filters1 || !filters2) return false;
|
|
372
|
-
return arraysEqual(filters1.types, filters2.types) && arraysEqual(filters1.bankIds, filters2.bankIds) && arraysEqual(filters1.yearIds, filters2.yearIds) && arraysEqual(filters1.
|
|
374
|
+
return arraysEqual(filters1.types, filters2.types) && arraysEqual(filters1.bankIds, filters2.bankIds) && arraysEqual(filters1.yearIds, filters2.yearIds) && arraysEqual(filters1.subjectIds, filters2.subjectIds) && arraysEqual(filters1.topicIds, filters2.topicIds) && arraysEqual(filters1.subtopicIds, filters2.subtopicIds) && arraysEqual(filters1.contentIds, filters2.contentIds);
|
|
373
375
|
}
|
|
374
376
|
|
|
375
377
|
// src/components/Quiz/useQuizStore.ts
|
|
@@ -998,12 +1000,19 @@ function mapQuestionTypeToEnumRequired(type, fallback = "ALTERNATIVA" /* ALTERNA
|
|
|
998
1000
|
}
|
|
999
1001
|
|
|
1000
1002
|
// src/types/activityDetails.ts
|
|
1003
|
+
var import_zod = require("zod");
|
|
1001
1004
|
var STUDENT_ACTIVITY_STATUS = {
|
|
1002
1005
|
CONCLUIDO: "CONCLUIDO",
|
|
1003
1006
|
AGUARDANDO_CORRECAO: "AGUARDANDO_CORRECAO",
|
|
1004
1007
|
AGUARDANDO_RESPOSTA: "AGUARDANDO_RESPOSTA",
|
|
1005
1008
|
NAO_ENTREGUE: "NAO_ENTREGUE"
|
|
1006
1009
|
};
|
|
1010
|
+
var studentActivityStatusSchema = import_zod.z.enum([
|
|
1011
|
+
STUDENT_ACTIVITY_STATUS.CONCLUIDO,
|
|
1012
|
+
STUDENT_ACTIVITY_STATUS.AGUARDANDO_CORRECAO,
|
|
1013
|
+
STUDENT_ACTIVITY_STATUS.AGUARDANDO_RESPOSTA,
|
|
1014
|
+
STUDENT_ACTIVITY_STATUS.NAO_ENTREGUE
|
|
1015
|
+
]);
|
|
1007
1016
|
var ACTIVITY_AVAILABILITY = {
|
|
1008
1017
|
DISPONIVEL: "DISPONIVEL",
|
|
1009
1018
|
NAO_INICIADA: "NAO_INICIADA",
|
|
@@ -1032,19 +1041,15 @@ var getStatusBadgeConfig = (status) => {
|
|
|
1032
1041
|
label: "N\xE3o Entregue",
|
|
1033
1042
|
bgColor: "bg-red-50",
|
|
1034
1043
|
textColor: "text-red-800"
|
|
1035
|
-
},
|
|
1036
|
-
default: {
|
|
1037
|
-
label: "Desconhecido",
|
|
1038
|
-
bgColor: "bg-gray-50",
|
|
1039
|
-
textColor: "text-gray-800"
|
|
1040
1044
|
}
|
|
1041
1045
|
};
|
|
1042
|
-
return configs[status]
|
|
1046
|
+
return configs[status];
|
|
1043
1047
|
};
|
|
1044
1048
|
var formatTimeSpent = (seconds) => {
|
|
1045
|
-
const
|
|
1046
|
-
const
|
|
1047
|
-
const
|
|
1049
|
+
const totalSeconds = Math.floor(Math.abs(seconds));
|
|
1050
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
1051
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
1052
|
+
const secs = totalSeconds % 60;
|
|
1048
1053
|
return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
|
|
1049
1054
|
};
|
|
1050
1055
|
var formatQuestionNumbers = (numbers) => {
|
|
@@ -12198,7 +12203,6 @@ var CorrectActivityModal = ({
|
|
|
12198
12203
|
}
|
|
12199
12204
|
await onQuestionCorrectionSubmit(data.studentId, {
|
|
12200
12205
|
questionId: questionData.question.id,
|
|
12201
|
-
questionNumber,
|
|
12202
12206
|
isCorrect: correction.isCorrect,
|
|
12203
12207
|
teacherFeedback: correction.teacherFeedback
|
|
12204
12208
|
});
|
|
@@ -12277,7 +12281,7 @@ var CorrectActivityModal = ({
|
|
|
12277
12281
|
renderQuestionDissertative({
|
|
12278
12282
|
result
|
|
12279
12283
|
}),
|
|
12280
|
-
|
|
12284
|
+
onQuestionCorrectionSubmit && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "space-y-4 border-t border-border-100 pt-4 mt-4", children: renderEssayCorrectionFields(questionData) })
|
|
12281
12285
|
] });
|
|
12282
12286
|
break;
|
|
12283
12287
|
case "PREENCHER" /* PREENCHER */:
|
|
@@ -14645,13 +14649,12 @@ var import_phosphor_react30 = require("phosphor-react");
|
|
|
14645
14649
|
// src/utils/questionFiltersConverter.ts
|
|
14646
14650
|
var convertActivityFiltersToQuestionsFilter = (filters) => {
|
|
14647
14651
|
return {
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
contentIds: filters.contentIds.length > 0 ? filters.contentIds : void 0
|
|
14652
|
+
questionType: filters.types,
|
|
14653
|
+
questionBankYearId: filters.yearIds.map((yearId) => yearId.split("-")[0]),
|
|
14654
|
+
subjectId: filters.subjectIds,
|
|
14655
|
+
topicId: filters.topicIds,
|
|
14656
|
+
subtopicId: filters.subtopicIds,
|
|
14657
|
+
contentId: filters.contentIds
|
|
14655
14658
|
};
|
|
14656
14659
|
};
|
|
14657
14660
|
|
|
@@ -14925,7 +14928,7 @@ function convertFiltersToBackendFormat(filters) {
|
|
|
14925
14928
|
return {
|
|
14926
14929
|
questionTypes: filters.types,
|
|
14927
14930
|
questionBanks: filters.bankIds,
|
|
14928
|
-
subjects: filters.
|
|
14931
|
+
subjects: filters.subjectIds,
|
|
14929
14932
|
topics: filters.topicIds,
|
|
14930
14933
|
subtopics: filters.subtopicIds,
|
|
14931
14934
|
contents: filters.contentIds
|
|
@@ -14938,7 +14941,7 @@ function convertBackendFiltersToActivityFiltersData(backendFilters) {
|
|
|
14938
14941
|
return {
|
|
14939
14942
|
types: (backendFilters.questionTypes || []).filter(isValidQuestionType),
|
|
14940
14943
|
bankIds: backendFilters.questionBanks || [],
|
|
14941
|
-
|
|
14944
|
+
subjectIds: backendFilters.subjects || [],
|
|
14942
14945
|
topicIds: backendFilters.topics || [],
|
|
14943
14946
|
subtopicIds: backendFilters.subtopics || [],
|
|
14944
14947
|
contentIds: backendFilters.contents || [],
|
|
@@ -15378,7 +15381,7 @@ var CreateActivity = ({
|
|
|
15378
15381
|
if (questions.length === 0 && !hasFirstSaveBeenDone.current) {
|
|
15379
15382
|
return false;
|
|
15380
15383
|
}
|
|
15381
|
-
if (!appliedFilters
|
|
15384
|
+
if (!appliedFilters?.subjectIds?.length) {
|
|
15382
15385
|
return false;
|
|
15383
15386
|
}
|
|
15384
15387
|
if (loadingInitialQuestions || isSaving) {
|
|
@@ -15387,7 +15390,10 @@ var CreateActivity = ({
|
|
|
15387
15390
|
return true;
|
|
15388
15391
|
}, [questions.length, appliedFilters, loadingInitialQuestions, isSaving]);
|
|
15389
15392
|
const createDraftPayload = (0, import_react42.useCallback)(() => {
|
|
15390
|
-
const subjectId = appliedFilters
|
|
15393
|
+
const subjectId = appliedFilters?.subjectIds?.[0];
|
|
15394
|
+
if (!subjectId) {
|
|
15395
|
+
throw new Error("Subject ID n\xE3o encontrado");
|
|
15396
|
+
}
|
|
15391
15397
|
const title = generateTitle(activityType, subjectId, knowledgeAreas);
|
|
15392
15398
|
const filters = convertFiltersToBackendFormat(appliedFilters);
|
|
15393
15399
|
const questionIds = questions.map((q) => q.id);
|
|
@@ -15602,7 +15608,7 @@ var CreateActivity = ({
|
|
|
15602
15608
|
if (questions.length === 0 && !hasFirstSaveBeenDone.current) {
|
|
15603
15609
|
return;
|
|
15604
15610
|
}
|
|
15605
|
-
if (!appliedFilters
|
|
15611
|
+
if (!appliedFilters) {
|
|
15606
15612
|
return;
|
|
15607
15613
|
}
|
|
15608
15614
|
const questionIds = questions.map((q) => q.id).join(",");
|
|
@@ -15660,7 +15666,8 @@ var CreateActivity = ({
|
|
|
15660
15666
|
const handleReorder = (0, import_react42.useCallback)(
|
|
15661
15667
|
(orderedQuestions) => {
|
|
15662
15668
|
setQuestions(orderedQuestions);
|
|
15663
|
-
|
|
15669
|
+
const hasSubjectIds = Array.isArray(appliedFilters?.subjectIds) && appliedFilters.subjectIds.length > 0;
|
|
15670
|
+
if (hasFirstSaveBeenDone.current && hasSubjectIds && !loadingInitialQuestions && !isSaving) {
|
|
15664
15671
|
if (saveTimeoutRef.current) {
|
|
15665
15672
|
clearTimeout(saveTimeoutRef.current);
|
|
15666
15673
|
}
|
|
@@ -15706,7 +15713,7 @@ var CreateActivity = ({
|
|
|
15706
15713
|
async (formData) => {
|
|
15707
15714
|
setIsSendingActivity(true);
|
|
15708
15715
|
try {
|
|
15709
|
-
const subjectId = activity?.subjectId || appliedFilters?.
|
|
15716
|
+
const subjectId = activity?.subjectId || appliedFilters?.subjectIds?.[0];
|
|
15710
15717
|
if (!subjectId) {
|
|
15711
15718
|
throw new Error("Subject ID n\xE3o encontrado");
|
|
15712
15719
|
}
|
|
@@ -16495,8 +16502,8 @@ var ActivityFilters = ({
|
|
|
16495
16502
|
if (initialFilters.types && initialFilters.types.length > 0) {
|
|
16496
16503
|
setSelectedQuestionTypes(initialFilters.types);
|
|
16497
16504
|
}
|
|
16498
|
-
if (initialFilters.
|
|
16499
|
-
setSelectedSubject(initialFilters.
|
|
16505
|
+
if (initialFilters.subjectIds && initialFilters.subjectIds.length > 0) {
|
|
16506
|
+
setSelectedSubject(initialFilters.subjectIds[0]);
|
|
16500
16507
|
}
|
|
16501
16508
|
hasAppliedBasicInitialFiltersRef.current = true;
|
|
16502
16509
|
}, [initialFilters]);
|
|
@@ -16536,7 +16543,7 @@ var ActivityFilters = ({
|
|
|
16536
16543
|
if (!initialFilters) {
|
|
16537
16544
|
return;
|
|
16538
16545
|
}
|
|
16539
|
-
const subjectIds = initialFilters.
|
|
16546
|
+
const subjectIds = initialFilters.subjectIds || [];
|
|
16540
16547
|
const topicIds = initialFilters.topicIds || [];
|
|
16541
16548
|
const subtopicIds = initialFilters.subtopicIds || [];
|
|
16542
16549
|
if (subjectIds.length > 0 && !hasRequestedTopicsRef.current) {
|
|
@@ -16658,7 +16665,7 @@ var ActivityFilters = ({
|
|
|
16658
16665
|
types: selectedQuestionTypes,
|
|
16659
16666
|
bankIds: bankIds.bankIds || [],
|
|
16660
16667
|
yearIds: bankIds.yearIds || [],
|
|
16661
|
-
|
|
16668
|
+
subjectIds: selectedSubjects,
|
|
16662
16669
|
topicIds: knowledgeIds.topicIds,
|
|
16663
16670
|
subtopicIds: knowledgeIds.subtopicIds,
|
|
16664
16671
|
contentIds: knowledgeIds.contentIds
|
|
@@ -16800,6 +16807,8 @@ function TableProvider({
|
|
|
16800
16807
|
rowKey,
|
|
16801
16808
|
onParamsChange,
|
|
16802
16809
|
onRowClick,
|
|
16810
|
+
headerContent,
|
|
16811
|
+
containerClassName,
|
|
16803
16812
|
children
|
|
16804
16813
|
}) {
|
|
16805
16814
|
const [searchQuery, setSearchQuery] = (0, import_react45.useState)("");
|
|
@@ -16944,6 +16953,10 @@ function TableProvider({
|
|
|
16944
16953
|
}
|
|
16945
16954
|
) })
|
|
16946
16955
|
] });
|
|
16956
|
+
const headerSection = (headerContent || controls) && /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex flex-col md:flex-row items-stretch md:items-center justify-between gap-4", children: [
|
|
16957
|
+
headerContent && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: headerContent }),
|
|
16958
|
+
controls && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex-1 md:flex-none", children: controls })
|
|
16959
|
+
] });
|
|
16947
16960
|
const table = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
16948
16961
|
Table_default,
|
|
16949
16962
|
{
|
|
@@ -17040,7 +17053,11 @@ function TableProvider({
|
|
|
17040
17053
|
) });
|
|
17041
17054
|
if (children) {
|
|
17042
17055
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
|
|
17043
|
-
children({
|
|
17056
|
+
children({
|
|
17057
|
+
controls: headerSection || controls || null,
|
|
17058
|
+
table,
|
|
17059
|
+
pagination
|
|
17060
|
+
}),
|
|
17044
17061
|
enableFilters && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
17045
17062
|
FilterModal,
|
|
17046
17063
|
{
|
|
@@ -17054,8 +17071,9 @@ function TableProvider({
|
|
|
17054
17071
|
)
|
|
17055
17072
|
] });
|
|
17056
17073
|
}
|
|
17057
|
-
|
|
17058
|
-
|
|
17074
|
+
const wrapperClassName = containerClassName || "w-full space-y-4";
|
|
17075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: wrapperClassName, children: [
|
|
17076
|
+
headerSection,
|
|
17059
17077
|
table,
|
|
17060
17078
|
pagination,
|
|
17061
17079
|
enableFilters && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
@@ -21759,8 +21777,104 @@ var ActivityPreview = ({
|
|
|
21759
21777
|
};
|
|
21760
21778
|
|
|
21761
21779
|
// src/components/ActivityDetails/ActivityDetails.tsx
|
|
21762
|
-
var
|
|
21780
|
+
var import_react65 = require("react");
|
|
21763
21781
|
var import_phosphor_react44 = require("phosphor-react");
|
|
21782
|
+
|
|
21783
|
+
// src/hooks/useActivityDetails.ts
|
|
21784
|
+
var import_react64 = require("react");
|
|
21785
|
+
var buildQueryParams = (params) => {
|
|
21786
|
+
const paramsObj = {};
|
|
21787
|
+
if (params?.page) paramsObj.page = params.page;
|
|
21788
|
+
if (params?.limit) paramsObj.limit = params.limit;
|
|
21789
|
+
if (params?.sortBy) paramsObj.sortBy = params.sortBy;
|
|
21790
|
+
if (params?.sortOrder) paramsObj.sortOrder = params.sortOrder;
|
|
21791
|
+
if (params?.status) paramsObj.status = params.status;
|
|
21792
|
+
return paramsObj;
|
|
21793
|
+
};
|
|
21794
|
+
var useActivityDetails = (apiClient) => {
|
|
21795
|
+
const fetchActivityDetails = (0, import_react64.useCallback)(
|
|
21796
|
+
async (id, params) => {
|
|
21797
|
+
const queryParams = buildQueryParams(params);
|
|
21798
|
+
const [detailsResponse, quizResponse] = await Promise.all([
|
|
21799
|
+
apiClient.get(`/activities/${id}/details`, {
|
|
21800
|
+
params: queryParams
|
|
21801
|
+
}),
|
|
21802
|
+
apiClient.get(`/activities/${id}/quiz`).catch(() => null)
|
|
21803
|
+
]);
|
|
21804
|
+
return {
|
|
21805
|
+
...detailsResponse.data.data,
|
|
21806
|
+
activity: quizResponse?.data?.data
|
|
21807
|
+
};
|
|
21808
|
+
},
|
|
21809
|
+
[apiClient]
|
|
21810
|
+
);
|
|
21811
|
+
const fetchStudentCorrection = (0, import_react64.useCallback)(
|
|
21812
|
+
async (activityId, studentId) => {
|
|
21813
|
+
const response = await apiClient.get(
|
|
21814
|
+
`/questions/activity/${activityId}/user/${studentId}/answers`
|
|
21815
|
+
);
|
|
21816
|
+
return response.data;
|
|
21817
|
+
},
|
|
21818
|
+
[apiClient]
|
|
21819
|
+
);
|
|
21820
|
+
const submitObservation = (0, import_react64.useCallback)(
|
|
21821
|
+
async (actId, studentId, observation, file) => {
|
|
21822
|
+
let attachmentUrl = null;
|
|
21823
|
+
if (file) {
|
|
21824
|
+
const presignedRes = await apiClient.post(
|
|
21825
|
+
"/user/get-pre-signed-url",
|
|
21826
|
+
{
|
|
21827
|
+
fileName: file.name,
|
|
21828
|
+
fileType: file.type,
|
|
21829
|
+
fileSize: file.size
|
|
21830
|
+
}
|
|
21831
|
+
);
|
|
21832
|
+
const { url, fields } = presignedRes.data.data;
|
|
21833
|
+
const formData = new FormData();
|
|
21834
|
+
for (const [key2, value] of Object.entries(fields)) {
|
|
21835
|
+
formData.append(key2, value);
|
|
21836
|
+
}
|
|
21837
|
+
formData.append("file", file);
|
|
21838
|
+
await fetch(url, {
|
|
21839
|
+
method: "POST",
|
|
21840
|
+
body: formData
|
|
21841
|
+
}).then((response) => {
|
|
21842
|
+
if (!response.ok) {
|
|
21843
|
+
throw new Error("Falha ao fazer upload do arquivo");
|
|
21844
|
+
}
|
|
21845
|
+
});
|
|
21846
|
+
const baseUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
21847
|
+
const key = fields.key.startsWith("/") ? fields.key.slice(1) : fields.key;
|
|
21848
|
+
attachmentUrl = `${baseUrl}/${key}`;
|
|
21849
|
+
}
|
|
21850
|
+
await apiClient.post(
|
|
21851
|
+
`/activities/${actId}/students/${studentId}/feedback/observation`,
|
|
21852
|
+
{
|
|
21853
|
+
observation,
|
|
21854
|
+
attachmentUrl
|
|
21855
|
+
}
|
|
21856
|
+
);
|
|
21857
|
+
},
|
|
21858
|
+
[apiClient]
|
|
21859
|
+
);
|
|
21860
|
+
const submitQuestionCorrection = (0, import_react64.useCallback)(
|
|
21861
|
+
async (activityId, studentId, payload) => {
|
|
21862
|
+
await apiClient.post(
|
|
21863
|
+
`/activities/${activityId}/students/${studentId}/questions/correction`,
|
|
21864
|
+
payload
|
|
21865
|
+
);
|
|
21866
|
+
},
|
|
21867
|
+
[apiClient]
|
|
21868
|
+
);
|
|
21869
|
+
return {
|
|
21870
|
+
fetchActivityDetails,
|
|
21871
|
+
fetchStudentCorrection,
|
|
21872
|
+
submitObservation,
|
|
21873
|
+
submitQuestionCorrection
|
|
21874
|
+
};
|
|
21875
|
+
};
|
|
21876
|
+
|
|
21877
|
+
// src/components/ActivityDetails/ActivityDetails.tsx
|
|
21764
21878
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
21765
21879
|
var createTableColumns = (onCorrectActivity) => [
|
|
21766
21880
|
{
|
|
@@ -21848,30 +21962,33 @@ var createTableColumns = (onCorrectActivity) => [
|
|
|
21848
21962
|
];
|
|
21849
21963
|
var ActivityDetails = ({
|
|
21850
21964
|
activityId,
|
|
21851
|
-
|
|
21852
|
-
fetchStudentCorrection,
|
|
21853
|
-
submitObservation,
|
|
21854
|
-
submitQuestionCorrection,
|
|
21965
|
+
apiClient,
|
|
21855
21966
|
onBack,
|
|
21856
21967
|
onViewActivity,
|
|
21857
21968
|
emptyStateImage,
|
|
21858
21969
|
mapSubjectNameToEnum: mapSubjectNameToEnum2
|
|
21859
21970
|
}) => {
|
|
21860
21971
|
const { isMobile } = useMobile();
|
|
21861
|
-
const [page, setPage] = (0,
|
|
21862
|
-
const [limit, setLimit] = (0,
|
|
21863
|
-
const [sortBy, setSortBy] = (0,
|
|
21864
|
-
const [sortOrder, setSortOrder] = (0,
|
|
21972
|
+
const [page, setPage] = (0, import_react65.useState)(1);
|
|
21973
|
+
const [limit, setLimit] = (0, import_react65.useState)(10);
|
|
21974
|
+
const [sortBy, setSortBy] = (0, import_react65.useState)(void 0);
|
|
21975
|
+
const [sortOrder, setSortOrder] = (0, import_react65.useState)(
|
|
21865
21976
|
void 0
|
|
21866
21977
|
);
|
|
21867
|
-
const [data, setData] = (0,
|
|
21868
|
-
const [correctionData, setCorrectionData] = (0,
|
|
21869
|
-
const [loading, setLoading] = (0,
|
|
21870
|
-
const [error, setError] = (0,
|
|
21871
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
21872
|
-
const [isViewOnlyModal, setIsViewOnlyModal] = (0,
|
|
21873
|
-
const [correctionError, setCorrectionError] = (0,
|
|
21874
|
-
|
|
21978
|
+
const [data, setData] = (0, import_react65.useState)(null);
|
|
21979
|
+
const [correctionData, setCorrectionData] = (0, import_react65.useState)(null);
|
|
21980
|
+
const [loading, setLoading] = (0, import_react65.useState)(true);
|
|
21981
|
+
const [error, setError] = (0, import_react65.useState)(null);
|
|
21982
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react65.useState)(false);
|
|
21983
|
+
const [isViewOnlyModal, setIsViewOnlyModal] = (0, import_react65.useState)(false);
|
|
21984
|
+
const [correctionError, setCorrectionError] = (0, import_react65.useState)(null);
|
|
21985
|
+
const {
|
|
21986
|
+
fetchActivityDetails,
|
|
21987
|
+
fetchStudentCorrection,
|
|
21988
|
+
submitObservation,
|
|
21989
|
+
submitQuestionCorrection
|
|
21990
|
+
} = useActivityDetails(apiClient);
|
|
21991
|
+
(0, import_react65.useEffect)(() => {
|
|
21875
21992
|
const loadData = async () => {
|
|
21876
21993
|
if (!activityId) return;
|
|
21877
21994
|
setLoading(true);
|
|
@@ -21894,7 +22011,7 @@ var ActivityDetails = ({
|
|
|
21894
22011
|
};
|
|
21895
22012
|
loadData();
|
|
21896
22013
|
}, [activityId, page, limit, sortBy, sortOrder, fetchActivityDetails]);
|
|
21897
|
-
const handleCorrectActivity = (0,
|
|
22014
|
+
const handleCorrectActivity = (0, import_react65.useCallback)(
|
|
21898
22015
|
async (studentId) => {
|
|
21899
22016
|
const student = data?.students.find((s) => s.studentId === studentId);
|
|
21900
22017
|
if (!student || !activityId) return;
|
|
@@ -21902,11 +22019,7 @@ var ActivityDetails = ({
|
|
|
21902
22019
|
setIsViewOnlyModal(isViewOnly);
|
|
21903
22020
|
setCorrectionError(null);
|
|
21904
22021
|
try {
|
|
21905
|
-
const apiResponse = await fetchStudentCorrection(
|
|
21906
|
-
activityId,
|
|
21907
|
-
studentId,
|
|
21908
|
-
student.studentName || "Aluno"
|
|
21909
|
-
);
|
|
22022
|
+
const apiResponse = await fetchStudentCorrection(activityId, studentId);
|
|
21910
22023
|
const correction = convertApiResponseToCorrectionData(
|
|
21911
22024
|
apiResponse,
|
|
21912
22025
|
studentId,
|
|
@@ -21923,23 +22036,24 @@ var ActivityDetails = ({
|
|
|
21923
22036
|
},
|
|
21924
22037
|
[data?.students, activityId, fetchStudentCorrection]
|
|
21925
22038
|
);
|
|
21926
|
-
const handleCloseModal = (0,
|
|
22039
|
+
const handleCloseModal = (0, import_react65.useCallback)(() => {
|
|
21927
22040
|
setIsModalOpen(false);
|
|
21928
22041
|
}, []);
|
|
21929
|
-
const handleObservationSubmit = (0,
|
|
22042
|
+
const handleObservationSubmit = (0, import_react65.useCallback)(
|
|
21930
22043
|
async (studentId, observation, files) => {
|
|
21931
22044
|
if (!activityId || !studentId) return;
|
|
21932
22045
|
try {
|
|
21933
|
-
|
|
22046
|
+
const file = files.length > 0 ? files[0] : null;
|
|
22047
|
+
await submitObservation(activityId, studentId, observation, file);
|
|
21934
22048
|
} catch (err) {
|
|
21935
22049
|
console.error("Failed to submit observation:", err);
|
|
21936
22050
|
}
|
|
21937
22051
|
},
|
|
21938
22052
|
[activityId, submitObservation]
|
|
21939
22053
|
);
|
|
21940
|
-
const handleQuestionCorrectionSubmit = (0,
|
|
22054
|
+
const handleQuestionCorrectionSubmit = (0, import_react65.useCallback)(
|
|
21941
22055
|
async (studentId, payload) => {
|
|
21942
|
-
if (!activityId || !studentId
|
|
22056
|
+
if (!activityId || !studentId) return;
|
|
21943
22057
|
try {
|
|
21944
22058
|
await submitQuestionCorrection(activityId, studentId, payload);
|
|
21945
22059
|
} catch (err) {
|
|
@@ -21949,7 +22063,7 @@ var ActivityDetails = ({
|
|
|
21949
22063
|
},
|
|
21950
22064
|
[activityId, submitQuestionCorrection]
|
|
21951
22065
|
);
|
|
21952
|
-
const tableData = (0,
|
|
22066
|
+
const tableData = (0, import_react65.useMemo)(() => {
|
|
21953
22067
|
if (!data?.students) return [];
|
|
21954
22068
|
return data.students.map((student) => ({
|
|
21955
22069
|
id: student.studentId,
|
|
@@ -21961,7 +22075,7 @@ var ActivityDetails = ({
|
|
|
21961
22075
|
score: student.score
|
|
21962
22076
|
}));
|
|
21963
22077
|
}, [data?.students]);
|
|
21964
|
-
const columns = (0,
|
|
22078
|
+
const columns = (0, import_react65.useMemo)(
|
|
21965
22079
|
() => createTableColumns(handleCorrectActivity),
|
|
21966
22080
|
[handleCorrectActivity]
|
|
21967
22081
|
);
|
|
@@ -22219,17 +22333,17 @@ var ActivityDetails = ({
|
|
|
22219
22333
|
};
|
|
22220
22334
|
|
|
22221
22335
|
// src/components/Support/Support.tsx
|
|
22222
|
-
var
|
|
22336
|
+
var import_react68 = require("react");
|
|
22223
22337
|
var import_react_hook_form = require("react-hook-form");
|
|
22224
|
-
var
|
|
22225
|
-
var
|
|
22338
|
+
var import_zod3 = require("@hookform/resolvers/zod");
|
|
22339
|
+
var import_react69 = require("@phosphor-icons/react");
|
|
22226
22340
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
22227
22341
|
|
|
22228
22342
|
// src/components/Support/schema/index.ts
|
|
22229
|
-
var
|
|
22230
|
-
var supportSchema =
|
|
22343
|
+
var import_zod2 = require("zod");
|
|
22344
|
+
var supportSchema = import_zod2.z.object({
|
|
22231
22345
|
// Tipo de problema selecionado
|
|
22232
|
-
problemType:
|
|
22346
|
+
problemType: import_zod2.z.enum(["tecnico", "acesso", "outros"], {
|
|
22233
22347
|
// istanbul ignore next - errorMap é testado em runtime pelo zod real
|
|
22234
22348
|
errorMap: (
|
|
22235
22349
|
/* istanbul ignore next */
|
|
@@ -22239,13 +22353,13 @@ var supportSchema = import_zod.z.object({
|
|
|
22239
22353
|
)
|
|
22240
22354
|
}),
|
|
22241
22355
|
// Título do problema
|
|
22242
|
-
title:
|
|
22356
|
+
title: import_zod2.z.string().min(1, "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.").min(5, "T\xEDtulo deve ter pelo menos 5 caracteres").max(100, "T\xEDtulo deve ter no m\xE1ximo 100 caracteres").trim(),
|
|
22243
22357
|
// Descrição do problema
|
|
22244
|
-
description:
|
|
22358
|
+
description: import_zod2.z.string().min(1, "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.").min(10, "Descri\xE7\xE3o deve ter pelo menos 10 caracteres").max(1e3, "Descri\xE7\xE3o deve ter no m\xE1ximo 1000 caracteres").trim()
|
|
22245
22359
|
});
|
|
22246
22360
|
|
|
22247
22361
|
// src/components/Support/components/TicketModal.tsx
|
|
22248
|
-
var
|
|
22362
|
+
var import_react67 = require("react");
|
|
22249
22363
|
var import_dayjs = __toESM(require("dayjs"));
|
|
22250
22364
|
var import_pt_br = require("dayjs/locale/pt-br");
|
|
22251
22365
|
|
|
@@ -22325,19 +22439,19 @@ var mapInternalStatusToApi = (internalStatus) => {
|
|
|
22325
22439
|
};
|
|
22326
22440
|
|
|
22327
22441
|
// src/components/Support/utils/supportUtils.tsx
|
|
22328
|
-
var
|
|
22442
|
+
var import_react66 = require("@phosphor-icons/react");
|
|
22329
22443
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
22330
22444
|
var getCategoryIcon = (category, size = 16) => {
|
|
22331
22445
|
if (!category) return null;
|
|
22332
22446
|
switch (category) {
|
|
22333
22447
|
case "acesso" /* ACESSO */:
|
|
22334
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.KeyIcon, { size });
|
|
22335
22449
|
case "tecnico" /* TECNICO */:
|
|
22336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.BugIcon, { size });
|
|
22337
22451
|
case "outros" /* OUTROS */:
|
|
22338
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.InfoIcon, { size });
|
|
22339
22453
|
default:
|
|
22340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.InfoIcon, { size });
|
|
22341
22455
|
}
|
|
22342
22456
|
};
|
|
22343
22457
|
|
|
@@ -22367,17 +22481,17 @@ var TicketModal = ({
|
|
|
22367
22481
|
apiClient,
|
|
22368
22482
|
userId
|
|
22369
22483
|
}) => {
|
|
22370
|
-
const [showCloseConfirmation, setShowCloseConfirmation] = (0,
|
|
22371
|
-
const [responseText, setResponseText] = (0,
|
|
22372
|
-
const [answers, setAnswers] = (0,
|
|
22373
|
-
const [isSubmittingAnswer, setIsSubmittingAnswer] = (0,
|
|
22374
|
-
const [isLoadingAnswers, setIsLoadingAnswers] = (0,
|
|
22484
|
+
const [showCloseConfirmation, setShowCloseConfirmation] = (0, import_react67.useState)(false);
|
|
22485
|
+
const [responseText, setResponseText] = (0, import_react67.useState)("");
|
|
22486
|
+
const [answers, setAnswers] = (0, import_react67.useState)([]);
|
|
22487
|
+
const [isSubmittingAnswer, setIsSubmittingAnswer] = (0, import_react67.useState)(false);
|
|
22488
|
+
const [isLoadingAnswers, setIsLoadingAnswers] = (0, import_react67.useState)(false);
|
|
22375
22489
|
const handleCloseTicket = () => {
|
|
22376
22490
|
onTicketClose?.(ticket.id);
|
|
22377
22491
|
setShowCloseConfirmation(false);
|
|
22378
22492
|
onClose();
|
|
22379
22493
|
};
|
|
22380
|
-
const fetchAnswers = (0,
|
|
22494
|
+
const fetchAnswers = (0, import_react67.useCallback)(async () => {
|
|
22381
22495
|
if (!ticket.id || ticket.status !== "respondido" /* RESPONDIDO */) return;
|
|
22382
22496
|
setIsLoadingAnswers(true);
|
|
22383
22497
|
try {
|
|
@@ -22416,7 +22530,7 @@ var TicketModal = ({
|
|
|
22416
22530
|
}
|
|
22417
22531
|
};
|
|
22418
22532
|
const canCloseTicket = ticket.status !== "encerrado" /* ENCERRADO */;
|
|
22419
|
-
(0,
|
|
22533
|
+
(0, import_react67.useEffect)(() => {
|
|
22420
22534
|
if (isOpen) {
|
|
22421
22535
|
setResponseText("");
|
|
22422
22536
|
(async () => {
|
|
@@ -22754,7 +22868,7 @@ var TicketCard = ({
|
|
|
22754
22868
|
getCategoryIcon(ticket.category, 18),
|
|
22755
22869
|
getCategoryText(ticket.category)
|
|
22756
22870
|
] }),
|
|
22757
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
22871
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.CaretRightIcon, { size: 24, className: "text-text-800" })
|
|
22758
22872
|
] })
|
|
22759
22873
|
]
|
|
22760
22874
|
},
|
|
@@ -22799,21 +22913,21 @@ var Support = ({
|
|
|
22799
22913
|
onTicketCreated,
|
|
22800
22914
|
onTicketClosed
|
|
22801
22915
|
}) => {
|
|
22802
|
-
const [activeTab, setActiveTab] = (0,
|
|
22803
|
-
const [selectedProblem, setSelectedProblem] = (0,
|
|
22804
|
-
const [statusFilter, setStatusFilter] = (0,
|
|
22805
|
-
const [categoryFilter, setCategoryFilter] = (0,
|
|
22806
|
-
const [selectedTicket, setSelectedTicket] = (0,
|
|
22916
|
+
const [activeTab, setActiveTab] = (0, import_react68.useState)("criar-pedido");
|
|
22917
|
+
const [selectedProblem, setSelectedProblem] = (0, import_react68.useState)(null);
|
|
22918
|
+
const [statusFilter, setStatusFilter] = (0, import_react68.useState)("todos");
|
|
22919
|
+
const [categoryFilter, setCategoryFilter] = (0, import_react68.useState)("todos");
|
|
22920
|
+
const [selectedTicket, setSelectedTicket] = (0, import_react68.useState)(
|
|
22807
22921
|
null
|
|
22808
22922
|
);
|
|
22809
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
22810
|
-
const [submitError, setSubmitError] = (0,
|
|
22811
|
-
const [showSuccessToast, setShowSuccessToast] = (0,
|
|
22812
|
-
const [showCloseSuccessToast, setShowCloseSuccessToast] = (0,
|
|
22813
|
-
const [showCloseErrorToast, setShowCloseErrorToast] = (0,
|
|
22814
|
-
const [allTickets, setAllTickets] = (0,
|
|
22815
|
-
const [loadingTickets, setLoadingTickets] = (0,
|
|
22816
|
-
const [currentPage, setCurrentPage] = (0,
|
|
22923
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react68.useState)(false);
|
|
22924
|
+
const [submitError, setSubmitError] = (0, import_react68.useState)(null);
|
|
22925
|
+
const [showSuccessToast, setShowSuccessToast] = (0, import_react68.useState)(false);
|
|
22926
|
+
const [showCloseSuccessToast, setShowCloseSuccessToast] = (0, import_react68.useState)(false);
|
|
22927
|
+
const [showCloseErrorToast, setShowCloseErrorToast] = (0, import_react68.useState)(false);
|
|
22928
|
+
const [allTickets, setAllTickets] = (0, import_react68.useState)([]);
|
|
22929
|
+
const [loadingTickets, setLoadingTickets] = (0, import_react68.useState)(false);
|
|
22930
|
+
const [currentPage, setCurrentPage] = (0, import_react68.useState)(1);
|
|
22817
22931
|
const ITEMS_PER_PAGE = 10;
|
|
22818
22932
|
const handlePrevPage = () => {
|
|
22819
22933
|
if (currentPage > 1) {
|
|
@@ -22826,13 +22940,13 @@ var Support = ({
|
|
|
22826
22940
|
setCurrentPage(currentPage + 1);
|
|
22827
22941
|
}
|
|
22828
22942
|
};
|
|
22829
|
-
(0,
|
|
22943
|
+
(0, import_react68.useEffect)(() => {
|
|
22830
22944
|
if (activeTab === "historico") {
|
|
22831
22945
|
fetchTickets(statusFilter);
|
|
22832
22946
|
setCurrentPage(1);
|
|
22833
22947
|
}
|
|
22834
22948
|
}, [activeTab, statusFilter]);
|
|
22835
|
-
(0,
|
|
22949
|
+
(0, import_react68.useEffect)(() => {
|
|
22836
22950
|
setCurrentPage(1);
|
|
22837
22951
|
}, [categoryFilter]);
|
|
22838
22952
|
const convertApiTicketToComponent = (apiTicket) => {
|
|
@@ -22873,7 +22987,7 @@ var Support = ({
|
|
|
22873
22987
|
reset,
|
|
22874
22988
|
formState: { errors, isSubmitting }
|
|
22875
22989
|
} = (0, import_react_hook_form.useForm)({
|
|
22876
|
-
resolver: (0,
|
|
22990
|
+
resolver: (0, import_zod3.zodResolver)(supportSchema),
|
|
22877
22991
|
defaultValues: {
|
|
22878
22992
|
problemType: void 0,
|
|
22879
22993
|
title: "",
|
|
@@ -22962,17 +23076,17 @@ var Support = ({
|
|
|
22962
23076
|
{
|
|
22963
23077
|
id: "tecnico" /* TECNICO */,
|
|
22964
23078
|
title: "T\xE9cnico",
|
|
22965
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23079
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.BugIcon, { size: 24 })
|
|
22966
23080
|
},
|
|
22967
23081
|
{
|
|
22968
23082
|
id: "acesso" /* ACESSO */,
|
|
22969
23083
|
title: "Acesso",
|
|
22970
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23084
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.KeyIcon, { size: 24 })
|
|
22971
23085
|
},
|
|
22972
23086
|
{
|
|
22973
23087
|
id: "outros" /* OUTROS */,
|
|
22974
23088
|
title: "Outros",
|
|
22975
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23089
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.InfoIcon, { size: 24 })
|
|
22976
23090
|
}
|
|
22977
23091
|
];
|
|
22978
23092
|
const emptyImage = emptyStateImage || suporthistory_default;
|
|
@@ -23092,15 +23206,15 @@ var Support = ({
|
|
|
23092
23206
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectContent, { children: [
|
|
23093
23207
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(SelectItem, { value: "todos", children: "Todos" }),
|
|
23094
23208
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectItem, { value: "tecnico" /* TECNICO */, children: [
|
|
23095
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23209
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.BugIcon, { size: 16 }),
|
|
23096
23210
|
" T\xE9cnico"
|
|
23097
23211
|
] }),
|
|
23098
23212
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectItem, { value: "acesso" /* ACESSO */, children: [
|
|
23099
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23213
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.KeyIcon, { size: 16 }),
|
|
23100
23214
|
" Acesso"
|
|
23101
23215
|
] }),
|
|
23102
23216
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectItem, { value: "outros" /* OUTROS */, children: [
|
|
23103
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23217
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.InfoIcon, { size: 16 }),
|
|
23104
23218
|
" Outros"
|
|
23105
23219
|
] })
|
|
23106
23220
|
] })
|
|
@@ -23201,14 +23315,14 @@ var Support = ({
|
|
|
23201
23315
|
var Support_default = Support;
|
|
23202
23316
|
|
|
23203
23317
|
// src/components/SendActivityModal/SendActivityModal.tsx
|
|
23204
|
-
var
|
|
23205
|
-
var
|
|
23318
|
+
var import_react70 = require("react");
|
|
23319
|
+
var import_react71 = require("@phosphor-icons/react");
|
|
23206
23320
|
|
|
23207
23321
|
// src/components/SendActivityModal/hooks/useSendActivityModal.ts
|
|
23208
23322
|
var import_zustand16 = require("zustand");
|
|
23209
23323
|
|
|
23210
23324
|
// src/components/SendActivityModal/validation.ts
|
|
23211
|
-
var
|
|
23325
|
+
var import_zod4 = require("zod");
|
|
23212
23326
|
var ERROR_MESSAGES = {
|
|
23213
23327
|
SUBTYPE_REQUIRED: "Campo obrigat\xF3rio! Por favor, selecione uma op\xE7\xE3o para continuar.",
|
|
23214
23328
|
TITLE_REQUIRED: "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.",
|
|
@@ -23217,20 +23331,20 @@ var ERROR_MESSAGES = {
|
|
|
23217
23331
|
FINAL_DATE_REQUIRED: "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.",
|
|
23218
23332
|
FINAL_DATE_INVALID: "A data final deve ser maior ou igual \xE0 data inicial."
|
|
23219
23333
|
};
|
|
23220
|
-
var activityStepSchema =
|
|
23221
|
-
subtype:
|
|
23334
|
+
var activityStepSchema = import_zod4.z.object({
|
|
23335
|
+
subtype: import_zod4.z.enum(["TAREFA", "TRABALHO", "PROVA"], {
|
|
23222
23336
|
errorMap: () => ({ message: ERROR_MESSAGES.SUBTYPE_REQUIRED })
|
|
23223
23337
|
}),
|
|
23224
|
-
title:
|
|
23338
|
+
title: import_zod4.z.string({ required_error: ERROR_MESSAGES.TITLE_REQUIRED }).transform((val) => val.trim()).refine((val) => val.length > 0, {
|
|
23225
23339
|
message: ERROR_MESSAGES.TITLE_REQUIRED
|
|
23226
23340
|
}),
|
|
23227
|
-
notification:
|
|
23341
|
+
notification: import_zod4.z.string().optional()
|
|
23228
23342
|
});
|
|
23229
|
-
var recipientStepSchema =
|
|
23230
|
-
students:
|
|
23231
|
-
|
|
23232
|
-
studentId:
|
|
23233
|
-
userInstitutionId:
|
|
23343
|
+
var recipientStepSchema = import_zod4.z.object({
|
|
23344
|
+
students: import_zod4.z.array(
|
|
23345
|
+
import_zod4.z.object({
|
|
23346
|
+
studentId: import_zod4.z.string(),
|
|
23347
|
+
userInstitutionId: import_zod4.z.string()
|
|
23234
23348
|
}),
|
|
23235
23349
|
{
|
|
23236
23350
|
required_error: ERROR_MESSAGES.STUDENTS_REQUIRED,
|
|
@@ -23240,18 +23354,18 @@ var recipientStepSchema = import_zod3.z.object({
|
|
|
23240
23354
|
});
|
|
23241
23355
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
23242
23356
|
var TIME_REGEX = /^\d{2}:\d{2}$/;
|
|
23243
|
-
var deadlineStepBaseSchema =
|
|
23244
|
-
startDate:
|
|
23357
|
+
var deadlineStepBaseSchema = import_zod4.z.object({
|
|
23358
|
+
startDate: import_zod4.z.string({
|
|
23245
23359
|
required_error: ERROR_MESSAGES.START_DATE_REQUIRED,
|
|
23246
23360
|
invalid_type_error: ERROR_MESSAGES.START_DATE_REQUIRED
|
|
23247
23361
|
}).min(1, ERROR_MESSAGES.START_DATE_REQUIRED).regex(DATE_REGEX, ERROR_MESSAGES.START_DATE_REQUIRED),
|
|
23248
|
-
startTime:
|
|
23249
|
-
finalDate:
|
|
23362
|
+
startTime: import_zod4.z.string().regex(TIME_REGEX).default("00:00"),
|
|
23363
|
+
finalDate: import_zod4.z.string({
|
|
23250
23364
|
required_error: ERROR_MESSAGES.FINAL_DATE_REQUIRED,
|
|
23251
23365
|
invalid_type_error: ERROR_MESSAGES.FINAL_DATE_REQUIRED
|
|
23252
23366
|
}).min(1, ERROR_MESSAGES.FINAL_DATE_REQUIRED).regex(DATE_REGEX, ERROR_MESSAGES.FINAL_DATE_REQUIRED),
|
|
23253
|
-
finalTime:
|
|
23254
|
-
canRetry:
|
|
23367
|
+
finalTime: import_zod4.z.string().regex(TIME_REGEX).default("23:59"),
|
|
23368
|
+
canRetry: import_zod4.z.boolean().default(false)
|
|
23255
23369
|
});
|
|
23256
23370
|
var deadlineStepSchema = deadlineStepBaseSchema.refine(
|
|
23257
23371
|
(data) => {
|
|
@@ -23494,17 +23608,17 @@ var SendActivityModal = ({
|
|
|
23494
23608
|
const storeCategories = useSendActivityModalStore(
|
|
23495
23609
|
(state) => state.categories
|
|
23496
23610
|
);
|
|
23497
|
-
const categoriesInitialized = (0,
|
|
23498
|
-
const prevInitialDataRef = (0,
|
|
23611
|
+
const categoriesInitialized = (0, import_react70.useRef)(false);
|
|
23612
|
+
const prevInitialDataRef = (0, import_react70.useRef)(
|
|
23499
23613
|
void 0
|
|
23500
23614
|
);
|
|
23501
|
-
(0,
|
|
23615
|
+
(0, import_react70.useEffect)(() => {
|
|
23502
23616
|
if (isOpen && initialCategories.length > 0 && !categoriesInitialized.current) {
|
|
23503
23617
|
setCategories(initialCategories);
|
|
23504
23618
|
categoriesInitialized.current = true;
|
|
23505
23619
|
}
|
|
23506
23620
|
}, [isOpen, initialCategories, setCategories]);
|
|
23507
|
-
(0,
|
|
23621
|
+
(0, import_react70.useEffect)(() => {
|
|
23508
23622
|
if (isOpen && initialData && prevInitialDataRef.current !== initialData) {
|
|
23509
23623
|
store.setFormData({
|
|
23510
23624
|
title: initialData.title ?? "",
|
|
@@ -23514,69 +23628,69 @@ var SendActivityModal = ({
|
|
|
23514
23628
|
prevInitialDataRef.current = initialData;
|
|
23515
23629
|
}
|
|
23516
23630
|
}, [isOpen, initialData, store]);
|
|
23517
|
-
(0,
|
|
23631
|
+
(0, import_react70.useEffect)(() => {
|
|
23518
23632
|
if (!isOpen) {
|
|
23519
23633
|
reset();
|
|
23520
23634
|
categoriesInitialized.current = false;
|
|
23521
23635
|
prevInitialDataRef.current = void 0;
|
|
23522
23636
|
}
|
|
23523
23637
|
}, [isOpen, reset]);
|
|
23524
|
-
const handleCategoriesChange = (0,
|
|
23638
|
+
const handleCategoriesChange = (0, import_react70.useCallback)(
|
|
23525
23639
|
(updatedCategories) => {
|
|
23526
23640
|
setCategories(updatedCategories);
|
|
23527
23641
|
onCategoriesChange?.(updatedCategories);
|
|
23528
23642
|
},
|
|
23529
23643
|
[setCategories, onCategoriesChange]
|
|
23530
23644
|
);
|
|
23531
|
-
const handleActivityTypeSelect = (0,
|
|
23645
|
+
const handleActivityTypeSelect = (0, import_react70.useCallback)(
|
|
23532
23646
|
(subtype) => {
|
|
23533
23647
|
store.setFormData({ subtype });
|
|
23534
23648
|
},
|
|
23535
23649
|
[store]
|
|
23536
23650
|
);
|
|
23537
|
-
const handleTitleChange = (0,
|
|
23651
|
+
const handleTitleChange = (0, import_react70.useCallback)(
|
|
23538
23652
|
(e) => {
|
|
23539
23653
|
store.setFormData({ title: e.target.value });
|
|
23540
23654
|
},
|
|
23541
23655
|
[store]
|
|
23542
23656
|
);
|
|
23543
|
-
const handleNotificationChange = (0,
|
|
23657
|
+
const handleNotificationChange = (0, import_react70.useCallback)(
|
|
23544
23658
|
(e) => {
|
|
23545
23659
|
store.setFormData({ notification: e.target.value });
|
|
23546
23660
|
},
|
|
23547
23661
|
[store]
|
|
23548
23662
|
);
|
|
23549
|
-
const handleStartDateChange = (0,
|
|
23663
|
+
const handleStartDateChange = (0, import_react70.useCallback)(
|
|
23550
23664
|
(date) => {
|
|
23551
23665
|
store.setFormData({ startDate: date });
|
|
23552
23666
|
},
|
|
23553
23667
|
[store]
|
|
23554
23668
|
);
|
|
23555
|
-
const handleStartTimeChange = (0,
|
|
23669
|
+
const handleStartTimeChange = (0, import_react70.useCallback)(
|
|
23556
23670
|
(time) => {
|
|
23557
23671
|
store.setFormData({ startTime: time });
|
|
23558
23672
|
},
|
|
23559
23673
|
[store]
|
|
23560
23674
|
);
|
|
23561
|
-
const handleFinalDateChange = (0,
|
|
23675
|
+
const handleFinalDateChange = (0, import_react70.useCallback)(
|
|
23562
23676
|
(date) => {
|
|
23563
23677
|
store.setFormData({ finalDate: date });
|
|
23564
23678
|
},
|
|
23565
23679
|
[store]
|
|
23566
23680
|
);
|
|
23567
|
-
const handleFinalTimeChange = (0,
|
|
23681
|
+
const handleFinalTimeChange = (0, import_react70.useCallback)(
|
|
23568
23682
|
(time) => {
|
|
23569
23683
|
store.setFormData({ finalTime: time });
|
|
23570
23684
|
},
|
|
23571
23685
|
[store]
|
|
23572
23686
|
);
|
|
23573
|
-
const handleRetryChange = (0,
|
|
23687
|
+
const handleRetryChange = (0, import_react70.useCallback)(
|
|
23574
23688
|
(value) => {
|
|
23575
23689
|
store.setFormData({ canRetry: value === "yes" });
|
|
23576
23690
|
},
|
|
23577
23691
|
[store]
|
|
23578
23692
|
);
|
|
23579
|
-
const handleSubmit = (0,
|
|
23693
|
+
const handleSubmit = (0, import_react70.useCallback)(async () => {
|
|
23580
23694
|
const isValid = store.validateAllSteps();
|
|
23581
23695
|
if (!isValid) return;
|
|
23582
23696
|
try {
|
|
@@ -23590,7 +23704,7 @@ var SendActivityModal = ({
|
|
|
23590
23704
|
}
|
|
23591
23705
|
}
|
|
23592
23706
|
}, [store, onSubmit, onError]);
|
|
23593
|
-
const handleCancel = (0,
|
|
23707
|
+
const handleCancel = (0, import_react70.useCallback)(() => {
|
|
23594
23708
|
onClose();
|
|
23595
23709
|
}, [onClose]);
|
|
23596
23710
|
const renderError = (error) => {
|
|
@@ -23603,7 +23717,7 @@ var SendActivityModal = ({
|
|
|
23603
23717
|
color: "text-error-600",
|
|
23604
23718
|
className: "flex items-center gap-1 mt-1",
|
|
23605
23719
|
children: [
|
|
23606
|
-
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23720
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.WarningCircleIcon, { size: 16 }),
|
|
23607
23721
|
error
|
|
23608
23722
|
]
|
|
23609
23723
|
}
|
|
@@ -23773,7 +23887,7 @@ var SendActivityModal = ({
|
|
|
23773
23887
|
variant: "outline",
|
|
23774
23888
|
action: "primary",
|
|
23775
23889
|
onClick: store.previousStep,
|
|
23776
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23890
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.CaretLeftIcon, { size: 16 }),
|
|
23777
23891
|
className: "w-full sm:w-auto",
|
|
23778
23892
|
children: "Anterior"
|
|
23779
23893
|
}
|
|
@@ -23784,7 +23898,7 @@ var SendActivityModal = ({
|
|
|
23784
23898
|
variant: "solid",
|
|
23785
23899
|
action: "primary",
|
|
23786
23900
|
onClick: () => store.nextStep(),
|
|
23787
|
-
iconRight: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23901
|
+
iconRight: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.ArrowRightIcon, { size: 16 }),
|
|
23788
23902
|
className: "w-full sm:w-auto",
|
|
23789
23903
|
children: "Pr\xF3ximo"
|
|
23790
23904
|
}
|
|
@@ -23795,7 +23909,7 @@ var SendActivityModal = ({
|
|
|
23795
23909
|
action: "primary",
|
|
23796
23910
|
onClick: handleSubmit,
|
|
23797
23911
|
disabled: isLoading,
|
|
23798
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23912
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.PaperPlaneTiltIcon, { size: 16 }),
|
|
23799
23913
|
className: "w-full sm:w-auto",
|
|
23800
23914
|
children: isLoading ? "Enviando..." : "Enviar atividade"
|
|
23801
23915
|
}
|
|
@@ -23828,7 +23942,7 @@ var SendActivityModal = ({
|
|
|
23828
23942
|
var SendActivityModal_default = SendActivityModal;
|
|
23829
23943
|
|
|
23830
23944
|
// src/components/RecommendedLessonsHistory/RecommendedLessonsHistory.tsx
|
|
23831
|
-
var
|
|
23945
|
+
var import_react73 = require("react");
|
|
23832
23946
|
var import_phosphor_react45 = require("phosphor-react");
|
|
23833
23947
|
|
|
23834
23948
|
// src/types/common.ts
|
|
@@ -23915,51 +24029,51 @@ var formatDaysToComplete = (daysToComplete) => {
|
|
|
23915
24029
|
};
|
|
23916
24030
|
|
|
23917
24031
|
// src/hooks/useRecommendedLessons.ts
|
|
23918
|
-
var
|
|
23919
|
-
var
|
|
24032
|
+
var import_react72 = require("react");
|
|
24033
|
+
var import_zod5 = require("zod");
|
|
23920
24034
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
23921
|
-
var goalSubjectSchema =
|
|
23922
|
-
id:
|
|
23923
|
-
name:
|
|
24035
|
+
var goalSubjectSchema = import_zod5.z.object({
|
|
24036
|
+
id: import_zod5.z.string().uuid(),
|
|
24037
|
+
name: import_zod5.z.string()
|
|
23924
24038
|
}).nullable();
|
|
23925
|
-
var goalCreatorSchema =
|
|
23926
|
-
id:
|
|
23927
|
-
name:
|
|
24039
|
+
var goalCreatorSchema = import_zod5.z.object({
|
|
24040
|
+
id: import_zod5.z.string().uuid(),
|
|
24041
|
+
name: import_zod5.z.string()
|
|
23928
24042
|
}).nullable();
|
|
23929
|
-
var goalStatsSchema =
|
|
23930
|
-
totalStudents:
|
|
23931
|
-
completedCount:
|
|
23932
|
-
completionPercentage:
|
|
24043
|
+
var goalStatsSchema = import_zod5.z.object({
|
|
24044
|
+
totalStudents: import_zod5.z.number(),
|
|
24045
|
+
completedCount: import_zod5.z.number(),
|
|
24046
|
+
completionPercentage: import_zod5.z.number()
|
|
23933
24047
|
});
|
|
23934
|
-
var goalBreakdownSchema =
|
|
23935
|
-
classId:
|
|
23936
|
-
className:
|
|
23937
|
-
schoolId:
|
|
23938
|
-
schoolName:
|
|
23939
|
-
studentCount:
|
|
23940
|
-
completedCount:
|
|
24048
|
+
var goalBreakdownSchema = import_zod5.z.object({
|
|
24049
|
+
classId: import_zod5.z.string().uuid(),
|
|
24050
|
+
className: import_zod5.z.string(),
|
|
24051
|
+
schoolId: import_zod5.z.string(),
|
|
24052
|
+
schoolName: import_zod5.z.string(),
|
|
24053
|
+
studentCount: import_zod5.z.number(),
|
|
24054
|
+
completedCount: import_zod5.z.number()
|
|
23941
24055
|
});
|
|
23942
|
-
var goalDataSchema =
|
|
23943
|
-
id:
|
|
23944
|
-
title:
|
|
23945
|
-
startDate:
|
|
23946
|
-
finalDate:
|
|
23947
|
-
createdAt:
|
|
23948
|
-
progress:
|
|
23949
|
-
totalLessons:
|
|
24056
|
+
var goalDataSchema = import_zod5.z.object({
|
|
24057
|
+
id: import_zod5.z.string().uuid(),
|
|
24058
|
+
title: import_zod5.z.string(),
|
|
24059
|
+
startDate: import_zod5.z.string().nullable(),
|
|
24060
|
+
finalDate: import_zod5.z.string().nullable(),
|
|
24061
|
+
createdAt: import_zod5.z.string(),
|
|
24062
|
+
progress: import_zod5.z.number(),
|
|
24063
|
+
totalLessons: import_zod5.z.number()
|
|
23950
24064
|
});
|
|
23951
|
-
var goalHistoryItemSchema =
|
|
24065
|
+
var goalHistoryItemSchema = import_zod5.z.object({
|
|
23952
24066
|
goal: goalDataSchema,
|
|
23953
24067
|
subject: goalSubjectSchema,
|
|
23954
24068
|
creator: goalCreatorSchema,
|
|
23955
24069
|
stats: goalStatsSchema,
|
|
23956
|
-
breakdown:
|
|
24070
|
+
breakdown: import_zod5.z.array(goalBreakdownSchema)
|
|
23957
24071
|
});
|
|
23958
|
-
var goalsHistoryApiResponseSchema =
|
|
23959
|
-
message:
|
|
23960
|
-
data:
|
|
23961
|
-
goals:
|
|
23962
|
-
total:
|
|
24072
|
+
var goalsHistoryApiResponseSchema = import_zod5.z.object({
|
|
24073
|
+
message: import_zod5.z.string(),
|
|
24074
|
+
data: import_zod5.z.object({
|
|
24075
|
+
goals: import_zod5.z.array(goalHistoryItemSchema),
|
|
24076
|
+
total: import_zod5.z.number()
|
|
23963
24077
|
})
|
|
23964
24078
|
});
|
|
23965
24079
|
var determineGoalStatus = (finalDate, completionPercentage) => {
|
|
@@ -23998,7 +24112,7 @@ var transformGoalToTableItem = (item) => {
|
|
|
23998
24112
|
};
|
|
23999
24113
|
};
|
|
24000
24114
|
var handleGoalFetchError = (error) => {
|
|
24001
|
-
if (error instanceof
|
|
24115
|
+
if (error instanceof import_zod5.z.ZodError) {
|
|
24002
24116
|
console.error("Erro ao validar dados de hist\xF3rico de aulas:", error);
|
|
24003
24117
|
return "Erro ao validar dados de hist\xF3rico de aulas";
|
|
24004
24118
|
}
|
|
@@ -24007,7 +24121,7 @@ var handleGoalFetchError = (error) => {
|
|
|
24007
24121
|
};
|
|
24008
24122
|
var createUseRecommendedLessonsHistory = (fetchGoalsHistory) => {
|
|
24009
24123
|
return () => {
|
|
24010
|
-
const [state, setState] = (0,
|
|
24124
|
+
const [state, setState] = (0, import_react72.useState)({
|
|
24011
24125
|
goals: [],
|
|
24012
24126
|
loading: false,
|
|
24013
24127
|
error: null,
|
|
@@ -24018,7 +24132,7 @@ var createUseRecommendedLessonsHistory = (fetchGoalsHistory) => {
|
|
|
24018
24132
|
totalPages: 0
|
|
24019
24133
|
}
|
|
24020
24134
|
});
|
|
24021
|
-
const fetchGoals = (0,
|
|
24135
|
+
const fetchGoals = (0, import_react72.useCallback)(
|
|
24022
24136
|
async (filters) => {
|
|
24023
24137
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24024
24138
|
try {
|
|
@@ -24366,10 +24480,10 @@ var RecommendedLessonsHistory = ({
|
|
|
24366
24480
|
createButtonText = "Criar aula",
|
|
24367
24481
|
searchPlaceholder = "Buscar aula"
|
|
24368
24482
|
}) => {
|
|
24369
|
-
const [activeTab, setActiveTab] = (0,
|
|
24370
|
-
const fetchGoalsHistoryRef = (0,
|
|
24483
|
+
const [activeTab, setActiveTab] = (0, import_react73.useState)("history" /* HISTORY */);
|
|
24484
|
+
const fetchGoalsHistoryRef = (0, import_react73.useRef)(fetchGoalsHistory);
|
|
24371
24485
|
fetchGoalsHistoryRef.current = fetchGoalsHistory;
|
|
24372
|
-
const useGoalsHistory = (0,
|
|
24486
|
+
const useGoalsHistory = (0, import_react73.useMemo)(
|
|
24373
24487
|
() => createUseRecommendedLessonsHistory(
|
|
24374
24488
|
(filters) => fetchGoalsHistoryRef.current(filters)
|
|
24375
24489
|
),
|
|
@@ -24382,15 +24496,15 @@ var RecommendedLessonsHistory = ({
|
|
|
24382
24496
|
pagination,
|
|
24383
24497
|
fetchGoals
|
|
24384
24498
|
} = useGoalsHistory();
|
|
24385
|
-
const initialFilterConfigs = (0,
|
|
24499
|
+
const initialFilterConfigs = (0, import_react73.useMemo)(
|
|
24386
24500
|
() => createGoalFiltersConfig(userFilterData),
|
|
24387
24501
|
[userFilterData]
|
|
24388
24502
|
);
|
|
24389
|
-
const tableColumns = (0,
|
|
24503
|
+
const tableColumns = (0, import_react73.useMemo)(
|
|
24390
24504
|
() => createTableColumns2(mapSubjectNameToEnum2, onDeleteGoal, onEditGoal),
|
|
24391
24505
|
[mapSubjectNameToEnum2, onDeleteGoal, onEditGoal]
|
|
24392
24506
|
);
|
|
24393
|
-
const handleParamsChange = (0,
|
|
24507
|
+
const handleParamsChange = (0, import_react73.useCallback)(
|
|
24394
24508
|
(params) => {
|
|
24395
24509
|
const filters = buildFiltersFromParams(params);
|
|
24396
24510
|
fetchGoals(filters);
|
|
@@ -24546,10 +24660,10 @@ var RecommendedLessonsHistory = ({
|
|
|
24546
24660
|
};
|
|
24547
24661
|
|
|
24548
24662
|
// src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
|
|
24549
|
-
var
|
|
24663
|
+
var import_react81 = require("react");
|
|
24550
24664
|
|
|
24551
24665
|
// src/components/RecommendedLessonDetails/components/Breadcrumb.tsx
|
|
24552
|
-
var
|
|
24666
|
+
var import_react74 = require("@phosphor-icons/react");
|
|
24553
24667
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
24554
24668
|
var Breadcrumb = ({ items, onItemClick }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("nav", { className: "flex items-center gap-2 text-sm", "aria-label": "Breadcrumb", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
24555
24669
|
Text_default,
|
|
@@ -24557,7 +24671,7 @@ var Breadcrumb = ({ items, onItemClick }) => /* @__PURE__ */ (0, import_jsx_runt
|
|
|
24557
24671
|
as: "span",
|
|
24558
24672
|
className: "flex items-center gap-2",
|
|
24559
24673
|
children: [
|
|
24560
|
-
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
24674
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_react74.CaretRightIcon, { size: 14, className: "text-text-500" }),
|
|
24561
24675
|
item.path ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
24562
24676
|
"button",
|
|
24563
24677
|
{
|
|
@@ -24573,7 +24687,7 @@ var Breadcrumb = ({ items, onItemClick }) => /* @__PURE__ */ (0, import_jsx_runt
|
|
|
24573
24687
|
)) });
|
|
24574
24688
|
|
|
24575
24689
|
// src/components/RecommendedLessonDetails/components/LessonHeader.tsx
|
|
24576
|
-
var
|
|
24690
|
+
var import_react75 = require("@phosphor-icons/react");
|
|
24577
24691
|
|
|
24578
24692
|
// src/components/RecommendedLessonDetails/utils/lessonDetailsUtils.ts
|
|
24579
24693
|
var formatDate = (dateString) => {
|
|
@@ -24661,7 +24775,7 @@ var LessonHeader = ({
|
|
|
24661
24775
|
variant: "solid",
|
|
24662
24776
|
action: "primary",
|
|
24663
24777
|
size: "small",
|
|
24664
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
24778
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react75.BookBookmarkIcon, { size: 16 }),
|
|
24665
24779
|
onClick: onViewLesson,
|
|
24666
24780
|
children: viewLessonLabel
|
|
24667
24781
|
}
|
|
@@ -24689,7 +24803,7 @@ var LoadingSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div"
|
|
|
24689
24803
|
] });
|
|
24690
24804
|
|
|
24691
24805
|
// src/components/RecommendedLessonDetails/components/ResultsSection.tsx
|
|
24692
|
-
var
|
|
24806
|
+
var import_react76 = require("@phosphor-icons/react");
|
|
24693
24807
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
24694
24808
|
var ResultsSection = ({ data, labels }) => {
|
|
24695
24809
|
const { details } = data;
|
|
@@ -24713,7 +24827,7 @@ var ResultsSection = ({ data, labels }) => {
|
|
|
24713
24827
|
{
|
|
24714
24828
|
as: "span",
|
|
24715
24829
|
className: "size-8 rounded-full flex items-center justify-center bg-warning-300 mb-2",
|
|
24716
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
24830
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react76.TrophyIcon, { size: 18, weight: "fill", className: "text-white" })
|
|
24717
24831
|
}
|
|
24718
24832
|
),
|
|
24719
24833
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -24741,7 +24855,7 @@ var ResultsSection = ({ data, labels }) => {
|
|
|
24741
24855
|
{
|
|
24742
24856
|
as: "span",
|
|
24743
24857
|
className: "size-8 rounded-full flex items-center justify-center bg-error-300 mb-2",
|
|
24744
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
24858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react76.WarningIcon, { size: 18, weight: "fill", className: "text-error-700" })
|
|
24745
24859
|
}
|
|
24746
24860
|
),
|
|
24747
24861
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -24768,8 +24882,8 @@ var ResultsSection = ({ data, labels }) => {
|
|
|
24768
24882
|
};
|
|
24769
24883
|
|
|
24770
24884
|
// src/components/RecommendedLessonDetails/components/StudentsTable.tsx
|
|
24771
|
-
var
|
|
24772
|
-
var
|
|
24885
|
+
var import_react77 = require("react");
|
|
24886
|
+
var import_react78 = require("@phosphor-icons/react");
|
|
24773
24887
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
24774
24888
|
var StudentsTable = ({
|
|
24775
24889
|
students,
|
|
@@ -24778,7 +24892,7 @@ var StudentsTable = ({
|
|
|
24778
24892
|
emptyMessage = "Nenhum aluno encontrado"
|
|
24779
24893
|
}) => {
|
|
24780
24894
|
const { sortedData, sortColumn, sortDirection, handleSort } = useTableSort(students);
|
|
24781
|
-
const canViewPerformance = (0,
|
|
24895
|
+
const canViewPerformance = (0, import_react77.useCallback)((student) => {
|
|
24782
24896
|
return student.status === "CONCLU\xCDDO" /* CONCLUIDO */ || student.status === "N\xC3O FINALIZADO" /* NAO_FINALIZADO */;
|
|
24783
24897
|
}, []);
|
|
24784
24898
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "bg-background rounded-xl border border-border-50 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Table_default, { children: [
|
|
@@ -24820,7 +24934,7 @@ var StudentsTable = ({
|
|
|
24820
24934
|
{
|
|
24821
24935
|
as: "span",
|
|
24822
24936
|
className: "size-8 rounded-full bg-background-100 flex items-center justify-center",
|
|
24823
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
24937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_react78.UserIcon, { size: 16, className: "text-text-500" })
|
|
24824
24938
|
}
|
|
24825
24939
|
),
|
|
24826
24940
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text_default, { size: "sm", className: "text-text-950", children: student.name })
|
|
@@ -24864,8 +24978,8 @@ var StudentsTable = ({
|
|
|
24864
24978
|
};
|
|
24865
24979
|
|
|
24866
24980
|
// src/components/RecommendedLessonDetails/components/StudentPerformanceModal.tsx
|
|
24867
|
-
var
|
|
24868
|
-
var
|
|
24981
|
+
var import_react79 = require("react");
|
|
24982
|
+
var import_react80 = require("@phosphor-icons/react");
|
|
24869
24983
|
|
|
24870
24984
|
// src/components/RecommendedLessonDetails/types.ts
|
|
24871
24985
|
var DEFAULT_LABELS = {
|
|
@@ -24997,7 +25111,7 @@ var QuestionAccordionItem = ({
|
|
|
24997
25111
|
size: "small",
|
|
24998
25112
|
action: question.isCorrect ? "success" : "error",
|
|
24999
25113
|
variant: "solid",
|
|
25000
|
-
iconLeft: question.isCorrect ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25114
|
+
iconLeft: question.isCorrect ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react80.CheckCircleIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react80.XCircleIcon, {}),
|
|
25001
25115
|
children: question.isCorrect ? "Correta" : "Incorreta"
|
|
25002
25116
|
}
|
|
25003
25117
|
)
|
|
@@ -25069,7 +25183,7 @@ var ErrorContent = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime102.js
|
|
|
25069
25183
|
{
|
|
25070
25184
|
as: "span",
|
|
25071
25185
|
className: "size-12 rounded-full bg-error-100 flex items-center justify-center",
|
|
25072
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react80.WarningCircleIcon, { size: 24, className: "text-error-700" })
|
|
25073
25187
|
}
|
|
25074
25188
|
),
|
|
25075
25189
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text_default, { size: "md", className: "text-error-700 text-center", children: message })
|
|
@@ -25084,7 +25198,7 @@ var PerformanceContent = ({
|
|
|
25084
25198
|
{
|
|
25085
25199
|
as: "span",
|
|
25086
25200
|
className: "size-8 rounded-full bg-background-100 flex items-center justify-center",
|
|
25087
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react80.UserIcon, { size: 16, className: "text-text-500" })
|
|
25088
25202
|
}
|
|
25089
25203
|
),
|
|
25090
25204
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text_default, { size: "md", weight: "medium", className: "text-text-950", children: data.studentName })
|
|
@@ -25094,7 +25208,7 @@ var PerformanceContent = ({
|
|
|
25094
25208
|
PerformanceCard,
|
|
25095
25209
|
{
|
|
25096
25210
|
icon: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25097
|
-
|
|
25211
|
+
import_react80.LightbulbFilamentIcon,
|
|
25098
25212
|
{
|
|
25099
25213
|
size: 18,
|
|
25100
25214
|
weight: "fill",
|
|
@@ -25112,7 +25226,7 @@ var PerformanceContent = ({
|
|
|
25112
25226
|
PerformanceCard,
|
|
25113
25227
|
{
|
|
25114
25228
|
icon: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25115
|
-
|
|
25229
|
+
import_react80.WarningCircleIcon,
|
|
25116
25230
|
{
|
|
25117
25231
|
size: 18,
|
|
25118
25232
|
weight: "fill",
|
|
@@ -25152,7 +25266,7 @@ var StudentPerformanceModal = ({
|
|
|
25152
25266
|
error = null,
|
|
25153
25267
|
labels: customLabels
|
|
25154
25268
|
}) => {
|
|
25155
|
-
const labels = (0,
|
|
25269
|
+
const labels = (0, import_react79.useMemo)(
|
|
25156
25270
|
() => ({ ...DEFAULT_PERFORMANCE_LABELS, ...customLabels }),
|
|
25157
25271
|
[customLabels]
|
|
25158
25272
|
);
|
|
@@ -25187,15 +25301,15 @@ var RecommendedLessonDetails = ({
|
|
|
25187
25301
|
labels: customLabels,
|
|
25188
25302
|
className
|
|
25189
25303
|
}) => {
|
|
25190
|
-
const labels = (0,
|
|
25304
|
+
const labels = (0, import_react81.useMemo)(
|
|
25191
25305
|
() => ({ ...DEFAULT_LABELS, ...customLabels }),
|
|
25192
25306
|
[customLabels]
|
|
25193
25307
|
);
|
|
25194
|
-
const [performanceModalOpen, setPerformanceModalOpen] = (0,
|
|
25195
|
-
const [performanceData, setPerformanceData] = (0,
|
|
25196
|
-
const [performanceLoading, setPerformanceLoading] = (0,
|
|
25197
|
-
const [performanceError, setPerformanceError] = (0,
|
|
25198
|
-
const handleViewStudentPerformance = (0,
|
|
25308
|
+
const [performanceModalOpen, setPerformanceModalOpen] = (0, import_react81.useState)(false);
|
|
25309
|
+
const [performanceData, setPerformanceData] = (0, import_react81.useState)(null);
|
|
25310
|
+
const [performanceLoading, setPerformanceLoading] = (0, import_react81.useState)(false);
|
|
25311
|
+
const [performanceError, setPerformanceError] = (0, import_react81.useState)(null);
|
|
25312
|
+
const handleViewStudentPerformance = (0, import_react81.useCallback)(
|
|
25199
25313
|
async (studentId) => {
|
|
25200
25314
|
if (!fetchStudentPerformance || !goalId) return;
|
|
25201
25315
|
setPerformanceModalOpen(true);
|
|
@@ -25216,12 +25330,12 @@ var RecommendedLessonDetails = ({
|
|
|
25216
25330
|
},
|
|
25217
25331
|
[fetchStudentPerformance, goalId]
|
|
25218
25332
|
);
|
|
25219
|
-
const handleClosePerformanceModal = (0,
|
|
25333
|
+
const handleClosePerformanceModal = (0, import_react81.useCallback)(() => {
|
|
25220
25334
|
setPerformanceModalOpen(false);
|
|
25221
25335
|
setPerformanceData(null);
|
|
25222
25336
|
setPerformanceError(null);
|
|
25223
25337
|
}, []);
|
|
25224
|
-
const defaultBreadcrumbs = (0,
|
|
25338
|
+
const defaultBreadcrumbs = (0, import_react81.useMemo)(
|
|
25225
25339
|
() => [
|
|
25226
25340
|
{ label: "Aulas recomendadas", path: "/aulas-recomendadas" },
|
|
25227
25341
|
{ label: data?.goal.title || "Detalhes" }
|
|
@@ -25229,7 +25343,7 @@ var RecommendedLessonDetails = ({
|
|
|
25229
25343
|
[data?.goal.title]
|
|
25230
25344
|
);
|
|
25231
25345
|
const breadcrumbItems = breadcrumbs || defaultBreadcrumbs;
|
|
25232
|
-
const displayStudents = (0,
|
|
25346
|
+
const displayStudents = (0, import_react81.useMemo)(() => {
|
|
25233
25347
|
if (!data?.details.students) return [];
|
|
25234
25348
|
const deadline = data?.goal.finalDate;
|
|
25235
25349
|
return data.details.students.map(
|
|
@@ -25306,101 +25420,101 @@ var RecommendedLessonDetails = ({
|
|
|
25306
25420
|
var RecommendedLessonDetails_default = RecommendedLessonDetails;
|
|
25307
25421
|
|
|
25308
25422
|
// src/hooks/useRecommendedLessonDetails.ts
|
|
25309
|
-
var
|
|
25310
|
-
var
|
|
25311
|
-
var goalLessonSubjectSchema =
|
|
25312
|
-
id:
|
|
25313
|
-
name:
|
|
25314
|
-
color:
|
|
25315
|
-
icon:
|
|
25423
|
+
var import_react82 = require("react");
|
|
25424
|
+
var import_zod6 = require("zod");
|
|
25425
|
+
var goalLessonSubjectSchema = import_zod6.z.object({
|
|
25426
|
+
id: import_zod6.z.string(),
|
|
25427
|
+
name: import_zod6.z.string(),
|
|
25428
|
+
color: import_zod6.z.string(),
|
|
25429
|
+
icon: import_zod6.z.string()
|
|
25316
25430
|
});
|
|
25317
|
-
var lessonContentSchema =
|
|
25318
|
-
id:
|
|
25319
|
-
name:
|
|
25431
|
+
var lessonContentSchema = import_zod6.z.object({
|
|
25432
|
+
id: import_zod6.z.string(),
|
|
25433
|
+
name: import_zod6.z.string()
|
|
25320
25434
|
});
|
|
25321
|
-
var goalLessonSchema =
|
|
25322
|
-
id:
|
|
25435
|
+
var goalLessonSchema = import_zod6.z.object({
|
|
25436
|
+
id: import_zod6.z.string(),
|
|
25323
25437
|
content: lessonContentSchema,
|
|
25324
25438
|
subtopic: lessonContentSchema,
|
|
25325
25439
|
topic: lessonContentSchema,
|
|
25326
25440
|
subject: goalLessonSubjectSchema
|
|
25327
25441
|
});
|
|
25328
|
-
var goalLessonProgressSchema =
|
|
25329
|
-
id:
|
|
25330
|
-
userId:
|
|
25331
|
-
lessonId:
|
|
25332
|
-
progress:
|
|
25442
|
+
var goalLessonProgressSchema = import_zod6.z.object({
|
|
25443
|
+
id: import_zod6.z.string(),
|
|
25444
|
+
userId: import_zod6.z.string(),
|
|
25445
|
+
lessonId: import_zod6.z.string(),
|
|
25446
|
+
progress: import_zod6.z.number(),
|
|
25333
25447
|
lesson: goalLessonSchema
|
|
25334
25448
|
});
|
|
25335
|
-
var goalLessonGoalItemSchema =
|
|
25336
|
-
goalId:
|
|
25337
|
-
supLessonsProgressId:
|
|
25449
|
+
var goalLessonGoalItemSchema = import_zod6.z.object({
|
|
25450
|
+
goalId: import_zod6.z.string(),
|
|
25451
|
+
supLessonsProgressId: import_zod6.z.string(),
|
|
25338
25452
|
supLessonsProgress: goalLessonProgressSchema
|
|
25339
25453
|
});
|
|
25340
|
-
var goalMetadataSchema =
|
|
25341
|
-
id:
|
|
25342
|
-
title:
|
|
25343
|
-
startDate:
|
|
25344
|
-
finalDate:
|
|
25345
|
-
progress:
|
|
25346
|
-
lessonsGoals:
|
|
25454
|
+
var goalMetadataSchema = import_zod6.z.object({
|
|
25455
|
+
id: import_zod6.z.string(),
|
|
25456
|
+
title: import_zod6.z.string(),
|
|
25457
|
+
startDate: import_zod6.z.string(),
|
|
25458
|
+
finalDate: import_zod6.z.string(),
|
|
25459
|
+
progress: import_zod6.z.number(),
|
|
25460
|
+
lessonsGoals: import_zod6.z.array(goalLessonGoalItemSchema)
|
|
25347
25461
|
});
|
|
25348
|
-
var goalApiResponseSchema =
|
|
25349
|
-
message:
|
|
25462
|
+
var goalApiResponseSchema = import_zod6.z.object({
|
|
25463
|
+
message: import_zod6.z.string(),
|
|
25350
25464
|
data: goalMetadataSchema
|
|
25351
25465
|
});
|
|
25352
|
-
var goalDetailStudentSchema =
|
|
25353
|
-
userInstitutionId:
|
|
25354
|
-
userId:
|
|
25355
|
-
name:
|
|
25356
|
-
progress:
|
|
25357
|
-
completedAt:
|
|
25358
|
-
avgScore:
|
|
25359
|
-
daysToComplete:
|
|
25466
|
+
var goalDetailStudentSchema = import_zod6.z.object({
|
|
25467
|
+
userInstitutionId: import_zod6.z.string(),
|
|
25468
|
+
userId: import_zod6.z.string(),
|
|
25469
|
+
name: import_zod6.z.string(),
|
|
25470
|
+
progress: import_zod6.z.number(),
|
|
25471
|
+
completedAt: import_zod6.z.string().nullable(),
|
|
25472
|
+
avgScore: import_zod6.z.number().nullable(),
|
|
25473
|
+
daysToComplete: import_zod6.z.number().nullable()
|
|
25360
25474
|
});
|
|
25361
|
-
var goalDetailAggregatedSchema =
|
|
25362
|
-
completionPercentage:
|
|
25363
|
-
avgScore:
|
|
25475
|
+
var goalDetailAggregatedSchema = import_zod6.z.object({
|
|
25476
|
+
completionPercentage: import_zod6.z.number(),
|
|
25477
|
+
avgScore: import_zod6.z.number().nullable()
|
|
25364
25478
|
});
|
|
25365
|
-
var goalDetailContentPerformanceItemSchema =
|
|
25366
|
-
contentId:
|
|
25367
|
-
contentName:
|
|
25368
|
-
rate:
|
|
25479
|
+
var goalDetailContentPerformanceItemSchema = import_zod6.z.object({
|
|
25480
|
+
contentId: import_zod6.z.string(),
|
|
25481
|
+
contentName: import_zod6.z.string(),
|
|
25482
|
+
rate: import_zod6.z.number()
|
|
25369
25483
|
}).nullable();
|
|
25370
|
-
var goalDetailContentPerformanceSchema =
|
|
25484
|
+
var goalDetailContentPerformanceSchema = import_zod6.z.object({
|
|
25371
25485
|
best: goalDetailContentPerformanceItemSchema,
|
|
25372
25486
|
worst: goalDetailContentPerformanceItemSchema
|
|
25373
25487
|
});
|
|
25374
|
-
var goalDetailsDataSchema =
|
|
25375
|
-
students:
|
|
25488
|
+
var goalDetailsDataSchema = import_zod6.z.object({
|
|
25489
|
+
students: import_zod6.z.array(goalDetailStudentSchema),
|
|
25376
25490
|
aggregated: goalDetailAggregatedSchema,
|
|
25377
25491
|
contentPerformance: goalDetailContentPerformanceSchema
|
|
25378
25492
|
});
|
|
25379
|
-
var goalDetailsApiResponseSchema =
|
|
25380
|
-
message:
|
|
25493
|
+
var goalDetailsApiResponseSchema = import_zod6.z.object({
|
|
25494
|
+
message: import_zod6.z.string(),
|
|
25381
25495
|
data: goalDetailsDataSchema
|
|
25382
25496
|
});
|
|
25383
|
-
var goalBreakdownSchema2 =
|
|
25384
|
-
classId:
|
|
25385
|
-
className:
|
|
25386
|
-
schoolId:
|
|
25387
|
-
schoolName:
|
|
25388
|
-
studentCount:
|
|
25389
|
-
completedCount:
|
|
25497
|
+
var goalBreakdownSchema2 = import_zod6.z.object({
|
|
25498
|
+
classId: import_zod6.z.string().uuid(),
|
|
25499
|
+
className: import_zod6.z.string(),
|
|
25500
|
+
schoolId: import_zod6.z.string(),
|
|
25501
|
+
schoolName: import_zod6.z.string(),
|
|
25502
|
+
studentCount: import_zod6.z.number(),
|
|
25503
|
+
completedCount: import_zod6.z.number()
|
|
25390
25504
|
});
|
|
25391
|
-
var historyGoalItemSchema =
|
|
25392
|
-
goal:
|
|
25393
|
-
breakdown:
|
|
25505
|
+
var historyGoalItemSchema = import_zod6.z.object({
|
|
25506
|
+
goal: import_zod6.z.object({ id: import_zod6.z.string().uuid() }),
|
|
25507
|
+
breakdown: import_zod6.z.array(goalBreakdownSchema2)
|
|
25394
25508
|
});
|
|
25395
|
-
var historyApiResponseSchema =
|
|
25396
|
-
message:
|
|
25397
|
-
data:
|
|
25398
|
-
goals:
|
|
25399
|
-
total:
|
|
25509
|
+
var historyApiResponseSchema = import_zod6.z.object({
|
|
25510
|
+
message: import_zod6.z.string(),
|
|
25511
|
+
data: import_zod6.z.object({
|
|
25512
|
+
goals: import_zod6.z.array(historyGoalItemSchema),
|
|
25513
|
+
total: import_zod6.z.number()
|
|
25400
25514
|
})
|
|
25401
25515
|
});
|
|
25402
25516
|
var handleLessonDetailsFetchError = (error) => {
|
|
25403
|
-
if (error instanceof
|
|
25517
|
+
if (error instanceof import_zod6.z.ZodError) {
|
|
25404
25518
|
console.error("Erro ao validar dados dos detalhes da aula:", error);
|
|
25405
25519
|
return "Erro ao validar dados dos detalhes da aula";
|
|
25406
25520
|
}
|
|
@@ -25409,12 +25523,12 @@ var handleLessonDetailsFetchError = (error) => {
|
|
|
25409
25523
|
};
|
|
25410
25524
|
var createUseRecommendedLessonDetails = (apiClient) => {
|
|
25411
25525
|
return (lessonId) => {
|
|
25412
|
-
const [state, setState] = (0,
|
|
25526
|
+
const [state, setState] = (0, import_react82.useState)({
|
|
25413
25527
|
data: null,
|
|
25414
25528
|
loading: true,
|
|
25415
25529
|
error: null
|
|
25416
25530
|
});
|
|
25417
|
-
const fetchLessonDetails = (0,
|
|
25531
|
+
const fetchLessonDetails = (0, import_react82.useCallback)(async () => {
|
|
25418
25532
|
if (!lessonId) {
|
|
25419
25533
|
setState({
|
|
25420
25534
|
data: null,
|
|
@@ -25460,7 +25574,7 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
25460
25574
|
});
|
|
25461
25575
|
}
|
|
25462
25576
|
}, [lessonId]);
|
|
25463
|
-
(0,
|
|
25577
|
+
(0, import_react82.useEffect)(() => {
|
|
25464
25578
|
fetchLessonDetails();
|
|
25465
25579
|
}, [fetchLessonDetails]);
|
|
25466
25580
|
return {
|
|
@@ -25472,10 +25586,10 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
25472
25586
|
var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
|
|
25473
25587
|
|
|
25474
25588
|
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
25475
|
-
var
|
|
25589
|
+
var import_react87 = require("react");
|
|
25476
25590
|
|
|
25477
25591
|
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
25478
|
-
var
|
|
25592
|
+
var import_react84 = require("react");
|
|
25479
25593
|
var import_phosphor_react47 = require("phosphor-react");
|
|
25480
25594
|
|
|
25481
25595
|
// src/components/ActivitiesHistory/components/ErrorDisplay.tsx
|
|
@@ -25717,14 +25831,14 @@ var createHistoryFiltersConfig = (userData) => [
|
|
|
25717
25831
|
];
|
|
25718
25832
|
|
|
25719
25833
|
// src/hooks/useActivitiesHistory.ts
|
|
25720
|
-
var
|
|
25721
|
-
var
|
|
25834
|
+
var import_react83 = require("react");
|
|
25835
|
+
var import_zod8 = require("zod");
|
|
25722
25836
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
25723
25837
|
|
|
25724
25838
|
// src/utils/hookErrorHandler.ts
|
|
25725
|
-
var
|
|
25839
|
+
var import_zod7 = require("zod");
|
|
25726
25840
|
var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
|
|
25727
|
-
if (error instanceof
|
|
25841
|
+
if (error instanceof import_zod7.z.ZodError) {
|
|
25728
25842
|
console.error(validationErrorMessage, error);
|
|
25729
25843
|
return validationErrorMessage;
|
|
25730
25844
|
}
|
|
@@ -25733,33 +25847,33 @@ var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (
|
|
|
25733
25847
|
};
|
|
25734
25848
|
|
|
25735
25849
|
// src/hooks/useActivitiesHistory.ts
|
|
25736
|
-
var activityHistoryResponseSchema =
|
|
25737
|
-
id:
|
|
25738
|
-
title:
|
|
25739
|
-
startDate:
|
|
25740
|
-
finalDate:
|
|
25741
|
-
status:
|
|
25742
|
-
completionPercentage:
|
|
25743
|
-
subjectId:
|
|
25744
|
-
schoolId:
|
|
25745
|
-
schoolName:
|
|
25746
|
-
year:
|
|
25747
|
-
className:
|
|
25748
|
-
subjectName:
|
|
25850
|
+
var activityHistoryResponseSchema = import_zod8.z.object({
|
|
25851
|
+
id: import_zod8.z.string().uuid(),
|
|
25852
|
+
title: import_zod8.z.string(),
|
|
25853
|
+
startDate: import_zod8.z.string().nullable(),
|
|
25854
|
+
finalDate: import_zod8.z.string().nullable(),
|
|
25855
|
+
status: import_zod8.z.nativeEnum(GenericApiStatus),
|
|
25856
|
+
completionPercentage: import_zod8.z.number().min(0).max(100).optional().default(0),
|
|
25857
|
+
subjectId: import_zod8.z.string().uuid().optional().nullable(),
|
|
25858
|
+
schoolId: import_zod8.z.string().optional(),
|
|
25859
|
+
schoolName: import_zod8.z.string().optional(),
|
|
25860
|
+
year: import_zod8.z.string().optional(),
|
|
25861
|
+
className: import_zod8.z.string().optional(),
|
|
25862
|
+
subjectName: import_zod8.z.string().optional()
|
|
25749
25863
|
});
|
|
25750
|
-
var activitiesHistoryApiResponseSchema =
|
|
25751
|
-
message:
|
|
25752
|
-
data:
|
|
25753
|
-
activities:
|
|
25864
|
+
var activitiesHistoryApiResponseSchema = import_zod8.z.object({
|
|
25865
|
+
message: import_zod8.z.string(),
|
|
25866
|
+
data: import_zod8.z.object({
|
|
25867
|
+
activities: import_zod8.z.array(import_zod8.z.unknown()).transform(
|
|
25754
25868
|
(items) => items.map((item) => activityHistoryResponseSchema.safeParse(item)).filter(
|
|
25755
25869
|
(result) => result.success
|
|
25756
25870
|
).map((result) => result.data)
|
|
25757
25871
|
),
|
|
25758
|
-
pagination:
|
|
25759
|
-
total:
|
|
25760
|
-
page:
|
|
25761
|
-
limit:
|
|
25762
|
-
totalPages:
|
|
25872
|
+
pagination: import_zod8.z.object({
|
|
25873
|
+
total: import_zod8.z.number(),
|
|
25874
|
+
page: import_zod8.z.number(),
|
|
25875
|
+
limit: import_zod8.z.number(),
|
|
25876
|
+
totalPages: import_zod8.z.number()
|
|
25763
25877
|
})
|
|
25764
25878
|
})
|
|
25765
25879
|
});
|
|
@@ -25789,13 +25903,13 @@ var handleActivityFetchError = createFetchErrorHandler(
|
|
|
25789
25903
|
);
|
|
25790
25904
|
var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
25791
25905
|
return () => {
|
|
25792
|
-
const [state, setState] = (0,
|
|
25906
|
+
const [state, setState] = (0, import_react83.useState)({
|
|
25793
25907
|
activities: [],
|
|
25794
25908
|
loading: false,
|
|
25795
25909
|
error: null,
|
|
25796
25910
|
pagination: DEFAULT_ACTIVITIES_PAGINATION
|
|
25797
25911
|
});
|
|
25798
|
-
const fetchActivities = (0,
|
|
25912
|
+
const fetchActivities = (0, import_react83.useCallback)(
|
|
25799
25913
|
async (filters) => {
|
|
25800
25914
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
25801
25915
|
try {
|
|
@@ -25840,9 +25954,9 @@ var HistoryTab = ({
|
|
|
25840
25954
|
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
25841
25955
|
userFilterData
|
|
25842
25956
|
}) => {
|
|
25843
|
-
const fetchActivitiesHistoryRef = (0,
|
|
25957
|
+
const fetchActivitiesHistoryRef = (0, import_react84.useRef)(fetchActivitiesHistory);
|
|
25844
25958
|
fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
|
|
25845
|
-
const useActivitiesHistory = (0,
|
|
25959
|
+
const useActivitiesHistory = (0, import_react84.useMemo)(
|
|
25846
25960
|
() => createUseActivitiesHistory(
|
|
25847
25961
|
(filters) => fetchActivitiesHistoryRef.current(filters)
|
|
25848
25962
|
),
|
|
@@ -25855,15 +25969,15 @@ var HistoryTab = ({
|
|
|
25855
25969
|
pagination,
|
|
25856
25970
|
fetchActivities
|
|
25857
25971
|
} = useActivitiesHistory();
|
|
25858
|
-
const historyFilterConfigs = (0,
|
|
25972
|
+
const historyFilterConfigs = (0, import_react84.useMemo)(
|
|
25859
25973
|
() => createHistoryFiltersConfig(userFilterData),
|
|
25860
25974
|
[userFilterData]
|
|
25861
25975
|
);
|
|
25862
|
-
const historyTableColumns = (0,
|
|
25976
|
+
const historyTableColumns = (0, import_react84.useMemo)(
|
|
25863
25977
|
() => createHistoryTableColumns(mapSubjectNameToEnum2),
|
|
25864
25978
|
[mapSubjectNameToEnum2]
|
|
25865
25979
|
);
|
|
25866
|
-
const handleParamsChange = (0,
|
|
25980
|
+
const handleParamsChange = (0, import_react84.useCallback)(
|
|
25867
25981
|
(params) => {
|
|
25868
25982
|
const filters = buildHistoryFiltersFromParams(params);
|
|
25869
25983
|
fetchActivities(filters);
|
|
@@ -25946,7 +26060,7 @@ var HistoryTab = ({
|
|
|
25946
26060
|
};
|
|
25947
26061
|
|
|
25948
26062
|
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
25949
|
-
var
|
|
26063
|
+
var import_react86 = require("react");
|
|
25950
26064
|
var import_phosphor_react49 = require("phosphor-react");
|
|
25951
26065
|
|
|
25952
26066
|
// src/components/ActivitiesHistory/config/modelsTableColumns.tsx
|
|
@@ -26052,32 +26166,32 @@ var createModelsFiltersConfig = (userData) => [
|
|
|
26052
26166
|
];
|
|
26053
26167
|
|
|
26054
26168
|
// src/hooks/useActivityModels.ts
|
|
26055
|
-
var
|
|
26056
|
-
var
|
|
26169
|
+
var import_react85 = require("react");
|
|
26170
|
+
var import_zod9 = require("zod");
|
|
26057
26171
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
26058
|
-
var activityDraftFiltersSchema =
|
|
26059
|
-
questionTypes:
|
|
26060
|
-
questionBanks:
|
|
26061
|
-
subjects:
|
|
26062
|
-
topics:
|
|
26063
|
-
subtopics:
|
|
26064
|
-
contents:
|
|
26172
|
+
var activityDraftFiltersSchema = import_zod9.z.object({
|
|
26173
|
+
questionTypes: import_zod9.z.array(import_zod9.z.string()).optional(),
|
|
26174
|
+
questionBanks: import_zod9.z.array(import_zod9.z.string()).optional(),
|
|
26175
|
+
subjects: import_zod9.z.array(import_zod9.z.string()).optional(),
|
|
26176
|
+
topics: import_zod9.z.array(import_zod9.z.string()).optional(),
|
|
26177
|
+
subtopics: import_zod9.z.array(import_zod9.z.string()).optional(),
|
|
26178
|
+
contents: import_zod9.z.array(import_zod9.z.string()).optional()
|
|
26065
26179
|
}).nullable();
|
|
26066
|
-
var activityModelResponseSchema =
|
|
26067
|
-
id:
|
|
26068
|
-
type:
|
|
26069
|
-
title:
|
|
26070
|
-
creatorUserInstitutionId:
|
|
26071
|
-
subjectId:
|
|
26180
|
+
var activityModelResponseSchema = import_zod9.z.object({
|
|
26181
|
+
id: import_zod9.z.string().uuid(),
|
|
26182
|
+
type: import_zod9.z.nativeEnum(ActivityDraftType),
|
|
26183
|
+
title: import_zod9.z.string().nullable(),
|
|
26184
|
+
creatorUserInstitutionId: import_zod9.z.string().uuid().nullable(),
|
|
26185
|
+
subjectId: import_zod9.z.string().uuid().nullable(),
|
|
26072
26186
|
filters: activityDraftFiltersSchema,
|
|
26073
|
-
createdAt:
|
|
26074
|
-
updatedAt:
|
|
26187
|
+
createdAt: import_zod9.z.string(),
|
|
26188
|
+
updatedAt: import_zod9.z.string()
|
|
26075
26189
|
});
|
|
26076
|
-
var activityModelsApiResponseSchema =
|
|
26077
|
-
message:
|
|
26078
|
-
data:
|
|
26079
|
-
activityDrafts:
|
|
26080
|
-
total:
|
|
26190
|
+
var activityModelsApiResponseSchema = import_zod9.z.object({
|
|
26191
|
+
message: import_zod9.z.string(),
|
|
26192
|
+
data: import_zod9.z.object({
|
|
26193
|
+
activityDrafts: import_zod9.z.array(activityModelResponseSchema),
|
|
26194
|
+
total: import_zod9.z.number()
|
|
26081
26195
|
})
|
|
26082
26196
|
});
|
|
26083
26197
|
var DEFAULT_MODELS_PAGINATION = {
|
|
@@ -26102,13 +26216,13 @@ var handleModelFetchError = createFetchErrorHandler(
|
|
|
26102
26216
|
);
|
|
26103
26217
|
var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
26104
26218
|
return () => {
|
|
26105
|
-
const [state, setState] = (0,
|
|
26219
|
+
const [state, setState] = (0, import_react85.useState)({
|
|
26106
26220
|
models: [],
|
|
26107
26221
|
loading: false,
|
|
26108
26222
|
error: null,
|
|
26109
26223
|
pagination: DEFAULT_MODELS_PAGINATION
|
|
26110
26224
|
});
|
|
26111
|
-
const fetchModels = (0,
|
|
26225
|
+
const fetchModels = (0, import_react85.useCallback)(
|
|
26112
26226
|
async (filters, subjectsMap) => {
|
|
26113
26227
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
26114
26228
|
try {
|
|
@@ -26143,7 +26257,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
|
26143
26257
|
},
|
|
26144
26258
|
[fetchActivityModels]
|
|
26145
26259
|
);
|
|
26146
|
-
const deleteModel = (0,
|
|
26260
|
+
const deleteModel = (0, import_react85.useCallback)(
|
|
26147
26261
|
async (id) => {
|
|
26148
26262
|
try {
|
|
26149
26263
|
await deleteActivityModel(id);
|
|
@@ -26178,16 +26292,16 @@ var ModelsTab = ({
|
|
|
26178
26292
|
userFilterData,
|
|
26179
26293
|
subjectsMap
|
|
26180
26294
|
}) => {
|
|
26181
|
-
const [deleteDialogOpen, setDeleteDialogOpen] = (0,
|
|
26182
|
-
const [modelToDelete, setModelToDelete] = (0,
|
|
26295
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = (0, import_react86.useState)(false);
|
|
26296
|
+
const [modelToDelete, setModelToDelete] = (0, import_react86.useState)(null);
|
|
26183
26297
|
const { addToast } = useToast();
|
|
26184
|
-
const fetchActivityModelsRef = (0,
|
|
26298
|
+
const fetchActivityModelsRef = (0, import_react86.useRef)(fetchActivityModels);
|
|
26185
26299
|
fetchActivityModelsRef.current = fetchActivityModels;
|
|
26186
|
-
const deleteActivityModelRef = (0,
|
|
26300
|
+
const deleteActivityModelRef = (0, import_react86.useRef)(deleteActivityModel);
|
|
26187
26301
|
deleteActivityModelRef.current = deleteActivityModel;
|
|
26188
|
-
const subjectsMapRef = (0,
|
|
26302
|
+
const subjectsMapRef = (0, import_react86.useRef)(subjectsMap);
|
|
26189
26303
|
subjectsMapRef.current = subjectsMap;
|
|
26190
|
-
const useActivityModels = (0,
|
|
26304
|
+
const useActivityModels = (0, import_react86.useMemo)(
|
|
26191
26305
|
() => createUseActivityModels(
|
|
26192
26306
|
(filters) => fetchActivityModelsRef.current(filters),
|
|
26193
26307
|
(id) => deleteActivityModelRef.current(id)
|
|
@@ -26202,15 +26316,15 @@ var ModelsTab = ({
|
|
|
26202
26316
|
fetchModels,
|
|
26203
26317
|
deleteModel
|
|
26204
26318
|
} = useActivityModels();
|
|
26205
|
-
const modelsFilterConfigs = (0,
|
|
26319
|
+
const modelsFilterConfigs = (0, import_react86.useMemo)(
|
|
26206
26320
|
() => createModelsFiltersConfig(userFilterData),
|
|
26207
26321
|
[userFilterData]
|
|
26208
26322
|
);
|
|
26209
|
-
const handleDeleteClick = (0,
|
|
26323
|
+
const handleDeleteClick = (0, import_react86.useCallback)((model) => {
|
|
26210
26324
|
setModelToDelete(model);
|
|
26211
26325
|
setDeleteDialogOpen(true);
|
|
26212
26326
|
}, []);
|
|
26213
|
-
const modelsTableColumns = (0,
|
|
26327
|
+
const modelsTableColumns = (0, import_react86.useMemo)(
|
|
26214
26328
|
() => createModelsTableColumns(
|
|
26215
26329
|
mapSubjectNameToEnum2,
|
|
26216
26330
|
onSendActivity,
|
|
@@ -26219,17 +26333,17 @@ var ModelsTab = ({
|
|
|
26219
26333
|
),
|
|
26220
26334
|
[mapSubjectNameToEnum2, onSendActivity, onEditModel, handleDeleteClick]
|
|
26221
26335
|
);
|
|
26222
|
-
const handleParamsChange = (0,
|
|
26336
|
+
const handleParamsChange = (0, import_react86.useCallback)(
|
|
26223
26337
|
(params) => {
|
|
26224
26338
|
const filters = buildModelsFiltersFromParams(params);
|
|
26225
26339
|
fetchModels(filters, subjectsMapRef.current);
|
|
26226
26340
|
},
|
|
26227
26341
|
[fetchModels]
|
|
26228
26342
|
);
|
|
26229
|
-
(0,
|
|
26343
|
+
(0, import_react86.useEffect)(() => {
|
|
26230
26344
|
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
26231
26345
|
}, [fetchModels]);
|
|
26232
|
-
const handleConfirmDelete = (0,
|
|
26346
|
+
const handleConfirmDelete = (0, import_react86.useCallback)(async () => {
|
|
26233
26347
|
if (modelToDelete) {
|
|
26234
26348
|
const success = await deleteModel(modelToDelete.id);
|
|
26235
26349
|
if (success) {
|
|
@@ -26242,7 +26356,7 @@ var ModelsTab = ({
|
|
|
26242
26356
|
setDeleteDialogOpen(false);
|
|
26243
26357
|
setModelToDelete(null);
|
|
26244
26358
|
}, [modelToDelete, deleteModel, fetchModels, addToast]);
|
|
26245
|
-
const handleCancelDelete = (0,
|
|
26359
|
+
const handleCancelDelete = (0, import_react86.useCallback)(() => {
|
|
26246
26360
|
setDeleteDialogOpen(false);
|
|
26247
26361
|
setModelToDelete(null);
|
|
26248
26362
|
}, []);
|
|
@@ -26360,7 +26474,7 @@ var ActivitiesHistory = ({
|
|
|
26360
26474
|
userFilterData,
|
|
26361
26475
|
subjectsMap
|
|
26362
26476
|
}) => {
|
|
26363
|
-
const [activeTab, setActiveTab] = (0,
|
|
26477
|
+
const [activeTab, setActiveTab] = (0, import_react87.useState)("history" /* HISTORY */);
|
|
26364
26478
|
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
|
|
26365
26479
|
"div",
|
|
26366
26480
|
{
|
|
@@ -26599,7 +26713,7 @@ var buildUserFilterData = (userData) => ({
|
|
|
26599
26713
|
});
|
|
26600
26714
|
|
|
26601
26715
|
// src/hooks/useChat.ts
|
|
26602
|
-
var
|
|
26716
|
+
var import_react88 = require("react");
|
|
26603
26717
|
var WS_STATES = {
|
|
26604
26718
|
CONNECTING: 0,
|
|
26605
26719
|
OPEN: 1,
|
|
@@ -26618,25 +26732,25 @@ function useChat({
|
|
|
26618
26732
|
reconnectInterval = 3e3,
|
|
26619
26733
|
maxReconnectAttempts = 5
|
|
26620
26734
|
}) {
|
|
26621
|
-
const [isConnected, setIsConnected] = (0,
|
|
26622
|
-
const [messages, setMessages] = (0,
|
|
26623
|
-
const [participants, setParticipants] = (0,
|
|
26624
|
-
const [error, setError] = (0,
|
|
26625
|
-
const wsRef = (0,
|
|
26626
|
-
const reconnectAttemptsRef = (0,
|
|
26627
|
-
const reconnectTimeoutRef = (0,
|
|
26735
|
+
const [isConnected, setIsConnected] = (0, import_react88.useState)(false);
|
|
26736
|
+
const [messages, setMessages] = (0, import_react88.useState)([]);
|
|
26737
|
+
const [participants, setParticipants] = (0, import_react88.useState)([]);
|
|
26738
|
+
const [error, setError] = (0, import_react88.useState)(null);
|
|
26739
|
+
const wsRef = (0, import_react88.useRef)(null);
|
|
26740
|
+
const reconnectAttemptsRef = (0, import_react88.useRef)(0);
|
|
26741
|
+
const reconnectTimeoutRef = (0, import_react88.useRef)(
|
|
26628
26742
|
null
|
|
26629
26743
|
);
|
|
26630
|
-
const isManualDisconnectRef = (0,
|
|
26631
|
-
const isConnectingRef = (0,
|
|
26632
|
-
const connectRef = (0,
|
|
26744
|
+
const isManualDisconnectRef = (0, import_react88.useRef)(false);
|
|
26745
|
+
const isConnectingRef = (0, import_react88.useRef)(false);
|
|
26746
|
+
const connectRef = (0, import_react88.useRef)(() => {
|
|
26633
26747
|
});
|
|
26634
|
-
const sendWsMessage = (0,
|
|
26748
|
+
const sendWsMessage = (0, import_react88.useCallback)((message) => {
|
|
26635
26749
|
if (wsRef.current?.readyState === WS_STATES.OPEN) {
|
|
26636
26750
|
wsRef.current.send(JSON.stringify(message));
|
|
26637
26751
|
}
|
|
26638
26752
|
}, []);
|
|
26639
|
-
const sendMessage = (0,
|
|
26753
|
+
const sendMessage = (0, import_react88.useCallback)(
|
|
26640
26754
|
(content) => {
|
|
26641
26755
|
const trimmedContent = content.trim();
|
|
26642
26756
|
if (!trimmedContent) return;
|
|
@@ -26647,12 +26761,12 @@ function useChat({
|
|
|
26647
26761
|
},
|
|
26648
26762
|
[sendWsMessage]
|
|
26649
26763
|
);
|
|
26650
|
-
const leave = (0,
|
|
26764
|
+
const leave = (0, import_react88.useCallback)(() => {
|
|
26651
26765
|
isManualDisconnectRef.current = true;
|
|
26652
26766
|
sendWsMessage({ type: "leave" });
|
|
26653
26767
|
wsRef.current?.close(1e3, "User left");
|
|
26654
26768
|
}, [sendWsMessage]);
|
|
26655
|
-
const handleMessage = (0,
|
|
26769
|
+
const handleMessage = (0, import_react88.useCallback)(
|
|
26656
26770
|
(event) => {
|
|
26657
26771
|
try {
|
|
26658
26772
|
const data = JSON.parse(event.data);
|
|
@@ -26720,7 +26834,7 @@ function useChat({
|
|
|
26720
26834
|
},
|
|
26721
26835
|
[onError]
|
|
26722
26836
|
);
|
|
26723
|
-
const connect = (0,
|
|
26837
|
+
const connect = (0, import_react88.useCallback)(() => {
|
|
26724
26838
|
if (isConnectingRef.current) {
|
|
26725
26839
|
return;
|
|
26726
26840
|
}
|
|
@@ -26773,12 +26887,12 @@ function useChat({
|
|
|
26773
26887
|
maxReconnectAttempts
|
|
26774
26888
|
]);
|
|
26775
26889
|
connectRef.current = connect;
|
|
26776
|
-
const reconnect = (0,
|
|
26890
|
+
const reconnect = (0, import_react88.useCallback)(() => {
|
|
26777
26891
|
isManualDisconnectRef.current = false;
|
|
26778
26892
|
reconnectAttemptsRef.current = 0;
|
|
26779
26893
|
connectRef.current();
|
|
26780
26894
|
}, []);
|
|
26781
|
-
(0,
|
|
26895
|
+
(0, import_react88.useEffect)(() => {
|
|
26782
26896
|
if (!roomId) {
|
|
26783
26897
|
return;
|
|
26784
26898
|
}
|
|
@@ -26822,15 +26936,15 @@ function createUseChat(baseWsUrl) {
|
|
|
26822
26936
|
}
|
|
26823
26937
|
|
|
26824
26938
|
// src/hooks/useChatRooms.ts
|
|
26825
|
-
var
|
|
26939
|
+
var import_react89 = require("react");
|
|
26826
26940
|
function useChatRooms({
|
|
26827
26941
|
apiClient
|
|
26828
26942
|
}) {
|
|
26829
|
-
const [rooms, setRooms] = (0,
|
|
26830
|
-
const [availableUsers, setAvailableUsers] = (0,
|
|
26831
|
-
const [loading, setLoading] = (0,
|
|
26832
|
-
const [error, setError] = (0,
|
|
26833
|
-
const fetchRooms = (0,
|
|
26943
|
+
const [rooms, setRooms] = (0, import_react89.useState)([]);
|
|
26944
|
+
const [availableUsers, setAvailableUsers] = (0, import_react89.useState)([]);
|
|
26945
|
+
const [loading, setLoading] = (0, import_react89.useState)(false);
|
|
26946
|
+
const [error, setError] = (0, import_react89.useState)(null);
|
|
26947
|
+
const fetchRooms = (0, import_react89.useCallback)(async () => {
|
|
26834
26948
|
setLoading(true);
|
|
26835
26949
|
setError(null);
|
|
26836
26950
|
try {
|
|
@@ -26846,7 +26960,7 @@ function useChatRooms({
|
|
|
26846
26960
|
setLoading(false);
|
|
26847
26961
|
}
|
|
26848
26962
|
}, [apiClient]);
|
|
26849
|
-
const fetchAvailableUsers = (0,
|
|
26963
|
+
const fetchAvailableUsers = (0, import_react89.useCallback)(async () => {
|
|
26850
26964
|
setLoading(true);
|
|
26851
26965
|
setError(null);
|
|
26852
26966
|
try {
|
|
@@ -26862,7 +26976,7 @@ function useChatRooms({
|
|
|
26862
26976
|
setLoading(false);
|
|
26863
26977
|
}
|
|
26864
26978
|
}, [apiClient]);
|
|
26865
|
-
const createRoom = (0,
|
|
26979
|
+
const createRoom = (0, import_react89.useCallback)(
|
|
26866
26980
|
async (participantIds) => {
|
|
26867
26981
|
setLoading(true);
|
|
26868
26982
|
setError(null);
|
|
@@ -26886,7 +27000,7 @@ function useChatRooms({
|
|
|
26886
27000
|
},
|
|
26887
27001
|
[apiClient, fetchRooms]
|
|
26888
27002
|
);
|
|
26889
|
-
const clearError = (0,
|
|
27003
|
+
const clearError = (0, import_react89.useCallback)(() => {
|
|
26890
27004
|
setError(null);
|
|
26891
27005
|
}, []);
|
|
26892
27006
|
return {
|
|
@@ -26920,8 +27034,8 @@ var CHAT_MESSAGE_TYPES = {
|
|
|
26920
27034
|
};
|
|
26921
27035
|
|
|
26922
27036
|
// src/components/Chat/Chat.tsx
|
|
26923
|
-
var
|
|
26924
|
-
var
|
|
27037
|
+
var import_react90 = require("react");
|
|
27038
|
+
var import_react91 = require("@phosphor-icons/react");
|
|
26925
27039
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
26926
27040
|
var RoomItem = ({
|
|
26927
27041
|
room,
|
|
@@ -26938,7 +27052,7 @@ var RoomItem = ({
|
|
|
26938
27052
|
isActive && "bg-primary-50 border-l-4 border-primary-500"
|
|
26939
27053
|
),
|
|
26940
27054
|
children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex items-start gap-3 w-full", children: [
|
|
26941
|
-
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: "w-10 h-10 rounded-full bg-primary-100 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
27055
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: "w-10 h-10 rounded-full bg-primary-100 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react91.UsersIcon, { size: 20, className: "text-primary-600" }) }),
|
|
26942
27056
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
26943
27057
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Text_default, { size: "sm", weight: "semibold", className: "text-text-900 truncate", children: room.name }),
|
|
26944
27058
|
room.lastMessage && /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(Text_default, { size: "xs", className: "text-text-500 truncate mt-1", children: [
|
|
@@ -27068,16 +27182,16 @@ function ChatContent({
|
|
|
27068
27182
|
onRoomChange,
|
|
27069
27183
|
onBackToList
|
|
27070
27184
|
}) {
|
|
27071
|
-
const [view, setView] = (0,
|
|
27072
|
-
const [selectedRoom, setSelectedRoom] = (0,
|
|
27185
|
+
const [view, setView] = (0, import_react90.useState)("list");
|
|
27186
|
+
const [selectedRoom, setSelectedRoom] = (0, import_react90.useState)(
|
|
27073
27187
|
null
|
|
27074
27188
|
);
|
|
27075
|
-
const [selectedUserIds, setSelectedUserIds] = (0,
|
|
27189
|
+
const [selectedUserIds, setSelectedUserIds] = (0, import_react90.useState)(
|
|
27076
27190
|
/* @__PURE__ */ new Set()
|
|
27077
27191
|
);
|
|
27078
|
-
const [messageInput, setMessageInput] = (0,
|
|
27079
|
-
const [showCreateModal, setShowCreateModal] = (0,
|
|
27080
|
-
const hasHandledInitialRoomRef = (0,
|
|
27192
|
+
const [messageInput, setMessageInput] = (0, import_react90.useState)("");
|
|
27193
|
+
const [showCreateModal, setShowCreateModal] = (0, import_react90.useState)(false);
|
|
27194
|
+
const hasHandledInitialRoomRef = (0, import_react90.useRef)(false);
|
|
27081
27195
|
const {
|
|
27082
27196
|
rooms,
|
|
27083
27197
|
availableUsers,
|
|
@@ -27105,10 +27219,10 @@ function ChatContent({
|
|
|
27105
27219
|
const getRoleLabel = () => {
|
|
27106
27220
|
return userRole === "TEACHER" /* TEACHER */ ? "Professor" : "Aluno";
|
|
27107
27221
|
};
|
|
27108
|
-
(0,
|
|
27222
|
+
(0, import_react90.useEffect)(() => {
|
|
27109
27223
|
fetchRooms();
|
|
27110
27224
|
}, [fetchRooms]);
|
|
27111
|
-
(0,
|
|
27225
|
+
(0, import_react90.useEffect)(() => {
|
|
27112
27226
|
if (hasHandledInitialRoomRef.current) {
|
|
27113
27227
|
return;
|
|
27114
27228
|
}
|
|
@@ -27130,7 +27244,7 @@ function ChatContent({
|
|
|
27130
27244
|
onBackToList?.();
|
|
27131
27245
|
}
|
|
27132
27246
|
}, [initialRoomId, rooms, roomsLoading, onBackToList]);
|
|
27133
|
-
const handleSelectRoom = (0,
|
|
27247
|
+
const handleSelectRoom = (0, import_react90.useCallback)(
|
|
27134
27248
|
(room) => {
|
|
27135
27249
|
setSelectedRoom(room);
|
|
27136
27250
|
setView("room");
|
|
@@ -27138,12 +27252,12 @@ function ChatContent({
|
|
|
27138
27252
|
},
|
|
27139
27253
|
[onRoomChange]
|
|
27140
27254
|
);
|
|
27141
|
-
const handleOpenCreateModal = (0,
|
|
27255
|
+
const handleOpenCreateModal = (0, import_react90.useCallback)(async () => {
|
|
27142
27256
|
await fetchAvailableUsers();
|
|
27143
27257
|
setSelectedUserIds(/* @__PURE__ */ new Set());
|
|
27144
27258
|
setShowCreateModal(true);
|
|
27145
27259
|
}, [fetchAvailableUsers]);
|
|
27146
|
-
const handleToggleUser = (0,
|
|
27260
|
+
const handleToggleUser = (0, import_react90.useCallback)((id) => {
|
|
27147
27261
|
setSelectedUserIds((prev) => {
|
|
27148
27262
|
const next = new Set(prev);
|
|
27149
27263
|
if (next.has(id)) {
|
|
@@ -27154,7 +27268,7 @@ function ChatContent({
|
|
|
27154
27268
|
return next;
|
|
27155
27269
|
});
|
|
27156
27270
|
}, []);
|
|
27157
|
-
const handleCreateRoom = (0,
|
|
27271
|
+
const handleCreateRoom = (0, import_react90.useCallback)(async () => {
|
|
27158
27272
|
if (selectedUserIds.size === 0) return;
|
|
27159
27273
|
const room = await createRoom(Array.from(selectedUserIds));
|
|
27160
27274
|
if (room) {
|
|
@@ -27163,12 +27277,12 @@ function ChatContent({
|
|
|
27163
27277
|
onRoomChange?.(room.id);
|
|
27164
27278
|
}
|
|
27165
27279
|
}, [selectedUserIds, createRoom, onRoomChange]);
|
|
27166
|
-
const handleSendMessage = (0,
|
|
27280
|
+
const handleSendMessage = (0, import_react90.useCallback)(() => {
|
|
27167
27281
|
if (!messageInput.trim()) return;
|
|
27168
27282
|
sendMessage(messageInput);
|
|
27169
27283
|
setMessageInput("");
|
|
27170
27284
|
}, [messageInput, sendMessage]);
|
|
27171
|
-
const handleBackToList = (0,
|
|
27285
|
+
const handleBackToList = (0, import_react90.useCallback)(() => {
|
|
27172
27286
|
setSelectedRoom(null);
|
|
27173
27287
|
setView("list");
|
|
27174
27288
|
onBackToList?.();
|
|
@@ -27221,7 +27335,7 @@ function ChatContent({
|
|
|
27221
27335
|
variant: "solid",
|
|
27222
27336
|
size: "small",
|
|
27223
27337
|
onClick: handleOpenCreateModal,
|
|
27224
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
27338
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react91.PlusIcon, { size: 16 }),
|
|
27225
27339
|
children: "Nova conversa"
|
|
27226
27340
|
}
|
|
27227
27341
|
)
|
|
@@ -27261,7 +27375,7 @@ function ChatContent({
|
|
|
27261
27375
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex h-full", children: [
|
|
27262
27376
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex-1 flex flex-col", children: [
|
|
27263
27377
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "p-4 border-b border-background-200 flex items-center gap-3", children: [
|
|
27264
|
-
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Button_default, { variant: "link", size: "small", onClick: handleBackToList, children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
27378
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Button_default, { variant: "link", size: "small", onClick: handleBackToList, children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react91.XIcon, { size: 20 }) }),
|
|
27265
27379
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex-1", children: [
|
|
27266
27380
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Text_default, { size: "md", weight: "semibold", className: "text-text-900", children: selectedRoom.name }),
|
|
27267
27381
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Text_default, { size: "xs", className: "text-text-500", children: isConnected ? "Conectado" : "Conectando..." })
|
|
@@ -27290,7 +27404,7 @@ function ChatContent({
|
|
|
27290
27404
|
variant: "solid",
|
|
27291
27405
|
onClick: handleSendMessage,
|
|
27292
27406
|
disabled: !messageInput.trim() || !isConnected,
|
|
27293
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
27407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react91.PaperPlaneTiltIcon, { size: 20 })
|
|
27294
27408
|
}
|
|
27295
27409
|
)
|
|
27296
27410
|
] }) })
|
|
@@ -27415,7 +27529,7 @@ var CalendarActivityStatus = /* @__PURE__ */ ((CalendarActivityStatus2) => {
|
|
|
27415
27529
|
})(CalendarActivityStatus || {});
|
|
27416
27530
|
|
|
27417
27531
|
// src/hooks/useSendActivity.ts
|
|
27418
|
-
var
|
|
27532
|
+
var import_react92 = require("react");
|
|
27419
27533
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
27420
27534
|
function transformToCategoryConfig(data) {
|
|
27421
27535
|
return [
|
|
@@ -27470,21 +27584,21 @@ function useSendActivity(config) {
|
|
|
27470
27584
|
onSuccess,
|
|
27471
27585
|
onError
|
|
27472
27586
|
} = config;
|
|
27473
|
-
const [isOpen, setIsOpen] = (0,
|
|
27474
|
-
const [selectedModel, setSelectedModel] = (0,
|
|
27587
|
+
const [isOpen, setIsOpen] = (0, import_react92.useState)(false);
|
|
27588
|
+
const [selectedModel, setSelectedModel] = (0, import_react92.useState)(
|
|
27475
27589
|
null
|
|
27476
27590
|
);
|
|
27477
|
-
const [categories, setCategories] = (0,
|
|
27478
|
-
const [isLoading, setIsLoading] = (0,
|
|
27479
|
-
const [isCategoriesLoading, setIsCategoriesLoading] = (0,
|
|
27480
|
-
const categoriesLoadedRef = (0,
|
|
27481
|
-
const initialData = (0,
|
|
27591
|
+
const [categories, setCategories] = (0, import_react92.useState)([]);
|
|
27592
|
+
const [isLoading, setIsLoading] = (0, import_react92.useState)(false);
|
|
27593
|
+
const [isCategoriesLoading, setIsCategoriesLoading] = (0, import_react92.useState)(false);
|
|
27594
|
+
const categoriesLoadedRef = (0, import_react92.useRef)(false);
|
|
27595
|
+
const initialData = (0, import_react92.useMemo)(() => {
|
|
27482
27596
|
if (!selectedModel) return void 0;
|
|
27483
27597
|
return {
|
|
27484
27598
|
title: selectedModel.title
|
|
27485
27599
|
};
|
|
27486
27600
|
}, [selectedModel]);
|
|
27487
|
-
const loadCategories = (0,
|
|
27601
|
+
const loadCategories = (0, import_react92.useCallback)(async () => {
|
|
27488
27602
|
if (categoriesLoadedRef.current) return;
|
|
27489
27603
|
setIsCategoriesLoading(true);
|
|
27490
27604
|
try {
|
|
@@ -27499,7 +27613,7 @@ function useSendActivity(config) {
|
|
|
27499
27613
|
setIsCategoriesLoading(false);
|
|
27500
27614
|
}
|
|
27501
27615
|
}, [fetchCategories, onError]);
|
|
27502
|
-
const openModal = (0,
|
|
27616
|
+
const openModal = (0, import_react92.useCallback)(
|
|
27503
27617
|
(model) => {
|
|
27504
27618
|
setSelectedModel(model);
|
|
27505
27619
|
setIsOpen(true);
|
|
@@ -27507,17 +27621,17 @@ function useSendActivity(config) {
|
|
|
27507
27621
|
},
|
|
27508
27622
|
[loadCategories]
|
|
27509
27623
|
);
|
|
27510
|
-
const closeModal = (0,
|
|
27624
|
+
const closeModal = (0, import_react92.useCallback)(() => {
|
|
27511
27625
|
setIsOpen(false);
|
|
27512
27626
|
setSelectedModel(null);
|
|
27513
27627
|
}, []);
|
|
27514
|
-
const onCategoriesChange = (0,
|
|
27628
|
+
const onCategoriesChange = (0, import_react92.useCallback)(
|
|
27515
27629
|
(updatedCategories) => {
|
|
27516
27630
|
setCategories(updatedCategories);
|
|
27517
27631
|
},
|
|
27518
27632
|
[]
|
|
27519
27633
|
);
|
|
27520
|
-
const handleSubmit = (0,
|
|
27634
|
+
const handleSubmit = (0, import_react92.useCallback)(
|
|
27521
27635
|
async (data) => {
|
|
27522
27636
|
if (!selectedModel) return;
|
|
27523
27637
|
setIsLoading(true);
|
|
@@ -27828,6 +27942,7 @@ function useSendActivity(config) {
|
|
|
27828
27942
|
mapSubjectEnumToName,
|
|
27829
27943
|
mapSubjectNameToEnum,
|
|
27830
27944
|
questionTypeLabels,
|
|
27945
|
+
studentActivityStatusSchema,
|
|
27831
27946
|
supportSchema,
|
|
27832
27947
|
syncDropdownState,
|
|
27833
27948
|
toggleArrayItem,
|
|
@@ -27835,6 +27950,7 @@ function useSendActivity(config) {
|
|
|
27835
27950
|
transformActivityToTableItem,
|
|
27836
27951
|
transformGoalToTableItem,
|
|
27837
27952
|
transformModelToTableItem,
|
|
27953
|
+
useActivityDetails,
|
|
27838
27954
|
useAlertFormStore,
|
|
27839
27955
|
useApiConfig,
|
|
27840
27956
|
useAppContent,
|