@droppii-org/chat-sdk 0.0.33 → 0.0.34
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/components/conversation/ConversationBySessionItem.d.ts.map +1 -1
- package/dist/components/conversation/ConversationBySessionItem.js +3 -68
- package/dist/components/conversation/DeskConversationList.d.ts.map +1 -1
- package/dist/components/conversation/DeskConversationList.js +44 -22
- package/dist/components/mediaCollection/FileCollection.d.ts.map +1 -1
- package/dist/components/mediaCollection/FileCollection.js +7 -6
- package/dist/components/mediaCollection/ImageCollection.d.ts.map +1 -1
- package/dist/components/mediaCollection/ImageCollection.js +7 -6
- package/dist/components/mediaCollection/VideoCollection.d.ts.map +1 -1
- package/dist/components/mediaCollection/VideoCollection.js +7 -6
- package/dist/components/mediaCollection/index.js +5 -5
- package/dist/components/message/MessageList.d.ts +1 -0
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +53 -15
- package/dist/components/message/footer/index.d.ts +1 -5
- package/dist/components/message/footer/index.d.ts.map +1 -1
- package/dist/components/message/footer/index.js +5 -4
- package/dist/components/message/item/index.d.ts +4 -3
- package/dist/components/message/item/index.d.ts.map +1 -1
- package/dist/components/message/item/index.js +24 -30
- package/dist/components/searchConversation/SearchAll.d.ts +6 -1
- package/dist/components/searchConversation/SearchAll.d.ts.map +1 -1
- package/dist/components/searchConversation/SearchAll.js +28 -4
- package/dist/components/searchConversation/SearchConversationAsMessages.d.ts +4 -1
- package/dist/components/searchConversation/SearchConversationAsMessages.d.ts.map +1 -1
- package/dist/components/searchConversation/SearchConversationAsMessages.js +18 -3
- package/dist/components/searchConversation/SearchConversationAsUsers.d.ts +4 -1
- package/dist/components/searchConversation/SearchConversationAsUsers.d.ts.map +1 -1
- package/dist/components/searchConversation/SearchConversationAsUsers.js +14 -3
- package/dist/components/searchConversation/index.d.ts +4 -1
- package/dist/components/searchConversation/index.d.ts.map +1 -1
- package/dist/components/searchConversation/index.js +8 -7
- package/dist/components/searchConversation/item/SearchItemAsMessage.d.ts +8 -0
- package/dist/components/searchConversation/item/SearchItemAsMessage.d.ts.map +1 -0
- package/dist/components/searchConversation/item/SearchItemAsMessage.js +49 -0
- package/dist/components/searchConversation/item/SearchItemAsUser.d.ts +8 -0
- package/dist/components/searchConversation/item/SearchItemAsUser.d.ts.map +1 -0
- package/dist/components/searchConversation/item/SearchItemAsUser.js +13 -0
- package/dist/components/session/DeskAssignedSession.js +5 -5
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +3 -0
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/context/ChatContext.js +1 -0
- package/dist/hooks/message/useMessage.d.ts +8 -5
- package/dist/hooks/message/useMessage.d.ts.map +1 -1
- package/dist/hooks/message/useMessage.js +117 -51
- package/dist/hooks/message/useSendMessage.d.ts +2 -4
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +9 -39
- package/dist/hooks/search/useSearchMessage.d.ts +232 -0
- package/dist/hooks/search/useSearchMessage.d.ts.map +1 -0
- package/dist/hooks/search/useSearchMessage.js +71 -0
- package/dist/hooks/session/useGetSession.d.ts +222 -0
- package/dist/hooks/session/useGetSession.d.ts.map +1 -0
- package/dist/hooks/session/useGetSession.js +83 -0
- package/dist/hooks/session/useGetSessionSummary.d.ts.map +1 -1
- package/dist/hooks/session/useGetSessionSummary.js +2 -1
- package/dist/hooks/user/useAuth.d.ts.map +1 -1
- package/dist/hooks/user/useAuth.js +6 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/locales/vi/common.json +4 -1
- package/dist/screens/deskMessage/index.d.ts.map +1 -1
- package/dist/screens/deskMessage/index.js +2 -1
- package/dist/services/query.d.ts +1 -1
- package/dist/services/query.js +1 -1
- package/dist/services/routes.d.ts +1 -1
- package/dist/services/routes.js +1 -1
- package/dist/store/auth.d.ts.map +1 -1
- package/dist/store/auth.js +12 -2
- package/dist/store/conversation.d.ts.map +1 -1
- package/dist/store/conversation.js +7 -1
- package/dist/styles/global.css +1 -1
- package/dist/types/chat.d.ts +7 -8
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/chat.js +4 -0
- package/dist/types/dto.d.ts +14 -23
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/utils/common.d.ts +3 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/common.js +98 -0
- package/dist/utils/events.d.ts +1 -0
- package/dist/utils/events.d.ts.map +1 -1
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationBySessionItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationBySessionItem.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAQpD,UAAU,8BAA8B;IACtC,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAED,QAAA,MAAM,yBAAyB,GAAI,kBAEhC,8BAA8B,
|
|
1
|
+
{"version":3,"file":"ConversationBySessionItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationBySessionItem.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAQpD,UAAU,8BAA8B;IACtC,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAED,QAAA,MAAM,yBAAyB,GAAI,kBAEhC,8BAA8B,mDA0FhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { MessageType } from "@openim/wasm-client-sdk";
|
|
4
3
|
import { useTranslation } from "react-i18next";
|
|
5
4
|
import useConversationStore from "../../store/conversation";
|
|
6
5
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
7
6
|
import { Avatar, Badge } from "antd";
|
|
8
|
-
import { Icon } from "../icon";
|
|
9
7
|
import { useChatContext } from "../../context/ChatContext";
|
|
10
8
|
import { useConversationDisplayData } from "../../hooks/conversation/useConversation";
|
|
9
|
+
import { formatTimestamp, parseLatestMessage } from "../../utils/common";
|
|
11
10
|
const ConversationBySessionItem = ({ sessionItem, }) => {
|
|
12
11
|
const { t } = useTranslation();
|
|
13
12
|
const { user } = useChatContext();
|
|
@@ -25,73 +24,9 @@ const ConversationBySessionItem = ({ sessionItem, }) => {
|
|
|
25
24
|
router.push(`${pathname}?${newSearchParams.toString()}`);
|
|
26
25
|
setSelectedConversationId(conversation.conversationID);
|
|
27
26
|
};
|
|
27
|
+
const { avatar, displayName = "" } = useConversationDisplayData(conversation || null);
|
|
28
28
|
if (!conversation)
|
|
29
29
|
return null;
|
|
30
|
-
|
|
31
|
-
return (_jsxs("div", { onClick: () => handleConversationClick(conversation), className: `relative p-3 border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors ${isSelected ? "bg-blue-50" : "bg-white"}`, children: [isSelected && (_jsx("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-blue-500" })), _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "relative flex-shrink-0", children: _jsx(Badge, { dot: true, status: "success", offset: [-2, 36], children: _jsx(Avatar, { size: 48, src: avatar, alt: displayName, children: displayName.charAt(0).toUpperCase() }) }) }), _jsx("div", { className: "flex-1 min-w-0", children: _jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("h3", { className: "font-semibold text-gray-900 text-sm truncate", children: displayName }), _jsx("p", { className: "text-xs text-gray-500 truncate mt-0.5", children: parseLatestMessage(conversation.latestMsg, user === null || user === void 0 ? void 0 : user.userID) })] }), _jsxs("div", { className: "flex flex-col items-end gap-1 ml-2", children: [_jsx("span", { className: "text-xs text-gray-400", children: formatTimestamp(conversation.latestMsgSendTime) }), _jsx("div", { className: "flex items-center gap-1", children: conversation.unreadCount > 0 && (_jsx(Badge, { count: conversation.unreadCount })) })] })] }) })] })] }, conversation.conversationID));
|
|
30
|
+
return (_jsxs("div", { onClick: () => handleConversationClick(conversation), className: `relative p-3 border-b border-gray-100 hover:bg-gray-100 cursor-pointer transition-colors ${isSelected ? "bg-blue-50" : "bg-white"}`, children: [isSelected && (_jsx("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-blue-500" })), _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "relative flex-shrink-0", children: _jsx(Badge, { dot: true, status: "success", offset: [-2, 36], children: _jsx(Avatar, { size: 48, src: avatar, alt: displayName, children: displayName.charAt(0).toUpperCase() }) }) }), _jsx("div", { className: "flex-1 min-w-0", children: _jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("h3", { className: "font-semibold text-gray-900 text-sm truncate", children: displayName }), _jsx("p", { className: "text-xs text-gray-500 truncate mt-0.5", children: parseLatestMessage(conversation.latestMsg, user === null || user === void 0 ? void 0 : user.userID) })] }), _jsxs("div", { className: "flex flex-col items-end gap-1 ml-2", children: [_jsx("span", { className: "text-xs text-gray-400", children: formatTimestamp(conversation.latestMsgSendTime) }), _jsx("div", { className: "flex items-center gap-1", children: conversation.unreadCount > 0 && (_jsx(Badge, { count: conversation.unreadCount })) })] })] }) })] })] }, conversation.conversationID));
|
|
32
31
|
};
|
|
33
32
|
export default ConversationBySessionItem;
|
|
34
|
-
const parseLatestMessage = (latestMsg, currentUserId) => {
|
|
35
|
-
var _a;
|
|
36
|
-
if (!latestMsg)
|
|
37
|
-
return "";
|
|
38
|
-
try {
|
|
39
|
-
const msgData = JSON.parse(latestMsg);
|
|
40
|
-
const contentType = msgData === null || msgData === void 0 ? void 0 : msgData.contentType;
|
|
41
|
-
const isMe = currentUserId && msgData.sendID === currentUserId;
|
|
42
|
-
const sender = isMe ? "Me" : (msgData === null || msgData === void 0 ? void 0 : msgData.senderNickname) || msgData.sendID;
|
|
43
|
-
switch (contentType) {
|
|
44
|
-
case MessageType.TextMessage:
|
|
45
|
-
if ((_a = msgData.textElem) === null || _a === void 0 ? void 0 : _a.content) {
|
|
46
|
-
return `${sender}: ${msgData.textElem.content}`;
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
case MessageType.PictureMessage:
|
|
50
|
-
return (_jsxs("span", { children: [sender, ": ", _jsx(Icon, { icon: "image-o", size: 16, className: "mr-1" }), "H\u00ECnh \u1EA3nh"] }));
|
|
51
|
-
case MessageType.VoiceMessage:
|
|
52
|
-
return `${sender}: [Tin nhắn thoại]`;
|
|
53
|
-
case MessageType.VideoMessage:
|
|
54
|
-
return `${sender}: [Video]`;
|
|
55
|
-
case MessageType.FileMessage:
|
|
56
|
-
return `${sender}: [File đính kèm]`;
|
|
57
|
-
default:
|
|
58
|
-
return "Tin nhắn không khả dụng";
|
|
59
|
-
}
|
|
60
|
-
return "Tin nhắn không khả dụng";
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error("Error parsing latest message:", error);
|
|
64
|
-
return "";
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const formatTimestamp = (timestamp) => {
|
|
68
|
-
if (!timestamp)
|
|
69
|
-
return "";
|
|
70
|
-
const date = new Date(timestamp);
|
|
71
|
-
const now = new Date();
|
|
72
|
-
const diffInMs = now.getTime() - date.getTime();
|
|
73
|
-
const diffInDays = Math.floor(diffInMs / (1000 * 60 * 60 * 24));
|
|
74
|
-
if (diffInDays === 0) {
|
|
75
|
-
// Today - show time
|
|
76
|
-
return date.toLocaleTimeString("vi-VN", {
|
|
77
|
-
hour: "2-digit",
|
|
78
|
-
minute: "2-digit",
|
|
79
|
-
hour12: false,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
else if (diffInDays === 1) {
|
|
83
|
-
// Yesterday
|
|
84
|
-
return "Hôm qua";
|
|
85
|
-
}
|
|
86
|
-
else if (diffInDays < 7) {
|
|
87
|
-
// This week - show day name
|
|
88
|
-
return date.toLocaleDateString("vi-VN", { weekday: "long" });
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
// Older - show date
|
|
92
|
-
return date.toLocaleDateString("vi-VN", {
|
|
93
|
-
day: "2-digit",
|
|
94
|
-
month: "2-digit",
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeskConversationList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/DeskConversationList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DeskConversationList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/DeskConversationList.tsx"],"names":[],"mappings":"AAgBA,QAAA,MAAM,oBAAoB,+CAqKzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect, useRef } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useSearchParams } from "next/navigation";
|
|
5
5
|
import { Input, Empty, Drawer, Button, Spin } from "antd";
|
|
6
6
|
import { Icon } from "../icon";
|
|
7
7
|
import useConversationStore from "../../store/conversation";
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
|
-
import { useBoolean,
|
|
9
|
+
import { useBoolean, useDebounce } from "ahooks";
|
|
10
10
|
import SearchConversation from "../searchConversation";
|
|
11
11
|
import useSessionStore from "../../store/session";
|
|
12
|
-
import { useGetSessionByTagOrStatus } from "../../hooks/session/useGetSessionByTagOrStatus";
|
|
13
12
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
14
13
|
import ConversationBySessionItem from "./ConversationBySessionItem";
|
|
14
|
+
import { useGetSession } from "../../hooks/session/useGetSession";
|
|
15
|
+
import { DChatSDK } from "../../constants/sdk";
|
|
15
16
|
const DeskConversationList = () => {
|
|
17
|
+
var _a;
|
|
16
18
|
const searchInputRef = useRef(null);
|
|
17
19
|
const { t } = useTranslation();
|
|
18
20
|
const [search, setSearch] = useState("");
|
|
19
21
|
const [showSearch, { setTrue: setShowSearchTrue, setFalse: setShowSearchFalse },] = useBoolean(false);
|
|
20
|
-
const router = useRouter();
|
|
21
|
-
const pathname = usePathname();
|
|
22
22
|
const searchParams = useSearchParams();
|
|
23
23
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
24
24
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
25
25
|
const conversationList = useConversationStore((state) => state.conversationList);
|
|
26
|
+
const updateConversationList = useConversationStore((state) => state.updateConversationList);
|
|
26
27
|
const filterSummary = useSessionStore((state) => state.filterSummary);
|
|
27
|
-
const { dataFlatten: sessions,
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const { dataFlatten: sessions, hasNextPage, fetchNextPage, } = useGetSession(filterSummary);
|
|
29
|
+
const debouncedSearch = useDebounce(search, { wait: 500 });
|
|
30
|
+
const onCloseSearch = () => {
|
|
31
|
+
setSearch("");
|
|
32
|
+
setShowSearchFalse();
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
var _a;
|
|
35
|
+
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
36
|
+
}, 500);
|
|
37
|
+
};
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (showSearch) {
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
var _a;
|
|
42
|
+
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
43
|
+
}, 100);
|
|
44
|
+
}
|
|
45
|
+
}, [showSearch]);
|
|
31
46
|
useEffect(() => {
|
|
32
47
|
const threadId = searchParams.get("threadId");
|
|
33
48
|
if (threadId) {
|
|
@@ -36,22 +51,29 @@ const DeskConversationList = () => {
|
|
|
36
51
|
if (selectedConversation) {
|
|
37
52
|
setConversationData(selectedConversation);
|
|
38
53
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
else {
|
|
55
|
+
DChatSDK.getMultipleConversation([threadId]).then((res) => {
|
|
56
|
+
if (res.data.length > 0) {
|
|
57
|
+
setConversationData(res.data[0]);
|
|
58
|
+
updateConversationList(res.data, "filter");
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
63
|
}, [searchParams, conversationList]);
|
|
48
|
-
return (_jsxs("div", { className: `flex flex-col h-full bg-white border-r border-gray-200 w-[320px]`, children: [_jsx("div", { className: "p-3 border-b border-gray-100", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { ref: searchInputRef, placeholder: t("search"), prefix: _jsx(Icon, { icon: "search-o", size: 18, className: "text-gray-400" }), onChange: (e) =>
|
|
64
|
+
return (_jsxs("div", { className: `flex flex-col h-full bg-white border-r border-gray-200 w-[320px]`, children: [_jsx("div", { className: "p-3 border-b border-gray-100", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { ref: searchInputRef, placeholder: t("search"), prefix: _jsx(Icon, { icon: "search-o", size: 18, className: "text-gray-400" }), onChange: (e) => {
|
|
65
|
+
if (!showSearch && e.target.value) {
|
|
66
|
+
setShowSearchTrue();
|
|
67
|
+
}
|
|
68
|
+
setSearch(e.target.value);
|
|
69
|
+
}, className: "rounded-lg text-sm flex-1 h-[36px]", size: "large", allowClear: true, onClick: setShowSearchTrue, value: search, autoFocus: false, onClear: onCloseSearch }), showSearch && (_jsx(Button, { onClick: onCloseSearch, variant: "outlined", className: "p-0 w-[36px] h-[36px] text-gray-500", children: _jsx(Icon, { icon: "close-b", size: 22 }) }))] }) }), _jsxs("div", { id: "scrollableConversationsDiv", style: {
|
|
49
70
|
height: "100%",
|
|
50
71
|
overflow: "auto",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
72
|
+
position: "relative",
|
|
73
|
+
}, children: [_jsx(InfiniteScroll, { dataLength: (sessions === null || sessions === void 0 ? void 0 : sessions.length) || 0, next: fetchNextPage, hasMore: hasNextPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableConversationsDiv", children: (sessions === null || sessions === void 0 ? void 0 : sessions.length) === 0 ? (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Empty, { image: _jsx(Icon, { icon: "chat-square-b", size: 80, className: "text-gray-300" }), description: t("no_conversation") }) })) : ((_a = sessions === null || sessions === void 0 ? void 0 : sessions.map) === null || _a === void 0 ? void 0 : _a.call(sessions, (session) => (_jsx(ConversationBySessionItem, { sessionItem: session }, session.conversationId)))) }), _jsx(Drawer, { open: showSearch, mask: false, closeIcon: false, styles: {
|
|
74
|
+
body: {
|
|
75
|
+
padding: 0,
|
|
76
|
+
},
|
|
77
|
+
}, getContainer: false, width: "100%", children: _jsx(SearchConversation, { searchTerm: debouncedSearch }) })] })] }));
|
|
56
78
|
};
|
|
57
79
|
export default DeskConversationList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileCollection.d.ts","sourceRoot":"","sources":["../../../src/components/mediaCollection/FileCollection.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,cAAc,+
|
|
1
|
+
{"version":3,"file":"FileCollection.d.ts","sourceRoot":"","sources":["../../../src/components/mediaCollection/FileCollection.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,cAAc,+CAqGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MessageType } from "@openim/wasm-client-sdk";
|
|
3
|
-
import {
|
|
3
|
+
import { useSearchMessage } from "../../hooks/search/useSearchMessage";
|
|
4
4
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
5
5
|
import { Empty, Spin } from "antd";
|
|
6
6
|
import { useCallback } from "react";
|
|
@@ -10,13 +10,14 @@ import { useTranslation } from "react-i18next";
|
|
|
10
10
|
import { documentIcon } from "../../assets/svg";
|
|
11
11
|
import { shortenFileName } from "../message/footer/FilePreview";
|
|
12
12
|
import { renderFileSize } from "../../utils/common";
|
|
13
|
-
import { TOP_OFFSET } from ".";
|
|
14
13
|
const FileCollection = () => {
|
|
15
14
|
const { t } = useTranslation();
|
|
16
15
|
const selectedSourceId = useConversationStore((state) => state.selectedSourceId);
|
|
17
|
-
const { groupedData, fetchNextPage, hasNextPage, dataFlatten, isLoading } =
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const { groupedData, fetchNextPage, hasNextPage, dataFlatten, isLoading } = useSearchMessage({
|
|
17
|
+
payload: {
|
|
18
|
+
recvID: selectedSourceId,
|
|
19
|
+
contentType: MessageType.FileMessage,
|
|
20
|
+
},
|
|
20
21
|
});
|
|
21
22
|
const handleDownload = (url, fileName) => {
|
|
22
23
|
if (!url) {
|
|
@@ -47,6 +48,6 @@ const FileCollection = () => {
|
|
|
47
48
|
return _jsx(Empty, { description: t("no_media_files") });
|
|
48
49
|
if (isLoading)
|
|
49
50
|
return (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Spin, {}) }));
|
|
50
|
-
return (_jsx("div", { id: "scrollableFileDiv", className: "h-full overflow-auto",
|
|
51
|
+
return (_jsx("div", { id: "scrollableFileDiv", className: "h-full overflow-auto", children: _jsx(InfiniteScroll, { dataLength: Object.keys(groupedData).length, next: fetchNextPage, hasMore: hasNextPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableFileDiv", children: Object.entries(groupedData).map(([date, items]) => renderItem(date, items)) }) }));
|
|
51
52
|
};
|
|
52
53
|
export default FileCollection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageCollection.d.ts","sourceRoot":"","sources":["../../../src/components/mediaCollection/ImageCollection.tsx"],"names":[],"mappings":"AAaA,QAAA,MAAM,eAAe,+
|
|
1
|
+
{"version":3,"file":"ImageCollection.d.ts","sourceRoot":"","sources":["../../../src/components/mediaCollection/ImageCollection.tsx"],"names":[],"mappings":"AAaA,QAAA,MAAM,eAAe,+CA+GpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MessageType } from "@openim/wasm-client-sdk";
|
|
3
|
-
import {
|
|
3
|
+
import { useSearchMessage } from "../../hooks/search/useSearchMessage";
|
|
4
4
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
5
5
|
import { Button, Empty, Image, Spin } from "antd";
|
|
6
6
|
import { useCallback } from "react";
|
|
@@ -8,14 +8,15 @@ import dayjs from "dayjs";
|
|
|
8
8
|
import useConversationStore from "../../store/conversation";
|
|
9
9
|
import { images } from "../../constants/images";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { TOP_OFFSET } from ".";
|
|
12
11
|
import { DownloadOutlined } from "@ant-design/icons";
|
|
13
12
|
const ImageCollection = () => {
|
|
14
13
|
const { t } = useTranslation();
|
|
15
14
|
const selectedSourceId = useConversationStore((state) => state.selectedSourceId);
|
|
16
|
-
const { groupedData, fetchNextPage, hasNextPage, dataFlatten, isLoading } =
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const { groupedData, fetchNextPage, hasNextPage, dataFlatten, isLoading } = useSearchMessage({
|
|
16
|
+
payload: {
|
|
17
|
+
recvID: selectedSourceId,
|
|
18
|
+
contentType: MessageType.PictureMessage,
|
|
19
|
+
},
|
|
19
20
|
});
|
|
20
21
|
const handleDownload = (imageUrl) => {
|
|
21
22
|
if (!imageUrl)
|
|
@@ -40,7 +41,7 @@ const ImageCollection = () => {
|
|
|
40
41
|
return _jsx(Empty, { description: t("no_media_files") });
|
|
41
42
|
if (isLoading)
|
|
42
43
|
return (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Spin, {}) }));
|
|
43
|
-
return (_jsx("div", { id: "scrollableImageDiv", className: "h-full overflow-auto",
|
|
44
|
+
return (_jsx("div", { id: "scrollableImageDiv", className: "h-full overflow-auto", children: _jsx(Image.PreviewGroup, { preview: {
|
|
44
45
|
toolbarRender: (originalNode, info) => {
|
|
45
46
|
var _a;
|
|
46
47
|
const imageUrl = (_a = info === null || info === void 0 ? void 0 : info.image) === null || _a === void 0 ? void 0 : _a.url;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoCollection.d.ts","sourceRoot":"","sources":["../../../src/components/mediaCollection/VideoCollection.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,eAAe,+
|
|
1
|
+
{"version":3,"file":"VideoCollection.d.ts","sourceRoot":"","sources":["../../../src/components/mediaCollection/VideoCollection.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,eAAe,+CAyHpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MessageType } from "@openim/wasm-client-sdk";
|
|
3
|
-
import {
|
|
3
|
+
import { useSearchMessage } from "../../hooks/search/useSearchMessage";
|
|
4
4
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
5
5
|
import { Carousel, Empty, Image, Modal, Spin } from "antd";
|
|
6
6
|
import { useCallback, useState } from "react";
|
|
@@ -10,13 +10,14 @@ import { useBoolean } from "ahooks";
|
|
|
10
10
|
import { images } from "../../constants/images";
|
|
11
11
|
import { Icon } from "../icon";
|
|
12
12
|
import { useTranslation } from "react-i18next";
|
|
13
|
-
import { TOP_OFFSET } from ".";
|
|
14
13
|
const VideoCollection = () => {
|
|
15
14
|
const { t } = useTranslation();
|
|
16
15
|
const selectedSourceId = useConversationStore((state) => state.selectedSourceId);
|
|
17
|
-
const { groupedData, fetchNextPage, hasNextPage, dataFlatten, isLoading } =
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const { groupedData, fetchNextPage, hasNextPage, dataFlatten, isLoading } = useSearchMessage({
|
|
17
|
+
payload: {
|
|
18
|
+
recvID: selectedSourceId,
|
|
19
|
+
contentType: MessageType.VideoMessage,
|
|
20
|
+
},
|
|
20
21
|
});
|
|
21
22
|
const [open, { setTrue, setFalse }] = useBoolean(false);
|
|
22
23
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
@@ -36,7 +37,7 @@ const VideoCollection = () => {
|
|
|
36
37
|
return _jsx(Empty, { description: t("no_media_files") });
|
|
37
38
|
if (isLoading)
|
|
38
39
|
return (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Spin, {}) }));
|
|
39
|
-
return (_jsxs("div", { id: "scrollableVideoDiv", className: "h-full overflow-auto",
|
|
40
|
+
return (_jsxs("div", { id: "scrollableVideoDiv", className: "h-full overflow-auto", children: [_jsx(InfiniteScroll, { dataLength: Object.keys(groupedData).length, next: fetchNextPage, hasMore: hasNextPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableVideoDiv", children: Object.entries(groupedData).map(([date, items]) => renderItem(date, items)) }), _jsx(Modal, { open: open, onCancel: setFalse, footer: null, centered: true, styles: {
|
|
40
41
|
content: {
|
|
41
42
|
padding: 0,
|
|
42
43
|
},
|
|
@@ -28,26 +28,26 @@ const MediaCollection = () => {
|
|
|
28
28
|
return [
|
|
29
29
|
{
|
|
30
30
|
key: MediaCollectionTabKey.Image,
|
|
31
|
-
label: "
|
|
31
|
+
label: t("image"),
|
|
32
32
|
children: _jsx(ImageCollection, {}),
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
key: MediaCollectionTabKey.Video,
|
|
36
|
-
label: "
|
|
36
|
+
label: t("video"),
|
|
37
37
|
children: _jsx(VideoCollection, {}),
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
key: MediaCollectionTabKey.File,
|
|
41
|
-
label: "
|
|
41
|
+
label: t("file"),
|
|
42
42
|
children: _jsx(FileCollection, {}),
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
key: MediaCollectionTabKey.Link,
|
|
46
|
-
label: "
|
|
46
|
+
label: t("link"),
|
|
47
47
|
children: _jsx(LinkCollection, {}),
|
|
48
48
|
},
|
|
49
49
|
];
|
|
50
|
-
}, [isOpen]);
|
|
50
|
+
}, [isOpen, t]);
|
|
51
51
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", onClick: toggle, children: _jsx(Icon, { icon: "folder-o", size: 22 }) }), _jsx(Drawer, { open: isOpen, onClose: toggle, mask: false, closeIcon: false, styles: {
|
|
52
52
|
body: {
|
|
53
53
|
padding: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AAoBA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CA0J3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMessage } from "../../hooks/message/useMessage";
|
|
4
4
|
import { Empty, Spin } from "antd";
|
|
5
|
-
import { useEffect,
|
|
5
|
+
import { useEffect, useRef } from "react";
|
|
6
6
|
import dayjs from "dayjs";
|
|
7
7
|
import isToday from "dayjs/plugin/isToday";
|
|
8
8
|
import emitter from "../../utils/events";
|
|
@@ -13,51 +13,89 @@ import MessageFooter from "./footer";
|
|
|
13
13
|
import { images } from "../../constants/images";
|
|
14
14
|
import { useTranslation } from "react-i18next";
|
|
15
15
|
import useConversationStore from "../../store/conversation";
|
|
16
|
+
import { isNumber } from "lodash";
|
|
17
|
+
import { useDebounceFn } from "ahooks";
|
|
18
|
+
import { MSG_ITEM_CONTENT_PREFIX, MSG_ITEM_PREFIX } from "../../constants";
|
|
16
19
|
dayjs.extend(isToday);
|
|
20
|
+
const BOTTOM_THRESHOLD = -5;
|
|
17
21
|
const MessageList = (props) => {
|
|
18
|
-
var _a
|
|
22
|
+
var _a;
|
|
19
23
|
const { t } = useTranslation();
|
|
20
|
-
const { onClose, conversationId } = props;
|
|
24
|
+
const { onClose, conversationId, searchClientMsgID } = props;
|
|
21
25
|
const scrollRef = useRef(null);
|
|
22
|
-
const { getMoreOldMessages, moreOldLoading, loadState,
|
|
26
|
+
const { getMoreOldMessages, moreOldLoading, loadState, getMoreNewMessages, moreNewLoading, } = useMessage(conversationId, searchClientMsgID);
|
|
23
27
|
const conversationData = useConversationStore((state) => state.conversationData);
|
|
24
|
-
const lastMessage = useMemo(() => {
|
|
25
|
-
var _a;
|
|
26
|
-
const messageList = (_a = latestLoadState.current) === null || _a === void 0 ? void 0 : _a.messageList;
|
|
27
|
-
return messageList === null || messageList === void 0 ? void 0 : messageList[(messageList === null || messageList === void 0 ? void 0 : messageList.length) - 1];
|
|
28
|
-
}, [(_a = latestLoadState === null || latestLoadState === void 0 ? void 0 : latestLoadState.current) === null || _a === void 0 ? void 0 : _a.messageList]);
|
|
29
28
|
const scrollToBottom = () => {
|
|
30
29
|
setTimeout(() => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
(_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
33
|
-
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
if (isNumber((_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollTop) &&
|
|
32
|
+
((_b = scrollRef.current) === null || _b === void 0 ? void 0 : _b.scrollTop) >= BOTTOM_THRESHOLD) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
(_c = scrollRef.current) === null || _c === void 0 ? void 0 : _c.scrollTo({
|
|
36
|
+
top: (_d = scrollRef.current) === null || _d === void 0 ? void 0 : _d.scrollHeight,
|
|
34
37
|
behavior: "smooth",
|
|
35
38
|
});
|
|
36
39
|
});
|
|
37
40
|
};
|
|
38
|
-
const
|
|
41
|
+
const scrollToMessage = (clientMsgID) => {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
const targetElement = document.getElementById(`${MSG_ITEM_PREFIX}${clientMsgID}`);
|
|
44
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.scrollIntoView({
|
|
45
|
+
behavior: "auto",
|
|
46
|
+
block: "center",
|
|
47
|
+
});
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
const targetContentElement = document.getElementById(`${MSG_ITEM_CONTENT_PREFIX}${clientMsgID}`);
|
|
50
|
+
targetContentElement === null || targetContentElement === void 0 ? void 0 : targetContentElement.classList.add("zoom-in-out-element", "border-blue-500", "border");
|
|
51
|
+
// Khi animation kết thúc thì remove element
|
|
52
|
+
const onEnd = () => {
|
|
53
|
+
targetContentElement === null || targetContentElement === void 0 ? void 0 : targetContentElement.classList.remove("zoom-in-out-element", "border-blue-500", "border");
|
|
54
|
+
targetContentElement === null || targetContentElement === void 0 ? void 0 : targetContentElement.removeEventListener("animationend", onEnd);
|
|
55
|
+
};
|
|
56
|
+
targetContentElement === null || targetContentElement === void 0 ? void 0 : targetContentElement.addEventListener("animationend", onEnd, {
|
|
57
|
+
once: true,
|
|
58
|
+
});
|
|
59
|
+
}, 500);
|
|
60
|
+
}, 200);
|
|
61
|
+
};
|
|
62
|
+
const loadMoreOldMessage = () => {
|
|
39
63
|
if (!loadState.hasMoreOld || moreOldLoading)
|
|
40
64
|
return;
|
|
41
65
|
getMoreOldMessages();
|
|
42
66
|
};
|
|
67
|
+
const { run: loadMoreNewMessage } = useDebounceFn(() => {
|
|
68
|
+
if (!loadState.hasMoreNew || moreNewLoading)
|
|
69
|
+
return;
|
|
70
|
+
getMoreNewMessages();
|
|
71
|
+
}, { wait: 200 });
|
|
43
72
|
useEffect(() => {
|
|
44
73
|
emitter.on("CHAT_LIST_SCROLL_TO_BOTTOM", scrollToBottom);
|
|
74
|
+
emitter.on("CHAT_LIST_SCROLL_TO_MESSAGE", scrollToMessage);
|
|
45
75
|
return () => {
|
|
46
76
|
emitter.off("CHAT_LIST_SCROLL_TO_BOTTOM", scrollToBottom);
|
|
77
|
+
emitter.off("CHAT_LIST_SCROLL_TO_MESSAGE", scrollToMessage);
|
|
47
78
|
};
|
|
48
79
|
}, []);
|
|
49
80
|
if (!conversationData) {
|
|
50
81
|
return (_jsx("div", { className: "flex flex-1 items-center justify-center h-full", children: _jsx(Empty, { description: t("no_conversation_data") }) }));
|
|
51
82
|
}
|
|
83
|
+
console.log("moreNewLoading", moreNewLoading);
|
|
52
84
|
return (_jsxs("div", { className: "flex flex-col flex-1 relative h-full", style: {
|
|
53
85
|
backgroundImage: `url(${images.conversationBg})`,
|
|
54
86
|
backgroundSize: "cover",
|
|
55
87
|
backgroundPosition: "center",
|
|
56
|
-
}, children: [_jsx(MessageHeader, { onClose: onClose }), _jsx("div", { id: "
|
|
88
|
+
}, children: [_jsx(MessageHeader, { onClose: onClose }), _jsx("div", { id: "scrollableMessagesDiv", ref: scrollRef, style: {
|
|
57
89
|
height: "100%",
|
|
58
90
|
overflow: "auto",
|
|
59
91
|
display: "flex",
|
|
60
92
|
flexDirection: "column-reverse",
|
|
61
|
-
|
|
93
|
+
paddingBottom: 12,
|
|
94
|
+
}, children: _jsx(InfiniteScroll, { dataLength: ((_a = loadState.messageList) === null || _a === void 0 ? void 0 : _a.length) || 0, next: loadMoreOldMessage, style: { display: "flex", flexDirection: "column-reverse" }, inverse: true, hasMore: loadState.hasMoreOld, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableMessagesDiv", onScroll: (e) => {
|
|
95
|
+
const target = e.target;
|
|
96
|
+
if (target.scrollTop > BOTTOM_THRESHOLD) {
|
|
97
|
+
loadMoreNewMessage();
|
|
98
|
+
}
|
|
99
|
+
}, children: loadState.messageList.map((message, _, array) => (_jsx(MessageItem, { message: message, allMessages: array }, message.clientMsgID))) }) }), moreNewLoading && (_jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) })), _jsx(MessageFooter, {})] }));
|
|
62
100
|
};
|
|
63
101
|
export default MessageList;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { MessageFooterContextType } from "../../../types/chat";
|
|
2
|
-
import { MessageItem } from "@openim/wasm-client-sdk";
|
|
3
|
-
interface IMessageFooterProviderProps {
|
|
4
|
-
lastMessage?: MessageItem;
|
|
5
|
-
}
|
|
6
2
|
export declare const MessageFooterContext: import("react").Context<MessageFooterContextType>;
|
|
7
3
|
export declare const useMessageFooterContext: () => MessageFooterContextType;
|
|
8
|
-
declare const MessageFooterProvider: (
|
|
4
|
+
declare const MessageFooterProvider: () => import("react/jsx-runtime").JSX.Element;
|
|
9
5
|
export default MessageFooterProvider;
|
|
10
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAmC/D,eAAO,MAAM,oBAAoB,mDAI/B,CAAC;AAEH,eAAO,MAAM,uBAAuB,gCAAyC,CAAC;AAE9E,QAAA,MAAM,qBAAqB,+CAuD1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -15,6 +15,7 @@ import EnterHandler from "./EnterHandler";
|
|
|
15
15
|
import ActionBar from "./ActionBar";
|
|
16
16
|
import { useSendMessage } from "../../../hooks/message/useSendMessage";
|
|
17
17
|
import FilePreview from "./FilePreview";
|
|
18
|
+
import { useTranslation } from "react-i18next";
|
|
18
19
|
const theme = {
|
|
19
20
|
text: {
|
|
20
21
|
bold: "font-bold",
|
|
@@ -47,9 +48,9 @@ export const MessageFooterContext = createContext({
|
|
|
47
48
|
setListUploadFiles: () => { },
|
|
48
49
|
});
|
|
49
50
|
export const useMessageFooterContext = () => useContext(MessageFooterContext);
|
|
50
|
-
const MessageFooterProvider = (
|
|
51
|
-
const {
|
|
52
|
-
const { sendTextMessage, sendMergeMessage } = useSendMessage(
|
|
51
|
+
const MessageFooterProvider = () => {
|
|
52
|
+
const { t } = useTranslation();
|
|
53
|
+
const { sendTextMessage, sendMergeMessage } = useSendMessage();
|
|
53
54
|
const [listUploadFiles, setListUploadFiles] = useState([]);
|
|
54
55
|
const onSendMessage = useCallback(async ({ plainText, richText, type, }) => {
|
|
55
56
|
if (type === "text") {
|
|
@@ -60,6 +61,6 @@ const MessageFooterProvider = (props) => {
|
|
|
60
61
|
}
|
|
61
62
|
setListUploadFiles([]);
|
|
62
63
|
}, [sendMergeMessage, sendTextMessage, listUploadFiles]);
|
|
63
|
-
return (_jsx(MessageFooterContext.Provider, { value: { onSendMessage, listUploadFiles, setListUploadFiles }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsx("div", { className: "relative px-4", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "border border-indigo-500 rounded-md bg-blue-100 min-h-[64px] max-h-[140px] overflow-y-auto px-3 py-2 text-sm" }), ErrorBoundary: LexicalErrorBoundary, "aria-placeholder": "
|
|
64
|
+
return (_jsx(MessageFooterContext.Provider, { value: { onSendMessage, listUploadFiles, setListUploadFiles }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsx("div", { className: "relative px-4", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "border border-indigo-500 rounded-md bg-blue-100 min-h-[64px] max-h-[140px] overflow-y-auto px-3 py-2 text-sm" }), ErrorBoundary: LexicalErrorBoundary, "aria-placeholder": t("enter_message"), placeholder: _jsx("div", { className: "absolute top-2 left-7 pointer-events-none", children: _jsx("p", { className: "text-gray-500 text-sm", children: t("enter_message") }) }) }) }), _jsx(ActionBar, {})] }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(EnterHandler, {})] }) }));
|
|
64
65
|
};
|
|
65
66
|
export default MessageFooterProvider;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MessageItem as MessageItemType } from "@openim/wasm-client-sdk";
|
|
2
2
|
interface MessageItemProps {
|
|
3
|
-
|
|
3
|
+
message: MessageItemType;
|
|
4
|
+
allMessages: MessageItemType[];
|
|
4
5
|
}
|
|
5
|
-
declare const MessageItem: ({
|
|
6
|
+
declare const MessageItem: ({ message, allMessages }: MessageItemProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
7
|
export default MessageItem;
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,WAAW,IAAI,eAAe,EAE/B,MAAM,yBAAyB,CAAC;AAajC,UAAU,gBAAgB;IACxB,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAID,QAAA,MAAM,WAAW,GAAI,0BAA0B,gBAAgB,mDAmH9D,CAAC;AAEF,eAAe,WAAW,CAAC"}
|