@pubuduth-aplicy/chat-ui 2.1.84 → 2.1.86
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
|
@@ -8,7 +8,7 @@ const SystemNotice = () => (
|
|
|
8
8
|
fontSize: "14px",
|
|
9
9
|
}}>
|
|
10
10
|
<strong style={{ display: "block", marginBottom: "0.5rem", textAlign:"center", fontSize:"smaller" }}>🛡 WE HAVE YOUR BACK</strong>
|
|
11
|
-
<p style={{fontSize:"x-small"}}>For added safety and your protection, keep payments and communications within
|
|
11
|
+
<p style={{fontSize:"x-small"}}>For added safety and your protection, keep payments and communications within Hirepanther.
|
|
12
12
|
{/* <a href="#">Learn more</a> */}
|
|
13
13
|
</p>
|
|
14
14
|
</div>
|
|
@@ -77,7 +77,7 @@ const Conversation = ({ conversation }: ConversationProps) => {
|
|
|
77
77
|
: participant?.name || "Conversation";
|
|
78
78
|
|
|
79
79
|
const lastMessageTimestamp = new Date(
|
|
80
|
-
conversation.lastMessage?.updatedAt || conversation.lastMessage?.createdAt
|
|
80
|
+
conversation.lastMessage?.updatedAt || conversation.lastMessage?.createdAt || conversation.createdAt
|
|
81
81
|
).toLocaleTimeString([], {
|
|
82
82
|
hour: "2-digit",
|
|
83
83
|
minute: "2-digit",
|
package/src/lib/api/apiClient.ts
CHANGED
|
@@ -114,17 +114,38 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
114
114
|
}
|
|
115
115
|
}, []);
|
|
116
116
|
|
|
117
|
+
// useEffect(() => {
|
|
118
|
+
// connectWebSocket();
|
|
119
|
+
|
|
120
|
+
// return () => {
|
|
121
|
+
// // console.log("❌ Closing WebSocket connection...");
|
|
122
|
+
// if (socketRef.current) {
|
|
123
|
+
// socketRef.current.close(1000, "Component unmounted");
|
|
124
|
+
// socketRef.current = null;
|
|
125
|
+
// }
|
|
126
|
+
// };
|
|
127
|
+
// }, [connectWebSocket]);
|
|
128
|
+
|
|
129
|
+
|
|
117
130
|
useEffect(() => {
|
|
118
131
|
connectWebSocket();
|
|
119
|
-
|
|
132
|
+
|
|
120
133
|
return () => {
|
|
121
|
-
//
|
|
122
|
-
if (socketRef.current) {
|
|
134
|
+
// Gracefully notify backend before closing
|
|
135
|
+
if (socketRef.current && socketRef.current.readyState === WebSocket.OPEN) {
|
|
136
|
+
socketRef.current.send(
|
|
137
|
+
JSON.stringify({
|
|
138
|
+
event: "disconnect",
|
|
139
|
+
userId,
|
|
140
|
+
role,
|
|
141
|
+
})
|
|
142
|
+
);
|
|
123
143
|
socketRef.current.close(1000, "Component unmounted");
|
|
124
|
-
socketRef.current = null;
|
|
125
144
|
}
|
|
145
|
+
socketRef.current = null;
|
|
126
146
|
};
|
|
127
147
|
}, [connectWebSocket]);
|
|
148
|
+
|
|
128
149
|
|
|
129
150
|
const isUserOnline = useCallback(
|
|
130
151
|
(userId: string) => {
|