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.mjs
CHANGED
|
@@ -4067,12 +4067,12 @@ function useTableSort(data, options = {}) {
|
|
|
4067
4067
|
}
|
|
4068
4068
|
return { column: null, direction: null };
|
|
4069
4069
|
};
|
|
4070
|
-
const
|
|
4070
|
+
const initialState6 = getInitialState();
|
|
4071
4071
|
const [sortColumn, setSortColumn] = useState7(
|
|
4072
|
-
|
|
4072
|
+
initialState6.column
|
|
4073
4073
|
);
|
|
4074
4074
|
const [sortDirection, setSortDirection] = useState7(
|
|
4075
|
-
|
|
4075
|
+
initialState6.direction
|
|
4076
4076
|
);
|
|
4077
4077
|
useEffect7(() => {
|
|
4078
4078
|
if (!syncWithUrl || globalThis.window === void 0) return;
|
|
@@ -29343,6 +29343,187 @@ var ActivitiesHistory = ({
|
|
|
29343
29343
|
);
|
|
29344
29344
|
};
|
|
29345
29345
|
|
|
29346
|
+
// src/hooks/useStudentsHighlight.ts
|
|
29347
|
+
import { useState as useState57, useCallback as useCallback37 } from "react";
|
|
29348
|
+
import { z as z10 } from "zod";
|
|
29349
|
+
var trendDirectionSchema = z10.enum(["up", "down", "stable"]).nullable();
|
|
29350
|
+
var studentHighlightItemSchema = z10.object({
|
|
29351
|
+
id: z10.string().uuid(),
|
|
29352
|
+
name: z10.string(),
|
|
29353
|
+
correctAnswers: z10.number().min(0),
|
|
29354
|
+
incorrectAnswers: z10.number().min(0),
|
|
29355
|
+
totalQuestions: z10.number().min(0),
|
|
29356
|
+
trend: z10.number().nullable(),
|
|
29357
|
+
trendDirection: trendDirectionSchema
|
|
29358
|
+
});
|
|
29359
|
+
var studentsHighlightApiResponseSchema = z10.object({
|
|
29360
|
+
message: z10.string(),
|
|
29361
|
+
data: z10.object({
|
|
29362
|
+
topStudents: z10.array(studentHighlightItemSchema),
|
|
29363
|
+
bottomStudents: z10.array(studentHighlightItemSchema)
|
|
29364
|
+
})
|
|
29365
|
+
});
|
|
29366
|
+
var calculatePerformancePercentage = (correctAnswers, totalQuestions) => {
|
|
29367
|
+
if (totalQuestions === 0) {
|
|
29368
|
+
return 0;
|
|
29369
|
+
}
|
|
29370
|
+
return Math.round(correctAnswers / totalQuestions * 100);
|
|
29371
|
+
};
|
|
29372
|
+
var transformStudentHighlightItem = (item, position) => ({
|
|
29373
|
+
id: item.id,
|
|
29374
|
+
position,
|
|
29375
|
+
name: item.name,
|
|
29376
|
+
percentage: calculatePerformancePercentage(
|
|
29377
|
+
item.correctAnswers,
|
|
29378
|
+
item.totalQuestions
|
|
29379
|
+
),
|
|
29380
|
+
correctAnswers: item.correctAnswers,
|
|
29381
|
+
incorrectAnswers: item.incorrectAnswers,
|
|
29382
|
+
totalQuestions: item.totalQuestions,
|
|
29383
|
+
trend: item.trend,
|
|
29384
|
+
trendDirection: item.trendDirection
|
|
29385
|
+
});
|
|
29386
|
+
var handleStudentsHighlightFetchError = (error) => {
|
|
29387
|
+
if (error instanceof z10.ZodError) {
|
|
29388
|
+
console.error("Erro ao validar dados de destaque de estudantes:", error);
|
|
29389
|
+
return "Erro ao validar dados de destaque de estudantes";
|
|
29390
|
+
}
|
|
29391
|
+
console.error("Erro ao carregar destaque de estudantes:", error);
|
|
29392
|
+
return "Erro ao carregar destaque de estudantes";
|
|
29393
|
+
};
|
|
29394
|
+
var initialState4 = {
|
|
29395
|
+
topStudents: [],
|
|
29396
|
+
bottomStudents: [],
|
|
29397
|
+
loading: false,
|
|
29398
|
+
error: null
|
|
29399
|
+
};
|
|
29400
|
+
var createUseStudentsHighlight = (fetchStudentsHighlightApi) => {
|
|
29401
|
+
return () => {
|
|
29402
|
+
const [state, setState] = useState57(initialState4);
|
|
29403
|
+
const fetchStudentsHighlight = useCallback37(
|
|
29404
|
+
async (filters) => {
|
|
29405
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
29406
|
+
try {
|
|
29407
|
+
const responseData = await fetchStudentsHighlightApi(filters);
|
|
29408
|
+
const validatedData = studentsHighlightApiResponseSchema.parse(responseData);
|
|
29409
|
+
const topStudents = validatedData.data.topStudents.map(
|
|
29410
|
+
(student, index) => transformStudentHighlightItem(student, index + 1)
|
|
29411
|
+
);
|
|
29412
|
+
const bottomStudents = validatedData.data.bottomStudents.map(
|
|
29413
|
+
(student, index) => transformStudentHighlightItem(student, index + 1)
|
|
29414
|
+
);
|
|
29415
|
+
setState({
|
|
29416
|
+
topStudents,
|
|
29417
|
+
bottomStudents,
|
|
29418
|
+
loading: false,
|
|
29419
|
+
error: null
|
|
29420
|
+
});
|
|
29421
|
+
} catch (error) {
|
|
29422
|
+
const errorMessage = handleStudentsHighlightFetchError(error);
|
|
29423
|
+
setState((prev) => ({
|
|
29424
|
+
...prev,
|
|
29425
|
+
loading: false,
|
|
29426
|
+
error: errorMessage
|
|
29427
|
+
}));
|
|
29428
|
+
}
|
|
29429
|
+
},
|
|
29430
|
+
[fetchStudentsHighlightApi]
|
|
29431
|
+
);
|
|
29432
|
+
const reset = useCallback37(() => {
|
|
29433
|
+
setState(initialState4);
|
|
29434
|
+
}, []);
|
|
29435
|
+
return {
|
|
29436
|
+
...state,
|
|
29437
|
+
fetchStudentsHighlight,
|
|
29438
|
+
reset
|
|
29439
|
+
};
|
|
29440
|
+
};
|
|
29441
|
+
};
|
|
29442
|
+
var createStudentsHighlightHook = createUseStudentsHighlight;
|
|
29443
|
+
|
|
29444
|
+
// src/hooks/useQuestionsData.ts
|
|
29445
|
+
import { useState as useState58, useCallback as useCallback38 } from "react";
|
|
29446
|
+
import { z as z11 } from "zod";
|
|
29447
|
+
var trendDirectionSchema2 = z11.enum(["up", "down", "stable"]);
|
|
29448
|
+
var trendSchema = z11.object({
|
|
29449
|
+
totalQuestions: z11.number(),
|
|
29450
|
+
correctPercentage: z11.number(),
|
|
29451
|
+
direction: trendDirectionSchema2
|
|
29452
|
+
}).nullable();
|
|
29453
|
+
var questionsDataApiResponseSchema = z11.object({
|
|
29454
|
+
message: z11.string(),
|
|
29455
|
+
data: z11.object({
|
|
29456
|
+
totalQuestions: z11.number().min(0),
|
|
29457
|
+
correctQuestions: z11.number().min(0),
|
|
29458
|
+
incorrectQuestions: z11.number().min(0),
|
|
29459
|
+
blankQuestions: z11.number().min(0),
|
|
29460
|
+
correctPercentage: z11.number().min(0).max(100),
|
|
29461
|
+
incorrectPercentage: z11.number().min(0).max(100),
|
|
29462
|
+
blankPercentage: z11.number().min(0).max(100),
|
|
29463
|
+
trend: trendSchema
|
|
29464
|
+
})
|
|
29465
|
+
});
|
|
29466
|
+
var transformQuestionsData = (apiData) => ({
|
|
29467
|
+
total: apiData.totalQuestions,
|
|
29468
|
+
corretas: apiData.correctQuestions,
|
|
29469
|
+
incorretas: apiData.incorrectQuestions,
|
|
29470
|
+
emBranco: apiData.blankQuestions,
|
|
29471
|
+
correctPercentage: apiData.correctPercentage,
|
|
29472
|
+
incorrectPercentage: apiData.incorrectPercentage,
|
|
29473
|
+
blankPercentage: apiData.blankPercentage,
|
|
29474
|
+
trend: apiData.trend
|
|
29475
|
+
});
|
|
29476
|
+
var handleQuestionsDataFetchError = (error) => {
|
|
29477
|
+
if (error instanceof z11.ZodError) {
|
|
29478
|
+
console.error("Erro ao validar dados de quest\xF5es:", error);
|
|
29479
|
+
return "Erro ao validar dados de quest\xF5es";
|
|
29480
|
+
}
|
|
29481
|
+
console.error("Erro ao carregar dados de quest\xF5es:", error);
|
|
29482
|
+
return "Erro ao carregar dados de quest\xF5es";
|
|
29483
|
+
};
|
|
29484
|
+
var initialState5 = {
|
|
29485
|
+
data: null,
|
|
29486
|
+
loading: false,
|
|
29487
|
+
error: null
|
|
29488
|
+
};
|
|
29489
|
+
var createUseQuestionsData = (fetchQuestionsDataApi) => {
|
|
29490
|
+
return () => {
|
|
29491
|
+
const [state, setState] = useState58(initialState5);
|
|
29492
|
+
const fetchQuestionsData = useCallback38(
|
|
29493
|
+
async (filters) => {
|
|
29494
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
29495
|
+
try {
|
|
29496
|
+
const responseData = await fetchQuestionsDataApi(filters);
|
|
29497
|
+
const validatedData = questionsDataApiResponseSchema.parse(responseData);
|
|
29498
|
+
const transformedData = transformQuestionsData(validatedData.data);
|
|
29499
|
+
setState({
|
|
29500
|
+
data: transformedData,
|
|
29501
|
+
loading: false,
|
|
29502
|
+
error: null
|
|
29503
|
+
});
|
|
29504
|
+
} catch (error) {
|
|
29505
|
+
const errorMessage = handleQuestionsDataFetchError(error);
|
|
29506
|
+
setState((prev) => ({
|
|
29507
|
+
...prev,
|
|
29508
|
+
loading: false,
|
|
29509
|
+
error: errorMessage
|
|
29510
|
+
}));
|
|
29511
|
+
}
|
|
29512
|
+
},
|
|
29513
|
+
[fetchQuestionsDataApi]
|
|
29514
|
+
);
|
|
29515
|
+
const reset = useCallback38(() => {
|
|
29516
|
+
setState(initialState5);
|
|
29517
|
+
}, []);
|
|
29518
|
+
return {
|
|
29519
|
+
...state,
|
|
29520
|
+
fetchQuestionsData,
|
|
29521
|
+
reset
|
|
29522
|
+
};
|
|
29523
|
+
};
|
|
29524
|
+
};
|
|
29525
|
+
var createQuestionsDataHook = createUseQuestionsData;
|
|
29526
|
+
|
|
29346
29527
|
// src/utils/subjectMappers.ts
|
|
29347
29528
|
var SUBJECT_NAME_MAPPING = {
|
|
29348
29529
|
matem\u00E1tica: "Matem\xE1tica" /* MATEMATICA */,
|
|
@@ -29477,7 +29658,7 @@ var buildUserFilterData = (userData) => ({
|
|
|
29477
29658
|
});
|
|
29478
29659
|
|
|
29479
29660
|
// src/hooks/useChat.ts
|
|
29480
|
-
import { useState as
|
|
29661
|
+
import { useState as useState59, useEffect as useEffect53, useCallback as useCallback39, useRef as useRef35 } from "react";
|
|
29481
29662
|
var WS_STATES = {
|
|
29482
29663
|
CONNECTING: 0,
|
|
29483
29664
|
OPEN: 1,
|
|
@@ -29496,10 +29677,10 @@ function useChat({
|
|
|
29496
29677
|
reconnectInterval = 3e3,
|
|
29497
29678
|
maxReconnectAttempts = 5
|
|
29498
29679
|
}) {
|
|
29499
|
-
const [isConnected, setIsConnected] =
|
|
29500
|
-
const [messages, setMessages] =
|
|
29501
|
-
const [participants, setParticipants] =
|
|
29502
|
-
const [error, setError] =
|
|
29680
|
+
const [isConnected, setIsConnected] = useState59(false);
|
|
29681
|
+
const [messages, setMessages] = useState59([]);
|
|
29682
|
+
const [participants, setParticipants] = useState59([]);
|
|
29683
|
+
const [error, setError] = useState59(null);
|
|
29503
29684
|
const wsRef = useRef35(null);
|
|
29504
29685
|
const reconnectAttemptsRef = useRef35(0);
|
|
29505
29686
|
const reconnectTimeoutRef = useRef35(
|
|
@@ -29509,12 +29690,12 @@ function useChat({
|
|
|
29509
29690
|
const isConnectingRef = useRef35(false);
|
|
29510
29691
|
const connectRef = useRef35(() => {
|
|
29511
29692
|
});
|
|
29512
|
-
const sendWsMessage =
|
|
29693
|
+
const sendWsMessage = useCallback39((message) => {
|
|
29513
29694
|
if (wsRef.current?.readyState === WS_STATES.OPEN) {
|
|
29514
29695
|
wsRef.current.send(JSON.stringify(message));
|
|
29515
29696
|
}
|
|
29516
29697
|
}, []);
|
|
29517
|
-
const sendMessage =
|
|
29698
|
+
const sendMessage = useCallback39(
|
|
29518
29699
|
(content) => {
|
|
29519
29700
|
const trimmedContent = content.trim();
|
|
29520
29701
|
if (!trimmedContent) return;
|
|
@@ -29525,12 +29706,12 @@ function useChat({
|
|
|
29525
29706
|
},
|
|
29526
29707
|
[sendWsMessage]
|
|
29527
29708
|
);
|
|
29528
|
-
const leave =
|
|
29709
|
+
const leave = useCallback39(() => {
|
|
29529
29710
|
isManualDisconnectRef.current = true;
|
|
29530
29711
|
sendWsMessage({ type: "leave" });
|
|
29531
29712
|
wsRef.current?.close(1e3, "User left");
|
|
29532
29713
|
}, [sendWsMessage]);
|
|
29533
|
-
const handleMessage =
|
|
29714
|
+
const handleMessage = useCallback39(
|
|
29534
29715
|
(event) => {
|
|
29535
29716
|
try {
|
|
29536
29717
|
const data = JSON.parse(event.data);
|
|
@@ -29598,7 +29779,7 @@ function useChat({
|
|
|
29598
29779
|
},
|
|
29599
29780
|
[onError]
|
|
29600
29781
|
);
|
|
29601
|
-
const connect =
|
|
29782
|
+
const connect = useCallback39(() => {
|
|
29602
29783
|
if (isConnectingRef.current) {
|
|
29603
29784
|
return;
|
|
29604
29785
|
}
|
|
@@ -29652,7 +29833,7 @@ function useChat({
|
|
|
29652
29833
|
maxReconnectAttempts
|
|
29653
29834
|
]);
|
|
29654
29835
|
connectRef.current = connect;
|
|
29655
|
-
const reconnect =
|
|
29836
|
+
const reconnect = useCallback39(() => {
|
|
29656
29837
|
isManualDisconnectRef.current = false;
|
|
29657
29838
|
reconnectAttemptsRef.current = 0;
|
|
29658
29839
|
connectRef.current();
|
|
@@ -29701,15 +29882,15 @@ function createUseChat(baseWsUrl) {
|
|
|
29701
29882
|
}
|
|
29702
29883
|
|
|
29703
29884
|
// src/hooks/useChatRooms.ts
|
|
29704
|
-
import { useState as
|
|
29885
|
+
import { useState as useState60, useCallback as useCallback40 } from "react";
|
|
29705
29886
|
function useChatRooms({
|
|
29706
29887
|
apiClient
|
|
29707
29888
|
}) {
|
|
29708
|
-
const [rooms, setRooms] =
|
|
29709
|
-
const [availableUsers, setAvailableUsers] =
|
|
29710
|
-
const [loading, setLoading] =
|
|
29711
|
-
const [error, setError] =
|
|
29712
|
-
const fetchRooms =
|
|
29889
|
+
const [rooms, setRooms] = useState60([]);
|
|
29890
|
+
const [availableUsers, setAvailableUsers] = useState60([]);
|
|
29891
|
+
const [loading, setLoading] = useState60(false);
|
|
29892
|
+
const [error, setError] = useState60(null);
|
|
29893
|
+
const fetchRooms = useCallback40(async () => {
|
|
29713
29894
|
setLoading(true);
|
|
29714
29895
|
setError(null);
|
|
29715
29896
|
try {
|
|
@@ -29725,7 +29906,7 @@ function useChatRooms({
|
|
|
29725
29906
|
setLoading(false);
|
|
29726
29907
|
}
|
|
29727
29908
|
}, [apiClient]);
|
|
29728
|
-
const fetchAvailableUsers =
|
|
29909
|
+
const fetchAvailableUsers = useCallback40(async () => {
|
|
29729
29910
|
setLoading(true);
|
|
29730
29911
|
setError(null);
|
|
29731
29912
|
try {
|
|
@@ -29741,7 +29922,7 @@ function useChatRooms({
|
|
|
29741
29922
|
setLoading(false);
|
|
29742
29923
|
}
|
|
29743
29924
|
}, [apiClient]);
|
|
29744
|
-
const createRoom =
|
|
29925
|
+
const createRoom = useCallback40(
|
|
29745
29926
|
async (participantIds) => {
|
|
29746
29927
|
setLoading(true);
|
|
29747
29928
|
setError(null);
|
|
@@ -29765,7 +29946,7 @@ function useChatRooms({
|
|
|
29765
29946
|
},
|
|
29766
29947
|
[apiClient, fetchRooms]
|
|
29767
29948
|
);
|
|
29768
|
-
const clearError =
|
|
29949
|
+
const clearError = useCallback40(() => {
|
|
29769
29950
|
setError(null);
|
|
29770
29951
|
}, []);
|
|
29771
29952
|
return {
|
|
@@ -29799,7 +29980,7 @@ var CHAT_MESSAGE_TYPES = {
|
|
|
29799
29980
|
};
|
|
29800
29981
|
|
|
29801
29982
|
// src/components/Chat/Chat.tsx
|
|
29802
|
-
import { useState as
|
|
29983
|
+
import { useState as useState61, useEffect as useEffect54, useCallback as useCallback41, useRef as useRef36 } from "react";
|
|
29803
29984
|
import {
|
|
29804
29985
|
PaperPlaneTiltIcon as PaperPlaneTiltIcon2,
|
|
29805
29986
|
XIcon,
|
|
@@ -29952,15 +30133,15 @@ function ChatContent({
|
|
|
29952
30133
|
onRoomChange,
|
|
29953
30134
|
onBackToList
|
|
29954
30135
|
}) {
|
|
29955
|
-
const [view, setView] =
|
|
29956
|
-
const [selectedRoom, setSelectedRoom] =
|
|
30136
|
+
const [view, setView] = useState61("list");
|
|
30137
|
+
const [selectedRoom, setSelectedRoom] = useState61(
|
|
29957
30138
|
null
|
|
29958
30139
|
);
|
|
29959
|
-
const [selectedUserIds, setSelectedUserIds] =
|
|
30140
|
+
const [selectedUserIds, setSelectedUserIds] = useState61(
|
|
29960
30141
|
/* @__PURE__ */ new Set()
|
|
29961
30142
|
);
|
|
29962
|
-
const [messageInput, setMessageInput] =
|
|
29963
|
-
const [showCreateModal, setShowCreateModal] =
|
|
30143
|
+
const [messageInput, setMessageInput] = useState61("");
|
|
30144
|
+
const [showCreateModal, setShowCreateModal] = useState61(false);
|
|
29964
30145
|
const hasHandledInitialRoomRef = useRef36(false);
|
|
29965
30146
|
const {
|
|
29966
30147
|
rooms,
|
|
@@ -30014,7 +30195,7 @@ function ChatContent({
|
|
|
30014
30195
|
onBackToList?.();
|
|
30015
30196
|
}
|
|
30016
30197
|
}, [initialRoomId, rooms, roomsLoading, onBackToList]);
|
|
30017
|
-
const handleSelectRoom =
|
|
30198
|
+
const handleSelectRoom = useCallback41(
|
|
30018
30199
|
(room) => {
|
|
30019
30200
|
setSelectedRoom(room);
|
|
30020
30201
|
setView("room");
|
|
@@ -30022,12 +30203,12 @@ function ChatContent({
|
|
|
30022
30203
|
},
|
|
30023
30204
|
[onRoomChange]
|
|
30024
30205
|
);
|
|
30025
|
-
const handleOpenCreateModal =
|
|
30206
|
+
const handleOpenCreateModal = useCallback41(async () => {
|
|
30026
30207
|
await fetchAvailableUsers();
|
|
30027
30208
|
setSelectedUserIds(/* @__PURE__ */ new Set());
|
|
30028
30209
|
setShowCreateModal(true);
|
|
30029
30210
|
}, [fetchAvailableUsers]);
|
|
30030
|
-
const handleToggleUser =
|
|
30211
|
+
const handleToggleUser = useCallback41((id) => {
|
|
30031
30212
|
setSelectedUserIds((prev) => {
|
|
30032
30213
|
const next = new Set(prev);
|
|
30033
30214
|
if (next.has(id)) {
|
|
@@ -30038,7 +30219,7 @@ function ChatContent({
|
|
|
30038
30219
|
return next;
|
|
30039
30220
|
});
|
|
30040
30221
|
}, []);
|
|
30041
|
-
const handleCreateRoom =
|
|
30222
|
+
const handleCreateRoom = useCallback41(async () => {
|
|
30042
30223
|
if (selectedUserIds.size === 0) return;
|
|
30043
30224
|
const room = await createRoom(Array.from(selectedUserIds));
|
|
30044
30225
|
if (room) {
|
|
@@ -30047,12 +30228,12 @@ function ChatContent({
|
|
|
30047
30228
|
onRoomChange?.(room.id);
|
|
30048
30229
|
}
|
|
30049
30230
|
}, [selectedUserIds, createRoom, onRoomChange]);
|
|
30050
|
-
const handleSendMessage =
|
|
30231
|
+
const handleSendMessage = useCallback41(() => {
|
|
30051
30232
|
if (!messageInput.trim()) return;
|
|
30052
30233
|
sendMessage(messageInput);
|
|
30053
30234
|
setMessageInput("");
|
|
30054
30235
|
}, [messageInput, sendMessage]);
|
|
30055
|
-
const handleBackToList =
|
|
30236
|
+
const handleBackToList = useCallback41(() => {
|
|
30056
30237
|
setSelectedRoom(null);
|
|
30057
30238
|
setView("list");
|
|
30058
30239
|
onBackToList?.();
|
|
@@ -30298,7 +30479,7 @@ var CalendarActivityStatus = /* @__PURE__ */ ((CalendarActivityStatus2) => {
|
|
|
30298
30479
|
})(CalendarActivityStatus || {});
|
|
30299
30480
|
|
|
30300
30481
|
// src/hooks/useSendActivity.ts
|
|
30301
|
-
import { useState as
|
|
30482
|
+
import { useState as useState62, useCallback as useCallback42, useMemo as useMemo33, useRef as useRef37 } from "react";
|
|
30302
30483
|
import dayjs8 from "dayjs";
|
|
30303
30484
|
function transformToCategoryConfig(data) {
|
|
30304
30485
|
return [
|
|
@@ -30353,13 +30534,13 @@ function useSendActivity(config) {
|
|
|
30353
30534
|
onSuccess,
|
|
30354
30535
|
onError
|
|
30355
30536
|
} = config;
|
|
30356
|
-
const [isOpen, setIsOpen] =
|
|
30357
|
-
const [selectedModel, setSelectedModel] =
|
|
30537
|
+
const [isOpen, setIsOpen] = useState62(false);
|
|
30538
|
+
const [selectedModel, setSelectedModel] = useState62(
|
|
30358
30539
|
null
|
|
30359
30540
|
);
|
|
30360
|
-
const [categories, setCategories] =
|
|
30361
|
-
const [isLoading, setIsLoading] =
|
|
30362
|
-
const [isCategoriesLoading, setIsCategoriesLoading] =
|
|
30541
|
+
const [categories, setCategories] = useState62([]);
|
|
30542
|
+
const [isLoading, setIsLoading] = useState62(false);
|
|
30543
|
+
const [isCategoriesLoading, setIsCategoriesLoading] = useState62(false);
|
|
30363
30544
|
const categoriesLoadedRef = useRef37(false);
|
|
30364
30545
|
const initialData = useMemo33(() => {
|
|
30365
30546
|
if (!selectedModel) return void 0;
|
|
@@ -30367,7 +30548,7 @@ function useSendActivity(config) {
|
|
|
30367
30548
|
title: selectedModel.title
|
|
30368
30549
|
};
|
|
30369
30550
|
}, [selectedModel]);
|
|
30370
|
-
const loadCategories =
|
|
30551
|
+
const loadCategories = useCallback42(async () => {
|
|
30371
30552
|
if (categoriesLoadedRef.current) return;
|
|
30372
30553
|
setIsCategoriesLoading(true);
|
|
30373
30554
|
try {
|
|
@@ -30382,7 +30563,7 @@ function useSendActivity(config) {
|
|
|
30382
30563
|
setIsCategoriesLoading(false);
|
|
30383
30564
|
}
|
|
30384
30565
|
}, [fetchCategories, onError]);
|
|
30385
|
-
const openModal =
|
|
30566
|
+
const openModal = useCallback42(
|
|
30386
30567
|
(model) => {
|
|
30387
30568
|
setSelectedModel(model);
|
|
30388
30569
|
setIsOpen(true);
|
|
@@ -30390,17 +30571,17 @@ function useSendActivity(config) {
|
|
|
30390
30571
|
},
|
|
30391
30572
|
[loadCategories]
|
|
30392
30573
|
);
|
|
30393
|
-
const closeModal =
|
|
30574
|
+
const closeModal = useCallback42(() => {
|
|
30394
30575
|
setIsOpen(false);
|
|
30395
30576
|
setSelectedModel(null);
|
|
30396
30577
|
}, []);
|
|
30397
|
-
const onCategoriesChange =
|
|
30578
|
+
const onCategoriesChange = useCallback42(
|
|
30398
30579
|
(updatedCategories) => {
|
|
30399
30580
|
setCategories(updatedCategories);
|
|
30400
30581
|
},
|
|
30401
30582
|
[]
|
|
30402
30583
|
);
|
|
30403
|
-
const handleSubmit =
|
|
30584
|
+
const handleSubmit = useCallback42(
|
|
30404
30585
|
async (data) => {
|
|
30405
30586
|
if (!selectedModel) return;
|
|
30406
30587
|
setIsLoading(true);
|
|
@@ -30650,6 +30831,7 @@ export {
|
|
|
30650
30831
|
activitiesHistoryApiResponseSchema,
|
|
30651
30832
|
activityModelsApiResponseSchema,
|
|
30652
30833
|
buildUserFilterData,
|
|
30834
|
+
calculatePerformancePercentage,
|
|
30653
30835
|
checkLessonAvailability,
|
|
30654
30836
|
cn,
|
|
30655
30837
|
convertActivityFiltersToQuestionsFilter,
|
|
@@ -30658,12 +30840,14 @@ export {
|
|
|
30658
30840
|
createActivityModelsHook,
|
|
30659
30841
|
createNotificationStore,
|
|
30660
30842
|
createNotificationsHook,
|
|
30843
|
+
createQuestionsDataHook,
|
|
30661
30844
|
createQuestionsListHook,
|
|
30662
30845
|
createRecommendedClassDraftsHook,
|
|
30663
30846
|
createRecommendedClassModelsHook,
|
|
30664
30847
|
createRecommendedLessonDetailsHook,
|
|
30665
30848
|
createRecommendedLessonsHistoryHook,
|
|
30666
30849
|
createRecommendedLessonsPageHook,
|
|
30850
|
+
createStudentsHighlightHook,
|
|
30667
30851
|
createUseActivitiesHistory,
|
|
30668
30852
|
createUseActivityFiltersData,
|
|
30669
30853
|
createUseActivityModels,
|
|
@@ -30671,12 +30855,14 @@ export {
|
|
|
30671
30855
|
createUseChatRooms,
|
|
30672
30856
|
createUseNotificationStore,
|
|
30673
30857
|
createUseNotifications,
|
|
30858
|
+
createUseQuestionsData,
|
|
30674
30859
|
createUseQuestionsList,
|
|
30675
30860
|
createUseRecommendedClassDrafts,
|
|
30676
30861
|
createUseRecommendedClassModels,
|
|
30677
30862
|
createUseRecommendedLessonDetails,
|
|
30678
30863
|
createUseRecommendedLessonsHistory,
|
|
30679
30864
|
createUseRecommendedLessonsPage,
|
|
30865
|
+
createUseStudentsHighlight,
|
|
30680
30866
|
createZustandAuthAdapter,
|
|
30681
30867
|
deriveStudentStatus,
|
|
30682
30868
|
determineRecommendedClassStatus,
|
|
@@ -30714,9 +30900,11 @@ export {
|
|
|
30714
30900
|
handleActivityFetchError,
|
|
30715
30901
|
handleLessonDetailsFetchError,
|
|
30716
30902
|
handleModelFetchError,
|
|
30903
|
+
handleQuestionsDataFetchError,
|
|
30717
30904
|
handleRecommendedClassDraftFetchError,
|
|
30718
30905
|
handleRecommendedClassFetchError,
|
|
30719
30906
|
handleRecommendedClassModelFetchError,
|
|
30907
|
+
handleStudentsHighlightFetchError,
|
|
30720
30908
|
historyApiResponseSchema,
|
|
30721
30909
|
isChatUserInfoValid,
|
|
30722
30910
|
isDeadlinePassed,
|
|
@@ -30732,20 +30920,24 @@ export {
|
|
|
30732
30920
|
mapSubjectEnumToName,
|
|
30733
30921
|
mapSubjectNameToEnum,
|
|
30734
30922
|
questionTypeLabels,
|
|
30923
|
+
questionsDataApiResponseSchema,
|
|
30735
30924
|
recommendedClassApiResponseSchema,
|
|
30736
30925
|
recommendedClassDetailsApiResponseSchema,
|
|
30737
30926
|
recommendedClassHistoryApiResponseSchema,
|
|
30738
30927
|
recommendedClassModelsApiResponseSchema,
|
|
30739
30928
|
renderSubjectCell,
|
|
30740
30929
|
studentActivityStatusSchema,
|
|
30930
|
+
studentsHighlightApiResponseSchema,
|
|
30741
30931
|
supportSchema,
|
|
30742
30932
|
syncDropdownState,
|
|
30743
30933
|
toggleArrayItem,
|
|
30744
30934
|
toggleSingleValue,
|
|
30745
30935
|
transformActivityToTableItem,
|
|
30746
30936
|
transformModelToTableItem,
|
|
30937
|
+
transformQuestionsData,
|
|
30747
30938
|
transformRecommendedClassModelToTableItem,
|
|
30748
30939
|
transformRecommendedClassToTableItem,
|
|
30940
|
+
transformStudentHighlightItem,
|
|
30749
30941
|
useActivityDetails,
|
|
30750
30942
|
useAlertFormStore,
|
|
30751
30943
|
useApiConfig,
|