@esvndev/es-react-template-chat 0.0.97 → 0.0.98
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/dist/index.js +102 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -91728,7 +91728,6 @@ const IconFileTypeColor = (props) => {
|
|
|
91728
91728
|
return jsx("img", { ...props, src: icon, style: { width: width ? width : 24, height: height ? height : 'auto', ...props.style } });
|
|
91729
91729
|
};
|
|
91730
91730
|
|
|
91731
|
-
const MySwal$1 = withReactContent(Swal);
|
|
91732
91731
|
const DateHeader = memo(({ label }) => (jsx("div", { className: "d-flex justify-content-center", children: jsx("div", { style: {
|
|
91733
91732
|
backgroundColor: "rgba(0,0,0,0.2)",
|
|
91734
91733
|
padding: "2px 15px",
|
|
@@ -92462,7 +92461,7 @@ const ChatLog = (props) => {
|
|
|
92462
92461
|
backgroundImage: `url(${`${CDN_URL_VIEW}/${replyData?.path[0].path.trim()}`})`
|
|
92463
92462
|
} })), replyData?.type === "file" && (jsx("div", { style: { marginRight: 8 }, children: jsx(IconFileTypeColor, { fileType: replyData?.path?.[0]?.type, width: 35 }) })), jsxs("div", { className: "reply-content d-flex flex-column", children: [jsx("div", { className: "fw-bold", children: replyData?.createdByName }), jsx("div", { children: renderMessageReply(replyData?.type, replyData?.msg) })] })] }) }));
|
|
92464
92463
|
}, [renderMessageReply]);
|
|
92465
|
-
|
|
92464
|
+
useCallback(async (path) => {
|
|
92466
92465
|
const url = `${CDN_URL_VIEW}/${path}`;
|
|
92467
92466
|
try {
|
|
92468
92467
|
const response = await axios$1.get(url, { responseType: "blob" });
|
|
@@ -92479,111 +92478,107 @@ const ChatLog = (props) => {
|
|
|
92479
92478
|
console.error(error);
|
|
92480
92479
|
}
|
|
92481
92480
|
}, []);
|
|
92482
|
-
const handleDownloadClick = useCallback((param) => {
|
|
92483
|
-
|
|
92484
|
-
|
|
92485
|
-
|
|
92486
|
-
|
|
92487
|
-
|
|
92488
|
-
|
|
92489
|
-
|
|
92490
|
-
|
|
92491
|
-
|
|
92492
|
-
|
|
92493
|
-
|
|
92494
|
-
|
|
92495
|
-
|
|
92496
|
-
|
|
92497
|
-
|
|
92498
|
-
|
|
92499
|
-
|
|
92500
|
-
|
|
92501
|
-
|
|
92502
|
-
|
|
92503
|
-
|
|
92504
|
-
|
|
92505
|
-
|
|
92506
|
-
|
|
92507
|
-
|
|
92508
|
-
|
|
92509
|
-
|
|
92510
|
-
|
|
92511
|
-
|
|
92512
|
-
|
|
92513
|
-
|
|
92514
|
-
|
|
92515
|
-
|
|
92516
|
-
|
|
92517
|
-
|
|
92518
|
-
|
|
92519
|
-
|
|
92520
|
-
|
|
92521
|
-
|
|
92522
|
-
|
|
92523
|
-
|
|
92524
|
-
|
|
92525
|
-
|
|
92526
|
-
|
|
92527
|
-
|
|
92528
|
-
|
|
92529
|
-
|
|
92530
|
-
|
|
92531
|
-
|
|
92532
|
-
|
|
92533
|
-
|
|
92534
|
-
|
|
92535
|
-
|
|
92536
|
-
|
|
92537
|
-
|
|
92538
|
-
|
|
92539
|
-
|
|
92540
|
-
|
|
92541
|
-
|
|
92542
|
-
|
|
92543
|
-
|
|
92544
|
-
|
|
92545
|
-
|
|
92546
|
-
|
|
92547
|
-
|
|
92548
|
-
|
|
92549
|
-
|
|
92550
|
-
|
|
92551
|
-
|
|
92552
|
-
|
|
92553
|
-
|
|
92554
|
-
|
|
92555
|
-
|
|
92556
|
-
|
|
92557
|
-
|
|
92558
|
-
|
|
92559
|
-
|
|
92560
|
-
|
|
92561
|
-
|
|
92562
|
-
|
|
92563
|
-
|
|
92564
|
-
|
|
92565
|
-
|
|
92566
|
-
|
|
92567
|
-
|
|
92568
|
-
|
|
92569
|
-
|
|
92570
|
-
|
|
92571
|
-
|
|
92572
|
-
|
|
92573
|
-
|
|
92574
|
-
|
|
92575
|
-
|
|
92576
|
-
|
|
92577
|
-
|
|
92578
|
-
|
|
92579
|
-
|
|
92580
|
-
|
|
92581
|
-
|
|
92582
|
-
|
|
92583
|
-
handleRecall(val.currentMessage);
|
|
92584
|
-
break;
|
|
92585
|
-
}
|
|
92586
|
-
}, [clickedImageFile, handleDelete, handleDownloadClick, handleRecall]);
|
|
92481
|
+
// const handleDownloadClick = useCallback((param: any) => {
|
|
92482
|
+
// // Ưu tiên ảnh được click, fallback về ảnh đầu tiên
|
|
92483
|
+
// const targetFile = clickedImageFile || param?.path?.[0]
|
|
92484
|
+
// if (targetFile?.path) {
|
|
92485
|
+
// downloadFile(targetFile.path)
|
|
92486
|
+
// } else {
|
|
92487
|
+
// console.error("No valid path found in param")
|
|
92488
|
+
// }
|
|
92489
|
+
// }, [clickedImageFile, downloadFile])
|
|
92490
|
+
// const handleDelete = useCallback(async (param: any) => {
|
|
92491
|
+
// try {
|
|
92492
|
+
// const result = await MySwal.fire({
|
|
92493
|
+
// title: "Xác nhận",
|
|
92494
|
+
// html: "Tin nhắn sẽ bị xóa vĩnh viễn. <br> Bạn có chắc muốn xóa?",
|
|
92495
|
+
// allowOutsideClick: false,
|
|
92496
|
+
// showCancelButton: true,
|
|
92497
|
+
// confirmButtonText: "Xoá",
|
|
92498
|
+
// cancelButtonText: "Hủy",
|
|
92499
|
+
// customClass: {
|
|
92500
|
+
// confirmButton: "btn btn-primary",
|
|
92501
|
+
// cancelButton: "btn btn-danger ms-1"
|
|
92502
|
+
// },
|
|
92503
|
+
// buttonsStyling: false
|
|
92504
|
+
// })
|
|
92505
|
+
// if (result.value) {
|
|
92506
|
+
// const data = { id: param.id, chatRoomId: groupChatUsers.id }
|
|
92507
|
+
// await deleteMessageApi(data)
|
|
92508
|
+
// } else if (result.dismiss === MySwal.DismissReason.cancel) {
|
|
92509
|
+
// console.log("Hủy xóa tin nhắn")
|
|
92510
|
+
// }
|
|
92511
|
+
// } catch (error) {
|
|
92512
|
+
// console.error("Error deleting message:", error)
|
|
92513
|
+
// }
|
|
92514
|
+
// }, [deleteMessageApi, groupChatUsers?.id])
|
|
92515
|
+
// const handleRecall = useCallback(async (param: any) => {
|
|
92516
|
+
// try {
|
|
92517
|
+
// const result = await MySwal.fire({
|
|
92518
|
+
// title: "Xác nhận",
|
|
92519
|
+
// html: "Bạn có chắc muốn thu hồi tin nhắn này?<br>Tin nhắn sẽ bị ẩn với tất cả mọi người.",
|
|
92520
|
+
// allowOutsideClick: false,
|
|
92521
|
+
// showCancelButton: true,
|
|
92522
|
+
// confirmButtonText: "Thu hồi",
|
|
92523
|
+
// cancelButtonText: "Hủy",
|
|
92524
|
+
// customClass: {
|
|
92525
|
+
// confirmButton: "btn btn-primary",
|
|
92526
|
+
// cancelButton: "btn btn-danger ms-1"
|
|
92527
|
+
// },
|
|
92528
|
+
// buttonsStyling: false
|
|
92529
|
+
// })
|
|
92530
|
+
// if (result.value) {
|
|
92531
|
+
// const data = { id: param.id, chatRoomId: groupChatUsers.id }
|
|
92532
|
+
// await recallMessageApi(data)
|
|
92533
|
+
// } else if (result.dismiss === MySwal.DismissReason.cancel) {
|
|
92534
|
+
// console.log("Hủy thu hồi tin nhắn")
|
|
92535
|
+
// }
|
|
92536
|
+
// } catch (error) {
|
|
92537
|
+
// console.error("Error recalling message:", error)
|
|
92538
|
+
// }
|
|
92539
|
+
// }, [recallMessageApi, groupChatUsers?.id])
|
|
92540
|
+
// const contextMenuClick = useCallback(async (val: any) => {
|
|
92541
|
+
// switch (val.id) {
|
|
92542
|
+
// case "copyImage":
|
|
92543
|
+
// try {
|
|
92544
|
+
// // Ưu tiên ảnh được click, fallback về ảnh đầu tiên
|
|
92545
|
+
// const targetFile = clickedImageFile || val?.currentMessage?.path?.[0]
|
|
92546
|
+
// const imagePath = targetFile?.path
|
|
92547
|
+
// if (!imagePath) {
|
|
92548
|
+
// console.error('Không tìm thấy đường dẫn ảnh')
|
|
92549
|
+
// return
|
|
92550
|
+
// }
|
|
92551
|
+
// const imgUrl = `${CDN_URL_VIEW}/${imagePath}`
|
|
92552
|
+
// const response = await fetch(imgUrl)
|
|
92553
|
+
// const blob = await response.blob()
|
|
92554
|
+
// await navigator.clipboard.write([
|
|
92555
|
+
// new ClipboardItem({
|
|
92556
|
+
// [blob.type]: blob
|
|
92557
|
+
// })
|
|
92558
|
+
// ])
|
|
92559
|
+
// } catch (error) {
|
|
92560
|
+
// console.error('Lỗi khi copy ảnh:', error)
|
|
92561
|
+
// }
|
|
92562
|
+
// break
|
|
92563
|
+
// case "copyText":
|
|
92564
|
+
// navigator.clipboard.writeText(val?.currentMessage.msg)
|
|
92565
|
+
// break
|
|
92566
|
+
// case "reply":
|
|
92567
|
+
// setReplyMessage(val)
|
|
92568
|
+
// break
|
|
92569
|
+
// case "save":
|
|
92570
|
+
// handleDownloadClick(val.currentMessage)
|
|
92571
|
+
// break
|
|
92572
|
+
// case "delete":
|
|
92573
|
+
// handleDelete(val.currentMessage)
|
|
92574
|
+
// break
|
|
92575
|
+
// case "recall":
|
|
92576
|
+
// handleRecall(val.currentMessage)
|
|
92577
|
+
// break
|
|
92578
|
+
// default:
|
|
92579
|
+
// break
|
|
92580
|
+
// }
|
|
92581
|
+
// }, [clickedImageFile, handleDelete, handleDownloadClick, handleRecall])
|
|
92587
92582
|
// const handleFocus = useCallback(() => {
|
|
92588
92583
|
// editor.focus()
|
|
92589
92584
|
// }, [editor])
|