@pubuduth-aplicy/chat-ui 2.1.67 → 2.1.69
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 +2 -1
- package/src/components/Chat.tsx +32 -59
- package/src/components/messages/Message.tsx +173 -7
- package/src/components/messages/MessageContainer.tsx +55 -40
- package/src/components/messages/MessageInput.tsx +333 -248
- package/src/components/messages/Messages.tsx +58 -91
- package/src/components/sidebar/Conversation.tsx +55 -38
- package/src/hooks/mutations/useDeleteMessage.ts +26 -0
- package/src/hooks/mutations/useEditMessage.ts +25 -0
- package/src/lib/api/apiClient.ts +1 -1
- package/src/lib/api/endpoint.ts +3 -1
- package/src/providers/ChatProvider.tsx +90 -63
- package/src/service/messageService.ts +46 -1
- package/src/style/style.css +36 -13
|
@@ -27,4 +27,49 @@ export const fetchMessages = async (chatId: string|undefined, userid: string,pag
|
|
|
27
27
|
console.error("Error fetching messages:", error);
|
|
28
28
|
return []; // Return a default empty array on error
|
|
29
29
|
}
|
|
30
|
-
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const setEditMessage = async ({
|
|
33
|
+
messageId,
|
|
34
|
+
userId,
|
|
35
|
+
newMessage
|
|
36
|
+
}: {
|
|
37
|
+
messageId: string;
|
|
38
|
+
userId: string;
|
|
39
|
+
newMessage: string;
|
|
40
|
+
}) => {
|
|
41
|
+
const apiClient = getApiClient();
|
|
42
|
+
try {
|
|
43
|
+
const response = await apiClient.put(`${Path.editMessage}/${messageId}`, {
|
|
44
|
+
userId,
|
|
45
|
+
newMessage
|
|
46
|
+
});
|
|
47
|
+
return response.data;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error("Error editing message:", error);
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
export const deleteMessage = async ({
|
|
56
|
+
messageId,
|
|
57
|
+
userId
|
|
58
|
+
}: {
|
|
59
|
+
messageId: string;
|
|
60
|
+
userId: string;
|
|
61
|
+
}) => {
|
|
62
|
+
const apiClient = getApiClient();
|
|
63
|
+
try {
|
|
64
|
+
const response = await apiClient.delete(
|
|
65
|
+
`${Path.deleteMessage}/${messageId}`,
|
|
66
|
+
{
|
|
67
|
+
data: { userId } // Sending userId in the request body
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
return response.data;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error("Error deleting message:", error);
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
};
|
package/src/style/style.css
CHANGED
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
/* Ensure full width */
|
|
95
95
|
/* min-width: 400px; */
|
|
96
96
|
max-width: 600px;
|
|
97
|
+
background-color: rgb(248, 249, 249);
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
.chatSidebarInput:focus {
|
|
@@ -420,10 +421,23 @@
|
|
|
420
421
|
max-width: 70%;
|
|
421
422
|
}
|
|
422
423
|
|
|
424
|
+
.amk7{
|
|
425
|
+
position: absolute;
|
|
426
|
+
top: 0;
|
|
427
|
+
display: block;
|
|
428
|
+
width: 8px;
|
|
429
|
+
height: 13px;
|
|
430
|
+
right: -8px;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
:root{
|
|
434
|
+
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
435
|
+
}
|
|
436
|
+
|
|
423
437
|
.chat-bubble {
|
|
424
438
|
|
|
425
439
|
background-color: #f3f4f6;
|
|
426
|
-
border-radius: 0.5rem;
|
|
440
|
+
border-radius: 0.5rem ;
|
|
427
441
|
padding: 0.5rem;
|
|
428
442
|
font-size: 14px;
|
|
429
443
|
max-width: 20rem;
|
|
@@ -437,7 +451,7 @@
|
|
|
437
451
|
}
|
|
438
452
|
|
|
439
453
|
.incoming .chat-bubble {
|
|
440
|
-
background-color: #
|
|
454
|
+
background-color: #EBEDF0;
|
|
441
455
|
color: black;
|
|
442
456
|
}
|
|
443
457
|
|
|
@@ -507,16 +521,21 @@
|
|
|
507
521
|
.grid-container {
|
|
508
522
|
height: 550px;
|
|
509
523
|
grid-template-columns: repeat(9, minmax(0, 1fr));
|
|
524
|
+
gap: 1rem;
|
|
510
525
|
}
|
|
511
526
|
|
|
512
527
|
.sidebarContainer {
|
|
513
528
|
/* display: grid; */
|
|
514
|
-
grid-column: span
|
|
529
|
+
grid-column: span 3;
|
|
530
|
+
background-color: rgb(248, 249, 249);
|
|
531
|
+
border-radius: 1%;
|
|
515
532
|
}
|
|
516
533
|
|
|
517
534
|
.messageContainer {
|
|
518
535
|
display: grid;
|
|
519
|
-
grid-column: span
|
|
536
|
+
grid-column: span 6;
|
|
537
|
+
border: 1px solid #ddd;
|
|
538
|
+
border-radius: 1%;
|
|
520
539
|
}
|
|
521
540
|
|
|
522
541
|
.chatMessageContainerInnerDiv_button {
|
|
@@ -753,7 +772,6 @@
|
|
|
753
772
|
width: 12px;
|
|
754
773
|
height: 12px;
|
|
755
774
|
border-radius: 50%;
|
|
756
|
-
border: 2px solid white;
|
|
757
775
|
/* Border for a neat appearance */
|
|
758
776
|
}
|
|
759
777
|
|
|
@@ -764,9 +782,9 @@
|
|
|
764
782
|
}
|
|
765
783
|
|
|
766
784
|
/* For offline status */
|
|
767
|
-
.chatSidebarStatusDot.offline {
|
|
785
|
+
/* .chatSidebarStatusDot.offline {
|
|
768
786
|
background-color: rgba(179, 170, 170, 0.712);
|
|
769
|
-
}
|
|
787
|
+
} */
|
|
770
788
|
|
|
771
789
|
.conversation-container {
|
|
772
790
|
display: flex;
|
|
@@ -775,14 +793,18 @@
|
|
|
775
793
|
padding: 12px;
|
|
776
794
|
/* border-radius: 8px; */
|
|
777
795
|
border-bottom: .5px solid lightgray;
|
|
778
|
-
background-color:
|
|
796
|
+
background-color: rgb(248, 249, 249);
|
|
779
797
|
/* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
|
|
780
798
|
cursor: pointer;
|
|
781
799
|
transition: background-color 0.3s ease-in-out;
|
|
782
800
|
}
|
|
783
801
|
|
|
784
802
|
.conversation-container:hover {
|
|
785
|
-
background-color:
|
|
803
|
+
background-color: rgb(255, 255, 255);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
.conversation-container.selected {
|
|
807
|
+
background-color: rgb(255, 255, 255);
|
|
786
808
|
}
|
|
787
809
|
|
|
788
810
|
.conversation-avatar {
|
|
@@ -815,9 +837,10 @@
|
|
|
815
837
|
}
|
|
816
838
|
|
|
817
839
|
.conversation-name {
|
|
818
|
-
font-size:
|
|
840
|
+
font-size: 1rem;
|
|
819
841
|
font-weight: bold;
|
|
820
|
-
color: #
|
|
842
|
+
color: #1f2937;
|
|
843
|
+
font-weight: 500;
|
|
821
844
|
}
|
|
822
845
|
|
|
823
846
|
.conversation-time {
|
|
@@ -1190,7 +1213,7 @@
|
|
|
1190
1213
|
|
|
1191
1214
|
.chat-bubble {
|
|
1192
1215
|
background-color: #e5e7eb;
|
|
1193
|
-
/* padding: 0.5rem 0.75rem;
|
|
1216
|
+
/* padding: 0.5rem 0.75rem; */
|
|
1194
1217
|
border-radius: 0.375rem;
|
|
1195
1218
|
margin-top: 0.5rem;
|
|
1196
1219
|
max-width: 100%;
|
|
@@ -1213,7 +1236,7 @@
|
|
|
1213
1236
|
|
|
1214
1237
|
.document-preview {
|
|
1215
1238
|
position: relative;
|
|
1216
|
-
width:
|
|
1239
|
+
width: 226px;
|
|
1217
1240
|
height: 60px;
|
|
1218
1241
|
/* Increased height to accommodate filename */
|
|
1219
1242
|
border-radius: 12px;
|