analytica-frontend-lib 1.2.87 → 1.2.88
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/QuestionsData/index.d.ts +26 -1
- package/dist/QuestionsData/index.d.ts.map +1 -1
- package/dist/QuestionsData/index.js.map +1 -1
- package/dist/QuestionsData/index.mjs.map +1 -1
- package/dist/StudentRanking/index.d.ts +33 -9
- package/dist/StudentRanking/index.d.ts.map +1 -1
- package/dist/StudentRanking/index.js.map +1 -1
- package/dist/StudentRanking/index.mjs.map +1 -1
- package/dist/hooks/useQuestionsData.d.ts +218 -0
- package/dist/hooks/useQuestionsData.d.ts.map +1 -0
- package/dist/hooks/useStudentsHighlight.d.ts +275 -0
- package/dist/hooks/useStudentsHighlight.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +266 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +238 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -227,6 +227,7 @@ __export(src_exports, {
|
|
|
227
227
|
activitiesHistoryApiResponseSchema: () => activitiesHistoryApiResponseSchema,
|
|
228
228
|
activityModelsApiResponseSchema: () => activityModelsApiResponseSchema,
|
|
229
229
|
buildUserFilterData: () => buildUserFilterData,
|
|
230
|
+
calculatePerformancePercentage: () => calculatePerformancePercentage,
|
|
230
231
|
checkLessonAvailability: () => checkLessonAvailability,
|
|
231
232
|
cn: () => cn,
|
|
232
233
|
convertActivityFiltersToQuestionsFilter: () => convertActivityFiltersToQuestionsFilter,
|
|
@@ -235,12 +236,14 @@ __export(src_exports, {
|
|
|
235
236
|
createActivityModelsHook: () => createActivityModelsHook,
|
|
236
237
|
createNotificationStore: () => createNotificationStore,
|
|
237
238
|
createNotificationsHook: () => createNotificationsHook,
|
|
239
|
+
createQuestionsDataHook: () => createQuestionsDataHook,
|
|
238
240
|
createQuestionsListHook: () => createQuestionsListHook,
|
|
239
241
|
createRecommendedClassDraftsHook: () => createRecommendedClassDraftsHook,
|
|
240
242
|
createRecommendedClassModelsHook: () => createRecommendedClassModelsHook,
|
|
241
243
|
createRecommendedLessonDetailsHook: () => createRecommendedLessonDetailsHook,
|
|
242
244
|
createRecommendedLessonsHistoryHook: () => createRecommendedLessonsHistoryHook,
|
|
243
245
|
createRecommendedLessonsPageHook: () => createRecommendedLessonsPageHook,
|
|
246
|
+
createStudentsHighlightHook: () => createStudentsHighlightHook,
|
|
244
247
|
createUseActivitiesHistory: () => createUseActivitiesHistory,
|
|
245
248
|
createUseActivityFiltersData: () => createUseActivityFiltersData,
|
|
246
249
|
createUseActivityModels: () => createUseActivityModels,
|
|
@@ -248,12 +251,14 @@ __export(src_exports, {
|
|
|
248
251
|
createUseChatRooms: () => createUseChatRooms,
|
|
249
252
|
createUseNotificationStore: () => createUseNotificationStore,
|
|
250
253
|
createUseNotifications: () => createUseNotifications,
|
|
254
|
+
createUseQuestionsData: () => createUseQuestionsData,
|
|
251
255
|
createUseQuestionsList: () => createUseQuestionsList,
|
|
252
256
|
createUseRecommendedClassDrafts: () => createUseRecommendedClassDrafts,
|
|
253
257
|
createUseRecommendedClassModels: () => createUseRecommendedClassModels,
|
|
254
258
|
createUseRecommendedLessonDetails: () => createUseRecommendedLessonDetails,
|
|
255
259
|
createUseRecommendedLessonsHistory: () => createUseRecommendedLessonsHistory,
|
|
256
260
|
createUseRecommendedLessonsPage: () => createUseRecommendedLessonsPage,
|
|
261
|
+
createUseStudentsHighlight: () => createUseStudentsHighlight,
|
|
257
262
|
createZustandAuthAdapter: () => createZustandAuthAdapter,
|
|
258
263
|
deriveStudentStatus: () => deriveStudentStatus,
|
|
259
264
|
determineRecommendedClassStatus: () => determineRecommendedClassStatus,
|
|
@@ -291,9 +296,11 @@ __export(src_exports, {
|
|
|
291
296
|
handleActivityFetchError: () => handleActivityFetchError,
|
|
292
297
|
handleLessonDetailsFetchError: () => handleLessonDetailsFetchError,
|
|
293
298
|
handleModelFetchError: () => handleModelFetchError,
|
|
299
|
+
handleQuestionsDataFetchError: () => handleQuestionsDataFetchError,
|
|
294
300
|
handleRecommendedClassDraftFetchError: () => handleRecommendedClassDraftFetchError,
|
|
295
301
|
handleRecommendedClassFetchError: () => handleRecommendedClassFetchError,
|
|
296
302
|
handleRecommendedClassModelFetchError: () => handleRecommendedClassModelFetchError,
|
|
303
|
+
handleStudentsHighlightFetchError: () => handleStudentsHighlightFetchError,
|
|
297
304
|
historyApiResponseSchema: () => historyApiResponseSchema,
|
|
298
305
|
isChatUserInfoValid: () => isChatUserInfoValid,
|
|
299
306
|
isDeadlinePassed: () => isDeadlinePassed,
|
|
@@ -309,20 +316,24 @@ __export(src_exports, {
|
|
|
309
316
|
mapSubjectEnumToName: () => mapSubjectEnumToName,
|
|
310
317
|
mapSubjectNameToEnum: () => mapSubjectNameToEnum,
|
|
311
318
|
questionTypeLabels: () => questionTypeLabels,
|
|
319
|
+
questionsDataApiResponseSchema: () => questionsDataApiResponseSchema,
|
|
312
320
|
recommendedClassApiResponseSchema: () => recommendedClassApiResponseSchema,
|
|
313
321
|
recommendedClassDetailsApiResponseSchema: () => recommendedClassDetailsApiResponseSchema,
|
|
314
322
|
recommendedClassHistoryApiResponseSchema: () => recommendedClassHistoryApiResponseSchema,
|
|
315
323
|
recommendedClassModelsApiResponseSchema: () => recommendedClassModelsApiResponseSchema,
|
|
316
324
|
renderSubjectCell: () => renderSubjectCell,
|
|
317
325
|
studentActivityStatusSchema: () => studentActivityStatusSchema,
|
|
326
|
+
studentsHighlightApiResponseSchema: () => studentsHighlightApiResponseSchema,
|
|
318
327
|
supportSchema: () => supportSchema,
|
|
319
328
|
syncDropdownState: () => syncDropdownState,
|
|
320
329
|
toggleArrayItem: () => toggleArrayItem,
|
|
321
330
|
toggleSingleValue: () => toggleSingleValue,
|
|
322
331
|
transformActivityToTableItem: () => transformActivityToTableItem,
|
|
323
332
|
transformModelToTableItem: () => transformModelToTableItem,
|
|
333
|
+
transformQuestionsData: () => transformQuestionsData,
|
|
324
334
|
transformRecommendedClassModelToTableItem: () => transformRecommendedClassModelToTableItem,
|
|
325
335
|
transformRecommendedClassToTableItem: () => transformRecommendedClassToTableItem,
|
|
336
|
+
transformStudentHighlightItem: () => transformStudentHighlightItem,
|
|
326
337
|
useActivityDetails: () => useActivityDetails,
|
|
327
338
|
useAlertFormStore: () => useAlertFormStore,
|
|
328
339
|
useApiConfig: () => useApiConfig,
|
|
@@ -4393,12 +4404,12 @@ function useTableSort(data, options = {}) {
|
|
|
4393
4404
|
}
|
|
4394
4405
|
return { column: null, direction: null };
|
|
4395
4406
|
};
|
|
4396
|
-
const
|
|
4407
|
+
const initialState6 = getInitialState();
|
|
4397
4408
|
const [sortColumn, setSortColumn] = (0, import_react15.useState)(
|
|
4398
|
-
|
|
4409
|
+
initialState6.column
|
|
4399
4410
|
);
|
|
4400
4411
|
const [sortDirection, setSortDirection] = (0, import_react15.useState)(
|
|
4401
|
-
|
|
4412
|
+
initialState6.direction
|
|
4402
4413
|
);
|
|
4403
4414
|
(0, import_react15.useEffect)(() => {
|
|
4404
4415
|
if (!syncWithUrl || globalThis.window === void 0) return;
|
|
@@ -29506,6 +29517,187 @@ var ActivitiesHistory = ({
|
|
|
29506
29517
|
);
|
|
29507
29518
|
};
|
|
29508
29519
|
|
|
29520
|
+
// src/hooks/useStudentsHighlight.ts
|
|
29521
|
+
var import_react98 = require("react");
|
|
29522
|
+
var import_zod11 = require("zod");
|
|
29523
|
+
var trendDirectionSchema = import_zod11.z.enum(["up", "down", "stable"]).nullable();
|
|
29524
|
+
var studentHighlightItemSchema = import_zod11.z.object({
|
|
29525
|
+
id: import_zod11.z.string().uuid(),
|
|
29526
|
+
name: import_zod11.z.string(),
|
|
29527
|
+
correctAnswers: import_zod11.z.number().min(0),
|
|
29528
|
+
incorrectAnswers: import_zod11.z.number().min(0),
|
|
29529
|
+
totalQuestions: import_zod11.z.number().min(0),
|
|
29530
|
+
trend: import_zod11.z.number().nullable(),
|
|
29531
|
+
trendDirection: trendDirectionSchema
|
|
29532
|
+
});
|
|
29533
|
+
var studentsHighlightApiResponseSchema = import_zod11.z.object({
|
|
29534
|
+
message: import_zod11.z.string(),
|
|
29535
|
+
data: import_zod11.z.object({
|
|
29536
|
+
topStudents: import_zod11.z.array(studentHighlightItemSchema),
|
|
29537
|
+
bottomStudents: import_zod11.z.array(studentHighlightItemSchema)
|
|
29538
|
+
})
|
|
29539
|
+
});
|
|
29540
|
+
var calculatePerformancePercentage = (correctAnswers, totalQuestions) => {
|
|
29541
|
+
if (totalQuestions === 0) {
|
|
29542
|
+
return 0;
|
|
29543
|
+
}
|
|
29544
|
+
return Math.round(correctAnswers / totalQuestions * 100);
|
|
29545
|
+
};
|
|
29546
|
+
var transformStudentHighlightItem = (item, position) => ({
|
|
29547
|
+
id: item.id,
|
|
29548
|
+
position,
|
|
29549
|
+
name: item.name,
|
|
29550
|
+
percentage: calculatePerformancePercentage(
|
|
29551
|
+
item.correctAnswers,
|
|
29552
|
+
item.totalQuestions
|
|
29553
|
+
),
|
|
29554
|
+
correctAnswers: item.correctAnswers,
|
|
29555
|
+
incorrectAnswers: item.incorrectAnswers,
|
|
29556
|
+
totalQuestions: item.totalQuestions,
|
|
29557
|
+
trend: item.trend,
|
|
29558
|
+
trendDirection: item.trendDirection
|
|
29559
|
+
});
|
|
29560
|
+
var handleStudentsHighlightFetchError = (error) => {
|
|
29561
|
+
if (error instanceof import_zod11.z.ZodError) {
|
|
29562
|
+
console.error("Erro ao validar dados de destaque de estudantes:", error);
|
|
29563
|
+
return "Erro ao validar dados de destaque de estudantes";
|
|
29564
|
+
}
|
|
29565
|
+
console.error("Erro ao carregar destaque de estudantes:", error);
|
|
29566
|
+
return "Erro ao carregar destaque de estudantes";
|
|
29567
|
+
};
|
|
29568
|
+
var initialState4 = {
|
|
29569
|
+
topStudents: [],
|
|
29570
|
+
bottomStudents: [],
|
|
29571
|
+
loading: false,
|
|
29572
|
+
error: null
|
|
29573
|
+
};
|
|
29574
|
+
var createUseStudentsHighlight = (fetchStudentsHighlightApi) => {
|
|
29575
|
+
return () => {
|
|
29576
|
+
const [state, setState] = (0, import_react98.useState)(initialState4);
|
|
29577
|
+
const fetchStudentsHighlight = (0, import_react98.useCallback)(
|
|
29578
|
+
async (filters) => {
|
|
29579
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
29580
|
+
try {
|
|
29581
|
+
const responseData = await fetchStudentsHighlightApi(filters);
|
|
29582
|
+
const validatedData = studentsHighlightApiResponseSchema.parse(responseData);
|
|
29583
|
+
const topStudents = validatedData.data.topStudents.map(
|
|
29584
|
+
(student, index) => transformStudentHighlightItem(student, index + 1)
|
|
29585
|
+
);
|
|
29586
|
+
const bottomStudents = validatedData.data.bottomStudents.map(
|
|
29587
|
+
(student, index) => transformStudentHighlightItem(student, index + 1)
|
|
29588
|
+
);
|
|
29589
|
+
setState({
|
|
29590
|
+
topStudents,
|
|
29591
|
+
bottomStudents,
|
|
29592
|
+
loading: false,
|
|
29593
|
+
error: null
|
|
29594
|
+
});
|
|
29595
|
+
} catch (error) {
|
|
29596
|
+
const errorMessage = handleStudentsHighlightFetchError(error);
|
|
29597
|
+
setState((prev) => ({
|
|
29598
|
+
...prev,
|
|
29599
|
+
loading: false,
|
|
29600
|
+
error: errorMessage
|
|
29601
|
+
}));
|
|
29602
|
+
}
|
|
29603
|
+
},
|
|
29604
|
+
[fetchStudentsHighlightApi]
|
|
29605
|
+
);
|
|
29606
|
+
const reset = (0, import_react98.useCallback)(() => {
|
|
29607
|
+
setState(initialState4);
|
|
29608
|
+
}, []);
|
|
29609
|
+
return {
|
|
29610
|
+
...state,
|
|
29611
|
+
fetchStudentsHighlight,
|
|
29612
|
+
reset
|
|
29613
|
+
};
|
|
29614
|
+
};
|
|
29615
|
+
};
|
|
29616
|
+
var createStudentsHighlightHook = createUseStudentsHighlight;
|
|
29617
|
+
|
|
29618
|
+
// src/hooks/useQuestionsData.ts
|
|
29619
|
+
var import_react99 = require("react");
|
|
29620
|
+
var import_zod12 = require("zod");
|
|
29621
|
+
var trendDirectionSchema2 = import_zod12.z.enum(["up", "down", "stable"]);
|
|
29622
|
+
var trendSchema = import_zod12.z.object({
|
|
29623
|
+
totalQuestions: import_zod12.z.number(),
|
|
29624
|
+
correctPercentage: import_zod12.z.number(),
|
|
29625
|
+
direction: trendDirectionSchema2
|
|
29626
|
+
}).nullable();
|
|
29627
|
+
var questionsDataApiResponseSchema = import_zod12.z.object({
|
|
29628
|
+
message: import_zod12.z.string(),
|
|
29629
|
+
data: import_zod12.z.object({
|
|
29630
|
+
totalQuestions: import_zod12.z.number().min(0),
|
|
29631
|
+
correctQuestions: import_zod12.z.number().min(0),
|
|
29632
|
+
incorrectQuestions: import_zod12.z.number().min(0),
|
|
29633
|
+
blankQuestions: import_zod12.z.number().min(0),
|
|
29634
|
+
correctPercentage: import_zod12.z.number().min(0).max(100),
|
|
29635
|
+
incorrectPercentage: import_zod12.z.number().min(0).max(100),
|
|
29636
|
+
blankPercentage: import_zod12.z.number().min(0).max(100),
|
|
29637
|
+
trend: trendSchema
|
|
29638
|
+
})
|
|
29639
|
+
});
|
|
29640
|
+
var transformQuestionsData = (apiData) => ({
|
|
29641
|
+
total: apiData.totalQuestions,
|
|
29642
|
+
corretas: apiData.correctQuestions,
|
|
29643
|
+
incorretas: apiData.incorrectQuestions,
|
|
29644
|
+
emBranco: apiData.blankQuestions,
|
|
29645
|
+
correctPercentage: apiData.correctPercentage,
|
|
29646
|
+
incorrectPercentage: apiData.incorrectPercentage,
|
|
29647
|
+
blankPercentage: apiData.blankPercentage,
|
|
29648
|
+
trend: apiData.trend
|
|
29649
|
+
});
|
|
29650
|
+
var handleQuestionsDataFetchError = (error) => {
|
|
29651
|
+
if (error instanceof import_zod12.z.ZodError) {
|
|
29652
|
+
console.error("Erro ao validar dados de quest\xF5es:", error);
|
|
29653
|
+
return "Erro ao validar dados de quest\xF5es";
|
|
29654
|
+
}
|
|
29655
|
+
console.error("Erro ao carregar dados de quest\xF5es:", error);
|
|
29656
|
+
return "Erro ao carregar dados de quest\xF5es";
|
|
29657
|
+
};
|
|
29658
|
+
var initialState5 = {
|
|
29659
|
+
data: null,
|
|
29660
|
+
loading: false,
|
|
29661
|
+
error: null
|
|
29662
|
+
};
|
|
29663
|
+
var createUseQuestionsData = (fetchQuestionsDataApi) => {
|
|
29664
|
+
return () => {
|
|
29665
|
+
const [state, setState] = (0, import_react99.useState)(initialState5);
|
|
29666
|
+
const fetchQuestionsData = (0, import_react99.useCallback)(
|
|
29667
|
+
async (filters) => {
|
|
29668
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
29669
|
+
try {
|
|
29670
|
+
const responseData = await fetchQuestionsDataApi(filters);
|
|
29671
|
+
const validatedData = questionsDataApiResponseSchema.parse(responseData);
|
|
29672
|
+
const transformedData = transformQuestionsData(validatedData.data);
|
|
29673
|
+
setState({
|
|
29674
|
+
data: transformedData,
|
|
29675
|
+
loading: false,
|
|
29676
|
+
error: null
|
|
29677
|
+
});
|
|
29678
|
+
} catch (error) {
|
|
29679
|
+
const errorMessage = handleQuestionsDataFetchError(error);
|
|
29680
|
+
setState((prev) => ({
|
|
29681
|
+
...prev,
|
|
29682
|
+
loading: false,
|
|
29683
|
+
error: errorMessage
|
|
29684
|
+
}));
|
|
29685
|
+
}
|
|
29686
|
+
},
|
|
29687
|
+
[fetchQuestionsDataApi]
|
|
29688
|
+
);
|
|
29689
|
+
const reset = (0, import_react99.useCallback)(() => {
|
|
29690
|
+
setState(initialState5);
|
|
29691
|
+
}, []);
|
|
29692
|
+
return {
|
|
29693
|
+
...state,
|
|
29694
|
+
fetchQuestionsData,
|
|
29695
|
+
reset
|
|
29696
|
+
};
|
|
29697
|
+
};
|
|
29698
|
+
};
|
|
29699
|
+
var createQuestionsDataHook = createUseQuestionsData;
|
|
29700
|
+
|
|
29509
29701
|
// src/utils/subjectMappers.ts
|
|
29510
29702
|
var SUBJECT_NAME_MAPPING = {
|
|
29511
29703
|
matem\u00E1tica: "Matem\xE1tica" /* MATEMATICA */,
|
|
@@ -29640,7 +29832,7 @@ var buildUserFilterData = (userData) => ({
|
|
|
29640
29832
|
});
|
|
29641
29833
|
|
|
29642
29834
|
// src/hooks/useChat.ts
|
|
29643
|
-
var
|
|
29835
|
+
var import_react100 = require("react");
|
|
29644
29836
|
var WS_STATES = {
|
|
29645
29837
|
CONNECTING: 0,
|
|
29646
29838
|
OPEN: 1,
|
|
@@ -29659,25 +29851,25 @@ function useChat({
|
|
|
29659
29851
|
reconnectInterval = 3e3,
|
|
29660
29852
|
maxReconnectAttempts = 5
|
|
29661
29853
|
}) {
|
|
29662
|
-
const [isConnected, setIsConnected] = (0,
|
|
29663
|
-
const [messages, setMessages] = (0,
|
|
29664
|
-
const [participants, setParticipants] = (0,
|
|
29665
|
-
const [error, setError] = (0,
|
|
29666
|
-
const wsRef = (0,
|
|
29667
|
-
const reconnectAttemptsRef = (0,
|
|
29668
|
-
const reconnectTimeoutRef = (0,
|
|
29854
|
+
const [isConnected, setIsConnected] = (0, import_react100.useState)(false);
|
|
29855
|
+
const [messages, setMessages] = (0, import_react100.useState)([]);
|
|
29856
|
+
const [participants, setParticipants] = (0, import_react100.useState)([]);
|
|
29857
|
+
const [error, setError] = (0, import_react100.useState)(null);
|
|
29858
|
+
const wsRef = (0, import_react100.useRef)(null);
|
|
29859
|
+
const reconnectAttemptsRef = (0, import_react100.useRef)(0);
|
|
29860
|
+
const reconnectTimeoutRef = (0, import_react100.useRef)(
|
|
29669
29861
|
null
|
|
29670
29862
|
);
|
|
29671
|
-
const isManualDisconnectRef = (0,
|
|
29672
|
-
const isConnectingRef = (0,
|
|
29673
|
-
const connectRef = (0,
|
|
29863
|
+
const isManualDisconnectRef = (0, import_react100.useRef)(false);
|
|
29864
|
+
const isConnectingRef = (0, import_react100.useRef)(false);
|
|
29865
|
+
const connectRef = (0, import_react100.useRef)(() => {
|
|
29674
29866
|
});
|
|
29675
|
-
const sendWsMessage = (0,
|
|
29867
|
+
const sendWsMessage = (0, import_react100.useCallback)((message) => {
|
|
29676
29868
|
if (wsRef.current?.readyState === WS_STATES.OPEN) {
|
|
29677
29869
|
wsRef.current.send(JSON.stringify(message));
|
|
29678
29870
|
}
|
|
29679
29871
|
}, []);
|
|
29680
|
-
const sendMessage = (0,
|
|
29872
|
+
const sendMessage = (0, import_react100.useCallback)(
|
|
29681
29873
|
(content) => {
|
|
29682
29874
|
const trimmedContent = content.trim();
|
|
29683
29875
|
if (!trimmedContent) return;
|
|
@@ -29688,12 +29880,12 @@ function useChat({
|
|
|
29688
29880
|
},
|
|
29689
29881
|
[sendWsMessage]
|
|
29690
29882
|
);
|
|
29691
|
-
const leave = (0,
|
|
29883
|
+
const leave = (0, import_react100.useCallback)(() => {
|
|
29692
29884
|
isManualDisconnectRef.current = true;
|
|
29693
29885
|
sendWsMessage({ type: "leave" });
|
|
29694
29886
|
wsRef.current?.close(1e3, "User left");
|
|
29695
29887
|
}, [sendWsMessage]);
|
|
29696
|
-
const handleMessage = (0,
|
|
29888
|
+
const handleMessage = (0, import_react100.useCallback)(
|
|
29697
29889
|
(event) => {
|
|
29698
29890
|
try {
|
|
29699
29891
|
const data = JSON.parse(event.data);
|
|
@@ -29761,7 +29953,7 @@ function useChat({
|
|
|
29761
29953
|
},
|
|
29762
29954
|
[onError]
|
|
29763
29955
|
);
|
|
29764
|
-
const connect = (0,
|
|
29956
|
+
const connect = (0, import_react100.useCallback)(() => {
|
|
29765
29957
|
if (isConnectingRef.current) {
|
|
29766
29958
|
return;
|
|
29767
29959
|
}
|
|
@@ -29815,12 +30007,12 @@ function useChat({
|
|
|
29815
30007
|
maxReconnectAttempts
|
|
29816
30008
|
]);
|
|
29817
30009
|
connectRef.current = connect;
|
|
29818
|
-
const reconnect = (0,
|
|
30010
|
+
const reconnect = (0, import_react100.useCallback)(() => {
|
|
29819
30011
|
isManualDisconnectRef.current = false;
|
|
29820
30012
|
reconnectAttemptsRef.current = 0;
|
|
29821
30013
|
connectRef.current();
|
|
29822
30014
|
}, []);
|
|
29823
|
-
(0,
|
|
30015
|
+
(0, import_react100.useEffect)(() => {
|
|
29824
30016
|
if (!roomId) {
|
|
29825
30017
|
return;
|
|
29826
30018
|
}
|
|
@@ -29864,15 +30056,15 @@ function createUseChat(baseWsUrl) {
|
|
|
29864
30056
|
}
|
|
29865
30057
|
|
|
29866
30058
|
// src/hooks/useChatRooms.ts
|
|
29867
|
-
var
|
|
30059
|
+
var import_react101 = require("react");
|
|
29868
30060
|
function useChatRooms({
|
|
29869
30061
|
apiClient
|
|
29870
30062
|
}) {
|
|
29871
|
-
const [rooms, setRooms] = (0,
|
|
29872
|
-
const [availableUsers, setAvailableUsers] = (0,
|
|
29873
|
-
const [loading, setLoading] = (0,
|
|
29874
|
-
const [error, setError] = (0,
|
|
29875
|
-
const fetchRooms = (0,
|
|
30063
|
+
const [rooms, setRooms] = (0, import_react101.useState)([]);
|
|
30064
|
+
const [availableUsers, setAvailableUsers] = (0, import_react101.useState)([]);
|
|
30065
|
+
const [loading, setLoading] = (0, import_react101.useState)(false);
|
|
30066
|
+
const [error, setError] = (0, import_react101.useState)(null);
|
|
30067
|
+
const fetchRooms = (0, import_react101.useCallback)(async () => {
|
|
29876
30068
|
setLoading(true);
|
|
29877
30069
|
setError(null);
|
|
29878
30070
|
try {
|
|
@@ -29888,7 +30080,7 @@ function useChatRooms({
|
|
|
29888
30080
|
setLoading(false);
|
|
29889
30081
|
}
|
|
29890
30082
|
}, [apiClient]);
|
|
29891
|
-
const fetchAvailableUsers = (0,
|
|
30083
|
+
const fetchAvailableUsers = (0, import_react101.useCallback)(async () => {
|
|
29892
30084
|
setLoading(true);
|
|
29893
30085
|
setError(null);
|
|
29894
30086
|
try {
|
|
@@ -29904,7 +30096,7 @@ function useChatRooms({
|
|
|
29904
30096
|
setLoading(false);
|
|
29905
30097
|
}
|
|
29906
30098
|
}, [apiClient]);
|
|
29907
|
-
const createRoom = (0,
|
|
30099
|
+
const createRoom = (0, import_react101.useCallback)(
|
|
29908
30100
|
async (participantIds) => {
|
|
29909
30101
|
setLoading(true);
|
|
29910
30102
|
setError(null);
|
|
@@ -29928,7 +30120,7 @@ function useChatRooms({
|
|
|
29928
30120
|
},
|
|
29929
30121
|
[apiClient, fetchRooms]
|
|
29930
30122
|
);
|
|
29931
|
-
const clearError = (0,
|
|
30123
|
+
const clearError = (0, import_react101.useCallback)(() => {
|
|
29932
30124
|
setError(null);
|
|
29933
30125
|
}, []);
|
|
29934
30126
|
return {
|
|
@@ -29962,8 +30154,8 @@ var CHAT_MESSAGE_TYPES = {
|
|
|
29962
30154
|
};
|
|
29963
30155
|
|
|
29964
30156
|
// src/components/Chat/Chat.tsx
|
|
29965
|
-
var
|
|
29966
|
-
var
|
|
30157
|
+
var import_react102 = require("react");
|
|
30158
|
+
var import_react103 = require("@phosphor-icons/react");
|
|
29967
30159
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
29968
30160
|
var RoomItem = ({
|
|
29969
30161
|
room,
|
|
@@ -29980,7 +30172,7 @@ var RoomItem = ({
|
|
|
29980
30172
|
isActive && "bg-primary-50 border-l-4 border-primary-500"
|
|
29981
30173
|
),
|
|
29982
30174
|
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex items-start gap-3 w-full", children: [
|
|
29983
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.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_runtime134.jsx)(
|
|
30175
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.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_runtime134.jsx)(import_react103.UsersIcon, { size: 20, className: "text-primary-600" }) }),
|
|
29984
30176
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
29985
30177
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Text_default, { size: "sm", weight: "semibold", className: "text-text-900 truncate", children: room.name }),
|
|
29986
30178
|
room.lastMessage && /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(Text_default, { size: "xs", className: "text-text-500 truncate mt-1", children: [
|
|
@@ -30110,16 +30302,16 @@ function ChatContent({
|
|
|
30110
30302
|
onRoomChange,
|
|
30111
30303
|
onBackToList
|
|
30112
30304
|
}) {
|
|
30113
|
-
const [view, setView] = (0,
|
|
30114
|
-
const [selectedRoom, setSelectedRoom] = (0,
|
|
30305
|
+
const [view, setView] = (0, import_react102.useState)("list");
|
|
30306
|
+
const [selectedRoom, setSelectedRoom] = (0, import_react102.useState)(
|
|
30115
30307
|
null
|
|
30116
30308
|
);
|
|
30117
|
-
const [selectedUserIds, setSelectedUserIds] = (0,
|
|
30309
|
+
const [selectedUserIds, setSelectedUserIds] = (0, import_react102.useState)(
|
|
30118
30310
|
/* @__PURE__ */ new Set()
|
|
30119
30311
|
);
|
|
30120
|
-
const [messageInput, setMessageInput] = (0,
|
|
30121
|
-
const [showCreateModal, setShowCreateModal] = (0,
|
|
30122
|
-
const hasHandledInitialRoomRef = (0,
|
|
30312
|
+
const [messageInput, setMessageInput] = (0, import_react102.useState)("");
|
|
30313
|
+
const [showCreateModal, setShowCreateModal] = (0, import_react102.useState)(false);
|
|
30314
|
+
const hasHandledInitialRoomRef = (0, import_react102.useRef)(false);
|
|
30123
30315
|
const {
|
|
30124
30316
|
rooms,
|
|
30125
30317
|
availableUsers,
|
|
@@ -30147,10 +30339,10 @@ function ChatContent({
|
|
|
30147
30339
|
const getRoleLabel = () => {
|
|
30148
30340
|
return userRole === "TEACHER" /* TEACHER */ ? "Professor" : "Aluno";
|
|
30149
30341
|
};
|
|
30150
|
-
(0,
|
|
30342
|
+
(0, import_react102.useEffect)(() => {
|
|
30151
30343
|
fetchRooms();
|
|
30152
30344
|
}, [fetchRooms]);
|
|
30153
|
-
(0,
|
|
30345
|
+
(0, import_react102.useEffect)(() => {
|
|
30154
30346
|
if (hasHandledInitialRoomRef.current) {
|
|
30155
30347
|
return;
|
|
30156
30348
|
}
|
|
@@ -30172,7 +30364,7 @@ function ChatContent({
|
|
|
30172
30364
|
onBackToList?.();
|
|
30173
30365
|
}
|
|
30174
30366
|
}, [initialRoomId, rooms, roomsLoading, onBackToList]);
|
|
30175
|
-
const handleSelectRoom = (0,
|
|
30367
|
+
const handleSelectRoom = (0, import_react102.useCallback)(
|
|
30176
30368
|
(room) => {
|
|
30177
30369
|
setSelectedRoom(room);
|
|
30178
30370
|
setView("room");
|
|
@@ -30180,12 +30372,12 @@ function ChatContent({
|
|
|
30180
30372
|
},
|
|
30181
30373
|
[onRoomChange]
|
|
30182
30374
|
);
|
|
30183
|
-
const handleOpenCreateModal = (0,
|
|
30375
|
+
const handleOpenCreateModal = (0, import_react102.useCallback)(async () => {
|
|
30184
30376
|
await fetchAvailableUsers();
|
|
30185
30377
|
setSelectedUserIds(/* @__PURE__ */ new Set());
|
|
30186
30378
|
setShowCreateModal(true);
|
|
30187
30379
|
}, [fetchAvailableUsers]);
|
|
30188
|
-
const handleToggleUser = (0,
|
|
30380
|
+
const handleToggleUser = (0, import_react102.useCallback)((id) => {
|
|
30189
30381
|
setSelectedUserIds((prev) => {
|
|
30190
30382
|
const next = new Set(prev);
|
|
30191
30383
|
if (next.has(id)) {
|
|
@@ -30196,7 +30388,7 @@ function ChatContent({
|
|
|
30196
30388
|
return next;
|
|
30197
30389
|
});
|
|
30198
30390
|
}, []);
|
|
30199
|
-
const handleCreateRoom = (0,
|
|
30391
|
+
const handleCreateRoom = (0, import_react102.useCallback)(async () => {
|
|
30200
30392
|
if (selectedUserIds.size === 0) return;
|
|
30201
30393
|
const room = await createRoom(Array.from(selectedUserIds));
|
|
30202
30394
|
if (room) {
|
|
@@ -30205,12 +30397,12 @@ function ChatContent({
|
|
|
30205
30397
|
onRoomChange?.(room.id);
|
|
30206
30398
|
}
|
|
30207
30399
|
}, [selectedUserIds, createRoom, onRoomChange]);
|
|
30208
|
-
const handleSendMessage = (0,
|
|
30400
|
+
const handleSendMessage = (0, import_react102.useCallback)(() => {
|
|
30209
30401
|
if (!messageInput.trim()) return;
|
|
30210
30402
|
sendMessage(messageInput);
|
|
30211
30403
|
setMessageInput("");
|
|
30212
30404
|
}, [messageInput, sendMessage]);
|
|
30213
|
-
const handleBackToList = (0,
|
|
30405
|
+
const handleBackToList = (0, import_react102.useCallback)(() => {
|
|
30214
30406
|
setSelectedRoom(null);
|
|
30215
30407
|
setView("list");
|
|
30216
30408
|
onBackToList?.();
|
|
@@ -30263,7 +30455,7 @@ function ChatContent({
|
|
|
30263
30455
|
variant: "solid",
|
|
30264
30456
|
size: "small",
|
|
30265
30457
|
onClick: handleOpenCreateModal,
|
|
30266
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
30458
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react103.PlusIcon, { size: 16 }),
|
|
30267
30459
|
children: "Nova conversa"
|
|
30268
30460
|
}
|
|
30269
30461
|
)
|
|
@@ -30303,7 +30495,7 @@ function ChatContent({
|
|
|
30303
30495
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex h-full", children: [
|
|
30304
30496
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex-1 flex flex-col", children: [
|
|
30305
30497
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "p-4 border-b border-background-200 flex items-center gap-3", children: [
|
|
30306
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Button_default, { variant: "link", size: "small", onClick: handleBackToList, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
30498
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Button_default, { variant: "link", size: "small", onClick: handleBackToList, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react103.XIcon, { size: 20 }) }),
|
|
30307
30499
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex-1", children: [
|
|
30308
30500
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Text_default, { size: "md", weight: "semibold", className: "text-text-900", children: selectedRoom.name }),
|
|
30309
30501
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Text_default, { size: "xs", className: "text-text-500", children: isConnected ? "Conectado" : "Conectando..." })
|
|
@@ -30332,7 +30524,7 @@ function ChatContent({
|
|
|
30332
30524
|
variant: "solid",
|
|
30333
30525
|
onClick: handleSendMessage,
|
|
30334
30526
|
disabled: !messageInput.trim() || !isConnected,
|
|
30335
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
30527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react103.PaperPlaneTiltIcon, { size: 20 })
|
|
30336
30528
|
}
|
|
30337
30529
|
)
|
|
30338
30530
|
] }) })
|
|
@@ -30456,7 +30648,7 @@ var CalendarActivityStatus = /* @__PURE__ */ ((CalendarActivityStatus2) => {
|
|
|
30456
30648
|
})(CalendarActivityStatus || {});
|
|
30457
30649
|
|
|
30458
30650
|
// src/hooks/useSendActivity.ts
|
|
30459
|
-
var
|
|
30651
|
+
var import_react104 = require("react");
|
|
30460
30652
|
var import_dayjs8 = __toESM(require("dayjs"));
|
|
30461
30653
|
function transformToCategoryConfig(data) {
|
|
30462
30654
|
return [
|
|
@@ -30511,21 +30703,21 @@ function useSendActivity(config) {
|
|
|
30511
30703
|
onSuccess,
|
|
30512
30704
|
onError
|
|
30513
30705
|
} = config;
|
|
30514
|
-
const [isOpen, setIsOpen] = (0,
|
|
30515
|
-
const [selectedModel, setSelectedModel] = (0,
|
|
30706
|
+
const [isOpen, setIsOpen] = (0, import_react104.useState)(false);
|
|
30707
|
+
const [selectedModel, setSelectedModel] = (0, import_react104.useState)(
|
|
30516
30708
|
null
|
|
30517
30709
|
);
|
|
30518
|
-
const [categories, setCategories] = (0,
|
|
30519
|
-
const [isLoading, setIsLoading] = (0,
|
|
30520
|
-
const [isCategoriesLoading, setIsCategoriesLoading] = (0,
|
|
30521
|
-
const categoriesLoadedRef = (0,
|
|
30522
|
-
const initialData = (0,
|
|
30710
|
+
const [categories, setCategories] = (0, import_react104.useState)([]);
|
|
30711
|
+
const [isLoading, setIsLoading] = (0, import_react104.useState)(false);
|
|
30712
|
+
const [isCategoriesLoading, setIsCategoriesLoading] = (0, import_react104.useState)(false);
|
|
30713
|
+
const categoriesLoadedRef = (0, import_react104.useRef)(false);
|
|
30714
|
+
const initialData = (0, import_react104.useMemo)(() => {
|
|
30523
30715
|
if (!selectedModel) return void 0;
|
|
30524
30716
|
return {
|
|
30525
30717
|
title: selectedModel.title
|
|
30526
30718
|
};
|
|
30527
30719
|
}, [selectedModel]);
|
|
30528
|
-
const loadCategories = (0,
|
|
30720
|
+
const loadCategories = (0, import_react104.useCallback)(async () => {
|
|
30529
30721
|
if (categoriesLoadedRef.current) return;
|
|
30530
30722
|
setIsCategoriesLoading(true);
|
|
30531
30723
|
try {
|
|
@@ -30540,7 +30732,7 @@ function useSendActivity(config) {
|
|
|
30540
30732
|
setIsCategoriesLoading(false);
|
|
30541
30733
|
}
|
|
30542
30734
|
}, [fetchCategories, onError]);
|
|
30543
|
-
const openModal = (0,
|
|
30735
|
+
const openModal = (0, import_react104.useCallback)(
|
|
30544
30736
|
(model) => {
|
|
30545
30737
|
setSelectedModel(model);
|
|
30546
30738
|
setIsOpen(true);
|
|
@@ -30548,17 +30740,17 @@ function useSendActivity(config) {
|
|
|
30548
30740
|
},
|
|
30549
30741
|
[loadCategories]
|
|
30550
30742
|
);
|
|
30551
|
-
const closeModal = (0,
|
|
30743
|
+
const closeModal = (0, import_react104.useCallback)(() => {
|
|
30552
30744
|
setIsOpen(false);
|
|
30553
30745
|
setSelectedModel(null);
|
|
30554
30746
|
}, []);
|
|
30555
|
-
const onCategoriesChange = (0,
|
|
30747
|
+
const onCategoriesChange = (0, import_react104.useCallback)(
|
|
30556
30748
|
(updatedCategories) => {
|
|
30557
30749
|
setCategories(updatedCategories);
|
|
30558
30750
|
},
|
|
30559
30751
|
[]
|
|
30560
30752
|
);
|
|
30561
|
-
const handleSubmit = (0,
|
|
30753
|
+
const handleSubmit = (0, import_react104.useCallback)(
|
|
30562
30754
|
async (data) => {
|
|
30563
30755
|
if (!selectedModel) return;
|
|
30564
30756
|
setIsLoading(true);
|
|
@@ -30809,6 +31001,7 @@ function useSendActivity(config) {
|
|
|
30809
31001
|
activitiesHistoryApiResponseSchema,
|
|
30810
31002
|
activityModelsApiResponseSchema,
|
|
30811
31003
|
buildUserFilterData,
|
|
31004
|
+
calculatePerformancePercentage,
|
|
30812
31005
|
checkLessonAvailability,
|
|
30813
31006
|
cn,
|
|
30814
31007
|
convertActivityFiltersToQuestionsFilter,
|
|
@@ -30817,12 +31010,14 @@ function useSendActivity(config) {
|
|
|
30817
31010
|
createActivityModelsHook,
|
|
30818
31011
|
createNotificationStore,
|
|
30819
31012
|
createNotificationsHook,
|
|
31013
|
+
createQuestionsDataHook,
|
|
30820
31014
|
createQuestionsListHook,
|
|
30821
31015
|
createRecommendedClassDraftsHook,
|
|
30822
31016
|
createRecommendedClassModelsHook,
|
|
30823
31017
|
createRecommendedLessonDetailsHook,
|
|
30824
31018
|
createRecommendedLessonsHistoryHook,
|
|
30825
31019
|
createRecommendedLessonsPageHook,
|
|
31020
|
+
createStudentsHighlightHook,
|
|
30826
31021
|
createUseActivitiesHistory,
|
|
30827
31022
|
createUseActivityFiltersData,
|
|
30828
31023
|
createUseActivityModels,
|
|
@@ -30830,12 +31025,14 @@ function useSendActivity(config) {
|
|
|
30830
31025
|
createUseChatRooms,
|
|
30831
31026
|
createUseNotificationStore,
|
|
30832
31027
|
createUseNotifications,
|
|
31028
|
+
createUseQuestionsData,
|
|
30833
31029
|
createUseQuestionsList,
|
|
30834
31030
|
createUseRecommendedClassDrafts,
|
|
30835
31031
|
createUseRecommendedClassModels,
|
|
30836
31032
|
createUseRecommendedLessonDetails,
|
|
30837
31033
|
createUseRecommendedLessonsHistory,
|
|
30838
31034
|
createUseRecommendedLessonsPage,
|
|
31035
|
+
createUseStudentsHighlight,
|
|
30839
31036
|
createZustandAuthAdapter,
|
|
30840
31037
|
deriveStudentStatus,
|
|
30841
31038
|
determineRecommendedClassStatus,
|
|
@@ -30873,9 +31070,11 @@ function useSendActivity(config) {
|
|
|
30873
31070
|
handleActivityFetchError,
|
|
30874
31071
|
handleLessonDetailsFetchError,
|
|
30875
31072
|
handleModelFetchError,
|
|
31073
|
+
handleQuestionsDataFetchError,
|
|
30876
31074
|
handleRecommendedClassDraftFetchError,
|
|
30877
31075
|
handleRecommendedClassFetchError,
|
|
30878
31076
|
handleRecommendedClassModelFetchError,
|
|
31077
|
+
handleStudentsHighlightFetchError,
|
|
30879
31078
|
historyApiResponseSchema,
|
|
30880
31079
|
isChatUserInfoValid,
|
|
30881
31080
|
isDeadlinePassed,
|
|
@@ -30891,20 +31090,24 @@ function useSendActivity(config) {
|
|
|
30891
31090
|
mapSubjectEnumToName,
|
|
30892
31091
|
mapSubjectNameToEnum,
|
|
30893
31092
|
questionTypeLabels,
|
|
31093
|
+
questionsDataApiResponseSchema,
|
|
30894
31094
|
recommendedClassApiResponseSchema,
|
|
30895
31095
|
recommendedClassDetailsApiResponseSchema,
|
|
30896
31096
|
recommendedClassHistoryApiResponseSchema,
|
|
30897
31097
|
recommendedClassModelsApiResponseSchema,
|
|
30898
31098
|
renderSubjectCell,
|
|
30899
31099
|
studentActivityStatusSchema,
|
|
31100
|
+
studentsHighlightApiResponseSchema,
|
|
30900
31101
|
supportSchema,
|
|
30901
31102
|
syncDropdownState,
|
|
30902
31103
|
toggleArrayItem,
|
|
30903
31104
|
toggleSingleValue,
|
|
30904
31105
|
transformActivityToTableItem,
|
|
30905
31106
|
transformModelToTableItem,
|
|
31107
|
+
transformQuestionsData,
|
|
30906
31108
|
transformRecommendedClassModelToTableItem,
|
|
30907
31109
|
transformRecommendedClassToTableItem,
|
|
31110
|
+
transformStudentHighlightItem,
|
|
30908
31111
|
useActivityDetails,
|
|
30909
31112
|
useAlertFormStore,
|
|
30910
31113
|
useApiConfig,
|