analytica-frontend-lib 1.2.66 → 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/index.mjs CHANGED
@@ -23449,7 +23449,7 @@ var RecommendedLessonsHistory = ({
23449
23449
  };
23450
23450
 
23451
23451
  // src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
23452
- import { useMemo as useMemo27 } from "react";
23452
+ import { useMemo as useMemo27, useState as useState45, useCallback as useCallback22 } from "react";
23453
23453
 
23454
23454
  // src/components/RecommendedLessonDetails/components/Breadcrumb.tsx
23455
23455
  import { CaretRightIcon as CaretRightIcon2 } from "@phosphor-icons/react";
@@ -23972,6 +23972,17 @@ var LoadingSkeleton2 = () => /* @__PURE__ */ jsxs76("div", { className: "flex fl
23972
23972
  /* @__PURE__ */ jsx94("div", { className: "h-44 bg-background-200 rounded-xl" })
23973
23973
  ] })
23974
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
+ ] });
23975
23986
  var PerformanceContent = ({
23976
23987
  data,
23977
23988
  labels
@@ -24030,10 +24041,13 @@ var PerformanceContent = ({
24030
24041
  /* @__PURE__ */ jsx94("div", { className: "flex flex-col gap-2", children: data.lessons.map((lesson) => /* @__PURE__ */ jsx94(LessonAccordionItem, { lesson }, lesson.id)) })
24031
24042
  ] })
24032
24043
  ] });
24033
- var renderModalContent = (loading, data, labels) => {
24044
+ var renderModalContent = (loading, error, data, labels) => {
24034
24045
  if (loading) {
24035
24046
  return /* @__PURE__ */ jsx94(LoadingSkeleton2, {});
24036
24047
  }
24048
+ if (error) {
24049
+ return /* @__PURE__ */ jsx94(ErrorContent, { message: error });
24050
+ }
24037
24051
  if (data) {
24038
24052
  return /* @__PURE__ */ jsx94(PerformanceContent, { data, labels });
24039
24053
  }
@@ -24044,13 +24058,14 @@ var StudentPerformanceModal = ({
24044
24058
  onClose,
24045
24059
  data,
24046
24060
  loading = false,
24061
+ error = null,
24047
24062
  labels: customLabels
24048
24063
  }) => {
24049
24064
  const labels = useMemo26(
24050
24065
  () => ({ ...DEFAULT_PERFORMANCE_LABELS, ...customLabels }),
24051
24066
  [customLabels]
24052
24067
  );
24053
- if (!data && !loading) {
24068
+ if (!data && !loading && !error) {
24054
24069
  return null;
24055
24070
  }
24056
24071
  return /* @__PURE__ */ jsx94(
@@ -24061,19 +24076,20 @@ var StudentPerformanceModal = ({
24061
24076
  title: labels.title,
24062
24077
  size: "lg",
24063
24078
  contentClassName: "max-h-[70vh] overflow-y-auto",
24064
- children: renderModalContent(loading, data, labels)
24079
+ children: renderModalContent(loading, error, data, labels)
24065
24080
  }
24066
24081
  );
24067
24082
  };
24068
24083
 
24069
24084
  // src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
24070
- 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";
24071
24086
  var RecommendedLessonDetails = ({
24087
+ goalId,
24072
24088
  data,
24073
24089
  loading = false,
24074
24090
  error = null,
24075
24091
  onViewLesson,
24076
- onViewStudentPerformance,
24092
+ fetchStudentPerformance,
24077
24093
  onBreadcrumbClick,
24078
24094
  mapSubjectNameToEnum: mapSubjectNameToEnum2,
24079
24095
  breadcrumbs,
@@ -24084,6 +24100,36 @@ var RecommendedLessonDetails = ({
24084
24100
  () => ({ ...DEFAULT_LABELS, ...customLabels }),
24085
24101
  [customLabels]
24086
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
+ }, []);
24087
24133
  const defaultBreadcrumbs = useMemo27(
24088
24134
  () => [
24089
24135
  { label: "Aulas recomendadas", path: "/aulas-recomendadas" },
@@ -24125,39 +24171,51 @@ var RecommendedLessonDetails = ({
24125
24171
  if (!data) {
24126
24172
  return null;
24127
24173
  }
24128
- return /* @__PURE__ */ jsxs77(
24129
- "div",
24130
- {
24131
- className: cn("flex flex-col gap-6", className),
24132
- "data-testid": "recommended-lesson-details",
24133
- children: [
24134
- /* @__PURE__ */ jsx95(Breadcrumb, { items: breadcrumbItems, onItemClick: onBreadcrumbClick }),
24135
- /* @__PURE__ */ jsx95(
24136
- LessonHeader,
24137
- {
24138
- data,
24139
- onViewLesson,
24140
- mapSubjectNameToEnum: mapSubjectNameToEnum2,
24141
- viewLessonLabel: labels.viewLesson
24142
- }
24143
- ),
24144
- /* @__PURE__ */ jsx95(ResultsSection, { data, labels }),
24145
- /* @__PURE__ */ jsx95(
24146
- StudentsTable,
24147
- {
24148
- students: displayStudents,
24149
- onViewPerformance: onViewStudentPerformance,
24150
- labels
24151
- }
24152
- )
24153
- ]
24154
- }
24155
- );
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
+ ] });
24156
24214
  };
24157
24215
  var RecommendedLessonDetails_default = RecommendedLessonDetails;
24158
24216
 
24159
24217
  // src/hooks/useRecommendedLessonDetails.ts
24160
- import { useState as useState45, useCallback as useCallback22, useEffect as useEffect44 } from "react";
24218
+ import { useState as useState46, useCallback as useCallback23, useEffect as useEffect44 } from "react";
24161
24219
  import { z as z4 } from "zod";
24162
24220
  var goalLessonSubjectSchema = z4.object({
24163
24221
  id: z4.string(),
@@ -24260,12 +24318,12 @@ var handleLessonDetailsFetchError = (error) => {
24260
24318
  };
24261
24319
  var createUseRecommendedLessonDetails = (apiClient) => {
24262
24320
  return (lessonId) => {
24263
- const [state, setState] = useState45({
24321
+ const [state, setState] = useState46({
24264
24322
  data: null,
24265
24323
  loading: true,
24266
24324
  error: null
24267
24325
  });
24268
- const fetchLessonDetails = useCallback22(async () => {
24326
+ const fetchLessonDetails = useCallback23(async () => {
24269
24327
  if (!lessonId) {
24270
24328
  setState({
24271
24329
  data: null,
@@ -24323,10 +24381,10 @@ var createUseRecommendedLessonDetails = (apiClient) => {
24323
24381
  var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
24324
24382
 
24325
24383
  // src/components/ActivitiesHistory/ActivitiesHistory.tsx
24326
- import { useState as useState49 } from "react";
24384
+ import { useState as useState50 } from "react";
24327
24385
 
24328
24386
  // src/components/ActivitiesHistory/tabs/HistoryTab.tsx
24329
- import { useCallback as useCallback24, useMemo as useMemo28, useRef as useRef26 } from "react";
24387
+ import { useCallback as useCallback25, useMemo as useMemo28, useRef as useRef26 } from "react";
24330
24388
  import { Plus as Plus4 } from "phosphor-react";
24331
24389
 
24332
24390
  // src/components/ActivitiesHistory/components/ErrorDisplay.tsx
@@ -24568,7 +24626,7 @@ var createHistoryFiltersConfig = (userData) => [
24568
24626
  ];
24569
24627
 
24570
24628
  // src/hooks/useActivitiesHistory.ts
24571
- import { useState as useState46, useCallback as useCallback23 } from "react";
24629
+ import { useState as useState47, useCallback as useCallback24 } from "react";
24572
24630
  import { z as z6 } from "zod";
24573
24631
  import dayjs4 from "dayjs";
24574
24632
 
@@ -24640,13 +24698,13 @@ var handleActivityFetchError = createFetchErrorHandler(
24640
24698
  );
24641
24699
  var createUseActivitiesHistory = (fetchActivitiesHistory) => {
24642
24700
  return () => {
24643
- const [state, setState] = useState46({
24701
+ const [state, setState] = useState47({
24644
24702
  activities: [],
24645
24703
  loading: false,
24646
24704
  error: null,
24647
24705
  pagination: DEFAULT_ACTIVITIES_PAGINATION
24648
24706
  });
24649
- const fetchActivities = useCallback23(
24707
+ const fetchActivities = useCallback24(
24650
24708
  async (filters) => {
24651
24709
  setState((prev) => ({ ...prev, loading: true, error: null }));
24652
24710
  try {
@@ -24714,7 +24772,7 @@ var HistoryTab = ({
24714
24772
  () => createHistoryTableColumns(mapSubjectNameToEnum2),
24715
24773
  [mapSubjectNameToEnum2]
24716
24774
  );
24717
- const handleParamsChange = useCallback24(
24775
+ const handleParamsChange = useCallback25(
24718
24776
  (params) => {
24719
24777
  const filters = buildHistoryFiltersFromParams(params);
24720
24778
  fetchActivities(filters);
@@ -24797,7 +24855,7 @@ var HistoryTab = ({
24797
24855
  };
24798
24856
 
24799
24857
  // src/components/ActivitiesHistory/tabs/ModelsTab.tsx
24800
- import { useState as useState48, useCallback as useCallback26, useMemo as useMemo29, useRef as useRef27, useEffect as useEffect45 } from "react";
24858
+ import { useState as useState49, useCallback as useCallback27, useMemo as useMemo29, useRef as useRef27, useEffect as useEffect45 } from "react";
24801
24859
  import { Plus as Plus5 } from "phosphor-react";
24802
24860
 
24803
24861
  // src/components/ActivitiesHistory/config/modelsTableColumns.tsx
@@ -24903,7 +24961,7 @@ var createModelsFiltersConfig = (userData) => [
24903
24961
  ];
24904
24962
 
24905
24963
  // src/hooks/useActivityModels.ts
24906
- import { useState as useState47, useCallback as useCallback25 } from "react";
24964
+ import { useState as useState48, useCallback as useCallback26 } from "react";
24907
24965
  import { z as z7 } from "zod";
24908
24966
  import dayjs5 from "dayjs";
24909
24967
  var activityDraftFiltersSchema = z7.object({
@@ -24953,13 +25011,13 @@ var handleModelFetchError = createFetchErrorHandler(
24953
25011
  );
24954
25012
  var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
24955
25013
  return () => {
24956
- const [state, setState] = useState47({
25014
+ const [state, setState] = useState48({
24957
25015
  models: [],
24958
25016
  loading: false,
24959
25017
  error: null,
24960
25018
  pagination: DEFAULT_MODELS_PAGINATION
24961
25019
  });
24962
- const fetchModels = useCallback25(
25020
+ const fetchModels = useCallback26(
24963
25021
  async (filters, subjectsMap) => {
24964
25022
  setState((prev) => ({ ...prev, loading: true, error: null }));
24965
25023
  try {
@@ -24994,7 +25052,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
24994
25052
  },
24995
25053
  [fetchActivityModels]
24996
25054
  );
24997
- const deleteModel = useCallback25(
25055
+ const deleteModel = useCallback26(
24998
25056
  async (id) => {
24999
25057
  try {
25000
25058
  await deleteActivityModel(id);
@@ -25016,7 +25074,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
25016
25074
  var createActivityModelsHook = createUseActivityModels;
25017
25075
 
25018
25076
  // src/components/ActivitiesHistory/tabs/ModelsTab.tsx
25019
- import { Fragment as Fragment23, jsx as jsx102, jsxs as jsxs81 } from "react/jsx-runtime";
25077
+ import { Fragment as Fragment24, jsx as jsx102, jsxs as jsxs81 } from "react/jsx-runtime";
25020
25078
  var ModelsTab = ({
25021
25079
  fetchActivityModels,
25022
25080
  deleteActivityModel,
@@ -25029,8 +25087,8 @@ var ModelsTab = ({
25029
25087
  userFilterData,
25030
25088
  subjectsMap
25031
25089
  }) => {
25032
- const [deleteDialogOpen, setDeleteDialogOpen] = useState48(false);
25033
- const [modelToDelete, setModelToDelete] = useState48(null);
25090
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState49(false);
25091
+ const [modelToDelete, setModelToDelete] = useState49(null);
25034
25092
  const { addToast } = useToast();
25035
25093
  const fetchActivityModelsRef = useRef27(fetchActivityModels);
25036
25094
  fetchActivityModelsRef.current = fetchActivityModels;
@@ -25057,7 +25115,7 @@ var ModelsTab = ({
25057
25115
  () => createModelsFiltersConfig(userFilterData),
25058
25116
  [userFilterData]
25059
25117
  );
25060
- const handleDeleteClick = useCallback26((model) => {
25118
+ const handleDeleteClick = useCallback27((model) => {
25061
25119
  setModelToDelete(model);
25062
25120
  setDeleteDialogOpen(true);
25063
25121
  }, []);
@@ -25070,7 +25128,7 @@ var ModelsTab = ({
25070
25128
  ),
25071
25129
  [mapSubjectNameToEnum2, onSendActivity, onEditModel, handleDeleteClick]
25072
25130
  );
25073
- const handleParamsChange = useCallback26(
25131
+ const handleParamsChange = useCallback27(
25074
25132
  (params) => {
25075
25133
  const filters = buildModelsFiltersFromParams(params);
25076
25134
  fetchModels(filters, subjectsMapRef.current);
@@ -25080,7 +25138,7 @@ var ModelsTab = ({
25080
25138
  useEffect45(() => {
25081
25139
  fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
25082
25140
  }, [fetchModels]);
25083
- const handleConfirmDelete = useCallback26(async () => {
25141
+ const handleConfirmDelete = useCallback27(async () => {
25084
25142
  if (modelToDelete) {
25085
25143
  const success = await deleteModel(modelToDelete.id);
25086
25144
  if (success) {
@@ -25093,11 +25151,11 @@ var ModelsTab = ({
25093
25151
  setDeleteDialogOpen(false);
25094
25152
  setModelToDelete(null);
25095
25153
  }, [modelToDelete, deleteModel, fetchModels, addToast]);
25096
- const handleCancelDelete = useCallback26(() => {
25154
+ const handleCancelDelete = useCallback27(() => {
25097
25155
  setDeleteDialogOpen(false);
25098
25156
  setModelToDelete(null);
25099
25157
  }, []);
25100
- return /* @__PURE__ */ jsxs81(Fragment23, { children: [
25158
+ return /* @__PURE__ */ jsxs81(Fragment24, { children: [
25101
25159
  /* @__PURE__ */ jsx102(Toaster_default, {}),
25102
25160
  modelsError ? /* @__PURE__ */ jsx102(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx102("div", { className: "w-full", "data-testid": "activity-models-tab", children: /* @__PURE__ */ jsx102(
25103
25161
  TableProvider,
@@ -25211,7 +25269,7 @@ var ActivitiesHistory = ({
25211
25269
  userFilterData,
25212
25270
  subjectsMap
25213
25271
  }) => {
25214
- const [activeTab, setActiveTab] = useState49("history" /* HISTORY */);
25272
+ const [activeTab, setActiveTab] = useState50("history" /* HISTORY */);
25215
25273
  return /* @__PURE__ */ jsxs82(
25216
25274
  "div",
25217
25275
  {
@@ -25450,7 +25508,7 @@ var buildUserFilterData = (userData) => ({
25450
25508
  });
25451
25509
 
25452
25510
  // src/hooks/useChat.ts
25453
- import { useState as useState50, useEffect as useEffect46, useCallback as useCallback27, useRef as useRef28 } from "react";
25511
+ import { useState as useState51, useEffect as useEffect46, useCallback as useCallback28, useRef as useRef28 } from "react";
25454
25512
  var WS_STATES = {
25455
25513
  CONNECTING: 0,
25456
25514
  OPEN: 1,
@@ -25469,10 +25527,10 @@ function useChat({
25469
25527
  reconnectInterval = 3e3,
25470
25528
  maxReconnectAttempts = 5
25471
25529
  }) {
25472
- const [isConnected, setIsConnected] = useState50(false);
25473
- const [messages, setMessages] = useState50([]);
25474
- const [participants, setParticipants] = useState50([]);
25475
- const [error, setError] = useState50(null);
25530
+ const [isConnected, setIsConnected] = useState51(false);
25531
+ const [messages, setMessages] = useState51([]);
25532
+ const [participants, setParticipants] = useState51([]);
25533
+ const [error, setError] = useState51(null);
25476
25534
  const wsRef = useRef28(null);
25477
25535
  const reconnectAttemptsRef = useRef28(0);
25478
25536
  const reconnectTimeoutRef = useRef28(
@@ -25482,12 +25540,12 @@ function useChat({
25482
25540
  const isConnectingRef = useRef28(false);
25483
25541
  const connectRef = useRef28(() => {
25484
25542
  });
25485
- const sendWsMessage = useCallback27((message) => {
25543
+ const sendWsMessage = useCallback28((message) => {
25486
25544
  if (wsRef.current?.readyState === WS_STATES.OPEN) {
25487
25545
  wsRef.current.send(JSON.stringify(message));
25488
25546
  }
25489
25547
  }, []);
25490
- const sendMessage = useCallback27(
25548
+ const sendMessage = useCallback28(
25491
25549
  (content) => {
25492
25550
  const trimmedContent = content.trim();
25493
25551
  if (!trimmedContent) return;
@@ -25498,12 +25556,12 @@ function useChat({
25498
25556
  },
25499
25557
  [sendWsMessage]
25500
25558
  );
25501
- const leave = useCallback27(() => {
25559
+ const leave = useCallback28(() => {
25502
25560
  isManualDisconnectRef.current = true;
25503
25561
  sendWsMessage({ type: "leave" });
25504
25562
  wsRef.current?.close(1e3, "User left");
25505
25563
  }, [sendWsMessage]);
25506
- const handleMessage = useCallback27(
25564
+ const handleMessage = useCallback28(
25507
25565
  (event) => {
25508
25566
  try {
25509
25567
  const data = JSON.parse(event.data);
@@ -25571,7 +25629,7 @@ function useChat({
25571
25629
  },
25572
25630
  [onError]
25573
25631
  );
25574
- const connect = useCallback27(() => {
25632
+ const connect = useCallback28(() => {
25575
25633
  if (isConnectingRef.current) {
25576
25634
  return;
25577
25635
  }
@@ -25624,7 +25682,7 @@ function useChat({
25624
25682
  maxReconnectAttempts
25625
25683
  ]);
25626
25684
  connectRef.current = connect;
25627
- const reconnect = useCallback27(() => {
25685
+ const reconnect = useCallback28(() => {
25628
25686
  isManualDisconnectRef.current = false;
25629
25687
  reconnectAttemptsRef.current = 0;
25630
25688
  connectRef.current();
@@ -25673,15 +25731,15 @@ function createUseChat(baseWsUrl) {
25673
25731
  }
25674
25732
 
25675
25733
  // src/hooks/useChatRooms.ts
25676
- import { useState as useState51, useCallback as useCallback28 } from "react";
25734
+ import { useState as useState52, useCallback as useCallback29 } from "react";
25677
25735
  function useChatRooms({
25678
25736
  apiClient
25679
25737
  }) {
25680
- const [rooms, setRooms] = useState51([]);
25681
- const [availableUsers, setAvailableUsers] = useState51([]);
25682
- const [loading, setLoading] = useState51(false);
25683
- const [error, setError] = useState51(null);
25684
- const fetchRooms = useCallback28(async () => {
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 () => {
25685
25743
  setLoading(true);
25686
25744
  setError(null);
25687
25745
  try {
@@ -25697,7 +25755,7 @@ function useChatRooms({
25697
25755
  setLoading(false);
25698
25756
  }
25699
25757
  }, [apiClient]);
25700
- const fetchAvailableUsers = useCallback28(async () => {
25758
+ const fetchAvailableUsers = useCallback29(async () => {
25701
25759
  setLoading(true);
25702
25760
  setError(null);
25703
25761
  try {
@@ -25713,7 +25771,7 @@ function useChatRooms({
25713
25771
  setLoading(false);
25714
25772
  }
25715
25773
  }, [apiClient]);
25716
- const createRoom = useCallback28(
25774
+ const createRoom = useCallback29(
25717
25775
  async (participantIds) => {
25718
25776
  setLoading(true);
25719
25777
  setError(null);
@@ -25737,7 +25795,7 @@ function useChatRooms({
25737
25795
  },
25738
25796
  [apiClient, fetchRooms]
25739
25797
  );
25740
- const clearError = useCallback28(() => {
25798
+ const clearError = useCallback29(() => {
25741
25799
  setError(null);
25742
25800
  }, []);
25743
25801
  return {
@@ -25771,7 +25829,7 @@ var CHAT_MESSAGE_TYPES = {
25771
25829
  };
25772
25830
 
25773
25831
  // src/components/Chat/Chat.tsx
25774
- import { useState as useState52, useEffect as useEffect47, useCallback as useCallback29, useRef as useRef29 } from "react";
25832
+ import { useState as useState53, useEffect as useEffect47, useCallback as useCallback30, useRef as useRef29 } from "react";
25775
25833
  import {
25776
25834
  PaperPlaneTiltIcon as PaperPlaneTiltIcon2,
25777
25835
  XIcon,
@@ -25924,15 +25982,15 @@ function ChatContent({
25924
25982
  onRoomChange,
25925
25983
  onBackToList
25926
25984
  }) {
25927
- const [view, setView] = useState52("list");
25928
- const [selectedRoom, setSelectedRoom] = useState52(
25985
+ const [view, setView] = useState53("list");
25986
+ const [selectedRoom, setSelectedRoom] = useState53(
25929
25987
  null
25930
25988
  );
25931
- const [selectedUserIds, setSelectedUserIds] = useState52(
25989
+ const [selectedUserIds, setSelectedUserIds] = useState53(
25932
25990
  /* @__PURE__ */ new Set()
25933
25991
  );
25934
- const [messageInput, setMessageInput] = useState52("");
25935
- const [showCreateModal, setShowCreateModal] = useState52(false);
25992
+ const [messageInput, setMessageInput] = useState53("");
25993
+ const [showCreateModal, setShowCreateModal] = useState53(false);
25936
25994
  const hasHandledInitialRoomRef = useRef29(false);
25937
25995
  const {
25938
25996
  rooms,
@@ -25986,7 +26044,7 @@ function ChatContent({
25986
26044
  onBackToList?.();
25987
26045
  }
25988
26046
  }, [initialRoomId, rooms, roomsLoading, onBackToList]);
25989
- const handleSelectRoom = useCallback29(
26047
+ const handleSelectRoom = useCallback30(
25990
26048
  (room) => {
25991
26049
  setSelectedRoom(room);
25992
26050
  setView("room");
@@ -25994,12 +26052,12 @@ function ChatContent({
25994
26052
  },
25995
26053
  [onRoomChange]
25996
26054
  );
25997
- const handleOpenCreateModal = useCallback29(async () => {
26055
+ const handleOpenCreateModal = useCallback30(async () => {
25998
26056
  await fetchAvailableUsers();
25999
26057
  setSelectedUserIds(/* @__PURE__ */ new Set());
26000
26058
  setShowCreateModal(true);
26001
26059
  }, [fetchAvailableUsers]);
26002
- const handleToggleUser = useCallback29((id) => {
26060
+ const handleToggleUser = useCallback30((id) => {
26003
26061
  setSelectedUserIds((prev) => {
26004
26062
  const next = new Set(prev);
26005
26063
  if (next.has(id)) {
@@ -26010,7 +26068,7 @@ function ChatContent({
26010
26068
  return next;
26011
26069
  });
26012
26070
  }, []);
26013
- const handleCreateRoom = useCallback29(async () => {
26071
+ const handleCreateRoom = useCallback30(async () => {
26014
26072
  if (selectedUserIds.size === 0) return;
26015
26073
  const room = await createRoom(Array.from(selectedUserIds));
26016
26074
  if (room) {
@@ -26019,12 +26077,12 @@ function ChatContent({
26019
26077
  onRoomChange?.(room.id);
26020
26078
  }
26021
26079
  }, [selectedUserIds, createRoom, onRoomChange]);
26022
- const handleSendMessage = useCallback29(() => {
26080
+ const handleSendMessage = useCallback30(() => {
26023
26081
  if (!messageInput.trim()) return;
26024
26082
  sendMessage(messageInput);
26025
26083
  setMessageInput("");
26026
26084
  }, [messageInput, sendMessage]);
26027
- const handleBackToList = useCallback29(() => {
26085
+ const handleBackToList = useCallback30(() => {
26028
26086
  setSelectedRoom(null);
26029
26087
  setView("list");
26030
26088
  onBackToList?.();