l-min-components 1.0.467 → 1.0.472

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.467",
3
+ "version": "1.0.472",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -19,8 +19,10 @@
19
19
  "chart.js": "4.4.1",
20
20
  "classnames": "^2.3.2",
21
21
  "emoji-picker-react": "^4.4.10",
22
+ "i": "^0.3.7",
22
23
  "js-cookie": "^3.0.5",
23
24
  "moment": "^2.29.4",
25
+ "npm": "^10.2.5",
24
26
  "prop-types": "^15.8.1",
25
27
  "rc-progress": "^3.5.1",
26
28
  "rc-slider": "^10.1.1",
@@ -54,14 +54,14 @@ const useMessaging = () => {
54
54
  }
55
55
  );
56
56
 
57
- const handleCreateMessage = async (user_id, data) => {
57
+ const handleCreateMessage = async (account_id, data) => {
58
58
  await createMessage({
59
59
  url: `/notify/v1/chats/`,
60
60
  data: {
61
61
  ...data,
62
62
  },
63
63
  params: {
64
- user_id,
64
+ account_id,
65
65
  // room_id,
66
66
  },
67
67
  });
@@ -87,7 +87,6 @@ const useMessaging = () => {
87
87
 
88
88
  newUploaded.push(uploadedData?.data?.results[0]);
89
89
 
90
-
91
90
  // if (uploadMediaData?.data) {
92
91
  await createMessageMedia({
93
92
  url: `/notify/v1/chats/`,
@@ -216,6 +215,30 @@ const useMessaging = () => {
216
215
  }
217
216
  };
218
217
 
218
+ //GET Room Messages for Recipient
219
+
220
+ const [{ ...roomRecipientDetailsData }, roomRecipientDetails] = useAxios(
221
+ {
222
+ method: "GET",
223
+ },
224
+ {
225
+ manual: true,
226
+ }
227
+ );
228
+
229
+ const handleRoomRecipientDetails = async (room_id, recipient_only = true) => {
230
+ try {
231
+ await roomRecipientDetails({
232
+ url: `/notify/v1/chats/recipient_details/`,
233
+ params: {
234
+ room_id,
235
+ },
236
+ });
237
+ } catch (err) {
238
+ console.log(err);
239
+ }
240
+ };
241
+
219
242
  return {
220
243
  retrieveMessageData,
221
244
  handleRetrieveMessage,
@@ -235,6 +258,8 @@ const useMessaging = () => {
235
258
  handleClearChat,
236
259
  roomMessageRecipientData,
237
260
  handleRoomMessageRecipient,
261
+ roomRecipientDetailsData,
262
+ handleRoomRecipientDetails,
238
263
  };
239
264
  };
240
265
 
@@ -58,7 +58,7 @@ const useRooms = () => {
58
58
  }
59
59
  };
60
60
 
61
- //GET Change Pin Status
61
+ //PATCH Change Pin Status
62
62
  const [{ ...changePinStatusData }, changePinStatus] = useAxios(
63
63
  {
64
64
  method: "PATCH",
@@ -67,12 +67,15 @@ const useRooms = () => {
67
67
  manual: true,
68
68
  }
69
69
  );
70
- const handleChangePinStatus = async (room_id, data) => {
70
+ const handleChangePinStatus = async (room_id, type) => {
71
71
  try {
72
72
  await changePinStatus({
73
73
  url: `/notify/v1/rooms/${room_id}/change_pin_status/`,
74
- data: {
75
- ...data,
74
+ // data: {
75
+ // ...data,
76
+ // },
77
+ params: {
78
+ type,
76
79
  },
77
80
  });
78
81
  } catch (err) {
@@ -185,6 +188,66 @@ const useRooms = () => {
185
188
  }
186
189
  };
187
190
 
191
+ //GET List Rooms Enterprise
192
+ const [{ ...getEnterpriseRoomsData }, getEnterpriseRooms] = useAxios(
193
+ {
194
+ method: "GET",
195
+ },
196
+ {
197
+ manual: true,
198
+ }
199
+ );
200
+
201
+ const handleGetEnterpriseRooms = async () => {
202
+ try {
203
+ await getEnterpriseRooms({
204
+ url: `/notify/v1/rooms/enterprise/`,
205
+ });
206
+ } catch (err) {
207
+ console.log(err);
208
+ }
209
+ };
210
+
211
+ //GET List Rooms Personal
212
+ const [{ ...getPersonalRoomsData }, getPersonalRooms] = useAxios(
213
+ {
214
+ method: "GET",
215
+ },
216
+ {
217
+ manual: true,
218
+ }
219
+ );
220
+
221
+ const handleGetPersonalRooms = async () => {
222
+ try {
223
+ await getPersonalRooms({
224
+ url: `/notify/v1/rooms/personal`,
225
+ });
226
+ } catch (err) {
227
+ console.log(err);
228
+ }
229
+ };
230
+
231
+ //GET List Rooms Instructor
232
+ const [{ ...getInstructorRoomsData }, getInstructorRooms] = useAxios(
233
+ {
234
+ method: "GET",
235
+ },
236
+ {
237
+ manual: true,
238
+ }
239
+ );
240
+
241
+ const handleGetInstructorRooms = async () => {
242
+ try {
243
+ await getInstructorRooms({
244
+ url: `/notify/v1/rooms/instructor`,
245
+ });
246
+ } catch (err) {
247
+ console.log(err);
248
+ }
249
+ };
250
+
188
251
  return {
189
252
  getMyRoomsData,
190
253
  handleGetMyRooms,
@@ -204,6 +267,12 @@ const useRooms = () => {
204
267
  handleChangePinStatus,
205
268
  getAllRoomsData,
206
269
  handleGetAllRooms,
270
+ getEnterpriseRoomsData,
271
+ handleGetEnterpriseRooms,
272
+ getPersonalRoomsData,
273
+ handleGetPersonalRooms,
274
+ getInstructorRoomsData,
275
+ handleGetInstructorRooms,
207
276
  };
208
277
  };
209
278
 
@@ -17,6 +17,9 @@ const ChatHeader = ({
17
17
  roomID,
18
18
  handleChangePinStatus,
19
19
  deleteChatModal,
20
+ userFullName,
21
+ courseName,
22
+ userType
20
23
  }) => {
21
24
  // handle click outside dropdown container
22
25
  const dropdownContainer = useRef(null);
@@ -55,15 +58,18 @@ const ChatHeader = ({
55
58
  </div>
56
59
  <div className="user-details">
57
60
  <h5>
58
- {chatRecipient?.first_name || "French For Geginners"} {chatRecipient?.last_name}
61
+ {chatRecipient?.course || courseName}
59
62
  </h5>
60
63
  <div className="friend_cont">
61
- <div className="friend-tag">
62
- <HiUser /> Friend
64
+ <div className="friend-tag">
65
+ <HiUser /> {userType}
66
+ </div>
67
+ <p>
68
+ {" "}
69
+ {chatRecipient?.full_name || userFullName}
70
+ </p>
63
71
  </div>
64
- <p>Julius Rippin</p>
65
- </div>
66
-
72
+
67
73
  {/* <div className="instructor-tag">
68
74
  <HiUser /> Instructor
69
75
  </div> */}
@@ -34,7 +34,17 @@ import { MdOutlineClose } from "react-icons/md";
34
34
  import DownSvg from "./assets/down";
35
35
  import CloseSvg from "./assets/close";
36
36
 
37
- const Messages = ({ close }) => {
37
+ const Messages = ({
38
+ close,
39
+ user,
40
+ userFullName,
41
+ userType,
42
+ courseName,
43
+ roomID,
44
+ setRoomID,
45
+ userID,
46
+ setUserID,
47
+ }) => {
38
48
  const [showEmoji, setShowEmoji] = useState(false);
39
49
  const [chatOptions, setChatOptions] = useState(false);
40
50
  const [modalIsOpen, setIsOpen] = useState(false);
@@ -59,10 +69,10 @@ const Messages = ({ close }) => {
59
69
  // } = useContext(MessagesContext);
60
70
  const { generalData, setRightLayout } = useContext(OutletContext);
61
71
  const [socketUrl, setSocketUrl] = useState(
62
- "dev-117782726-api.learngual.com/notify/v1/ws/connect/",
72
+ "dev-117782726-api.learngual.com/notify/v1/ws/connect/"
63
73
  );
64
- const [roomID, setRoomID] = useState("");
65
- const [userID, setUserID] = useState("");
74
+ // const [roomID, setRoomID] = useState("");
75
+ // const [userID, setUserID] = useState("");
66
76
  const [userChatList, setUserChatList] = useState([]);
67
77
  const [isFullHeight, setIsFullHeight] = useState(true);
68
78
 
@@ -77,6 +87,9 @@ const Messages = ({ close }) => {
77
87
  clearChatData,
78
88
  roomMessageRecipientData,
79
89
  handleRoomMessageRecipient,
90
+ roomRecipientDetailsData,
91
+ handleRoomRecipientDetails,
92
+ handleRetrieveMessage,
80
93
  } = useMessaging();
81
94
  const {
82
95
  handleGetMyRooms,
@@ -89,7 +102,7 @@ const Messages = ({ close }) => {
89
102
  handleGetAllRooms,
90
103
  } = useRooms();
91
104
 
92
- const chatRecipient = roomMessageRecipientData?.data;
105
+ const chatRecipient = roomRecipientDetailsData?.data;
93
106
  const singleChat = getAllRoomsData?.data?.results?.map((user) => {
94
107
  return user.id;
95
108
  });
@@ -119,7 +132,7 @@ const Messages = ({ close }) => {
119
132
  handleGetMyRooms();
120
133
  handleGetPinnedRooms();
121
134
  handleRoomMessage(roomID);
122
- handleRoomMessageRecipient(roomID);
135
+ handleRoomRecipientDetails(roomID);
123
136
  }
124
137
  }, [clearChatData?.response]);
125
138
 
@@ -141,12 +154,12 @@ const Messages = ({ close }) => {
141
154
  console.log("clearChatData", clearChatData);
142
155
 
143
156
  useEffect(() => {
144
- setUserID(roomMessageRecipientData?.data?.id);
145
- }, [roomMessageRecipientData?.data]);
157
+ setUserID(roomRecipientDetailsData?.data?.id);
158
+ }, [roomRecipientDetailsData?.data]);
146
159
 
147
160
  useEffect(() => {
148
161
  handleRoomMessage(roomID);
149
- handleRoomMessageRecipient(roomID);
162
+ handleRoomRecipientDetails();
150
163
  }, [roomID]);
151
164
 
152
165
  console.log("allMessages", allMessages);
@@ -159,7 +172,7 @@ const Messages = ({ close }) => {
159
172
 
160
173
  console.log("account_id", account_id);
161
174
  const websocket = new WebSocket(
162
- `wss://${socketUrl}?account=${account_id}&authorization=${token}`,
175
+ `wss://${socketUrl}?account=${account_id}&authorization=${token}`
163
176
  );
164
177
 
165
178
  useEffect(() => {
@@ -211,7 +224,7 @@ const Messages = ({ close }) => {
211
224
  const sortedList = chatListCopy?.sort(
212
225
  (chatA, chatB) =>
213
226
  new Date(chatA.last_message.created_at).getTime() -
214
- new Date(chatB.last_message.created_at).getTime(),
227
+ new Date(chatB.last_message.created_at).getTime()
215
228
  );
216
229
 
217
230
  setUserChatList(sortedList);
@@ -248,7 +261,7 @@ const Messages = ({ close }) => {
248
261
  <>
249
262
  <MessagesWrapper>
250
263
  <div className="message_by_wrapper">
251
- <p className="mbw_name"> Message Julius Rippin </p>
264
+ <p className="mbw_name"> Message {user} </p>
252
265
 
253
266
  <div className="icon-box">
254
267
  <span onClick={() => setIsFullHeight(!isFullHeight)}>
@@ -275,6 +288,9 @@ const Messages = ({ close }) => {
275
288
  deleteChatModal={() => {
276
289
  setDeleteChatModalIsOpen(true);
277
290
  }}
291
+ userFullName={userFullName}
292
+ userType={userType}
293
+ courseName={courseName}
278
294
  />
279
295
 
280
296
  <MessageBody ref={scrollRef}>