@pubuduth-aplicy/chat-ui 2.1.86 → 2.1.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/package.json
CHANGED
|
Binary file
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { ChevronLeft,
|
|
3
|
-
import { FiArrowLeft } from "react-icons/fi";
|
|
2
|
+
import { ChevronLeft, MessageCircle } from "lucide-react";
|
|
4
3
|
import { useEffect } from "react";
|
|
5
4
|
import MessageInput from "./MessageInput";
|
|
6
5
|
import Messages from "./Messages";
|
|
7
6
|
import useChatUIStore from "../../stores/Zustant";
|
|
8
7
|
import { useChatContext } from "../../providers/ChatProvider";
|
|
9
8
|
import { getChatConfig } from "../../Chat.config";
|
|
9
|
+
import defaultProfilePicture from "../../assets/pngegg.png";
|
|
10
10
|
|
|
11
11
|
const MessageContainer = () => {
|
|
12
12
|
const { userId } = useChatContext();
|
|
@@ -24,6 +24,7 @@ const MessageContainer = () => {
|
|
|
24
24
|
data: {
|
|
25
25
|
chatId: selectedConversation._id,
|
|
26
26
|
userId: userId,
|
|
27
|
+
role: role,
|
|
27
28
|
},
|
|
28
29
|
})
|
|
29
30
|
);
|
|
@@ -89,13 +90,13 @@ const MessageContainer = () => {
|
|
|
89
90
|
</button>
|
|
90
91
|
{selectedConversation.type === "service" ? (
|
|
91
92
|
<div className="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center">
|
|
92
|
-
<
|
|
93
|
+
<MessageCircle size={24} className="text-gray-600" />
|
|
93
94
|
</div>
|
|
94
95
|
) : (
|
|
95
96
|
<img
|
|
96
97
|
className="chatMessageContainerInnerImg"
|
|
97
98
|
alt="Profile"
|
|
98
|
-
src={participant?.profilePicture}
|
|
99
|
+
src={participant?.profilePicture || defaultProfilePicture}
|
|
99
100
|
/>
|
|
100
101
|
)}
|
|
101
102
|
<div className="chatMessageContainerOutter">
|
|
@@ -4,17 +4,20 @@ import { useEffect } from "react";
|
|
|
4
4
|
import { useChatContext } from "../../providers/ChatProvider";
|
|
5
5
|
import useChatUIStore from "../../stores/Zustant";
|
|
6
6
|
import { ConversationProps } from "../../types/type";
|
|
7
|
+
import { getChatConfig } from "../../Chat.config";
|
|
8
|
+
import defaultProfilePicture from "../../assets/pngegg.png";
|
|
7
9
|
|
|
8
10
|
const Conversation = ({ conversation }: ConversationProps) => {
|
|
9
11
|
const {
|
|
10
12
|
setSelectedConversation,
|
|
11
13
|
setOnlineUsers,
|
|
12
14
|
} = useChatUIStore();
|
|
13
|
-
const { socket, isUserOnline } = useChatContext();
|
|
15
|
+
const { socket, isUserOnline, } = useChatContext();
|
|
14
16
|
const selectedConversation = useChatUIStore(
|
|
15
17
|
(state) => state.selectedConversation
|
|
16
18
|
);
|
|
17
19
|
const { userId } = useChatContext();
|
|
20
|
+
const { role } = getChatConfig();
|
|
18
21
|
|
|
19
22
|
const participant = conversation.participantDetails?.find(
|
|
20
23
|
(p:any) => p._id !== userId
|
|
@@ -36,6 +39,7 @@ const Conversation = ({ conversation }: ConversationProps) => {
|
|
|
36
39
|
messageIds: unreadMessageIds,
|
|
37
40
|
senderId: participant?._id,
|
|
38
41
|
receiverId: userId,
|
|
42
|
+
receiverRole: role,
|
|
39
43
|
chatId: conversation._id,
|
|
40
44
|
},
|
|
41
45
|
};
|
|
@@ -99,7 +103,7 @@ const Conversation = ({ conversation }: ConversationProps) => {
|
|
|
99
103
|
<>
|
|
100
104
|
<img
|
|
101
105
|
className="w-10 h-10 rounded-full"
|
|
102
|
-
src={participant?.profilePicture}
|
|
106
|
+
src={participant?.profilePicture || defaultProfilePicture}
|
|
103
107
|
alt="User Avatar"
|
|
104
108
|
/>
|
|
105
109
|
<span
|