analytica-frontend-lib 1.2.71 → 1.2.73
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 +175 -64
- package/dist/ActivityDetails/index.js.map +1 -1
- package/dist/ActivityDetails/index.mjs +142 -31
- 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 -417
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +390 -272
- 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;
|
|
@@ -21919,23 +22036,24 @@ var ActivityDetails = ({
|
|
|
21919
22036
|
},
|
|
21920
22037
|
[data?.students, activityId, fetchStudentCorrection]
|
|
21921
22038
|
);
|
|
21922
|
-
const handleCloseModal = (0,
|
|
22039
|
+
const handleCloseModal = (0, import_react65.useCallback)(() => {
|
|
21923
22040
|
setIsModalOpen(false);
|
|
21924
22041
|
}, []);
|
|
21925
|
-
const handleObservationSubmit = (0,
|
|
22042
|
+
const handleObservationSubmit = (0, import_react65.useCallback)(
|
|
21926
22043
|
async (studentId, observation, files) => {
|
|
21927
22044
|
if (!activityId || !studentId) return;
|
|
21928
22045
|
try {
|
|
21929
|
-
|
|
22046
|
+
const file = files.length > 0 ? files[0] : null;
|
|
22047
|
+
await submitObservation(activityId, studentId, observation, file);
|
|
21930
22048
|
} catch (err) {
|
|
21931
22049
|
console.error("Failed to submit observation:", err);
|
|
21932
22050
|
}
|
|
21933
22051
|
},
|
|
21934
22052
|
[activityId, submitObservation]
|
|
21935
22053
|
);
|
|
21936
|
-
const handleQuestionCorrectionSubmit = (0,
|
|
22054
|
+
const handleQuestionCorrectionSubmit = (0, import_react65.useCallback)(
|
|
21937
22055
|
async (studentId, payload) => {
|
|
21938
|
-
if (!activityId || !studentId
|
|
22056
|
+
if (!activityId || !studentId) return;
|
|
21939
22057
|
try {
|
|
21940
22058
|
await submitQuestionCorrection(activityId, studentId, payload);
|
|
21941
22059
|
} catch (err) {
|
|
@@ -21945,7 +22063,7 @@ var ActivityDetails = ({
|
|
|
21945
22063
|
},
|
|
21946
22064
|
[activityId, submitQuestionCorrection]
|
|
21947
22065
|
);
|
|
21948
|
-
const tableData = (0,
|
|
22066
|
+
const tableData = (0, import_react65.useMemo)(() => {
|
|
21949
22067
|
if (!data?.students) return [];
|
|
21950
22068
|
return data.students.map((student) => ({
|
|
21951
22069
|
id: student.studentId,
|
|
@@ -21957,7 +22075,7 @@ var ActivityDetails = ({
|
|
|
21957
22075
|
score: student.score
|
|
21958
22076
|
}));
|
|
21959
22077
|
}, [data?.students]);
|
|
21960
|
-
const columns = (0,
|
|
22078
|
+
const columns = (0, import_react65.useMemo)(
|
|
21961
22079
|
() => createTableColumns(handleCorrectActivity),
|
|
21962
22080
|
[handleCorrectActivity]
|
|
21963
22081
|
);
|
|
@@ -22215,17 +22333,17 @@ var ActivityDetails = ({
|
|
|
22215
22333
|
};
|
|
22216
22334
|
|
|
22217
22335
|
// src/components/Support/Support.tsx
|
|
22218
|
-
var
|
|
22336
|
+
var import_react68 = require("react");
|
|
22219
22337
|
var import_react_hook_form = require("react-hook-form");
|
|
22220
|
-
var
|
|
22221
|
-
var
|
|
22338
|
+
var import_zod3 = require("@hookform/resolvers/zod");
|
|
22339
|
+
var import_react69 = require("@phosphor-icons/react");
|
|
22222
22340
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
22223
22341
|
|
|
22224
22342
|
// src/components/Support/schema/index.ts
|
|
22225
|
-
var
|
|
22226
|
-
var supportSchema =
|
|
22343
|
+
var import_zod2 = require("zod");
|
|
22344
|
+
var supportSchema = import_zod2.z.object({
|
|
22227
22345
|
// Tipo de problema selecionado
|
|
22228
|
-
problemType:
|
|
22346
|
+
problemType: import_zod2.z.enum(["tecnico", "acesso", "outros"], {
|
|
22229
22347
|
// istanbul ignore next - errorMap é testado em runtime pelo zod real
|
|
22230
22348
|
errorMap: (
|
|
22231
22349
|
/* istanbul ignore next */
|
|
@@ -22235,13 +22353,13 @@ var supportSchema = import_zod.z.object({
|
|
|
22235
22353
|
)
|
|
22236
22354
|
}),
|
|
22237
22355
|
// Título do problema
|
|
22238
|
-
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(),
|
|
22239
22357
|
// Descrição do problema
|
|
22240
|
-
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()
|
|
22241
22359
|
});
|
|
22242
22360
|
|
|
22243
22361
|
// src/components/Support/components/TicketModal.tsx
|
|
22244
|
-
var
|
|
22362
|
+
var import_react67 = require("react");
|
|
22245
22363
|
var import_dayjs = __toESM(require("dayjs"));
|
|
22246
22364
|
var import_pt_br = require("dayjs/locale/pt-br");
|
|
22247
22365
|
|
|
@@ -22321,19 +22439,19 @@ var mapInternalStatusToApi = (internalStatus) => {
|
|
|
22321
22439
|
};
|
|
22322
22440
|
|
|
22323
22441
|
// src/components/Support/utils/supportUtils.tsx
|
|
22324
|
-
var
|
|
22442
|
+
var import_react66 = require("@phosphor-icons/react");
|
|
22325
22443
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
22326
22444
|
var getCategoryIcon = (category, size = 16) => {
|
|
22327
22445
|
if (!category) return null;
|
|
22328
22446
|
switch (category) {
|
|
22329
22447
|
case "acesso" /* ACESSO */:
|
|
22330
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.KeyIcon, { size });
|
|
22331
22449
|
case "tecnico" /* TECNICO */:
|
|
22332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.BugIcon, { size });
|
|
22333
22451
|
case "outros" /* OUTROS */:
|
|
22334
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.InfoIcon, { size });
|
|
22335
22453
|
default:
|
|
22336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
22454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react66.InfoIcon, { size });
|
|
22337
22455
|
}
|
|
22338
22456
|
};
|
|
22339
22457
|
|
|
@@ -22363,17 +22481,17 @@ var TicketModal = ({
|
|
|
22363
22481
|
apiClient,
|
|
22364
22482
|
userId
|
|
22365
22483
|
}) => {
|
|
22366
|
-
const [showCloseConfirmation, setShowCloseConfirmation] = (0,
|
|
22367
|
-
const [responseText, setResponseText] = (0,
|
|
22368
|
-
const [answers, setAnswers] = (0,
|
|
22369
|
-
const [isSubmittingAnswer, setIsSubmittingAnswer] = (0,
|
|
22370
|
-
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);
|
|
22371
22489
|
const handleCloseTicket = () => {
|
|
22372
22490
|
onTicketClose?.(ticket.id);
|
|
22373
22491
|
setShowCloseConfirmation(false);
|
|
22374
22492
|
onClose();
|
|
22375
22493
|
};
|
|
22376
|
-
const fetchAnswers = (0,
|
|
22494
|
+
const fetchAnswers = (0, import_react67.useCallback)(async () => {
|
|
22377
22495
|
if (!ticket.id || ticket.status !== "respondido" /* RESPONDIDO */) return;
|
|
22378
22496
|
setIsLoadingAnswers(true);
|
|
22379
22497
|
try {
|
|
@@ -22412,7 +22530,7 @@ var TicketModal = ({
|
|
|
22412
22530
|
}
|
|
22413
22531
|
};
|
|
22414
22532
|
const canCloseTicket = ticket.status !== "encerrado" /* ENCERRADO */;
|
|
22415
|
-
(0,
|
|
22533
|
+
(0, import_react67.useEffect)(() => {
|
|
22416
22534
|
if (isOpen) {
|
|
22417
22535
|
setResponseText("");
|
|
22418
22536
|
(async () => {
|
|
@@ -22750,7 +22868,7 @@ var TicketCard = ({
|
|
|
22750
22868
|
getCategoryIcon(ticket.category, 18),
|
|
22751
22869
|
getCategoryText(ticket.category)
|
|
22752
22870
|
] }),
|
|
22753
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
22871
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.CaretRightIcon, { size: 24, className: "text-text-800" })
|
|
22754
22872
|
] })
|
|
22755
22873
|
]
|
|
22756
22874
|
},
|
|
@@ -22795,21 +22913,21 @@ var Support = ({
|
|
|
22795
22913
|
onTicketCreated,
|
|
22796
22914
|
onTicketClosed
|
|
22797
22915
|
}) => {
|
|
22798
|
-
const [activeTab, setActiveTab] = (0,
|
|
22799
|
-
const [selectedProblem, setSelectedProblem] = (0,
|
|
22800
|
-
const [statusFilter, setStatusFilter] = (0,
|
|
22801
|
-
const [categoryFilter, setCategoryFilter] = (0,
|
|
22802
|
-
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)(
|
|
22803
22921
|
null
|
|
22804
22922
|
);
|
|
22805
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
22806
|
-
const [submitError, setSubmitError] = (0,
|
|
22807
|
-
const [showSuccessToast, setShowSuccessToast] = (0,
|
|
22808
|
-
const [showCloseSuccessToast, setShowCloseSuccessToast] = (0,
|
|
22809
|
-
const [showCloseErrorToast, setShowCloseErrorToast] = (0,
|
|
22810
|
-
const [allTickets, setAllTickets] = (0,
|
|
22811
|
-
const [loadingTickets, setLoadingTickets] = (0,
|
|
22812
|
-
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);
|
|
22813
22931
|
const ITEMS_PER_PAGE = 10;
|
|
22814
22932
|
const handlePrevPage = () => {
|
|
22815
22933
|
if (currentPage > 1) {
|
|
@@ -22822,13 +22940,13 @@ var Support = ({
|
|
|
22822
22940
|
setCurrentPage(currentPage + 1);
|
|
22823
22941
|
}
|
|
22824
22942
|
};
|
|
22825
|
-
(0,
|
|
22943
|
+
(0, import_react68.useEffect)(() => {
|
|
22826
22944
|
if (activeTab === "historico") {
|
|
22827
22945
|
fetchTickets(statusFilter);
|
|
22828
22946
|
setCurrentPage(1);
|
|
22829
22947
|
}
|
|
22830
22948
|
}, [activeTab, statusFilter]);
|
|
22831
|
-
(0,
|
|
22949
|
+
(0, import_react68.useEffect)(() => {
|
|
22832
22950
|
setCurrentPage(1);
|
|
22833
22951
|
}, [categoryFilter]);
|
|
22834
22952
|
const convertApiTicketToComponent = (apiTicket) => {
|
|
@@ -22869,7 +22987,7 @@ var Support = ({
|
|
|
22869
22987
|
reset,
|
|
22870
22988
|
formState: { errors, isSubmitting }
|
|
22871
22989
|
} = (0, import_react_hook_form.useForm)({
|
|
22872
|
-
resolver: (0,
|
|
22990
|
+
resolver: (0, import_zod3.zodResolver)(supportSchema),
|
|
22873
22991
|
defaultValues: {
|
|
22874
22992
|
problemType: void 0,
|
|
22875
22993
|
title: "",
|
|
@@ -22958,17 +23076,17 @@ var Support = ({
|
|
|
22958
23076
|
{
|
|
22959
23077
|
id: "tecnico" /* TECNICO */,
|
|
22960
23078
|
title: "T\xE9cnico",
|
|
22961
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23079
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.BugIcon, { size: 24 })
|
|
22962
23080
|
},
|
|
22963
23081
|
{
|
|
22964
23082
|
id: "acesso" /* ACESSO */,
|
|
22965
23083
|
title: "Acesso",
|
|
22966
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23084
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.KeyIcon, { size: 24 })
|
|
22967
23085
|
},
|
|
22968
23086
|
{
|
|
22969
23087
|
id: "outros" /* OUTROS */,
|
|
22970
23088
|
title: "Outros",
|
|
22971
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23089
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.InfoIcon, { size: 24 })
|
|
22972
23090
|
}
|
|
22973
23091
|
];
|
|
22974
23092
|
const emptyImage = emptyStateImage || suporthistory_default;
|
|
@@ -23088,15 +23206,15 @@ var Support = ({
|
|
|
23088
23206
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectContent, { children: [
|
|
23089
23207
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(SelectItem, { value: "todos", children: "Todos" }),
|
|
23090
23208
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectItem, { value: "tecnico" /* TECNICO */, children: [
|
|
23091
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23209
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.BugIcon, { size: 16 }),
|
|
23092
23210
|
" T\xE9cnico"
|
|
23093
23211
|
] }),
|
|
23094
23212
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectItem, { value: "acesso" /* ACESSO */, children: [
|
|
23095
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23213
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.KeyIcon, { size: 16 }),
|
|
23096
23214
|
" Acesso"
|
|
23097
23215
|
] }),
|
|
23098
23216
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(SelectItem, { value: "outros" /* OUTROS */, children: [
|
|
23099
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
23217
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.InfoIcon, { size: 16 }),
|
|
23100
23218
|
" Outros"
|
|
23101
23219
|
] })
|
|
23102
23220
|
] })
|
|
@@ -23197,14 +23315,14 @@ var Support = ({
|
|
|
23197
23315
|
var Support_default = Support;
|
|
23198
23316
|
|
|
23199
23317
|
// src/components/SendActivityModal/SendActivityModal.tsx
|
|
23200
|
-
var
|
|
23201
|
-
var
|
|
23318
|
+
var import_react70 = require("react");
|
|
23319
|
+
var import_react71 = require("@phosphor-icons/react");
|
|
23202
23320
|
|
|
23203
23321
|
// src/components/SendActivityModal/hooks/useSendActivityModal.ts
|
|
23204
23322
|
var import_zustand16 = require("zustand");
|
|
23205
23323
|
|
|
23206
23324
|
// src/components/SendActivityModal/validation.ts
|
|
23207
|
-
var
|
|
23325
|
+
var import_zod4 = require("zod");
|
|
23208
23326
|
var ERROR_MESSAGES = {
|
|
23209
23327
|
SUBTYPE_REQUIRED: "Campo obrigat\xF3rio! Por favor, selecione uma op\xE7\xE3o para continuar.",
|
|
23210
23328
|
TITLE_REQUIRED: "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.",
|
|
@@ -23213,20 +23331,20 @@ var ERROR_MESSAGES = {
|
|
|
23213
23331
|
FINAL_DATE_REQUIRED: "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.",
|
|
23214
23332
|
FINAL_DATE_INVALID: "A data final deve ser maior ou igual \xE0 data inicial."
|
|
23215
23333
|
};
|
|
23216
|
-
var activityStepSchema =
|
|
23217
|
-
subtype:
|
|
23334
|
+
var activityStepSchema = import_zod4.z.object({
|
|
23335
|
+
subtype: import_zod4.z.enum(["TAREFA", "TRABALHO", "PROVA"], {
|
|
23218
23336
|
errorMap: () => ({ message: ERROR_MESSAGES.SUBTYPE_REQUIRED })
|
|
23219
23337
|
}),
|
|
23220
|
-
title:
|
|
23338
|
+
title: import_zod4.z.string({ required_error: ERROR_MESSAGES.TITLE_REQUIRED }).transform((val) => val.trim()).refine((val) => val.length > 0, {
|
|
23221
23339
|
message: ERROR_MESSAGES.TITLE_REQUIRED
|
|
23222
23340
|
}),
|
|
23223
|
-
notification:
|
|
23341
|
+
notification: import_zod4.z.string().optional()
|
|
23224
23342
|
});
|
|
23225
|
-
var recipientStepSchema =
|
|
23226
|
-
students:
|
|
23227
|
-
|
|
23228
|
-
studentId:
|
|
23229
|
-
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()
|
|
23230
23348
|
}),
|
|
23231
23349
|
{
|
|
23232
23350
|
required_error: ERROR_MESSAGES.STUDENTS_REQUIRED,
|
|
@@ -23236,18 +23354,18 @@ var recipientStepSchema = import_zod3.z.object({
|
|
|
23236
23354
|
});
|
|
23237
23355
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
23238
23356
|
var TIME_REGEX = /^\d{2}:\d{2}$/;
|
|
23239
|
-
var deadlineStepBaseSchema =
|
|
23240
|
-
startDate:
|
|
23357
|
+
var deadlineStepBaseSchema = import_zod4.z.object({
|
|
23358
|
+
startDate: import_zod4.z.string({
|
|
23241
23359
|
required_error: ERROR_MESSAGES.START_DATE_REQUIRED,
|
|
23242
23360
|
invalid_type_error: ERROR_MESSAGES.START_DATE_REQUIRED
|
|
23243
23361
|
}).min(1, ERROR_MESSAGES.START_DATE_REQUIRED).regex(DATE_REGEX, ERROR_MESSAGES.START_DATE_REQUIRED),
|
|
23244
|
-
startTime:
|
|
23245
|
-
finalDate:
|
|
23362
|
+
startTime: import_zod4.z.string().regex(TIME_REGEX).default("00:00"),
|
|
23363
|
+
finalDate: import_zod4.z.string({
|
|
23246
23364
|
required_error: ERROR_MESSAGES.FINAL_DATE_REQUIRED,
|
|
23247
23365
|
invalid_type_error: ERROR_MESSAGES.FINAL_DATE_REQUIRED
|
|
23248
23366
|
}).min(1, ERROR_MESSAGES.FINAL_DATE_REQUIRED).regex(DATE_REGEX, ERROR_MESSAGES.FINAL_DATE_REQUIRED),
|
|
23249
|
-
finalTime:
|
|
23250
|
-
canRetry:
|
|
23367
|
+
finalTime: import_zod4.z.string().regex(TIME_REGEX).default("23:59"),
|
|
23368
|
+
canRetry: import_zod4.z.boolean().default(false)
|
|
23251
23369
|
});
|
|
23252
23370
|
var deadlineStepSchema = deadlineStepBaseSchema.refine(
|
|
23253
23371
|
(data) => {
|
|
@@ -23490,17 +23608,17 @@ var SendActivityModal = ({
|
|
|
23490
23608
|
const storeCategories = useSendActivityModalStore(
|
|
23491
23609
|
(state) => state.categories
|
|
23492
23610
|
);
|
|
23493
|
-
const categoriesInitialized = (0,
|
|
23494
|
-
const prevInitialDataRef = (0,
|
|
23611
|
+
const categoriesInitialized = (0, import_react70.useRef)(false);
|
|
23612
|
+
const prevInitialDataRef = (0, import_react70.useRef)(
|
|
23495
23613
|
void 0
|
|
23496
23614
|
);
|
|
23497
|
-
(0,
|
|
23615
|
+
(0, import_react70.useEffect)(() => {
|
|
23498
23616
|
if (isOpen && initialCategories.length > 0 && !categoriesInitialized.current) {
|
|
23499
23617
|
setCategories(initialCategories);
|
|
23500
23618
|
categoriesInitialized.current = true;
|
|
23501
23619
|
}
|
|
23502
23620
|
}, [isOpen, initialCategories, setCategories]);
|
|
23503
|
-
(0,
|
|
23621
|
+
(0, import_react70.useEffect)(() => {
|
|
23504
23622
|
if (isOpen && initialData && prevInitialDataRef.current !== initialData) {
|
|
23505
23623
|
store.setFormData({
|
|
23506
23624
|
title: initialData.title ?? "",
|
|
@@ -23510,69 +23628,69 @@ var SendActivityModal = ({
|
|
|
23510
23628
|
prevInitialDataRef.current = initialData;
|
|
23511
23629
|
}
|
|
23512
23630
|
}, [isOpen, initialData, store]);
|
|
23513
|
-
(0,
|
|
23631
|
+
(0, import_react70.useEffect)(() => {
|
|
23514
23632
|
if (!isOpen) {
|
|
23515
23633
|
reset();
|
|
23516
23634
|
categoriesInitialized.current = false;
|
|
23517
23635
|
prevInitialDataRef.current = void 0;
|
|
23518
23636
|
}
|
|
23519
23637
|
}, [isOpen, reset]);
|
|
23520
|
-
const handleCategoriesChange = (0,
|
|
23638
|
+
const handleCategoriesChange = (0, import_react70.useCallback)(
|
|
23521
23639
|
(updatedCategories) => {
|
|
23522
23640
|
setCategories(updatedCategories);
|
|
23523
23641
|
onCategoriesChange?.(updatedCategories);
|
|
23524
23642
|
},
|
|
23525
23643
|
[setCategories, onCategoriesChange]
|
|
23526
23644
|
);
|
|
23527
|
-
const handleActivityTypeSelect = (0,
|
|
23645
|
+
const handleActivityTypeSelect = (0, import_react70.useCallback)(
|
|
23528
23646
|
(subtype) => {
|
|
23529
23647
|
store.setFormData({ subtype });
|
|
23530
23648
|
},
|
|
23531
23649
|
[store]
|
|
23532
23650
|
);
|
|
23533
|
-
const handleTitleChange = (0,
|
|
23651
|
+
const handleTitleChange = (0, import_react70.useCallback)(
|
|
23534
23652
|
(e) => {
|
|
23535
23653
|
store.setFormData({ title: e.target.value });
|
|
23536
23654
|
},
|
|
23537
23655
|
[store]
|
|
23538
23656
|
);
|
|
23539
|
-
const handleNotificationChange = (0,
|
|
23657
|
+
const handleNotificationChange = (0, import_react70.useCallback)(
|
|
23540
23658
|
(e) => {
|
|
23541
23659
|
store.setFormData({ notification: e.target.value });
|
|
23542
23660
|
},
|
|
23543
23661
|
[store]
|
|
23544
23662
|
);
|
|
23545
|
-
const handleStartDateChange = (0,
|
|
23663
|
+
const handleStartDateChange = (0, import_react70.useCallback)(
|
|
23546
23664
|
(date) => {
|
|
23547
23665
|
store.setFormData({ startDate: date });
|
|
23548
23666
|
},
|
|
23549
23667
|
[store]
|
|
23550
23668
|
);
|
|
23551
|
-
const handleStartTimeChange = (0,
|
|
23669
|
+
const handleStartTimeChange = (0, import_react70.useCallback)(
|
|
23552
23670
|
(time) => {
|
|
23553
23671
|
store.setFormData({ startTime: time });
|
|
23554
23672
|
},
|
|
23555
23673
|
[store]
|
|
23556
23674
|
);
|
|
23557
|
-
const handleFinalDateChange = (0,
|
|
23675
|
+
const handleFinalDateChange = (0, import_react70.useCallback)(
|
|
23558
23676
|
(date) => {
|
|
23559
23677
|
store.setFormData({ finalDate: date });
|
|
23560
23678
|
},
|
|
23561
23679
|
[store]
|
|
23562
23680
|
);
|
|
23563
|
-
const handleFinalTimeChange = (0,
|
|
23681
|
+
const handleFinalTimeChange = (0, import_react70.useCallback)(
|
|
23564
23682
|
(time) => {
|
|
23565
23683
|
store.setFormData({ finalTime: time });
|
|
23566
23684
|
},
|
|
23567
23685
|
[store]
|
|
23568
23686
|
);
|
|
23569
|
-
const handleRetryChange = (0,
|
|
23687
|
+
const handleRetryChange = (0, import_react70.useCallback)(
|
|
23570
23688
|
(value) => {
|
|
23571
23689
|
store.setFormData({ canRetry: value === "yes" });
|
|
23572
23690
|
},
|
|
23573
23691
|
[store]
|
|
23574
23692
|
);
|
|
23575
|
-
const handleSubmit = (0,
|
|
23693
|
+
const handleSubmit = (0, import_react70.useCallback)(async () => {
|
|
23576
23694
|
const isValid = store.validateAllSteps();
|
|
23577
23695
|
if (!isValid) return;
|
|
23578
23696
|
try {
|
|
@@ -23586,7 +23704,7 @@ var SendActivityModal = ({
|
|
|
23586
23704
|
}
|
|
23587
23705
|
}
|
|
23588
23706
|
}, [store, onSubmit, onError]);
|
|
23589
|
-
const handleCancel = (0,
|
|
23707
|
+
const handleCancel = (0, import_react70.useCallback)(() => {
|
|
23590
23708
|
onClose();
|
|
23591
23709
|
}, [onClose]);
|
|
23592
23710
|
const renderError = (error) => {
|
|
@@ -23599,7 +23717,7 @@ var SendActivityModal = ({
|
|
|
23599
23717
|
color: "text-error-600",
|
|
23600
23718
|
className: "flex items-center gap-1 mt-1",
|
|
23601
23719
|
children: [
|
|
23602
|
-
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23720
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.WarningCircleIcon, { size: 16 }),
|
|
23603
23721
|
error
|
|
23604
23722
|
]
|
|
23605
23723
|
}
|
|
@@ -23769,7 +23887,7 @@ var SendActivityModal = ({
|
|
|
23769
23887
|
variant: "outline",
|
|
23770
23888
|
action: "primary",
|
|
23771
23889
|
onClick: store.previousStep,
|
|
23772
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23890
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.CaretLeftIcon, { size: 16 }),
|
|
23773
23891
|
className: "w-full sm:w-auto",
|
|
23774
23892
|
children: "Anterior"
|
|
23775
23893
|
}
|
|
@@ -23780,7 +23898,7 @@ var SendActivityModal = ({
|
|
|
23780
23898
|
variant: "solid",
|
|
23781
23899
|
action: "primary",
|
|
23782
23900
|
onClick: () => store.nextStep(),
|
|
23783
|
-
iconRight: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23901
|
+
iconRight: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.ArrowRightIcon, { size: 16 }),
|
|
23784
23902
|
className: "w-full sm:w-auto",
|
|
23785
23903
|
children: "Pr\xF3ximo"
|
|
23786
23904
|
}
|
|
@@ -23791,7 +23909,7 @@ var SendActivityModal = ({
|
|
|
23791
23909
|
action: "primary",
|
|
23792
23910
|
onClick: handleSubmit,
|
|
23793
23911
|
disabled: isLoading,
|
|
23794
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
23912
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react71.PaperPlaneTiltIcon, { size: 16 }),
|
|
23795
23913
|
className: "w-full sm:w-auto",
|
|
23796
23914
|
children: isLoading ? "Enviando..." : "Enviar atividade"
|
|
23797
23915
|
}
|
|
@@ -23824,7 +23942,7 @@ var SendActivityModal = ({
|
|
|
23824
23942
|
var SendActivityModal_default = SendActivityModal;
|
|
23825
23943
|
|
|
23826
23944
|
// src/components/RecommendedLessonsHistory/RecommendedLessonsHistory.tsx
|
|
23827
|
-
var
|
|
23945
|
+
var import_react73 = require("react");
|
|
23828
23946
|
var import_phosphor_react45 = require("phosphor-react");
|
|
23829
23947
|
|
|
23830
23948
|
// src/types/common.ts
|
|
@@ -23911,51 +24029,51 @@ var formatDaysToComplete = (daysToComplete) => {
|
|
|
23911
24029
|
};
|
|
23912
24030
|
|
|
23913
24031
|
// src/hooks/useRecommendedLessons.ts
|
|
23914
|
-
var
|
|
23915
|
-
var
|
|
24032
|
+
var import_react72 = require("react");
|
|
24033
|
+
var import_zod5 = require("zod");
|
|
23916
24034
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
23917
|
-
var goalSubjectSchema =
|
|
23918
|
-
id:
|
|
23919
|
-
name:
|
|
24035
|
+
var goalSubjectSchema = import_zod5.z.object({
|
|
24036
|
+
id: import_zod5.z.string().uuid(),
|
|
24037
|
+
name: import_zod5.z.string()
|
|
23920
24038
|
}).nullable();
|
|
23921
|
-
var goalCreatorSchema =
|
|
23922
|
-
id:
|
|
23923
|
-
name:
|
|
24039
|
+
var goalCreatorSchema = import_zod5.z.object({
|
|
24040
|
+
id: import_zod5.z.string().uuid(),
|
|
24041
|
+
name: import_zod5.z.string()
|
|
23924
24042
|
}).nullable();
|
|
23925
|
-
var goalStatsSchema =
|
|
23926
|
-
totalStudents:
|
|
23927
|
-
completedCount:
|
|
23928
|
-
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()
|
|
23929
24047
|
});
|
|
23930
|
-
var goalBreakdownSchema =
|
|
23931
|
-
classId:
|
|
23932
|
-
className:
|
|
23933
|
-
schoolId:
|
|
23934
|
-
schoolName:
|
|
23935
|
-
studentCount:
|
|
23936
|
-
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()
|
|
23937
24055
|
});
|
|
23938
|
-
var goalDataSchema =
|
|
23939
|
-
id:
|
|
23940
|
-
title:
|
|
23941
|
-
startDate:
|
|
23942
|
-
finalDate:
|
|
23943
|
-
createdAt:
|
|
23944
|
-
progress:
|
|
23945
|
-
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()
|
|
23946
24064
|
});
|
|
23947
|
-
var goalHistoryItemSchema =
|
|
24065
|
+
var goalHistoryItemSchema = import_zod5.z.object({
|
|
23948
24066
|
goal: goalDataSchema,
|
|
23949
24067
|
subject: goalSubjectSchema,
|
|
23950
24068
|
creator: goalCreatorSchema,
|
|
23951
24069
|
stats: goalStatsSchema,
|
|
23952
|
-
breakdown:
|
|
24070
|
+
breakdown: import_zod5.z.array(goalBreakdownSchema)
|
|
23953
24071
|
});
|
|
23954
|
-
var goalsHistoryApiResponseSchema =
|
|
23955
|
-
message:
|
|
23956
|
-
data:
|
|
23957
|
-
goals:
|
|
23958
|
-
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()
|
|
23959
24077
|
})
|
|
23960
24078
|
});
|
|
23961
24079
|
var determineGoalStatus = (finalDate, completionPercentage) => {
|
|
@@ -23994,7 +24112,7 @@ var transformGoalToTableItem = (item) => {
|
|
|
23994
24112
|
};
|
|
23995
24113
|
};
|
|
23996
24114
|
var handleGoalFetchError = (error) => {
|
|
23997
|
-
if (error instanceof
|
|
24115
|
+
if (error instanceof import_zod5.z.ZodError) {
|
|
23998
24116
|
console.error("Erro ao validar dados de hist\xF3rico de aulas:", error);
|
|
23999
24117
|
return "Erro ao validar dados de hist\xF3rico de aulas";
|
|
24000
24118
|
}
|
|
@@ -24003,7 +24121,7 @@ var handleGoalFetchError = (error) => {
|
|
|
24003
24121
|
};
|
|
24004
24122
|
var createUseRecommendedLessonsHistory = (fetchGoalsHistory) => {
|
|
24005
24123
|
return () => {
|
|
24006
|
-
const [state, setState] = (0,
|
|
24124
|
+
const [state, setState] = (0, import_react72.useState)({
|
|
24007
24125
|
goals: [],
|
|
24008
24126
|
loading: false,
|
|
24009
24127
|
error: null,
|
|
@@ -24014,7 +24132,7 @@ var createUseRecommendedLessonsHistory = (fetchGoalsHistory) => {
|
|
|
24014
24132
|
totalPages: 0
|
|
24015
24133
|
}
|
|
24016
24134
|
});
|
|
24017
|
-
const fetchGoals = (0,
|
|
24135
|
+
const fetchGoals = (0, import_react72.useCallback)(
|
|
24018
24136
|
async (filters) => {
|
|
24019
24137
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24020
24138
|
try {
|
|
@@ -24362,10 +24480,10 @@ var RecommendedLessonsHistory = ({
|
|
|
24362
24480
|
createButtonText = "Criar aula",
|
|
24363
24481
|
searchPlaceholder = "Buscar aula"
|
|
24364
24482
|
}) => {
|
|
24365
|
-
const [activeTab, setActiveTab] = (0,
|
|
24366
|
-
const fetchGoalsHistoryRef = (0,
|
|
24483
|
+
const [activeTab, setActiveTab] = (0, import_react73.useState)("history" /* HISTORY */);
|
|
24484
|
+
const fetchGoalsHistoryRef = (0, import_react73.useRef)(fetchGoalsHistory);
|
|
24367
24485
|
fetchGoalsHistoryRef.current = fetchGoalsHistory;
|
|
24368
|
-
const useGoalsHistory = (0,
|
|
24486
|
+
const useGoalsHistory = (0, import_react73.useMemo)(
|
|
24369
24487
|
() => createUseRecommendedLessonsHistory(
|
|
24370
24488
|
(filters) => fetchGoalsHistoryRef.current(filters)
|
|
24371
24489
|
),
|
|
@@ -24378,15 +24496,15 @@ var RecommendedLessonsHistory = ({
|
|
|
24378
24496
|
pagination,
|
|
24379
24497
|
fetchGoals
|
|
24380
24498
|
} = useGoalsHistory();
|
|
24381
|
-
const initialFilterConfigs = (0,
|
|
24499
|
+
const initialFilterConfigs = (0, import_react73.useMemo)(
|
|
24382
24500
|
() => createGoalFiltersConfig(userFilterData),
|
|
24383
24501
|
[userFilterData]
|
|
24384
24502
|
);
|
|
24385
|
-
const tableColumns = (0,
|
|
24503
|
+
const tableColumns = (0, import_react73.useMemo)(
|
|
24386
24504
|
() => createTableColumns2(mapSubjectNameToEnum2, onDeleteGoal, onEditGoal),
|
|
24387
24505
|
[mapSubjectNameToEnum2, onDeleteGoal, onEditGoal]
|
|
24388
24506
|
);
|
|
24389
|
-
const handleParamsChange = (0,
|
|
24507
|
+
const handleParamsChange = (0, import_react73.useCallback)(
|
|
24390
24508
|
(params) => {
|
|
24391
24509
|
const filters = buildFiltersFromParams(params);
|
|
24392
24510
|
fetchGoals(filters);
|
|
@@ -24542,10 +24660,10 @@ var RecommendedLessonsHistory = ({
|
|
|
24542
24660
|
};
|
|
24543
24661
|
|
|
24544
24662
|
// src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
|
|
24545
|
-
var
|
|
24663
|
+
var import_react81 = require("react");
|
|
24546
24664
|
|
|
24547
24665
|
// src/components/RecommendedLessonDetails/components/Breadcrumb.tsx
|
|
24548
|
-
var
|
|
24666
|
+
var import_react74 = require("@phosphor-icons/react");
|
|
24549
24667
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
24550
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)(
|
|
24551
24669
|
Text_default,
|
|
@@ -24553,7 +24671,7 @@ var Breadcrumb = ({ items, onItemClick }) => /* @__PURE__ */ (0, import_jsx_runt
|
|
|
24553
24671
|
as: "span",
|
|
24554
24672
|
className: "flex items-center gap-2",
|
|
24555
24673
|
children: [
|
|
24556
|
-
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" }),
|
|
24557
24675
|
item.path ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
24558
24676
|
"button",
|
|
24559
24677
|
{
|
|
@@ -24569,7 +24687,7 @@ var Breadcrumb = ({ items, onItemClick }) => /* @__PURE__ */ (0, import_jsx_runt
|
|
|
24569
24687
|
)) });
|
|
24570
24688
|
|
|
24571
24689
|
// src/components/RecommendedLessonDetails/components/LessonHeader.tsx
|
|
24572
|
-
var
|
|
24690
|
+
var import_react75 = require("@phosphor-icons/react");
|
|
24573
24691
|
|
|
24574
24692
|
// src/components/RecommendedLessonDetails/utils/lessonDetailsUtils.ts
|
|
24575
24693
|
var formatDate = (dateString) => {
|
|
@@ -24657,7 +24775,7 @@ var LessonHeader = ({
|
|
|
24657
24775
|
variant: "solid",
|
|
24658
24776
|
action: "primary",
|
|
24659
24777
|
size: "small",
|
|
24660
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
24778
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react75.BookBookmarkIcon, { size: 16 }),
|
|
24661
24779
|
onClick: onViewLesson,
|
|
24662
24780
|
children: viewLessonLabel
|
|
24663
24781
|
}
|
|
@@ -24685,7 +24803,7 @@ var LoadingSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div"
|
|
|
24685
24803
|
] });
|
|
24686
24804
|
|
|
24687
24805
|
// src/components/RecommendedLessonDetails/components/ResultsSection.tsx
|
|
24688
|
-
var
|
|
24806
|
+
var import_react76 = require("@phosphor-icons/react");
|
|
24689
24807
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
24690
24808
|
var ResultsSection = ({ data, labels }) => {
|
|
24691
24809
|
const { details } = data;
|
|
@@ -24709,7 +24827,7 @@ var ResultsSection = ({ data, labels }) => {
|
|
|
24709
24827
|
{
|
|
24710
24828
|
as: "span",
|
|
24711
24829
|
className: "size-8 rounded-full flex items-center justify-center bg-warning-300 mb-2",
|
|
24712
|
-
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" })
|
|
24713
24831
|
}
|
|
24714
24832
|
),
|
|
24715
24833
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -24737,7 +24855,7 @@ var ResultsSection = ({ data, labels }) => {
|
|
|
24737
24855
|
{
|
|
24738
24856
|
as: "span",
|
|
24739
24857
|
className: "size-8 rounded-full flex items-center justify-center bg-error-300 mb-2",
|
|
24740
|
-
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" })
|
|
24741
24859
|
}
|
|
24742
24860
|
),
|
|
24743
24861
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -24764,8 +24882,8 @@ var ResultsSection = ({ data, labels }) => {
|
|
|
24764
24882
|
};
|
|
24765
24883
|
|
|
24766
24884
|
// src/components/RecommendedLessonDetails/components/StudentsTable.tsx
|
|
24767
|
-
var
|
|
24768
|
-
var
|
|
24885
|
+
var import_react77 = require("react");
|
|
24886
|
+
var import_react78 = require("@phosphor-icons/react");
|
|
24769
24887
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
24770
24888
|
var StudentsTable = ({
|
|
24771
24889
|
students,
|
|
@@ -24774,7 +24892,7 @@ var StudentsTable = ({
|
|
|
24774
24892
|
emptyMessage = "Nenhum aluno encontrado"
|
|
24775
24893
|
}) => {
|
|
24776
24894
|
const { sortedData, sortColumn, sortDirection, handleSort } = useTableSort(students);
|
|
24777
|
-
const canViewPerformance = (0,
|
|
24895
|
+
const canViewPerformance = (0, import_react77.useCallback)((student) => {
|
|
24778
24896
|
return student.status === "CONCLU\xCDDO" /* CONCLUIDO */ || student.status === "N\xC3O FINALIZADO" /* NAO_FINALIZADO */;
|
|
24779
24897
|
}, []);
|
|
24780
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: [
|
|
@@ -24816,7 +24934,7 @@ var StudentsTable = ({
|
|
|
24816
24934
|
{
|
|
24817
24935
|
as: "span",
|
|
24818
24936
|
className: "size-8 rounded-full bg-background-100 flex items-center justify-center",
|
|
24819
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
24937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_react78.UserIcon, { size: 16, className: "text-text-500" })
|
|
24820
24938
|
}
|
|
24821
24939
|
),
|
|
24822
24940
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text_default, { size: "sm", className: "text-text-950", children: student.name })
|
|
@@ -24860,8 +24978,8 @@ var StudentsTable = ({
|
|
|
24860
24978
|
};
|
|
24861
24979
|
|
|
24862
24980
|
// src/components/RecommendedLessonDetails/components/StudentPerformanceModal.tsx
|
|
24863
|
-
var
|
|
24864
|
-
var
|
|
24981
|
+
var import_react79 = require("react");
|
|
24982
|
+
var import_react80 = require("@phosphor-icons/react");
|
|
24865
24983
|
|
|
24866
24984
|
// src/components/RecommendedLessonDetails/types.ts
|
|
24867
24985
|
var DEFAULT_LABELS = {
|
|
@@ -24993,7 +25111,7 @@ var QuestionAccordionItem = ({
|
|
|
24993
25111
|
size: "small",
|
|
24994
25112
|
action: question.isCorrect ? "success" : "error",
|
|
24995
25113
|
variant: "solid",
|
|
24996
|
-
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, {}),
|
|
24997
25115
|
children: question.isCorrect ? "Correta" : "Incorreta"
|
|
24998
25116
|
}
|
|
24999
25117
|
)
|
|
@@ -25065,7 +25183,7 @@ var ErrorContent = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime102.js
|
|
|
25065
25183
|
{
|
|
25066
25184
|
as: "span",
|
|
25067
25185
|
className: "size-12 rounded-full bg-error-100 flex items-center justify-center",
|
|
25068
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react80.WarningCircleIcon, { size: 24, className: "text-error-700" })
|
|
25069
25187
|
}
|
|
25070
25188
|
),
|
|
25071
25189
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text_default, { size: "md", className: "text-error-700 text-center", children: message })
|
|
@@ -25080,7 +25198,7 @@ var PerformanceContent = ({
|
|
|
25080
25198
|
{
|
|
25081
25199
|
as: "span",
|
|
25082
25200
|
className: "size-8 rounded-full bg-background-100 flex items-center justify-center",
|
|
25083
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react80.UserIcon, { size: 16, className: "text-text-500" })
|
|
25084
25202
|
}
|
|
25085
25203
|
),
|
|
25086
25204
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text_default, { size: "md", weight: "medium", className: "text-text-950", children: data.studentName })
|
|
@@ -25090,7 +25208,7 @@ var PerformanceContent = ({
|
|
|
25090
25208
|
PerformanceCard,
|
|
25091
25209
|
{
|
|
25092
25210
|
icon: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25093
|
-
|
|
25211
|
+
import_react80.LightbulbFilamentIcon,
|
|
25094
25212
|
{
|
|
25095
25213
|
size: 18,
|
|
25096
25214
|
weight: "fill",
|
|
@@ -25108,7 +25226,7 @@ var PerformanceContent = ({
|
|
|
25108
25226
|
PerformanceCard,
|
|
25109
25227
|
{
|
|
25110
25228
|
icon: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
25111
|
-
|
|
25229
|
+
import_react80.WarningCircleIcon,
|
|
25112
25230
|
{
|
|
25113
25231
|
size: 18,
|
|
25114
25232
|
weight: "fill",
|
|
@@ -25148,7 +25266,7 @@ var StudentPerformanceModal = ({
|
|
|
25148
25266
|
error = null,
|
|
25149
25267
|
labels: customLabels
|
|
25150
25268
|
}) => {
|
|
25151
|
-
const labels = (0,
|
|
25269
|
+
const labels = (0, import_react79.useMemo)(
|
|
25152
25270
|
() => ({ ...DEFAULT_PERFORMANCE_LABELS, ...customLabels }),
|
|
25153
25271
|
[customLabels]
|
|
25154
25272
|
);
|
|
@@ -25183,15 +25301,15 @@ var RecommendedLessonDetails = ({
|
|
|
25183
25301
|
labels: customLabels,
|
|
25184
25302
|
className
|
|
25185
25303
|
}) => {
|
|
25186
|
-
const labels = (0,
|
|
25304
|
+
const labels = (0, import_react81.useMemo)(
|
|
25187
25305
|
() => ({ ...DEFAULT_LABELS, ...customLabels }),
|
|
25188
25306
|
[customLabels]
|
|
25189
25307
|
);
|
|
25190
|
-
const [performanceModalOpen, setPerformanceModalOpen] = (0,
|
|
25191
|
-
const [performanceData, setPerformanceData] = (0,
|
|
25192
|
-
const [performanceLoading, setPerformanceLoading] = (0,
|
|
25193
|
-
const [performanceError, setPerformanceError] = (0,
|
|
25194
|
-
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)(
|
|
25195
25313
|
async (studentId) => {
|
|
25196
25314
|
if (!fetchStudentPerformance || !goalId) return;
|
|
25197
25315
|
setPerformanceModalOpen(true);
|
|
@@ -25212,12 +25330,12 @@ var RecommendedLessonDetails = ({
|
|
|
25212
25330
|
},
|
|
25213
25331
|
[fetchStudentPerformance, goalId]
|
|
25214
25332
|
);
|
|
25215
|
-
const handleClosePerformanceModal = (0,
|
|
25333
|
+
const handleClosePerformanceModal = (0, import_react81.useCallback)(() => {
|
|
25216
25334
|
setPerformanceModalOpen(false);
|
|
25217
25335
|
setPerformanceData(null);
|
|
25218
25336
|
setPerformanceError(null);
|
|
25219
25337
|
}, []);
|
|
25220
|
-
const defaultBreadcrumbs = (0,
|
|
25338
|
+
const defaultBreadcrumbs = (0, import_react81.useMemo)(
|
|
25221
25339
|
() => [
|
|
25222
25340
|
{ label: "Aulas recomendadas", path: "/aulas-recomendadas" },
|
|
25223
25341
|
{ label: data?.goal.title || "Detalhes" }
|
|
@@ -25225,7 +25343,7 @@ var RecommendedLessonDetails = ({
|
|
|
25225
25343
|
[data?.goal.title]
|
|
25226
25344
|
);
|
|
25227
25345
|
const breadcrumbItems = breadcrumbs || defaultBreadcrumbs;
|
|
25228
|
-
const displayStudents = (0,
|
|
25346
|
+
const displayStudents = (0, import_react81.useMemo)(() => {
|
|
25229
25347
|
if (!data?.details.students) return [];
|
|
25230
25348
|
const deadline = data?.goal.finalDate;
|
|
25231
25349
|
return data.details.students.map(
|
|
@@ -25302,101 +25420,101 @@ var RecommendedLessonDetails = ({
|
|
|
25302
25420
|
var RecommendedLessonDetails_default = RecommendedLessonDetails;
|
|
25303
25421
|
|
|
25304
25422
|
// src/hooks/useRecommendedLessonDetails.ts
|
|
25305
|
-
var
|
|
25306
|
-
var
|
|
25307
|
-
var goalLessonSubjectSchema =
|
|
25308
|
-
id:
|
|
25309
|
-
name:
|
|
25310
|
-
color:
|
|
25311
|
-
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()
|
|
25312
25430
|
});
|
|
25313
|
-
var lessonContentSchema =
|
|
25314
|
-
id:
|
|
25315
|
-
name:
|
|
25431
|
+
var lessonContentSchema = import_zod6.z.object({
|
|
25432
|
+
id: import_zod6.z.string(),
|
|
25433
|
+
name: import_zod6.z.string()
|
|
25316
25434
|
});
|
|
25317
|
-
var goalLessonSchema =
|
|
25318
|
-
id:
|
|
25435
|
+
var goalLessonSchema = import_zod6.z.object({
|
|
25436
|
+
id: import_zod6.z.string(),
|
|
25319
25437
|
content: lessonContentSchema,
|
|
25320
25438
|
subtopic: lessonContentSchema,
|
|
25321
25439
|
topic: lessonContentSchema,
|
|
25322
25440
|
subject: goalLessonSubjectSchema
|
|
25323
25441
|
});
|
|
25324
|
-
var goalLessonProgressSchema =
|
|
25325
|
-
id:
|
|
25326
|
-
userId:
|
|
25327
|
-
lessonId:
|
|
25328
|
-
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(),
|
|
25329
25447
|
lesson: goalLessonSchema
|
|
25330
25448
|
});
|
|
25331
|
-
var goalLessonGoalItemSchema =
|
|
25332
|
-
goalId:
|
|
25333
|
-
supLessonsProgressId:
|
|
25449
|
+
var goalLessonGoalItemSchema = import_zod6.z.object({
|
|
25450
|
+
goalId: import_zod6.z.string(),
|
|
25451
|
+
supLessonsProgressId: import_zod6.z.string(),
|
|
25334
25452
|
supLessonsProgress: goalLessonProgressSchema
|
|
25335
25453
|
});
|
|
25336
|
-
var goalMetadataSchema =
|
|
25337
|
-
id:
|
|
25338
|
-
title:
|
|
25339
|
-
startDate:
|
|
25340
|
-
finalDate:
|
|
25341
|
-
progress:
|
|
25342
|
-
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)
|
|
25343
25461
|
});
|
|
25344
|
-
var goalApiResponseSchema =
|
|
25345
|
-
message:
|
|
25462
|
+
var goalApiResponseSchema = import_zod6.z.object({
|
|
25463
|
+
message: import_zod6.z.string(),
|
|
25346
25464
|
data: goalMetadataSchema
|
|
25347
25465
|
});
|
|
25348
|
-
var goalDetailStudentSchema =
|
|
25349
|
-
userInstitutionId:
|
|
25350
|
-
userId:
|
|
25351
|
-
name:
|
|
25352
|
-
progress:
|
|
25353
|
-
completedAt:
|
|
25354
|
-
avgScore:
|
|
25355
|
-
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()
|
|
25356
25474
|
});
|
|
25357
|
-
var goalDetailAggregatedSchema =
|
|
25358
|
-
completionPercentage:
|
|
25359
|
-
avgScore:
|
|
25475
|
+
var goalDetailAggregatedSchema = import_zod6.z.object({
|
|
25476
|
+
completionPercentage: import_zod6.z.number(),
|
|
25477
|
+
avgScore: import_zod6.z.number().nullable()
|
|
25360
25478
|
});
|
|
25361
|
-
var goalDetailContentPerformanceItemSchema =
|
|
25362
|
-
contentId:
|
|
25363
|
-
contentName:
|
|
25364
|
-
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()
|
|
25365
25483
|
}).nullable();
|
|
25366
|
-
var goalDetailContentPerformanceSchema =
|
|
25484
|
+
var goalDetailContentPerformanceSchema = import_zod6.z.object({
|
|
25367
25485
|
best: goalDetailContentPerformanceItemSchema,
|
|
25368
25486
|
worst: goalDetailContentPerformanceItemSchema
|
|
25369
25487
|
});
|
|
25370
|
-
var goalDetailsDataSchema =
|
|
25371
|
-
students:
|
|
25488
|
+
var goalDetailsDataSchema = import_zod6.z.object({
|
|
25489
|
+
students: import_zod6.z.array(goalDetailStudentSchema),
|
|
25372
25490
|
aggregated: goalDetailAggregatedSchema,
|
|
25373
25491
|
contentPerformance: goalDetailContentPerformanceSchema
|
|
25374
25492
|
});
|
|
25375
|
-
var goalDetailsApiResponseSchema =
|
|
25376
|
-
message:
|
|
25493
|
+
var goalDetailsApiResponseSchema = import_zod6.z.object({
|
|
25494
|
+
message: import_zod6.z.string(),
|
|
25377
25495
|
data: goalDetailsDataSchema
|
|
25378
25496
|
});
|
|
25379
|
-
var goalBreakdownSchema2 =
|
|
25380
|
-
classId:
|
|
25381
|
-
className:
|
|
25382
|
-
schoolId:
|
|
25383
|
-
schoolName:
|
|
25384
|
-
studentCount:
|
|
25385
|
-
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()
|
|
25386
25504
|
});
|
|
25387
|
-
var historyGoalItemSchema =
|
|
25388
|
-
goal:
|
|
25389
|
-
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)
|
|
25390
25508
|
});
|
|
25391
|
-
var historyApiResponseSchema =
|
|
25392
|
-
message:
|
|
25393
|
-
data:
|
|
25394
|
-
goals:
|
|
25395
|
-
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()
|
|
25396
25514
|
})
|
|
25397
25515
|
});
|
|
25398
25516
|
var handleLessonDetailsFetchError = (error) => {
|
|
25399
|
-
if (error instanceof
|
|
25517
|
+
if (error instanceof import_zod6.z.ZodError) {
|
|
25400
25518
|
console.error("Erro ao validar dados dos detalhes da aula:", error);
|
|
25401
25519
|
return "Erro ao validar dados dos detalhes da aula";
|
|
25402
25520
|
}
|
|
@@ -25405,12 +25523,12 @@ var handleLessonDetailsFetchError = (error) => {
|
|
|
25405
25523
|
};
|
|
25406
25524
|
var createUseRecommendedLessonDetails = (apiClient) => {
|
|
25407
25525
|
return (lessonId) => {
|
|
25408
|
-
const [state, setState] = (0,
|
|
25526
|
+
const [state, setState] = (0, import_react82.useState)({
|
|
25409
25527
|
data: null,
|
|
25410
25528
|
loading: true,
|
|
25411
25529
|
error: null
|
|
25412
25530
|
});
|
|
25413
|
-
const fetchLessonDetails = (0,
|
|
25531
|
+
const fetchLessonDetails = (0, import_react82.useCallback)(async () => {
|
|
25414
25532
|
if (!lessonId) {
|
|
25415
25533
|
setState({
|
|
25416
25534
|
data: null,
|
|
@@ -25456,7 +25574,7 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
25456
25574
|
});
|
|
25457
25575
|
}
|
|
25458
25576
|
}, [lessonId]);
|
|
25459
|
-
(0,
|
|
25577
|
+
(0, import_react82.useEffect)(() => {
|
|
25460
25578
|
fetchLessonDetails();
|
|
25461
25579
|
}, [fetchLessonDetails]);
|
|
25462
25580
|
return {
|
|
@@ -25468,10 +25586,10 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
25468
25586
|
var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
|
|
25469
25587
|
|
|
25470
25588
|
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
25471
|
-
var
|
|
25589
|
+
var import_react87 = require("react");
|
|
25472
25590
|
|
|
25473
25591
|
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
25474
|
-
var
|
|
25592
|
+
var import_react84 = require("react");
|
|
25475
25593
|
var import_phosphor_react47 = require("phosphor-react");
|
|
25476
25594
|
|
|
25477
25595
|
// src/components/ActivitiesHistory/components/ErrorDisplay.tsx
|
|
@@ -25713,14 +25831,14 @@ var createHistoryFiltersConfig = (userData) => [
|
|
|
25713
25831
|
];
|
|
25714
25832
|
|
|
25715
25833
|
// src/hooks/useActivitiesHistory.ts
|
|
25716
|
-
var
|
|
25717
|
-
var
|
|
25834
|
+
var import_react83 = require("react");
|
|
25835
|
+
var import_zod8 = require("zod");
|
|
25718
25836
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
25719
25837
|
|
|
25720
25838
|
// src/utils/hookErrorHandler.ts
|
|
25721
|
-
var
|
|
25839
|
+
var import_zod7 = require("zod");
|
|
25722
25840
|
var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
|
|
25723
|
-
if (error instanceof
|
|
25841
|
+
if (error instanceof import_zod7.z.ZodError) {
|
|
25724
25842
|
console.error(validationErrorMessage, error);
|
|
25725
25843
|
return validationErrorMessage;
|
|
25726
25844
|
}
|
|
@@ -25729,33 +25847,33 @@ var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (
|
|
|
25729
25847
|
};
|
|
25730
25848
|
|
|
25731
25849
|
// src/hooks/useActivitiesHistory.ts
|
|
25732
|
-
var activityHistoryResponseSchema =
|
|
25733
|
-
id:
|
|
25734
|
-
title:
|
|
25735
|
-
startDate:
|
|
25736
|
-
finalDate:
|
|
25737
|
-
status:
|
|
25738
|
-
completionPercentage:
|
|
25739
|
-
subjectId:
|
|
25740
|
-
schoolId:
|
|
25741
|
-
schoolName:
|
|
25742
|
-
year:
|
|
25743
|
-
className:
|
|
25744
|
-
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()
|
|
25745
25863
|
});
|
|
25746
|
-
var activitiesHistoryApiResponseSchema =
|
|
25747
|
-
message:
|
|
25748
|
-
data:
|
|
25749
|
-
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(
|
|
25750
25868
|
(items) => items.map((item) => activityHistoryResponseSchema.safeParse(item)).filter(
|
|
25751
25869
|
(result) => result.success
|
|
25752
25870
|
).map((result) => result.data)
|
|
25753
25871
|
),
|
|
25754
|
-
pagination:
|
|
25755
|
-
total:
|
|
25756
|
-
page:
|
|
25757
|
-
limit:
|
|
25758
|
-
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()
|
|
25759
25877
|
})
|
|
25760
25878
|
})
|
|
25761
25879
|
});
|
|
@@ -25785,13 +25903,13 @@ var handleActivityFetchError = createFetchErrorHandler(
|
|
|
25785
25903
|
);
|
|
25786
25904
|
var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
25787
25905
|
return () => {
|
|
25788
|
-
const [state, setState] = (0,
|
|
25906
|
+
const [state, setState] = (0, import_react83.useState)({
|
|
25789
25907
|
activities: [],
|
|
25790
25908
|
loading: false,
|
|
25791
25909
|
error: null,
|
|
25792
25910
|
pagination: DEFAULT_ACTIVITIES_PAGINATION
|
|
25793
25911
|
});
|
|
25794
|
-
const fetchActivities = (0,
|
|
25912
|
+
const fetchActivities = (0, import_react83.useCallback)(
|
|
25795
25913
|
async (filters) => {
|
|
25796
25914
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
25797
25915
|
try {
|
|
@@ -25836,9 +25954,9 @@ var HistoryTab = ({
|
|
|
25836
25954
|
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
25837
25955
|
userFilterData
|
|
25838
25956
|
}) => {
|
|
25839
|
-
const fetchActivitiesHistoryRef = (0,
|
|
25957
|
+
const fetchActivitiesHistoryRef = (0, import_react84.useRef)(fetchActivitiesHistory);
|
|
25840
25958
|
fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
|
|
25841
|
-
const useActivitiesHistory = (0,
|
|
25959
|
+
const useActivitiesHistory = (0, import_react84.useMemo)(
|
|
25842
25960
|
() => createUseActivitiesHistory(
|
|
25843
25961
|
(filters) => fetchActivitiesHistoryRef.current(filters)
|
|
25844
25962
|
),
|
|
@@ -25851,15 +25969,15 @@ var HistoryTab = ({
|
|
|
25851
25969
|
pagination,
|
|
25852
25970
|
fetchActivities
|
|
25853
25971
|
} = useActivitiesHistory();
|
|
25854
|
-
const historyFilterConfigs = (0,
|
|
25972
|
+
const historyFilterConfigs = (0, import_react84.useMemo)(
|
|
25855
25973
|
() => createHistoryFiltersConfig(userFilterData),
|
|
25856
25974
|
[userFilterData]
|
|
25857
25975
|
);
|
|
25858
|
-
const historyTableColumns = (0,
|
|
25976
|
+
const historyTableColumns = (0, import_react84.useMemo)(
|
|
25859
25977
|
() => createHistoryTableColumns(mapSubjectNameToEnum2),
|
|
25860
25978
|
[mapSubjectNameToEnum2]
|
|
25861
25979
|
);
|
|
25862
|
-
const handleParamsChange = (0,
|
|
25980
|
+
const handleParamsChange = (0, import_react84.useCallback)(
|
|
25863
25981
|
(params) => {
|
|
25864
25982
|
const filters = buildHistoryFiltersFromParams(params);
|
|
25865
25983
|
fetchActivities(filters);
|
|
@@ -25942,7 +26060,7 @@ var HistoryTab = ({
|
|
|
25942
26060
|
};
|
|
25943
26061
|
|
|
25944
26062
|
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
25945
|
-
var
|
|
26063
|
+
var import_react86 = require("react");
|
|
25946
26064
|
var import_phosphor_react49 = require("phosphor-react");
|
|
25947
26065
|
|
|
25948
26066
|
// src/components/ActivitiesHistory/config/modelsTableColumns.tsx
|
|
@@ -26048,32 +26166,32 @@ var createModelsFiltersConfig = (userData) => [
|
|
|
26048
26166
|
];
|
|
26049
26167
|
|
|
26050
26168
|
// src/hooks/useActivityModels.ts
|
|
26051
|
-
var
|
|
26052
|
-
var
|
|
26169
|
+
var import_react85 = require("react");
|
|
26170
|
+
var import_zod9 = require("zod");
|
|
26053
26171
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
26054
|
-
var activityDraftFiltersSchema =
|
|
26055
|
-
questionTypes:
|
|
26056
|
-
questionBanks:
|
|
26057
|
-
subjects:
|
|
26058
|
-
topics:
|
|
26059
|
-
subtopics:
|
|
26060
|
-
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()
|
|
26061
26179
|
}).nullable();
|
|
26062
|
-
var activityModelResponseSchema =
|
|
26063
|
-
id:
|
|
26064
|
-
type:
|
|
26065
|
-
title:
|
|
26066
|
-
creatorUserInstitutionId:
|
|
26067
|
-
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(),
|
|
26068
26186
|
filters: activityDraftFiltersSchema,
|
|
26069
|
-
createdAt:
|
|
26070
|
-
updatedAt:
|
|
26187
|
+
createdAt: import_zod9.z.string(),
|
|
26188
|
+
updatedAt: import_zod9.z.string()
|
|
26071
26189
|
});
|
|
26072
|
-
var activityModelsApiResponseSchema =
|
|
26073
|
-
message:
|
|
26074
|
-
data:
|
|
26075
|
-
activityDrafts:
|
|
26076
|
-
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()
|
|
26077
26195
|
})
|
|
26078
26196
|
});
|
|
26079
26197
|
var DEFAULT_MODELS_PAGINATION = {
|
|
@@ -26098,13 +26216,13 @@ var handleModelFetchError = createFetchErrorHandler(
|
|
|
26098
26216
|
);
|
|
26099
26217
|
var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
26100
26218
|
return () => {
|
|
26101
|
-
const [state, setState] = (0,
|
|
26219
|
+
const [state, setState] = (0, import_react85.useState)({
|
|
26102
26220
|
models: [],
|
|
26103
26221
|
loading: false,
|
|
26104
26222
|
error: null,
|
|
26105
26223
|
pagination: DEFAULT_MODELS_PAGINATION
|
|
26106
26224
|
});
|
|
26107
|
-
const fetchModels = (0,
|
|
26225
|
+
const fetchModels = (0, import_react85.useCallback)(
|
|
26108
26226
|
async (filters, subjectsMap) => {
|
|
26109
26227
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
26110
26228
|
try {
|
|
@@ -26139,7 +26257,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
|
26139
26257
|
},
|
|
26140
26258
|
[fetchActivityModels]
|
|
26141
26259
|
);
|
|
26142
|
-
const deleteModel = (0,
|
|
26260
|
+
const deleteModel = (0, import_react85.useCallback)(
|
|
26143
26261
|
async (id) => {
|
|
26144
26262
|
try {
|
|
26145
26263
|
await deleteActivityModel(id);
|
|
@@ -26174,16 +26292,16 @@ var ModelsTab = ({
|
|
|
26174
26292
|
userFilterData,
|
|
26175
26293
|
subjectsMap
|
|
26176
26294
|
}) => {
|
|
26177
|
-
const [deleteDialogOpen, setDeleteDialogOpen] = (0,
|
|
26178
|
-
const [modelToDelete, setModelToDelete] = (0,
|
|
26295
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = (0, import_react86.useState)(false);
|
|
26296
|
+
const [modelToDelete, setModelToDelete] = (0, import_react86.useState)(null);
|
|
26179
26297
|
const { addToast } = useToast();
|
|
26180
|
-
const fetchActivityModelsRef = (0,
|
|
26298
|
+
const fetchActivityModelsRef = (0, import_react86.useRef)(fetchActivityModels);
|
|
26181
26299
|
fetchActivityModelsRef.current = fetchActivityModels;
|
|
26182
|
-
const deleteActivityModelRef = (0,
|
|
26300
|
+
const deleteActivityModelRef = (0, import_react86.useRef)(deleteActivityModel);
|
|
26183
26301
|
deleteActivityModelRef.current = deleteActivityModel;
|
|
26184
|
-
const subjectsMapRef = (0,
|
|
26302
|
+
const subjectsMapRef = (0, import_react86.useRef)(subjectsMap);
|
|
26185
26303
|
subjectsMapRef.current = subjectsMap;
|
|
26186
|
-
const useActivityModels = (0,
|
|
26304
|
+
const useActivityModels = (0, import_react86.useMemo)(
|
|
26187
26305
|
() => createUseActivityModels(
|
|
26188
26306
|
(filters) => fetchActivityModelsRef.current(filters),
|
|
26189
26307
|
(id) => deleteActivityModelRef.current(id)
|
|
@@ -26198,15 +26316,15 @@ var ModelsTab = ({
|
|
|
26198
26316
|
fetchModels,
|
|
26199
26317
|
deleteModel
|
|
26200
26318
|
} = useActivityModels();
|
|
26201
|
-
const modelsFilterConfigs = (0,
|
|
26319
|
+
const modelsFilterConfigs = (0, import_react86.useMemo)(
|
|
26202
26320
|
() => createModelsFiltersConfig(userFilterData),
|
|
26203
26321
|
[userFilterData]
|
|
26204
26322
|
);
|
|
26205
|
-
const handleDeleteClick = (0,
|
|
26323
|
+
const handleDeleteClick = (0, import_react86.useCallback)((model) => {
|
|
26206
26324
|
setModelToDelete(model);
|
|
26207
26325
|
setDeleteDialogOpen(true);
|
|
26208
26326
|
}, []);
|
|
26209
|
-
const modelsTableColumns = (0,
|
|
26327
|
+
const modelsTableColumns = (0, import_react86.useMemo)(
|
|
26210
26328
|
() => createModelsTableColumns(
|
|
26211
26329
|
mapSubjectNameToEnum2,
|
|
26212
26330
|
onSendActivity,
|
|
@@ -26215,17 +26333,17 @@ var ModelsTab = ({
|
|
|
26215
26333
|
),
|
|
26216
26334
|
[mapSubjectNameToEnum2, onSendActivity, onEditModel, handleDeleteClick]
|
|
26217
26335
|
);
|
|
26218
|
-
const handleParamsChange = (0,
|
|
26336
|
+
const handleParamsChange = (0, import_react86.useCallback)(
|
|
26219
26337
|
(params) => {
|
|
26220
26338
|
const filters = buildModelsFiltersFromParams(params);
|
|
26221
26339
|
fetchModels(filters, subjectsMapRef.current);
|
|
26222
26340
|
},
|
|
26223
26341
|
[fetchModels]
|
|
26224
26342
|
);
|
|
26225
|
-
(0,
|
|
26343
|
+
(0, import_react86.useEffect)(() => {
|
|
26226
26344
|
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
26227
26345
|
}, [fetchModels]);
|
|
26228
|
-
const handleConfirmDelete = (0,
|
|
26346
|
+
const handleConfirmDelete = (0, import_react86.useCallback)(async () => {
|
|
26229
26347
|
if (modelToDelete) {
|
|
26230
26348
|
const success = await deleteModel(modelToDelete.id);
|
|
26231
26349
|
if (success) {
|
|
@@ -26238,7 +26356,7 @@ var ModelsTab = ({
|
|
|
26238
26356
|
setDeleteDialogOpen(false);
|
|
26239
26357
|
setModelToDelete(null);
|
|
26240
26358
|
}, [modelToDelete, deleteModel, fetchModels, addToast]);
|
|
26241
|
-
const handleCancelDelete = (0,
|
|
26359
|
+
const handleCancelDelete = (0, import_react86.useCallback)(() => {
|
|
26242
26360
|
setDeleteDialogOpen(false);
|
|
26243
26361
|
setModelToDelete(null);
|
|
26244
26362
|
}, []);
|
|
@@ -26356,7 +26474,7 @@ var ActivitiesHistory = ({
|
|
|
26356
26474
|
userFilterData,
|
|
26357
26475
|
subjectsMap
|
|
26358
26476
|
}) => {
|
|
26359
|
-
const [activeTab, setActiveTab] = (0,
|
|
26477
|
+
const [activeTab, setActiveTab] = (0, import_react87.useState)("history" /* HISTORY */);
|
|
26360
26478
|
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
|
|
26361
26479
|
"div",
|
|
26362
26480
|
{
|
|
@@ -26595,7 +26713,7 @@ var buildUserFilterData = (userData) => ({
|
|
|
26595
26713
|
});
|
|
26596
26714
|
|
|
26597
26715
|
// src/hooks/useChat.ts
|
|
26598
|
-
var
|
|
26716
|
+
var import_react88 = require("react");
|
|
26599
26717
|
var WS_STATES = {
|
|
26600
26718
|
CONNECTING: 0,
|
|
26601
26719
|
OPEN: 1,
|
|
@@ -26614,25 +26732,25 @@ function useChat({
|
|
|
26614
26732
|
reconnectInterval = 3e3,
|
|
26615
26733
|
maxReconnectAttempts = 5
|
|
26616
26734
|
}) {
|
|
26617
|
-
const [isConnected, setIsConnected] = (0,
|
|
26618
|
-
const [messages, setMessages] = (0,
|
|
26619
|
-
const [participants, setParticipants] = (0,
|
|
26620
|
-
const [error, setError] = (0,
|
|
26621
|
-
const wsRef = (0,
|
|
26622
|
-
const reconnectAttemptsRef = (0,
|
|
26623
|
-
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)(
|
|
26624
26742
|
null
|
|
26625
26743
|
);
|
|
26626
|
-
const isManualDisconnectRef = (0,
|
|
26627
|
-
const isConnectingRef = (0,
|
|
26628
|
-
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)(() => {
|
|
26629
26747
|
});
|
|
26630
|
-
const sendWsMessage = (0,
|
|
26748
|
+
const sendWsMessage = (0, import_react88.useCallback)((message) => {
|
|
26631
26749
|
if (wsRef.current?.readyState === WS_STATES.OPEN) {
|
|
26632
26750
|
wsRef.current.send(JSON.stringify(message));
|
|
26633
26751
|
}
|
|
26634
26752
|
}, []);
|
|
26635
|
-
const sendMessage = (0,
|
|
26753
|
+
const sendMessage = (0, import_react88.useCallback)(
|
|
26636
26754
|
(content) => {
|
|
26637
26755
|
const trimmedContent = content.trim();
|
|
26638
26756
|
if (!trimmedContent) return;
|
|
@@ -26643,12 +26761,12 @@ function useChat({
|
|
|
26643
26761
|
},
|
|
26644
26762
|
[sendWsMessage]
|
|
26645
26763
|
);
|
|
26646
|
-
const leave = (0,
|
|
26764
|
+
const leave = (0, import_react88.useCallback)(() => {
|
|
26647
26765
|
isManualDisconnectRef.current = true;
|
|
26648
26766
|
sendWsMessage({ type: "leave" });
|
|
26649
26767
|
wsRef.current?.close(1e3, "User left");
|
|
26650
26768
|
}, [sendWsMessage]);
|
|
26651
|
-
const handleMessage = (0,
|
|
26769
|
+
const handleMessage = (0, import_react88.useCallback)(
|
|
26652
26770
|
(event) => {
|
|
26653
26771
|
try {
|
|
26654
26772
|
const data = JSON.parse(event.data);
|
|
@@ -26716,7 +26834,7 @@ function useChat({
|
|
|
26716
26834
|
},
|
|
26717
26835
|
[onError]
|
|
26718
26836
|
);
|
|
26719
|
-
const connect = (0,
|
|
26837
|
+
const connect = (0, import_react88.useCallback)(() => {
|
|
26720
26838
|
if (isConnectingRef.current) {
|
|
26721
26839
|
return;
|
|
26722
26840
|
}
|
|
@@ -26769,12 +26887,12 @@ function useChat({
|
|
|
26769
26887
|
maxReconnectAttempts
|
|
26770
26888
|
]);
|
|
26771
26889
|
connectRef.current = connect;
|
|
26772
|
-
const reconnect = (0,
|
|
26890
|
+
const reconnect = (0, import_react88.useCallback)(() => {
|
|
26773
26891
|
isManualDisconnectRef.current = false;
|
|
26774
26892
|
reconnectAttemptsRef.current = 0;
|
|
26775
26893
|
connectRef.current();
|
|
26776
26894
|
}, []);
|
|
26777
|
-
(0,
|
|
26895
|
+
(0, import_react88.useEffect)(() => {
|
|
26778
26896
|
if (!roomId) {
|
|
26779
26897
|
return;
|
|
26780
26898
|
}
|
|
@@ -26818,15 +26936,15 @@ function createUseChat(baseWsUrl) {
|
|
|
26818
26936
|
}
|
|
26819
26937
|
|
|
26820
26938
|
// src/hooks/useChatRooms.ts
|
|
26821
|
-
var
|
|
26939
|
+
var import_react89 = require("react");
|
|
26822
26940
|
function useChatRooms({
|
|
26823
26941
|
apiClient
|
|
26824
26942
|
}) {
|
|
26825
|
-
const [rooms, setRooms] = (0,
|
|
26826
|
-
const [availableUsers, setAvailableUsers] = (0,
|
|
26827
|
-
const [loading, setLoading] = (0,
|
|
26828
|
-
const [error, setError] = (0,
|
|
26829
|
-
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 () => {
|
|
26830
26948
|
setLoading(true);
|
|
26831
26949
|
setError(null);
|
|
26832
26950
|
try {
|
|
@@ -26842,7 +26960,7 @@ function useChatRooms({
|
|
|
26842
26960
|
setLoading(false);
|
|
26843
26961
|
}
|
|
26844
26962
|
}, [apiClient]);
|
|
26845
|
-
const fetchAvailableUsers = (0,
|
|
26963
|
+
const fetchAvailableUsers = (0, import_react89.useCallback)(async () => {
|
|
26846
26964
|
setLoading(true);
|
|
26847
26965
|
setError(null);
|
|
26848
26966
|
try {
|
|
@@ -26858,7 +26976,7 @@ function useChatRooms({
|
|
|
26858
26976
|
setLoading(false);
|
|
26859
26977
|
}
|
|
26860
26978
|
}, [apiClient]);
|
|
26861
|
-
const createRoom = (0,
|
|
26979
|
+
const createRoom = (0, import_react89.useCallback)(
|
|
26862
26980
|
async (participantIds) => {
|
|
26863
26981
|
setLoading(true);
|
|
26864
26982
|
setError(null);
|
|
@@ -26882,7 +27000,7 @@ function useChatRooms({
|
|
|
26882
27000
|
},
|
|
26883
27001
|
[apiClient, fetchRooms]
|
|
26884
27002
|
);
|
|
26885
|
-
const clearError = (0,
|
|
27003
|
+
const clearError = (0, import_react89.useCallback)(() => {
|
|
26886
27004
|
setError(null);
|
|
26887
27005
|
}, []);
|
|
26888
27006
|
return {
|
|
@@ -26916,8 +27034,8 @@ var CHAT_MESSAGE_TYPES = {
|
|
|
26916
27034
|
};
|
|
26917
27035
|
|
|
26918
27036
|
// src/components/Chat/Chat.tsx
|
|
26919
|
-
var
|
|
26920
|
-
var
|
|
27037
|
+
var import_react90 = require("react");
|
|
27038
|
+
var import_react91 = require("@phosphor-icons/react");
|
|
26921
27039
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
26922
27040
|
var RoomItem = ({
|
|
26923
27041
|
room,
|
|
@@ -26934,7 +27052,7 @@ var RoomItem = ({
|
|
|
26934
27052
|
isActive && "bg-primary-50 border-l-4 border-primary-500"
|
|
26935
27053
|
),
|
|
26936
27054
|
children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex items-start gap-3 w-full", children: [
|
|
26937
|
-
/* @__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" }) }),
|
|
26938
27056
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
26939
27057
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Text_default, { size: "sm", weight: "semibold", className: "text-text-900 truncate", children: room.name }),
|
|
26940
27058
|
room.lastMessage && /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(Text_default, { size: "xs", className: "text-text-500 truncate mt-1", children: [
|
|
@@ -27064,16 +27182,16 @@ function ChatContent({
|
|
|
27064
27182
|
onRoomChange,
|
|
27065
27183
|
onBackToList
|
|
27066
27184
|
}) {
|
|
27067
|
-
const [view, setView] = (0,
|
|
27068
|
-
const [selectedRoom, setSelectedRoom] = (0,
|
|
27185
|
+
const [view, setView] = (0, import_react90.useState)("list");
|
|
27186
|
+
const [selectedRoom, setSelectedRoom] = (0, import_react90.useState)(
|
|
27069
27187
|
null
|
|
27070
27188
|
);
|
|
27071
|
-
const [selectedUserIds, setSelectedUserIds] = (0,
|
|
27189
|
+
const [selectedUserIds, setSelectedUserIds] = (0, import_react90.useState)(
|
|
27072
27190
|
/* @__PURE__ */ new Set()
|
|
27073
27191
|
);
|
|
27074
|
-
const [messageInput, setMessageInput] = (0,
|
|
27075
|
-
const [showCreateModal, setShowCreateModal] = (0,
|
|
27076
|
-
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);
|
|
27077
27195
|
const {
|
|
27078
27196
|
rooms,
|
|
27079
27197
|
availableUsers,
|
|
@@ -27101,10 +27219,10 @@ function ChatContent({
|
|
|
27101
27219
|
const getRoleLabel = () => {
|
|
27102
27220
|
return userRole === "TEACHER" /* TEACHER */ ? "Professor" : "Aluno";
|
|
27103
27221
|
};
|
|
27104
|
-
(0,
|
|
27222
|
+
(0, import_react90.useEffect)(() => {
|
|
27105
27223
|
fetchRooms();
|
|
27106
27224
|
}, [fetchRooms]);
|
|
27107
|
-
(0,
|
|
27225
|
+
(0, import_react90.useEffect)(() => {
|
|
27108
27226
|
if (hasHandledInitialRoomRef.current) {
|
|
27109
27227
|
return;
|
|
27110
27228
|
}
|
|
@@ -27126,7 +27244,7 @@ function ChatContent({
|
|
|
27126
27244
|
onBackToList?.();
|
|
27127
27245
|
}
|
|
27128
27246
|
}, [initialRoomId, rooms, roomsLoading, onBackToList]);
|
|
27129
|
-
const handleSelectRoom = (0,
|
|
27247
|
+
const handleSelectRoom = (0, import_react90.useCallback)(
|
|
27130
27248
|
(room) => {
|
|
27131
27249
|
setSelectedRoom(room);
|
|
27132
27250
|
setView("room");
|
|
@@ -27134,12 +27252,12 @@ function ChatContent({
|
|
|
27134
27252
|
},
|
|
27135
27253
|
[onRoomChange]
|
|
27136
27254
|
);
|
|
27137
|
-
const handleOpenCreateModal = (0,
|
|
27255
|
+
const handleOpenCreateModal = (0, import_react90.useCallback)(async () => {
|
|
27138
27256
|
await fetchAvailableUsers();
|
|
27139
27257
|
setSelectedUserIds(/* @__PURE__ */ new Set());
|
|
27140
27258
|
setShowCreateModal(true);
|
|
27141
27259
|
}, [fetchAvailableUsers]);
|
|
27142
|
-
const handleToggleUser = (0,
|
|
27260
|
+
const handleToggleUser = (0, import_react90.useCallback)((id) => {
|
|
27143
27261
|
setSelectedUserIds((prev) => {
|
|
27144
27262
|
const next = new Set(prev);
|
|
27145
27263
|
if (next.has(id)) {
|
|
@@ -27150,7 +27268,7 @@ function ChatContent({
|
|
|
27150
27268
|
return next;
|
|
27151
27269
|
});
|
|
27152
27270
|
}, []);
|
|
27153
|
-
const handleCreateRoom = (0,
|
|
27271
|
+
const handleCreateRoom = (0, import_react90.useCallback)(async () => {
|
|
27154
27272
|
if (selectedUserIds.size === 0) return;
|
|
27155
27273
|
const room = await createRoom(Array.from(selectedUserIds));
|
|
27156
27274
|
if (room) {
|
|
@@ -27159,12 +27277,12 @@ function ChatContent({
|
|
|
27159
27277
|
onRoomChange?.(room.id);
|
|
27160
27278
|
}
|
|
27161
27279
|
}, [selectedUserIds, createRoom, onRoomChange]);
|
|
27162
|
-
const handleSendMessage = (0,
|
|
27280
|
+
const handleSendMessage = (0, import_react90.useCallback)(() => {
|
|
27163
27281
|
if (!messageInput.trim()) return;
|
|
27164
27282
|
sendMessage(messageInput);
|
|
27165
27283
|
setMessageInput("");
|
|
27166
27284
|
}, [messageInput, sendMessage]);
|
|
27167
|
-
const handleBackToList = (0,
|
|
27285
|
+
const handleBackToList = (0, import_react90.useCallback)(() => {
|
|
27168
27286
|
setSelectedRoom(null);
|
|
27169
27287
|
setView("list");
|
|
27170
27288
|
onBackToList?.();
|
|
@@ -27217,7 +27335,7 @@ function ChatContent({
|
|
|
27217
27335
|
variant: "solid",
|
|
27218
27336
|
size: "small",
|
|
27219
27337
|
onClick: handleOpenCreateModal,
|
|
27220
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
27338
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react91.PlusIcon, { size: 16 }),
|
|
27221
27339
|
children: "Nova conversa"
|
|
27222
27340
|
}
|
|
27223
27341
|
)
|
|
@@ -27257,7 +27375,7 @@ function ChatContent({
|
|
|
27257
27375
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex h-full", children: [
|
|
27258
27376
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex-1 flex flex-col", children: [
|
|
27259
27377
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "p-4 border-b border-background-200 flex items-center gap-3", children: [
|
|
27260
|
-
/* @__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 }) }),
|
|
27261
27379
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex-1", children: [
|
|
27262
27380
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Text_default, { size: "md", weight: "semibold", className: "text-text-900", children: selectedRoom.name }),
|
|
27263
27381
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Text_default, { size: "xs", className: "text-text-500", children: isConnected ? "Conectado" : "Conectando..." })
|
|
@@ -27286,7 +27404,7 @@ function ChatContent({
|
|
|
27286
27404
|
variant: "solid",
|
|
27287
27405
|
onClick: handleSendMessage,
|
|
27288
27406
|
disabled: !messageInput.trim() || !isConnected,
|
|
27289
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
27407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react91.PaperPlaneTiltIcon, { size: 20 })
|
|
27290
27408
|
}
|
|
27291
27409
|
)
|
|
27292
27410
|
] }) })
|
|
@@ -27370,7 +27488,7 @@ var isChatUserInfoValid = (userInfo) => {
|
|
|
27370
27488
|
};
|
|
27371
27489
|
var getChatWsUrl = (apiUrl) => {
|
|
27372
27490
|
const baseUrl = apiUrl;
|
|
27373
|
-
return baseUrl.replace(/^http/, "ws")
|
|
27491
|
+
return baseUrl.replace(/^http/, "ws");
|
|
27374
27492
|
};
|
|
27375
27493
|
var getChatUserInfo = (user, tokens, sessionInfo, defaultUserName = "Usuario") => {
|
|
27376
27494
|
const userId = String(user?.userInstitutionId ?? sessionInfo?.userId ?? "");
|
|
@@ -27411,7 +27529,7 @@ var CalendarActivityStatus = /* @__PURE__ */ ((CalendarActivityStatus2) => {
|
|
|
27411
27529
|
})(CalendarActivityStatus || {});
|
|
27412
27530
|
|
|
27413
27531
|
// src/hooks/useSendActivity.ts
|
|
27414
|
-
var
|
|
27532
|
+
var import_react92 = require("react");
|
|
27415
27533
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
27416
27534
|
function transformToCategoryConfig(data) {
|
|
27417
27535
|
return [
|
|
@@ -27466,21 +27584,21 @@ function useSendActivity(config) {
|
|
|
27466
27584
|
onSuccess,
|
|
27467
27585
|
onError
|
|
27468
27586
|
} = config;
|
|
27469
|
-
const [isOpen, setIsOpen] = (0,
|
|
27470
|
-
const [selectedModel, setSelectedModel] = (0,
|
|
27587
|
+
const [isOpen, setIsOpen] = (0, import_react92.useState)(false);
|
|
27588
|
+
const [selectedModel, setSelectedModel] = (0, import_react92.useState)(
|
|
27471
27589
|
null
|
|
27472
27590
|
);
|
|
27473
|
-
const [categories, setCategories] = (0,
|
|
27474
|
-
const [isLoading, setIsLoading] = (0,
|
|
27475
|
-
const [isCategoriesLoading, setIsCategoriesLoading] = (0,
|
|
27476
|
-
const categoriesLoadedRef = (0,
|
|
27477
|
-
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)(() => {
|
|
27478
27596
|
if (!selectedModel) return void 0;
|
|
27479
27597
|
return {
|
|
27480
27598
|
title: selectedModel.title
|
|
27481
27599
|
};
|
|
27482
27600
|
}, [selectedModel]);
|
|
27483
|
-
const loadCategories = (0,
|
|
27601
|
+
const loadCategories = (0, import_react92.useCallback)(async () => {
|
|
27484
27602
|
if (categoriesLoadedRef.current) return;
|
|
27485
27603
|
setIsCategoriesLoading(true);
|
|
27486
27604
|
try {
|
|
@@ -27495,7 +27613,7 @@ function useSendActivity(config) {
|
|
|
27495
27613
|
setIsCategoriesLoading(false);
|
|
27496
27614
|
}
|
|
27497
27615
|
}, [fetchCategories, onError]);
|
|
27498
|
-
const openModal = (0,
|
|
27616
|
+
const openModal = (0, import_react92.useCallback)(
|
|
27499
27617
|
(model) => {
|
|
27500
27618
|
setSelectedModel(model);
|
|
27501
27619
|
setIsOpen(true);
|
|
@@ -27503,17 +27621,17 @@ function useSendActivity(config) {
|
|
|
27503
27621
|
},
|
|
27504
27622
|
[loadCategories]
|
|
27505
27623
|
);
|
|
27506
|
-
const closeModal = (0,
|
|
27624
|
+
const closeModal = (0, import_react92.useCallback)(() => {
|
|
27507
27625
|
setIsOpen(false);
|
|
27508
27626
|
setSelectedModel(null);
|
|
27509
27627
|
}, []);
|
|
27510
|
-
const onCategoriesChange = (0,
|
|
27628
|
+
const onCategoriesChange = (0, import_react92.useCallback)(
|
|
27511
27629
|
(updatedCategories) => {
|
|
27512
27630
|
setCategories(updatedCategories);
|
|
27513
27631
|
},
|
|
27514
27632
|
[]
|
|
27515
27633
|
);
|
|
27516
|
-
const handleSubmit = (0,
|
|
27634
|
+
const handleSubmit = (0, import_react92.useCallback)(
|
|
27517
27635
|
async (data) => {
|
|
27518
27636
|
if (!selectedModel) return;
|
|
27519
27637
|
setIsLoading(true);
|
|
@@ -27824,6 +27942,7 @@ function useSendActivity(config) {
|
|
|
27824
27942
|
mapSubjectEnumToName,
|
|
27825
27943
|
mapSubjectNameToEnum,
|
|
27826
27944
|
questionTypeLabels,
|
|
27945
|
+
studentActivityStatusSchema,
|
|
27827
27946
|
supportSchema,
|
|
27828
27947
|
syncDropdownState,
|
|
27829
27948
|
toggleArrayItem,
|
|
@@ -27831,6 +27950,7 @@ function useSendActivity(config) {
|
|
|
27831
27950
|
transformActivityToTableItem,
|
|
27832
27951
|
transformGoalToTableItem,
|
|
27833
27952
|
transformModelToTableItem,
|
|
27953
|
+
useActivityDetails,
|
|
27834
27954
|
useAlertFormStore,
|
|
27835
27955
|
useApiConfig,
|
|
27836
27956
|
useAppContent,
|