@pubuduth-aplicy/chat-ui 2.1.92 → 2.1.94

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": "@pubuduth-aplicy/chat-ui",
3
- "version": "2.1.92",
3
+ "version": "2.1.94",
4
4
  "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -23,33 +23,50 @@ const VirtualizedChatList = ({ conversations }: Props) => {
23
23
  <div
24
24
  ref={parentRef}
25
25
  style={{
26
- height: `${virtualizer.getTotalSize()}px`,
26
+ height: `400px`,
27
27
  width: "100%",
28
- position: "relative",
28
+ // position: "relative",
29
29
  overflow: "auto",
30
30
  }}
31
31
  >
32
- {virtualizer.getVirtualItems().map((item) => {
32
+ {/* {virtualizer.getVirtualItems().map((item) => {
33
33
  const conversation = conversations[item.index];
34
- return (
35
- <div
36
- key={item.key}
37
- style={{
38
- position: "absolute",
39
- top: 0,
40
- left: 0,
41
- width: "100%",
42
- height: `${item.size}px`,
43
- transform: `translateY(${item.start}px)`,
44
- }}
45
- >
46
- <Conversation
47
- conversation={conversation}
48
- lastIdx={item.index === conversations.length - 1}
49
- />
50
- </div>
51
- );
52
- })}
34
+ return ( */}
35
+ <div
36
+ // key={item.key}
37
+ style={{
38
+ position: "relative",
39
+ top: 0,
40
+ left: 0,
41
+ width: "100%",
42
+ height: `${virtualizer.getTotalSize()}px`,
43
+ // transform: `translateY(${item.start}px)`,
44
+ }}
45
+ >
46
+ {virtualizer.getVirtualItems().map((item) => {
47
+ const conversation = conversations[item.index];
48
+ return (
49
+ <div
50
+ key={item.key}
51
+ style={{
52
+ position: "absolute",
53
+ top: 0,
54
+ left: 0,
55
+ width: "100%",
56
+ height: `${item.size}px`,
57
+ transform: `translateY(${item.start}px)`,
58
+ }}
59
+ >
60
+ <Conversation
61
+ conversation={conversation}
62
+ lastIdx={item.index === conversations.length - 1}
63
+ />
64
+ </div>
65
+ );
66
+ })}
67
+ </div>
68
+ {/* ); */}
69
+ {/* })} */}
53
70
  </div>
54
71
  );
55
72
  };
@@ -455,7 +455,7 @@ const Message = ({ message }: MessageProps) => {
455
455
  cancelDownload();
456
456
  } else {
457
457
  handleDownload(
458
- `${cdnUrl}${media.url}`,
458
+ `${cdnUrl}/${media.url}`,
459
459
  media.name,
460
460
  index
461
461
  );
@@ -194,8 +194,8 @@ const MessageInput = () => {
194
194
  };
195
195
 
196
196
  const getFileType = (mimeType: string): FileType | null => {
197
- if (ACCEPTED_IMAGE_TYPES.includes(mimeType)) return "image";
198
197
  if (ACCEPTED_VIDEO_TYPES.includes(mimeType)) return "video";
198
+ if (ACCEPTED_IMAGE_TYPES.includes(mimeType)) return "image";
199
199
  if (ACCEPTED_DOCUMENT_TYPES.includes(mimeType)) return "document";
200
200
  return null;
201
201
  };
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { MessageCircle } from "lucide-react";
3
- import { useEffect } from "react";
3
+ import { memo, useEffect } from "react";
4
4
  import { useChatContext } from "../../providers/ChatProvider";
5
5
  import useChatUIStore from "../../stores/Zustant";
6
6
  import { ConversationProps } from "../../types/type";
@@ -143,4 +143,4 @@ const Conversation = ({ conversation }: ConversationProps) => {
143
143
  );
144
144
  };
145
145
 
146
- export default Conversation;
146
+ export default memo(Conversation);
@@ -17,6 +17,10 @@ type GroupedServiceChats = {
17
17
  };
18
18
  };
19
19
 
20
+ type Row =
21
+ | { type: "service-header"; serviceId: string; title: string }
22
+ | { type: "conversation"; conversation: ConversationType };
23
+
20
24
  type TabType = "personal" | "service";
21
25
 
22
26
  const Conversations = () => {
@@ -36,13 +40,13 @@ const Conversations = () => {
36
40
  const allPersonalChats: ConversationType[] = [];
37
41
  const allServiceChatsMap = new Map<string, GroupedServiceChats[string]>();
38
42
 
39
- groups.forEach((group, groupIndex) => {
43
+ groups.forEach((group) => {
40
44
 
41
45
  if (group.personalConversation) {
42
46
  allPersonalChats.push(group.personalConversation);
43
47
  }
44
48
 
45
- group.serviceConversations.forEach((serviceGroup, serviceIndex) => {
49
+ group.serviceConversations.forEach((serviceGroup) => {
46
50
  if (!allServiceChatsMap.has(serviceGroup.serviceId)) {
47
51
  allServiceChatsMap.set(serviceGroup.serviceId, {
48
52
  serviceTitle: serviceGroup.serviceTitle,
@@ -64,7 +68,7 @@ const Conversations = () => {
64
68
  );
65
69
 
66
70
  sortConversations(allPersonalChats);
67
- allServiceChatsMap.forEach((value, key) => {
71
+ allServiceChatsMap.forEach((value) => {
68
72
  sortConversations(value.conversations);
69
73
  });
70
74
 
@@ -320,7 +324,8 @@ const isEmpty = !showPersonalTab && !showServiceTab;
320
324
  </div>
321
325
  ) : (
322
326
  <>
323
- {activeTab === "personal" && filteredPersonalChats.length > 0 && (
327
+ <div className="h-full overflow-auto">
328
+ {activeTab === "personal" && filteredPersonalChats.length > 0 && (
324
329
  <VirtualizedChatList conversations={filteredPersonalChats} />
325
330
  )}
326
331
 
@@ -340,6 +345,8 @@ const isEmpty = !showPersonalTab && !showServiceTab;
340
345
  )}
341
346
  </div>
342
347
  )}
348
+ </div>
349
+
343
350
  </>
344
351
  )}
345
352
  </div>