@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.js
CHANGED
|
@@ -91777,7 +91777,6 @@ const IconFileTypeColor = (props) => {
|
|
|
91777
91777
|
return jsxRuntime.jsx("img", { ...props, src: icon, style: { width: width ? width : 24, height: height ? height : 'auto', ...props.style } });
|
|
91778
91778
|
};
|
|
91779
91779
|
|
|
91780
|
-
const MySwal$1 = withReactContent(Swal);
|
|
91781
91780
|
const DateHeader = React.memo(({ label }) => (jsxRuntime.jsx("div", { className: "d-flex justify-content-center", children: jsxRuntime.jsx("div", { style: {
|
|
91782
91781
|
backgroundColor: "rgba(0,0,0,0.2)",
|
|
91783
91782
|
padding: "2px 15px",
|
|
@@ -92511,7 +92510,7 @@ const ChatLog = (props) => {
|
|
|
92511
92510
|
backgroundImage: `url(${`${CDN_URL_VIEW}/${replyData?.path[0].path.trim()}`})`
|
|
92512
92511
|
} })), replyData?.type === "file" && (jsxRuntime.jsx("div", { style: { marginRight: 8 }, children: jsxRuntime.jsx(IconFileTypeColor, { fileType: replyData?.path?.[0]?.type, width: 35 }) })), jsxRuntime.jsxs("div", { className: "reply-content d-flex flex-column", children: [jsxRuntime.jsx("div", { className: "fw-bold", children: replyData?.createdByName }), jsxRuntime.jsx("div", { children: renderMessageReply(replyData?.type, replyData?.msg) })] })] }) }));
|
|
92513
92512
|
}, [renderMessageReply]);
|
|
92514
|
-
|
|
92513
|
+
React.useCallback(async (path) => {
|
|
92515
92514
|
const url = `${CDN_URL_VIEW}/${path}`;
|
|
92516
92515
|
try {
|
|
92517
92516
|
const response = await axios$1.get(url, { responseType: "blob" });
|
|
@@ -92528,111 +92527,107 @@ const ChatLog = (props) => {
|
|
|
92528
92527
|
console.error(error);
|
|
92529
92528
|
}
|
|
92530
92529
|
}, []);
|
|
92531
|
-
const handleDownloadClick =
|
|
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
|
-
|
|
92584
|
-
|
|
92585
|
-
|
|
92586
|
-
|
|
92587
|
-
|
|
92588
|
-
|
|
92589
|
-
|
|
92590
|
-
|
|
92591
|
-
|
|
92592
|
-
|
|
92593
|
-
|
|
92594
|
-
|
|
92595
|
-
|
|
92596
|
-
|
|
92597
|
-
|
|
92598
|
-
|
|
92599
|
-
|
|
92600
|
-
|
|
92601
|
-
|
|
92602
|
-
|
|
92603
|
-
|
|
92604
|
-
|
|
92605
|
-
|
|
92606
|
-
|
|
92607
|
-
|
|
92608
|
-
|
|
92609
|
-
|
|
92610
|
-
|
|
92611
|
-
|
|
92612
|
-
|
|
92613
|
-
|
|
92614
|
-
|
|
92615
|
-
|
|
92616
|
-
|
|
92617
|
-
|
|
92618
|
-
|
|
92619
|
-
|
|
92620
|
-
|
|
92621
|
-
|
|
92622
|
-
|
|
92623
|
-
|
|
92624
|
-
|
|
92625
|
-
|
|
92626
|
-
|
|
92627
|
-
|
|
92628
|
-
|
|
92629
|
-
|
|
92630
|
-
|
|
92631
|
-
|
|
92632
|
-
handleRecall(val.currentMessage);
|
|
92633
|
-
break;
|
|
92634
|
-
}
|
|
92635
|
-
}, [clickedImageFile, handleDelete, handleDownloadClick, handleRecall]);
|
|
92530
|
+
// const handleDownloadClick = useCallback((param: any) => {
|
|
92531
|
+
// // Ưu tiên ảnh được click, fallback về ảnh đầu tiên
|
|
92532
|
+
// const targetFile = clickedImageFile || param?.path?.[0]
|
|
92533
|
+
// if (targetFile?.path) {
|
|
92534
|
+
// downloadFile(targetFile.path)
|
|
92535
|
+
// } else {
|
|
92536
|
+
// console.error("No valid path found in param")
|
|
92537
|
+
// }
|
|
92538
|
+
// }, [clickedImageFile, downloadFile])
|
|
92539
|
+
// const handleDelete = useCallback(async (param: any) => {
|
|
92540
|
+
// try {
|
|
92541
|
+
// const result = await MySwal.fire({
|
|
92542
|
+
// title: "Xác nhận",
|
|
92543
|
+
// html: "Tin nhắn sẽ bị xóa vĩnh viễn. <br> Bạn có chắc muốn xóa?",
|
|
92544
|
+
// allowOutsideClick: false,
|
|
92545
|
+
// showCancelButton: true,
|
|
92546
|
+
// confirmButtonText: "Xoá",
|
|
92547
|
+
// cancelButtonText: "Hủy",
|
|
92548
|
+
// customClass: {
|
|
92549
|
+
// confirmButton: "btn btn-primary",
|
|
92550
|
+
// cancelButton: "btn btn-danger ms-1"
|
|
92551
|
+
// },
|
|
92552
|
+
// buttonsStyling: false
|
|
92553
|
+
// })
|
|
92554
|
+
// if (result.value) {
|
|
92555
|
+
// const data = { id: param.id, chatRoomId: groupChatUsers.id }
|
|
92556
|
+
// await deleteMessageApi(data)
|
|
92557
|
+
// } else if (result.dismiss === MySwal.DismissReason.cancel) {
|
|
92558
|
+
// console.log("Hủy xóa tin nhắn")
|
|
92559
|
+
// }
|
|
92560
|
+
// } catch (error) {
|
|
92561
|
+
// console.error("Error deleting message:", error)
|
|
92562
|
+
// }
|
|
92563
|
+
// }, [deleteMessageApi, groupChatUsers?.id])
|
|
92564
|
+
// const handleRecall = useCallback(async (param: any) => {
|
|
92565
|
+
// try {
|
|
92566
|
+
// const result = await MySwal.fire({
|
|
92567
|
+
// title: "Xác nhận",
|
|
92568
|
+
// 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.",
|
|
92569
|
+
// allowOutsideClick: false,
|
|
92570
|
+
// showCancelButton: true,
|
|
92571
|
+
// confirmButtonText: "Thu hồi",
|
|
92572
|
+
// cancelButtonText: "Hủy",
|
|
92573
|
+
// customClass: {
|
|
92574
|
+
// confirmButton: "btn btn-primary",
|
|
92575
|
+
// cancelButton: "btn btn-danger ms-1"
|
|
92576
|
+
// },
|
|
92577
|
+
// buttonsStyling: false
|
|
92578
|
+
// })
|
|
92579
|
+
// if (result.value) {
|
|
92580
|
+
// const data = { id: param.id, chatRoomId: groupChatUsers.id }
|
|
92581
|
+
// await recallMessageApi(data)
|
|
92582
|
+
// } else if (result.dismiss === MySwal.DismissReason.cancel) {
|
|
92583
|
+
// console.log("Hủy thu hồi tin nhắn")
|
|
92584
|
+
// }
|
|
92585
|
+
// } catch (error) {
|
|
92586
|
+
// console.error("Error recalling message:", error)
|
|
92587
|
+
// }
|
|
92588
|
+
// }, [recallMessageApi, groupChatUsers?.id])
|
|
92589
|
+
// const contextMenuClick = useCallback(async (val: any) => {
|
|
92590
|
+
// switch (val.id) {
|
|
92591
|
+
// case "copyImage":
|
|
92592
|
+
// try {
|
|
92593
|
+
// // Ưu tiên ảnh được click, fallback về ảnh đầu tiên
|
|
92594
|
+
// const targetFile = clickedImageFile || val?.currentMessage?.path?.[0]
|
|
92595
|
+
// const imagePath = targetFile?.path
|
|
92596
|
+
// if (!imagePath) {
|
|
92597
|
+
// console.error('Không tìm thấy đường dẫn ảnh')
|
|
92598
|
+
// return
|
|
92599
|
+
// }
|
|
92600
|
+
// const imgUrl = `${CDN_URL_VIEW}/${imagePath}`
|
|
92601
|
+
// const response = await fetch(imgUrl)
|
|
92602
|
+
// const blob = await response.blob()
|
|
92603
|
+
// await navigator.clipboard.write([
|
|
92604
|
+
// new ClipboardItem({
|
|
92605
|
+
// [blob.type]: blob
|
|
92606
|
+
// })
|
|
92607
|
+
// ])
|
|
92608
|
+
// } catch (error) {
|
|
92609
|
+
// console.error('Lỗi khi copy ảnh:', error)
|
|
92610
|
+
// }
|
|
92611
|
+
// break
|
|
92612
|
+
// case "copyText":
|
|
92613
|
+
// navigator.clipboard.writeText(val?.currentMessage.msg)
|
|
92614
|
+
// break
|
|
92615
|
+
// case "reply":
|
|
92616
|
+
// setReplyMessage(val)
|
|
92617
|
+
// break
|
|
92618
|
+
// case "save":
|
|
92619
|
+
// handleDownloadClick(val.currentMessage)
|
|
92620
|
+
// break
|
|
92621
|
+
// case "delete":
|
|
92622
|
+
// handleDelete(val.currentMessage)
|
|
92623
|
+
// break
|
|
92624
|
+
// case "recall":
|
|
92625
|
+
// handleRecall(val.currentMessage)
|
|
92626
|
+
// break
|
|
92627
|
+
// default:
|
|
92628
|
+
// break
|
|
92629
|
+
// }
|
|
92630
|
+
// }, [clickedImageFile, handleDelete, handleDownloadClick, handleRecall])
|
|
92636
92631
|
// const handleFocus = useCallback(() => {
|
|
92637
92632
|
// editor.focus()
|
|
92638
92633
|
// }, [editor])
|