@esvndev/es-react-template-chat 0.0.102 → 0.0.103
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 +21 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -72530,6 +72530,18 @@ const ChatLog = (props) => {
|
|
|
72530
72530
|
}
|
|
72531
72531
|
}
|
|
72532
72532
|
}, []);
|
|
72533
|
+
const useParsedChatData = (chatMsg) => {
|
|
72534
|
+
if (!chatMsg) {
|
|
72535
|
+
return {};
|
|
72536
|
+
}
|
|
72537
|
+
try {
|
|
72538
|
+
return typeof chatMsg === 'string' ? JSON.parse(chatMsg) : chatMsg;
|
|
72539
|
+
}
|
|
72540
|
+
catch (err) {
|
|
72541
|
+
console.error('JSON parse error:', err);
|
|
72542
|
+
return {};
|
|
72543
|
+
}
|
|
72544
|
+
};
|
|
72533
72545
|
React.useCallback((chat) => {
|
|
72534
72546
|
const isPath = Array.isArray(chat?.path) && typeof chat.path[0]?.path === "string" ? chat.path[0].path.trim() : "";
|
|
72535
72547
|
const img = isPath ? `${CDN_URL_VIEW}/${isPath}` : "";
|
|
@@ -72941,7 +72953,7 @@ const ChatLog = (props) => {
|
|
|
72941
72953
|
setOpenModalReminder(true);
|
|
72942
72954
|
}, children: "Xem chi ti\u1EBFt" })] }));
|
|
72943
72955
|
}, []);
|
|
72944
|
-
React.useCallback((type, msg, path) => {
|
|
72956
|
+
const renderMessageReply = React.useCallback((type, msg, path) => {
|
|
72945
72957
|
switch (type) {
|
|
72946
72958
|
case "file": // ✅ THÊM CASE NÀY
|
|
72947
72959
|
const fileName = path?.[0]?.name || '';
|
|
@@ -72952,41 +72964,14 @@ const ChatLog = (props) => {
|
|
|
72952
72964
|
return msg;
|
|
72953
72965
|
}
|
|
72954
72966
|
}, []);
|
|
72955
|
-
|
|
72956
|
-
|
|
72957
|
-
|
|
72958
|
-
|
|
72959
|
-
|
|
72960
|
-
|
|
72961
|
-
|
|
72962
|
-
|
|
72963
|
-
// <div className="reply-container">
|
|
72964
|
-
// <div className="reply-quote" />
|
|
72965
|
-
// {replyData?.type === "image" && (
|
|
72966
|
-
// <div
|
|
72967
|
-
// className="reply-image"
|
|
72968
|
-
// style={{
|
|
72969
|
-
// backgroundImage: `url(${`${CDN_URL_VIEW}/${replyData?.path[0].path.trim()}`})`
|
|
72970
|
-
// }}
|
|
72971
|
-
// />
|
|
72972
|
-
// )}
|
|
72973
|
-
// {/* ✅ THÊM: File */}
|
|
72974
|
-
// {replyData?.type === "file" && (
|
|
72975
|
-
// <div style={{ marginRight: 8 }}>
|
|
72976
|
-
// <IconFileTypeColor
|
|
72977
|
-
// fileType={replyData?.path?.[0]?.type}
|
|
72978
|
-
// width={35}
|
|
72979
|
-
// />
|
|
72980
|
-
// </div>
|
|
72981
|
-
// )}
|
|
72982
|
-
// <div className="reply-content d-flex flex-column">
|
|
72983
|
-
// <div className="fw-bold">{replyData?.createdByName}</div>
|
|
72984
|
-
// <div>{renderMessageReply(replyData?.type, replyData?.msg)}</div>
|
|
72985
|
-
// </div>
|
|
72986
|
-
// </div>
|
|
72987
|
-
// </div>
|
|
72988
|
-
// )
|
|
72989
|
-
// }, [renderMessageReply])
|
|
72967
|
+
React.useCallback((replyMsg) => {
|
|
72968
|
+
const replyData = useParsedChatData(replyMsg);
|
|
72969
|
+
return (jsxRuntime.jsx("div", { className: classnames("chat-app-reply p-0 mb-50", {
|
|
72970
|
+
show: true
|
|
72971
|
+
}), children: jsxRuntime.jsxs("div", { className: "reply-container", children: [jsxRuntime.jsx("div", { className: "reply-quote" }), replyData?.type === "image" && (jsxRuntime.jsx("div", { className: "reply-image", style: {
|
|
72972
|
+
backgroundImage: `url(${`${CDN_URL_VIEW}/${replyData?.path[0].path.trim()}`})`
|
|
72973
|
+
} })), 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) })] })] }) }));
|
|
72974
|
+
}, [renderMessageReply]);
|
|
72990
72975
|
// const downloadFile = useCallback(async (path: string) => {
|
|
72991
72976
|
// const url = `${CDN_URL_VIEW}/${path}`
|
|
72992
72977
|
// try {
|