analytica-frontend-lib 1.2.65 → 1.2.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivitiesHistory/index.css +4 -0
- package/dist/ActivitiesHistory/index.css.map +1 -1
- package/dist/ActivityCardQuestionBanks/index.css +4 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.css +4 -0
- package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
- package/dist/ActivityDetails/index.css +4 -0
- package/dist/ActivityDetails/index.css.map +1 -1
- package/dist/ActivityFilters/index.css +4 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityPreview/index.css +4 -0
- package/dist/ActivityPreview/index.css.map +1 -1
- package/dist/AlertManager/index.css +4 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.css +4 -0
- package/dist/RecommendedLessonsHistory/index.css.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.css +4 -0
- package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
- package/dist/SendActivityModal/index.css +4 -0
- package/dist/SendActivityModal/index.css.map +1 -1
- package/dist/TableProvider/index.css +4 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +104 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +162 -102
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +4 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12234,7 +12234,7 @@ var createQuestionsListHook = (apiClient) => {
|
|
|
12234
12234
|
|
|
12235
12235
|
// src/components/ActivityCreate/ActivityCreate.tsx
|
|
12236
12236
|
import { useCallback as useCallback5, useEffect as useEffect23, useMemo as useMemo11, useState as useState24, useRef as useRef15 } from "react";
|
|
12237
|
-
import {
|
|
12237
|
+
import { useSearchParams, useNavigate } from "react-router-dom";
|
|
12238
12238
|
import { Funnel } from "phosphor-react";
|
|
12239
12239
|
|
|
12240
12240
|
// src/components/ActivityListQuestions/ActivityListQuestions.tsx
|
|
@@ -12856,8 +12856,10 @@ var CreateActivity = ({
|
|
|
12856
12856
|
onCreateActivity,
|
|
12857
12857
|
onSaveModel
|
|
12858
12858
|
}) => {
|
|
12859
|
-
const
|
|
12859
|
+
const [searchParams] = useSearchParams();
|
|
12860
12860
|
const navigate = useNavigate();
|
|
12861
|
+
const typeParam = searchParams.get("type") || void 0;
|
|
12862
|
+
const idParam = searchParams.get("id") || void 0;
|
|
12861
12863
|
const applyFilters = useQuestionFiltersStore(
|
|
12862
12864
|
(state) => state.applyFilters
|
|
12863
12865
|
);
|
|
@@ -12878,9 +12880,9 @@ var CreateActivity = ({
|
|
|
12878
12880
|
const [loading, setLoading] = useState24(false);
|
|
12879
12881
|
const [questions, setQuestions] = useState24([]);
|
|
12880
12882
|
const [loadingInitialQuestions, setLoadingInitialQuestions] = useState24(false);
|
|
12881
|
-
const [draftId, setDraftId] = useState24(
|
|
12883
|
+
const [draftId, setDraftId] = useState24(idParam ?? null);
|
|
12882
12884
|
const [activityType, setActivityType] = useState24(
|
|
12883
|
-
getTypeFromUrlString(
|
|
12885
|
+
getTypeFromUrlString(typeParam)
|
|
12884
12886
|
);
|
|
12885
12887
|
const [lastSavedAt, setLastSavedAt] = useState24(null);
|
|
12886
12888
|
const [isSaving, setIsSaving] = useState24(false);
|
|
@@ -12930,10 +12932,10 @@ var CreateActivity = ({
|
|
|
12930
12932
|
}, [activity?.id, activity?.filters, resolvedPreFilters]);
|
|
12931
12933
|
useEffect23(() => {
|
|
12932
12934
|
const fetchActivityDraft = async () => {
|
|
12933
|
-
if (
|
|
12935
|
+
if (idParam && idParam !== lastFetchedActivityIdRef.current) {
|
|
12934
12936
|
setLoading(true);
|
|
12935
12937
|
try {
|
|
12936
|
-
const response = await apiClient.get(`/activity-drafts/${
|
|
12938
|
+
const response = await apiClient.get(`/activity-drafts/${idParam}`);
|
|
12937
12939
|
const activityData = "data" in response.data ? response.data.data : response.data;
|
|
12938
12940
|
setActivity(activityData);
|
|
12939
12941
|
setPreFilters(activityData.filters);
|
|
@@ -12942,7 +12944,7 @@ var CreateActivity = ({
|
|
|
12942
12944
|
if (activityData.updatedAt) {
|
|
12943
12945
|
setLastSavedAt(new Date(activityData.updatedAt));
|
|
12944
12946
|
}
|
|
12945
|
-
lastFetchedActivityIdRef.current =
|
|
12947
|
+
lastFetchedActivityIdRef.current = idParam;
|
|
12946
12948
|
} catch (error) {
|
|
12947
12949
|
console.error("Erro ao buscar rascunho da atividade:", error);
|
|
12948
12950
|
addToast({
|
|
@@ -12958,19 +12960,19 @@ var CreateActivity = ({
|
|
|
12958
12960
|
}
|
|
12959
12961
|
};
|
|
12960
12962
|
fetchActivityDraft();
|
|
12961
|
-
}, [
|
|
12963
|
+
}, [idParam, apiClient, addToast]);
|
|
12962
12964
|
useEffect23(() => {
|
|
12963
12965
|
if (activity?.id && activity?.type) {
|
|
12964
12966
|
const urlType = getTypeFromUrl(activity.type);
|
|
12965
|
-
const currentUrlType =
|
|
12966
|
-
const currentUrlId =
|
|
12967
|
+
const currentUrlType = typeParam;
|
|
12968
|
+
const currentUrlId = idParam;
|
|
12967
12969
|
if (!currentUrlType || !currentUrlId || currentUrlId !== activity.id || currentUrlType !== urlType) {
|
|
12968
|
-
navigate(`/criar-atividade
|
|
12970
|
+
navigate(`/criar-atividade?type=${urlType}&id=${activity.id}`, {
|
|
12969
12971
|
replace: true
|
|
12970
12972
|
});
|
|
12971
12973
|
}
|
|
12972
12974
|
}
|
|
12973
|
-
}, [activity?.id, activity?.type,
|
|
12975
|
+
}, [activity?.id, activity?.type, typeParam, idParam, navigate]);
|
|
12974
12976
|
const validateSaveConditions = useCallback5(() => {
|
|
12975
12977
|
if (questions.length === 0 && !hasFirstSaveBeenDone.current) {
|
|
12976
12978
|
return false;
|
|
@@ -13091,7 +13093,7 @@ var CreateActivity = ({
|
|
|
13091
13093
|
lastFetchedActivityIdRef.current = savedDraft.id;
|
|
13092
13094
|
if (wasNewDraft && savedDraft.id) {
|
|
13093
13095
|
const urlType = getTypeFromUrl(savedDraft.type);
|
|
13094
|
-
navigate(`/criar-atividade
|
|
13096
|
+
navigate(`/criar-atividade?type=${urlType}&id=${savedDraft.id}`, {
|
|
13095
13097
|
replace: true
|
|
13096
13098
|
});
|
|
13097
13099
|
}
|
|
@@ -23447,7 +23449,7 @@ var RecommendedLessonsHistory = ({
|
|
|
23447
23449
|
};
|
|
23448
23450
|
|
|
23449
23451
|
// src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
|
|
23450
|
-
import { useMemo as useMemo27 } from "react";
|
|
23452
|
+
import { useMemo as useMemo27, useState as useState45, useCallback as useCallback22 } from "react";
|
|
23451
23453
|
|
|
23452
23454
|
// src/components/RecommendedLessonDetails/components/Breadcrumb.tsx
|
|
23453
23455
|
import { CaretRightIcon as CaretRightIcon2 } from "@phosphor-icons/react";
|
|
@@ -23970,6 +23972,17 @@ var LoadingSkeleton2 = () => /* @__PURE__ */ jsxs76("div", { className: "flex fl
|
|
|
23970
23972
|
/* @__PURE__ */ jsx94("div", { className: "h-44 bg-background-200 rounded-xl" })
|
|
23971
23973
|
] })
|
|
23972
23974
|
] });
|
|
23975
|
+
var ErrorContent = ({ message }) => /* @__PURE__ */ jsxs76("div", { className: "flex flex-col items-center justify-center py-8 gap-3", children: [
|
|
23976
|
+
/* @__PURE__ */ jsx94(
|
|
23977
|
+
Text_default,
|
|
23978
|
+
{
|
|
23979
|
+
as: "span",
|
|
23980
|
+
className: "size-12 rounded-full bg-error-100 flex items-center justify-center",
|
|
23981
|
+
children: /* @__PURE__ */ jsx94(WarningCircleIcon2, { size: 24, className: "text-error-700" })
|
|
23982
|
+
}
|
|
23983
|
+
),
|
|
23984
|
+
/* @__PURE__ */ jsx94(Text_default, { size: "md", className: "text-error-700 text-center", children: message })
|
|
23985
|
+
] });
|
|
23973
23986
|
var PerformanceContent = ({
|
|
23974
23987
|
data,
|
|
23975
23988
|
labels
|
|
@@ -24028,10 +24041,13 @@ var PerformanceContent = ({
|
|
|
24028
24041
|
/* @__PURE__ */ jsx94("div", { className: "flex flex-col gap-2", children: data.lessons.map((lesson) => /* @__PURE__ */ jsx94(LessonAccordionItem, { lesson }, lesson.id)) })
|
|
24029
24042
|
] })
|
|
24030
24043
|
] });
|
|
24031
|
-
var renderModalContent = (loading, data, labels) => {
|
|
24044
|
+
var renderModalContent = (loading, error, data, labels) => {
|
|
24032
24045
|
if (loading) {
|
|
24033
24046
|
return /* @__PURE__ */ jsx94(LoadingSkeleton2, {});
|
|
24034
24047
|
}
|
|
24048
|
+
if (error) {
|
|
24049
|
+
return /* @__PURE__ */ jsx94(ErrorContent, { message: error });
|
|
24050
|
+
}
|
|
24035
24051
|
if (data) {
|
|
24036
24052
|
return /* @__PURE__ */ jsx94(PerformanceContent, { data, labels });
|
|
24037
24053
|
}
|
|
@@ -24042,13 +24058,14 @@ var StudentPerformanceModal = ({
|
|
|
24042
24058
|
onClose,
|
|
24043
24059
|
data,
|
|
24044
24060
|
loading = false,
|
|
24061
|
+
error = null,
|
|
24045
24062
|
labels: customLabels
|
|
24046
24063
|
}) => {
|
|
24047
24064
|
const labels = useMemo26(
|
|
24048
24065
|
() => ({ ...DEFAULT_PERFORMANCE_LABELS, ...customLabels }),
|
|
24049
24066
|
[customLabels]
|
|
24050
24067
|
);
|
|
24051
|
-
if (!data && !loading) {
|
|
24068
|
+
if (!data && !loading && !error) {
|
|
24052
24069
|
return null;
|
|
24053
24070
|
}
|
|
24054
24071
|
return /* @__PURE__ */ jsx94(
|
|
@@ -24059,19 +24076,20 @@ var StudentPerformanceModal = ({
|
|
|
24059
24076
|
title: labels.title,
|
|
24060
24077
|
size: "lg",
|
|
24061
24078
|
contentClassName: "max-h-[70vh] overflow-y-auto",
|
|
24062
|
-
children: renderModalContent(loading, data, labels)
|
|
24079
|
+
children: renderModalContent(loading, error, data, labels)
|
|
24063
24080
|
}
|
|
24064
24081
|
);
|
|
24065
24082
|
};
|
|
24066
24083
|
|
|
24067
24084
|
// src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
|
|
24068
|
-
import { jsx as jsx95, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
24085
|
+
import { Fragment as Fragment23, jsx as jsx95, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
24069
24086
|
var RecommendedLessonDetails = ({
|
|
24087
|
+
goalId,
|
|
24070
24088
|
data,
|
|
24071
24089
|
loading = false,
|
|
24072
24090
|
error = null,
|
|
24073
24091
|
onViewLesson,
|
|
24074
|
-
|
|
24092
|
+
fetchStudentPerformance,
|
|
24075
24093
|
onBreadcrumbClick,
|
|
24076
24094
|
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
24077
24095
|
breadcrumbs,
|
|
@@ -24082,6 +24100,36 @@ var RecommendedLessonDetails = ({
|
|
|
24082
24100
|
() => ({ ...DEFAULT_LABELS, ...customLabels }),
|
|
24083
24101
|
[customLabels]
|
|
24084
24102
|
);
|
|
24103
|
+
const [performanceModalOpen, setPerformanceModalOpen] = useState45(false);
|
|
24104
|
+
const [performanceData, setPerformanceData] = useState45(null);
|
|
24105
|
+
const [performanceLoading, setPerformanceLoading] = useState45(false);
|
|
24106
|
+
const [performanceError, setPerformanceError] = useState45(null);
|
|
24107
|
+
const handleViewStudentPerformance = useCallback22(
|
|
24108
|
+
async (studentId) => {
|
|
24109
|
+
if (!fetchStudentPerformance || !goalId) return;
|
|
24110
|
+
setPerformanceModalOpen(true);
|
|
24111
|
+
setPerformanceLoading(true);
|
|
24112
|
+
setPerformanceData(null);
|
|
24113
|
+
setPerformanceError(null);
|
|
24114
|
+
try {
|
|
24115
|
+
const result = await fetchStudentPerformance(goalId, studentId);
|
|
24116
|
+
setPerformanceData(result);
|
|
24117
|
+
} catch (err) {
|
|
24118
|
+
console.error("Error fetching student performance:", err);
|
|
24119
|
+
setPerformanceError(
|
|
24120
|
+
err instanceof Error ? err.message : "Erro ao carregar desempenho do aluno"
|
|
24121
|
+
);
|
|
24122
|
+
} finally {
|
|
24123
|
+
setPerformanceLoading(false);
|
|
24124
|
+
}
|
|
24125
|
+
},
|
|
24126
|
+
[fetchStudentPerformance, goalId]
|
|
24127
|
+
);
|
|
24128
|
+
const handleClosePerformanceModal = useCallback22(() => {
|
|
24129
|
+
setPerformanceModalOpen(false);
|
|
24130
|
+
setPerformanceData(null);
|
|
24131
|
+
setPerformanceError(null);
|
|
24132
|
+
}, []);
|
|
24085
24133
|
const defaultBreadcrumbs = useMemo27(
|
|
24086
24134
|
() => [
|
|
24087
24135
|
{ label: "Aulas recomendadas", path: "/aulas-recomendadas" },
|
|
@@ -24123,39 +24171,51 @@ var RecommendedLessonDetails = ({
|
|
|
24123
24171
|
if (!data) {
|
|
24124
24172
|
return null;
|
|
24125
24173
|
}
|
|
24126
|
-
return /* @__PURE__ */ jsxs77(
|
|
24127
|
-
|
|
24128
|
-
|
|
24129
|
-
|
|
24130
|
-
|
|
24131
|
-
|
|
24132
|
-
|
|
24133
|
-
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24137
|
-
|
|
24138
|
-
|
|
24139
|
-
|
|
24140
|
-
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
|
|
24148
|
-
|
|
24149
|
-
|
|
24150
|
-
|
|
24151
|
-
|
|
24152
|
-
|
|
24153
|
-
|
|
24174
|
+
return /* @__PURE__ */ jsxs77(Fragment23, { children: [
|
|
24175
|
+
/* @__PURE__ */ jsxs77(
|
|
24176
|
+
"div",
|
|
24177
|
+
{
|
|
24178
|
+
className: cn("flex flex-col gap-6", className),
|
|
24179
|
+
"data-testid": "recommended-lesson-details",
|
|
24180
|
+
children: [
|
|
24181
|
+
/* @__PURE__ */ jsx95(Breadcrumb, { items: breadcrumbItems, onItemClick: onBreadcrumbClick }),
|
|
24182
|
+
/* @__PURE__ */ jsx95(
|
|
24183
|
+
LessonHeader,
|
|
24184
|
+
{
|
|
24185
|
+
data,
|
|
24186
|
+
onViewLesson,
|
|
24187
|
+
mapSubjectNameToEnum: mapSubjectNameToEnum2,
|
|
24188
|
+
viewLessonLabel: labels.viewLesson
|
|
24189
|
+
}
|
|
24190
|
+
),
|
|
24191
|
+
/* @__PURE__ */ jsx95(ResultsSection, { data, labels }),
|
|
24192
|
+
/* @__PURE__ */ jsx95(
|
|
24193
|
+
StudentsTable,
|
|
24194
|
+
{
|
|
24195
|
+
students: displayStudents,
|
|
24196
|
+
onViewPerformance: fetchStudentPerformance ? handleViewStudentPerformance : void 0,
|
|
24197
|
+
labels
|
|
24198
|
+
}
|
|
24199
|
+
)
|
|
24200
|
+
]
|
|
24201
|
+
}
|
|
24202
|
+
),
|
|
24203
|
+
fetchStudentPerformance && /* @__PURE__ */ jsx95(
|
|
24204
|
+
StudentPerformanceModal,
|
|
24205
|
+
{
|
|
24206
|
+
isOpen: performanceModalOpen,
|
|
24207
|
+
onClose: handleClosePerformanceModal,
|
|
24208
|
+
data: performanceData,
|
|
24209
|
+
loading: performanceLoading,
|
|
24210
|
+
error: performanceError
|
|
24211
|
+
}
|
|
24212
|
+
)
|
|
24213
|
+
] });
|
|
24154
24214
|
};
|
|
24155
24215
|
var RecommendedLessonDetails_default = RecommendedLessonDetails;
|
|
24156
24216
|
|
|
24157
24217
|
// src/hooks/useRecommendedLessonDetails.ts
|
|
24158
|
-
import { useState as
|
|
24218
|
+
import { useState as useState46, useCallback as useCallback23, useEffect as useEffect44 } from "react";
|
|
24159
24219
|
import { z as z4 } from "zod";
|
|
24160
24220
|
var goalLessonSubjectSchema = z4.object({
|
|
24161
24221
|
id: z4.string(),
|
|
@@ -24258,12 +24318,12 @@ var handleLessonDetailsFetchError = (error) => {
|
|
|
24258
24318
|
};
|
|
24259
24319
|
var createUseRecommendedLessonDetails = (apiClient) => {
|
|
24260
24320
|
return (lessonId) => {
|
|
24261
|
-
const [state, setState] =
|
|
24321
|
+
const [state, setState] = useState46({
|
|
24262
24322
|
data: null,
|
|
24263
24323
|
loading: true,
|
|
24264
24324
|
error: null
|
|
24265
24325
|
});
|
|
24266
|
-
const fetchLessonDetails =
|
|
24326
|
+
const fetchLessonDetails = useCallback23(async () => {
|
|
24267
24327
|
if (!lessonId) {
|
|
24268
24328
|
setState({
|
|
24269
24329
|
data: null,
|
|
@@ -24321,10 +24381,10 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
24321
24381
|
var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
|
|
24322
24382
|
|
|
24323
24383
|
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
24324
|
-
import { useState as
|
|
24384
|
+
import { useState as useState50 } from "react";
|
|
24325
24385
|
|
|
24326
24386
|
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
24327
|
-
import { useCallback as
|
|
24387
|
+
import { useCallback as useCallback25, useMemo as useMemo28, useRef as useRef26 } from "react";
|
|
24328
24388
|
import { Plus as Plus4 } from "phosphor-react";
|
|
24329
24389
|
|
|
24330
24390
|
// src/components/ActivitiesHistory/components/ErrorDisplay.tsx
|
|
@@ -24566,7 +24626,7 @@ var createHistoryFiltersConfig = (userData) => [
|
|
|
24566
24626
|
];
|
|
24567
24627
|
|
|
24568
24628
|
// src/hooks/useActivitiesHistory.ts
|
|
24569
|
-
import { useState as
|
|
24629
|
+
import { useState as useState47, useCallback as useCallback24 } from "react";
|
|
24570
24630
|
import { z as z6 } from "zod";
|
|
24571
24631
|
import dayjs4 from "dayjs";
|
|
24572
24632
|
|
|
@@ -24638,13 +24698,13 @@ var handleActivityFetchError = createFetchErrorHandler(
|
|
|
24638
24698
|
);
|
|
24639
24699
|
var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
24640
24700
|
return () => {
|
|
24641
|
-
const [state, setState] =
|
|
24701
|
+
const [state, setState] = useState47({
|
|
24642
24702
|
activities: [],
|
|
24643
24703
|
loading: false,
|
|
24644
24704
|
error: null,
|
|
24645
24705
|
pagination: DEFAULT_ACTIVITIES_PAGINATION
|
|
24646
24706
|
});
|
|
24647
|
-
const fetchActivities =
|
|
24707
|
+
const fetchActivities = useCallback24(
|
|
24648
24708
|
async (filters) => {
|
|
24649
24709
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24650
24710
|
try {
|
|
@@ -24712,7 +24772,7 @@ var HistoryTab = ({
|
|
|
24712
24772
|
() => createHistoryTableColumns(mapSubjectNameToEnum2),
|
|
24713
24773
|
[mapSubjectNameToEnum2]
|
|
24714
24774
|
);
|
|
24715
|
-
const handleParamsChange =
|
|
24775
|
+
const handleParamsChange = useCallback25(
|
|
24716
24776
|
(params) => {
|
|
24717
24777
|
const filters = buildHistoryFiltersFromParams(params);
|
|
24718
24778
|
fetchActivities(filters);
|
|
@@ -24795,7 +24855,7 @@ var HistoryTab = ({
|
|
|
24795
24855
|
};
|
|
24796
24856
|
|
|
24797
24857
|
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
24798
|
-
import { useState as
|
|
24858
|
+
import { useState as useState49, useCallback as useCallback27, useMemo as useMemo29, useRef as useRef27, useEffect as useEffect45 } from "react";
|
|
24799
24859
|
import { Plus as Plus5 } from "phosphor-react";
|
|
24800
24860
|
|
|
24801
24861
|
// src/components/ActivitiesHistory/config/modelsTableColumns.tsx
|
|
@@ -24901,7 +24961,7 @@ var createModelsFiltersConfig = (userData) => [
|
|
|
24901
24961
|
];
|
|
24902
24962
|
|
|
24903
24963
|
// src/hooks/useActivityModels.ts
|
|
24904
|
-
import { useState as
|
|
24964
|
+
import { useState as useState48, useCallback as useCallback26 } from "react";
|
|
24905
24965
|
import { z as z7 } from "zod";
|
|
24906
24966
|
import dayjs5 from "dayjs";
|
|
24907
24967
|
var activityDraftFiltersSchema = z7.object({
|
|
@@ -24951,13 +25011,13 @@ var handleModelFetchError = createFetchErrorHandler(
|
|
|
24951
25011
|
);
|
|
24952
25012
|
var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
24953
25013
|
return () => {
|
|
24954
|
-
const [state, setState] =
|
|
25014
|
+
const [state, setState] = useState48({
|
|
24955
25015
|
models: [],
|
|
24956
25016
|
loading: false,
|
|
24957
25017
|
error: null,
|
|
24958
25018
|
pagination: DEFAULT_MODELS_PAGINATION
|
|
24959
25019
|
});
|
|
24960
|
-
const fetchModels =
|
|
25020
|
+
const fetchModels = useCallback26(
|
|
24961
25021
|
async (filters, subjectsMap) => {
|
|
24962
25022
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24963
25023
|
try {
|
|
@@ -24992,7 +25052,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
|
24992
25052
|
},
|
|
24993
25053
|
[fetchActivityModels]
|
|
24994
25054
|
);
|
|
24995
|
-
const deleteModel =
|
|
25055
|
+
const deleteModel = useCallback26(
|
|
24996
25056
|
async (id) => {
|
|
24997
25057
|
try {
|
|
24998
25058
|
await deleteActivityModel(id);
|
|
@@ -25014,7 +25074,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
|
25014
25074
|
var createActivityModelsHook = createUseActivityModels;
|
|
25015
25075
|
|
|
25016
25076
|
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
25017
|
-
import { Fragment as
|
|
25077
|
+
import { Fragment as Fragment24, jsx as jsx102, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
25018
25078
|
var ModelsTab = ({
|
|
25019
25079
|
fetchActivityModels,
|
|
25020
25080
|
deleteActivityModel,
|
|
@@ -25027,8 +25087,8 @@ var ModelsTab = ({
|
|
|
25027
25087
|
userFilterData,
|
|
25028
25088
|
subjectsMap
|
|
25029
25089
|
}) => {
|
|
25030
|
-
const [deleteDialogOpen, setDeleteDialogOpen] =
|
|
25031
|
-
const [modelToDelete, setModelToDelete] =
|
|
25090
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState49(false);
|
|
25091
|
+
const [modelToDelete, setModelToDelete] = useState49(null);
|
|
25032
25092
|
const { addToast } = useToast();
|
|
25033
25093
|
const fetchActivityModelsRef = useRef27(fetchActivityModels);
|
|
25034
25094
|
fetchActivityModelsRef.current = fetchActivityModels;
|
|
@@ -25055,7 +25115,7 @@ var ModelsTab = ({
|
|
|
25055
25115
|
() => createModelsFiltersConfig(userFilterData),
|
|
25056
25116
|
[userFilterData]
|
|
25057
25117
|
);
|
|
25058
|
-
const handleDeleteClick =
|
|
25118
|
+
const handleDeleteClick = useCallback27((model) => {
|
|
25059
25119
|
setModelToDelete(model);
|
|
25060
25120
|
setDeleteDialogOpen(true);
|
|
25061
25121
|
}, []);
|
|
@@ -25068,7 +25128,7 @@ var ModelsTab = ({
|
|
|
25068
25128
|
),
|
|
25069
25129
|
[mapSubjectNameToEnum2, onSendActivity, onEditModel, handleDeleteClick]
|
|
25070
25130
|
);
|
|
25071
|
-
const handleParamsChange =
|
|
25131
|
+
const handleParamsChange = useCallback27(
|
|
25072
25132
|
(params) => {
|
|
25073
25133
|
const filters = buildModelsFiltersFromParams(params);
|
|
25074
25134
|
fetchModels(filters, subjectsMapRef.current);
|
|
@@ -25078,7 +25138,7 @@ var ModelsTab = ({
|
|
|
25078
25138
|
useEffect45(() => {
|
|
25079
25139
|
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
25080
25140
|
}, [fetchModels]);
|
|
25081
|
-
const handleConfirmDelete =
|
|
25141
|
+
const handleConfirmDelete = useCallback27(async () => {
|
|
25082
25142
|
if (modelToDelete) {
|
|
25083
25143
|
const success = await deleteModel(modelToDelete.id);
|
|
25084
25144
|
if (success) {
|
|
@@ -25091,11 +25151,11 @@ var ModelsTab = ({
|
|
|
25091
25151
|
setDeleteDialogOpen(false);
|
|
25092
25152
|
setModelToDelete(null);
|
|
25093
25153
|
}, [modelToDelete, deleteModel, fetchModels, addToast]);
|
|
25094
|
-
const handleCancelDelete =
|
|
25154
|
+
const handleCancelDelete = useCallback27(() => {
|
|
25095
25155
|
setDeleteDialogOpen(false);
|
|
25096
25156
|
setModelToDelete(null);
|
|
25097
25157
|
}, []);
|
|
25098
|
-
return /* @__PURE__ */ jsxs81(
|
|
25158
|
+
return /* @__PURE__ */ jsxs81(Fragment24, { children: [
|
|
25099
25159
|
/* @__PURE__ */ jsx102(Toaster_default, {}),
|
|
25100
25160
|
modelsError ? /* @__PURE__ */ jsx102(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx102("div", { className: "w-full", "data-testid": "activity-models-tab", children: /* @__PURE__ */ jsx102(
|
|
25101
25161
|
TableProvider,
|
|
@@ -25209,7 +25269,7 @@ var ActivitiesHistory = ({
|
|
|
25209
25269
|
userFilterData,
|
|
25210
25270
|
subjectsMap
|
|
25211
25271
|
}) => {
|
|
25212
|
-
const [activeTab, setActiveTab] =
|
|
25272
|
+
const [activeTab, setActiveTab] = useState50("history" /* HISTORY */);
|
|
25213
25273
|
return /* @__PURE__ */ jsxs82(
|
|
25214
25274
|
"div",
|
|
25215
25275
|
{
|
|
@@ -25448,7 +25508,7 @@ var buildUserFilterData = (userData) => ({
|
|
|
25448
25508
|
});
|
|
25449
25509
|
|
|
25450
25510
|
// src/hooks/useChat.ts
|
|
25451
|
-
import { useState as
|
|
25511
|
+
import { useState as useState51, useEffect as useEffect46, useCallback as useCallback28, useRef as useRef28 } from "react";
|
|
25452
25512
|
var WS_STATES = {
|
|
25453
25513
|
CONNECTING: 0,
|
|
25454
25514
|
OPEN: 1,
|
|
@@ -25467,10 +25527,10 @@ function useChat({
|
|
|
25467
25527
|
reconnectInterval = 3e3,
|
|
25468
25528
|
maxReconnectAttempts = 5
|
|
25469
25529
|
}) {
|
|
25470
|
-
const [isConnected, setIsConnected] =
|
|
25471
|
-
const [messages, setMessages] =
|
|
25472
|
-
const [participants, setParticipants] =
|
|
25473
|
-
const [error, setError] =
|
|
25530
|
+
const [isConnected, setIsConnected] = useState51(false);
|
|
25531
|
+
const [messages, setMessages] = useState51([]);
|
|
25532
|
+
const [participants, setParticipants] = useState51([]);
|
|
25533
|
+
const [error, setError] = useState51(null);
|
|
25474
25534
|
const wsRef = useRef28(null);
|
|
25475
25535
|
const reconnectAttemptsRef = useRef28(0);
|
|
25476
25536
|
const reconnectTimeoutRef = useRef28(
|
|
@@ -25480,12 +25540,12 @@ function useChat({
|
|
|
25480
25540
|
const isConnectingRef = useRef28(false);
|
|
25481
25541
|
const connectRef = useRef28(() => {
|
|
25482
25542
|
});
|
|
25483
|
-
const sendWsMessage =
|
|
25543
|
+
const sendWsMessage = useCallback28((message) => {
|
|
25484
25544
|
if (wsRef.current?.readyState === WS_STATES.OPEN) {
|
|
25485
25545
|
wsRef.current.send(JSON.stringify(message));
|
|
25486
25546
|
}
|
|
25487
25547
|
}, []);
|
|
25488
|
-
const sendMessage =
|
|
25548
|
+
const sendMessage = useCallback28(
|
|
25489
25549
|
(content) => {
|
|
25490
25550
|
const trimmedContent = content.trim();
|
|
25491
25551
|
if (!trimmedContent) return;
|
|
@@ -25496,12 +25556,12 @@ function useChat({
|
|
|
25496
25556
|
},
|
|
25497
25557
|
[sendWsMessage]
|
|
25498
25558
|
);
|
|
25499
|
-
const leave =
|
|
25559
|
+
const leave = useCallback28(() => {
|
|
25500
25560
|
isManualDisconnectRef.current = true;
|
|
25501
25561
|
sendWsMessage({ type: "leave" });
|
|
25502
25562
|
wsRef.current?.close(1e3, "User left");
|
|
25503
25563
|
}, [sendWsMessage]);
|
|
25504
|
-
const handleMessage =
|
|
25564
|
+
const handleMessage = useCallback28(
|
|
25505
25565
|
(event) => {
|
|
25506
25566
|
try {
|
|
25507
25567
|
const data = JSON.parse(event.data);
|
|
@@ -25569,7 +25629,7 @@ function useChat({
|
|
|
25569
25629
|
},
|
|
25570
25630
|
[onError]
|
|
25571
25631
|
);
|
|
25572
|
-
const connect =
|
|
25632
|
+
const connect = useCallback28(() => {
|
|
25573
25633
|
if (isConnectingRef.current) {
|
|
25574
25634
|
return;
|
|
25575
25635
|
}
|
|
@@ -25622,7 +25682,7 @@ function useChat({
|
|
|
25622
25682
|
maxReconnectAttempts
|
|
25623
25683
|
]);
|
|
25624
25684
|
connectRef.current = connect;
|
|
25625
|
-
const reconnect =
|
|
25685
|
+
const reconnect = useCallback28(() => {
|
|
25626
25686
|
isManualDisconnectRef.current = false;
|
|
25627
25687
|
reconnectAttemptsRef.current = 0;
|
|
25628
25688
|
connectRef.current();
|
|
@@ -25671,15 +25731,15 @@ function createUseChat(baseWsUrl) {
|
|
|
25671
25731
|
}
|
|
25672
25732
|
|
|
25673
25733
|
// src/hooks/useChatRooms.ts
|
|
25674
|
-
import { useState as
|
|
25734
|
+
import { useState as useState52, useCallback as useCallback29 } from "react";
|
|
25675
25735
|
function useChatRooms({
|
|
25676
25736
|
apiClient
|
|
25677
25737
|
}) {
|
|
25678
|
-
const [rooms, setRooms] =
|
|
25679
|
-
const [availableUsers, setAvailableUsers] =
|
|
25680
|
-
const [loading, setLoading] =
|
|
25681
|
-
const [error, setError] =
|
|
25682
|
-
const fetchRooms =
|
|
25738
|
+
const [rooms, setRooms] = useState52([]);
|
|
25739
|
+
const [availableUsers, setAvailableUsers] = useState52([]);
|
|
25740
|
+
const [loading, setLoading] = useState52(false);
|
|
25741
|
+
const [error, setError] = useState52(null);
|
|
25742
|
+
const fetchRooms = useCallback29(async () => {
|
|
25683
25743
|
setLoading(true);
|
|
25684
25744
|
setError(null);
|
|
25685
25745
|
try {
|
|
@@ -25695,7 +25755,7 @@ function useChatRooms({
|
|
|
25695
25755
|
setLoading(false);
|
|
25696
25756
|
}
|
|
25697
25757
|
}, [apiClient]);
|
|
25698
|
-
const fetchAvailableUsers =
|
|
25758
|
+
const fetchAvailableUsers = useCallback29(async () => {
|
|
25699
25759
|
setLoading(true);
|
|
25700
25760
|
setError(null);
|
|
25701
25761
|
try {
|
|
@@ -25711,7 +25771,7 @@ function useChatRooms({
|
|
|
25711
25771
|
setLoading(false);
|
|
25712
25772
|
}
|
|
25713
25773
|
}, [apiClient]);
|
|
25714
|
-
const createRoom =
|
|
25774
|
+
const createRoom = useCallback29(
|
|
25715
25775
|
async (participantIds) => {
|
|
25716
25776
|
setLoading(true);
|
|
25717
25777
|
setError(null);
|
|
@@ -25735,7 +25795,7 @@ function useChatRooms({
|
|
|
25735
25795
|
},
|
|
25736
25796
|
[apiClient, fetchRooms]
|
|
25737
25797
|
);
|
|
25738
|
-
const clearError =
|
|
25798
|
+
const clearError = useCallback29(() => {
|
|
25739
25799
|
setError(null);
|
|
25740
25800
|
}, []);
|
|
25741
25801
|
return {
|
|
@@ -25769,7 +25829,7 @@ var CHAT_MESSAGE_TYPES = {
|
|
|
25769
25829
|
};
|
|
25770
25830
|
|
|
25771
25831
|
// src/components/Chat/Chat.tsx
|
|
25772
|
-
import { useState as
|
|
25832
|
+
import { useState as useState53, useEffect as useEffect47, useCallback as useCallback30, useRef as useRef29 } from "react";
|
|
25773
25833
|
import {
|
|
25774
25834
|
PaperPlaneTiltIcon as PaperPlaneTiltIcon2,
|
|
25775
25835
|
XIcon,
|
|
@@ -25922,15 +25982,15 @@ function ChatContent({
|
|
|
25922
25982
|
onRoomChange,
|
|
25923
25983
|
onBackToList
|
|
25924
25984
|
}) {
|
|
25925
|
-
const [view, setView] =
|
|
25926
|
-
const [selectedRoom, setSelectedRoom] =
|
|
25985
|
+
const [view, setView] = useState53("list");
|
|
25986
|
+
const [selectedRoom, setSelectedRoom] = useState53(
|
|
25927
25987
|
null
|
|
25928
25988
|
);
|
|
25929
|
-
const [selectedUserIds, setSelectedUserIds] =
|
|
25989
|
+
const [selectedUserIds, setSelectedUserIds] = useState53(
|
|
25930
25990
|
/* @__PURE__ */ new Set()
|
|
25931
25991
|
);
|
|
25932
|
-
const [messageInput, setMessageInput] =
|
|
25933
|
-
const [showCreateModal, setShowCreateModal] =
|
|
25992
|
+
const [messageInput, setMessageInput] = useState53("");
|
|
25993
|
+
const [showCreateModal, setShowCreateModal] = useState53(false);
|
|
25934
25994
|
const hasHandledInitialRoomRef = useRef29(false);
|
|
25935
25995
|
const {
|
|
25936
25996
|
rooms,
|
|
@@ -25984,7 +26044,7 @@ function ChatContent({
|
|
|
25984
26044
|
onBackToList?.();
|
|
25985
26045
|
}
|
|
25986
26046
|
}, [initialRoomId, rooms, roomsLoading, onBackToList]);
|
|
25987
|
-
const handleSelectRoom =
|
|
26047
|
+
const handleSelectRoom = useCallback30(
|
|
25988
26048
|
(room) => {
|
|
25989
26049
|
setSelectedRoom(room);
|
|
25990
26050
|
setView("room");
|
|
@@ -25992,12 +26052,12 @@ function ChatContent({
|
|
|
25992
26052
|
},
|
|
25993
26053
|
[onRoomChange]
|
|
25994
26054
|
);
|
|
25995
|
-
const handleOpenCreateModal =
|
|
26055
|
+
const handleOpenCreateModal = useCallback30(async () => {
|
|
25996
26056
|
await fetchAvailableUsers();
|
|
25997
26057
|
setSelectedUserIds(/* @__PURE__ */ new Set());
|
|
25998
26058
|
setShowCreateModal(true);
|
|
25999
26059
|
}, [fetchAvailableUsers]);
|
|
26000
|
-
const handleToggleUser =
|
|
26060
|
+
const handleToggleUser = useCallback30((id) => {
|
|
26001
26061
|
setSelectedUserIds((prev) => {
|
|
26002
26062
|
const next = new Set(prev);
|
|
26003
26063
|
if (next.has(id)) {
|
|
@@ -26008,7 +26068,7 @@ function ChatContent({
|
|
|
26008
26068
|
return next;
|
|
26009
26069
|
});
|
|
26010
26070
|
}, []);
|
|
26011
|
-
const handleCreateRoom =
|
|
26071
|
+
const handleCreateRoom = useCallback30(async () => {
|
|
26012
26072
|
if (selectedUserIds.size === 0) return;
|
|
26013
26073
|
const room = await createRoom(Array.from(selectedUserIds));
|
|
26014
26074
|
if (room) {
|
|
@@ -26017,12 +26077,12 @@ function ChatContent({
|
|
|
26017
26077
|
onRoomChange?.(room.id);
|
|
26018
26078
|
}
|
|
26019
26079
|
}, [selectedUserIds, createRoom, onRoomChange]);
|
|
26020
|
-
const handleSendMessage =
|
|
26080
|
+
const handleSendMessage = useCallback30(() => {
|
|
26021
26081
|
if (!messageInput.trim()) return;
|
|
26022
26082
|
sendMessage(messageInput);
|
|
26023
26083
|
setMessageInput("");
|
|
26024
26084
|
}, [messageInput, sendMessage]);
|
|
26025
|
-
const handleBackToList =
|
|
26085
|
+
const handleBackToList = useCallback30(() => {
|
|
26026
26086
|
setSelectedRoom(null);
|
|
26027
26087
|
setView("list");
|
|
26028
26088
|
onBackToList?.();
|