@webinex/chatify 2.0.0-alpha8 → 2.0.0-alpha9
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/Chatify-DGRV4QKP.js +2203 -0
- package/dist/Chatify-DGRV4QKP.js.map +1 -0
- package/dist/Chatify.css +670 -0
- package/dist/audit.css +60 -0
- package/dist/audit.js +242 -0
- package/dist/audit.js.map +1 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/types/audit/AuditChatList.d.ts +9 -0
- package/dist/types/audit/AuditConversationPanel.d.ts +10 -0
- package/dist/types/audit/AuditPanel.d.ts +14 -0
- package/dist/types/audit/AuditPanelCustomizeValue.d.ts +9 -0
- package/dist/types/audit/AuditSearch.d.ts +5 -0
- package/dist/types/audit/AuditSearchValue.d.ts +14 -0
- package/dist/types/audit/auditApi.d.ts +97 -0
- package/dist/types/audit/index.d.ts +17 -0
- package/dist/types/core/api/api.d.ts +17295 -0
- package/dist/{esm/types → types}/core/api/baseApi.d.ts +1 -1
- package/dist/{esm/types → types}/core/client.d.ts +3 -3
- package/dist/{esm/types → types}/core/types.d.ts +5 -0
- package/dist/types/ui/Chat/ChatEditableHeaderName.d.ts +1 -0
- package/dist/types/ui/Chat/ChatHeaderActions.d.ts +1 -0
- package/dist/{esm/types → types}/ui/Chat/ChatView.d.ts +1 -2
- package/dist/types/ui/Chat/Members/ChatMembersButton.d.ts +1 -0
- package/dist/types/ui/Chat/Members/ChatMembersPanel.d.ts +1 -0
- package/dist/types/ui/Chat/Members/ChatMembersPreview.d.ts +1 -0
- package/dist/{esm/types → types}/ui/ChatGroup/ChatGroupPanel.d.ts +2 -2
- package/dist/types/ui/ChatGroup/Create/CreateChatButton.d.ts +1 -0
- package/dist/{esm/types → types}/ui/ChatGroup/Create/CreateChatForm.d.ts +1 -2
- package/dist/types/ui/ChatGroup/Create/CreateChatMemberInput.d.ts +4 -0
- package/dist/types/ui/ChatGroup/Create/CreateChatNameInput.d.ts +4 -0
- package/dist/types/ui/ChatGroup/Create/CreateChatPanel.d.ts +1 -0
- package/dist/types/ui/ChatGroup/Layout/ChatGroupAside.d.ts +1 -0
- package/dist/types/ui/ChatGroup/Layout/ChatGroupBody.d.ts +1 -0
- package/dist/types/ui/ChatGroup/Layout/ChatGroupFooter.d.ts +1 -0
- package/dist/types/ui/ChatGroup/Layout/ChatGroupHeader.d.ts +1 -0
- package/dist/types/ui/ChatGroup/Layout/ChatGroupMain.d.ts +1 -0
- package/dist/types/ui/ChatGroup/List/ChatListPanel.d.ts +1 -0
- package/dist/types/ui/ChatGroup/List/index.d.ts +6 -0
- package/dist/types/ui/Chatify.d.ts +9 -0
- package/dist/{esm/types → types}/ui/Conversation/Conversation.d.ts +2 -3
- package/dist/types/ui/Conversation/ConversationActions.d.ts +1 -0
- package/dist/types/ui/Conversation/ConversationBody.d.ts +1 -0
- package/dist/{esm/types → types}/ui/Conversation/ConversationContext.d.ts +6 -5
- package/dist/types/ui/Conversation/ConversationHeader.d.ts +1 -0
- package/dist/types/ui/Conversation/ConversationName.d.ts +1 -0
- package/dist/types/ui/Conversation/InputBox/InputBox.d.ts +1 -0
- package/dist/types/ui/Conversation/InputBox/InputBoxFile.d.ts +7 -0
- package/dist/types/ui/Conversation/InputBox/InputBoxFileList.d.ts +7 -0
- package/dist/types/ui/Conversation/InputBox/InputFilesBox.d.ts +11 -0
- package/dist/types/ui/Conversation/InputBox/InputSubmitButtonBox.d.ts +6 -0
- package/dist/{esm/types → types}/ui/Conversation/InputBox/InputTextBox.d.ts +1 -1
- package/dist/types/ui/Conversation/Message/MessageAuthor.d.ts +2 -0
- package/dist/types/ui/Conversation/Message/MessageBox.d.ts +5 -0
- package/dist/types/ui/Conversation/Message/MessageContent.d.ts +2 -0
- package/dist/types/ui/Conversation/Message/MessageFile.d.ts +5 -0
- package/dist/types/ui/Conversation/Message/MessageFileList.d.ts +2 -0
- package/dist/types/ui/Conversation/Message/MessageInfoBox.d.ts +2 -0
- package/dist/{esm/types → types}/ui/Conversation/Message/MessageRow.d.ts +1 -1
- package/dist/types/ui/Conversation/Message/MessageText.d.ts +2 -0
- package/dist/types/ui/Conversation/SendingMessage/SendingMessageBox.d.ts +6 -0
- package/dist/types/ui/Conversation/SendingMessage/SendingMessageContent.d.ts +2 -0
- package/dist/types/ui/Conversation/SendingMessage/SendingMessageInfoBox.d.ts +2 -0
- package/dist/types/ui/Conversation/SendingMessage/SendingMessageText.d.ts +2 -0
- package/dist/types/ui/Conversation/SystemMessage/SystemMessageBox.d.ts +5 -0
- package/dist/{esm/types → types}/ui/Conversation/SystemMessage/SystemMessageRow.d.ts +1 -1
- package/dist/types/ui/Thread/ThreadActions.d.ts +1 -0
- package/dist/{esm/types → types}/ui/Thread/ThreadContext.d.ts +1 -1
- package/dist/types/ui/common/Avatar.d.ts +5 -0
- package/dist/types/ui/common/ChatList/ChatList.d.ts +16 -0
- package/dist/types/ui/common/ChatList/ChatListItemAvatar.d.ts +2 -0
- package/dist/types/ui/common/ChatList/ChatListItemBox.d.ts +9 -0
- package/dist/types/ui/common/ChatList/ChatListItemLastMessage.d.ts +2 -0
- package/dist/types/ui/common/ChatList/ChatListItemLastMessageAuthor.d.ts +2 -0
- package/dist/types/ui/common/ChatList/ChatListItemLastMessageContent.d.ts +2 -0
- package/dist/types/ui/common/ChatList/ChatListItemLastMessageSentAt.d.ts +2 -0
- package/dist/types/ui/common/ChatList/ChatListItemName.d.ts +2 -0
- package/dist/types/ui/common/ChatList/ChatListItemUnreadCount.d.ts +2 -0
- package/dist/types/ui/common/ChatList/ChatListValue.d.ts +8 -0
- package/dist/{esm/types/ui/ChatGroup/List → types/ui/common/ChatList}/index.d.ts +1 -0
- package/dist/types/ui/common/Icon.d.ts +21 -0
- package/dist/types/ui/common/MessageSkeleton.d.ts +4 -0
- package/dist/{esm/types → types}/ui/common/index.d.ts +1 -0
- package/dist/{esm/types → types}/ui/customize.d.ts +1 -1
- package/dist/{esm/types → types}/ui/index.d.ts +1 -3
- package/dist/{esm/types → types}/ui/localizer.d.ts +7 -2
- package/package.json +39 -52
- package/src/audit/AuditChatList.tsx +25 -0
- package/src/audit/AuditConversationPanel.tsx +48 -0
- package/src/audit/AuditPanel.tsx +76 -0
- package/src/audit/AuditPanelCustomizeValue.ts +11 -0
- package/src/audit/AuditSearch.tsx +89 -0
- package/src/audit/AuditSearchValue.tsx +42 -0
- package/src/audit/auditApi.tsx +113 -0
- package/src/audit/index.d.ts +18 -0
- package/src/audit/index.tsx +28 -0
- package/src/audit/styles.scss +72 -0
- package/src/core/client.ts +1 -1
- package/src/core/debounce.ts +1 -1
- package/src/core/types.tsx +9 -0
- package/src/styles/aside.scss +0 -136
- package/src/styles/chat-list.scss +138 -0
- package/src/styles/chat.scss +0 -198
- package/src/styles/conversation.scss +200 -0
- package/src/styles/index.scss +2 -0
- package/src/ui/Chat/ChatEditableHeaderName.tsx +1 -1
- package/src/ui/Chat/Members/ChatMembersPreview.tsx +1 -1
- package/src/ui/ChatGroup/ChatGroupPanel.tsx +2 -2
- package/src/ui/ChatGroup/Layout/ChatGroupAside.tsx +2 -2
- package/src/ui/ChatGroup/List/ChatListPanel.tsx +28 -0
- package/src/ui/ChatGroup/List/index.ts +6 -29
- package/src/ui/Chatify.tsx +7 -1
- package/src/ui/Conversation/Conversation.tsx +15 -1
- package/src/ui/Conversation/ConversationActions.tsx +8 -1
- package/src/ui/Conversation/ConversationContext.ts +4 -3
- package/src/ui/Conversation/ConversationHeader.tsx +4 -8
- package/src/ui/Conversation/InputBox/InputBox.tsx +4 -0
- package/src/ui/Conversation/InputBox/InputTextBox.tsx +1 -1
- package/src/ui/Conversation/Message/MessageInfoBox.tsx +1 -1
- package/src/ui/Conversation/ReadObserver/MessageReadObserver.tsx +1 -1
- package/src/ui/common/ChatList/ChatList.tsx +84 -0
- package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemBox.tsx +11 -5
- package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessageAuthor.tsx +3 -3
- package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessageContent.tsx +4 -4
- package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessageSentAt.tsx +1 -1
- package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemUnreadCount.tsx +1 -1
- package/src/ui/common/ChatList/ChatListValue.ts +9 -0
- package/src/ui/common/ChatList/index.ts +32 -0
- package/src/ui/common/Icon.tsx +15 -13
- package/src/ui/common/index.ts +1 -0
- package/src/ui/index.ts +3 -3
- package/src/ui/localizer.tsx +14 -2
- package/dist/css/chatify.css +0 -664
- package/dist/esm/index.js +0 -11
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/core/api/api.d.ts +0 -12696
- package/dist/esm/types/ui/Chat/ChatEditableHeaderName.d.ts +0 -2
- package/dist/esm/types/ui/Chat/ChatHeaderActions.d.ts +0 -2
- package/dist/esm/types/ui/Chat/Members/ChatMembersButton.d.ts +0 -2
- package/dist/esm/types/ui/Chat/Members/ChatMembersPanel.d.ts +0 -2
- package/dist/esm/types/ui/Chat/Members/ChatMembersPreview.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/Create/CreateChatButton.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/Create/CreateChatMemberInput.d.ts +0 -5
- package/dist/esm/types/ui/ChatGroup/Create/CreateChatNameInput.d.ts +0 -5
- package/dist/esm/types/ui/ChatGroup/Create/CreateChatPanel.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupAside.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupBody.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupFooter.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupHeader.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/Layout/ChatGroupMain.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/List/ChatList.d.ts +0 -2
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemAvatar.d.ts +0 -3
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemBox.d.ts +0 -6
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessage.d.ts +0 -3
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessageAuthor.d.ts +0 -3
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessageContent.d.ts +0 -3
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemLastMessageSentAt.d.ts +0 -3
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemName.d.ts +0 -3
- package/dist/esm/types/ui/ChatGroup/List/ChatListItemUnreadCount.d.ts +0 -3
- package/dist/esm/types/ui/Chatify.d.ts +0 -8
- package/dist/esm/types/ui/Conversation/ConversationActions.d.ts +0 -2
- package/dist/esm/types/ui/Conversation/ConversationBody.d.ts +0 -2
- package/dist/esm/types/ui/Conversation/ConversationHeader.d.ts +0 -2
- package/dist/esm/types/ui/Conversation/ConversationName.d.ts +0 -2
- package/dist/esm/types/ui/Conversation/InputBox/InputBox.d.ts +0 -2
- package/dist/esm/types/ui/Conversation/InputBox/InputBoxFile.d.ts +0 -8
- package/dist/esm/types/ui/Conversation/InputBox/InputBoxFileList.d.ts +0 -8
- package/dist/esm/types/ui/Conversation/InputBox/InputFilesBox.d.ts +0 -12
- package/dist/esm/types/ui/Conversation/InputBox/InputSubmitButtonBox.d.ts +0 -7
- package/dist/esm/types/ui/Conversation/Message/MessageAuthor.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/Message/MessageBox.d.ts +0 -6
- package/dist/esm/types/ui/Conversation/Message/MessageContent.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/Message/MessageFile.d.ts +0 -6
- package/dist/esm/types/ui/Conversation/Message/MessageFileList.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/Message/MessageInfoBox.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/Message/MessageText.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageBox.d.ts +0 -7
- package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageContent.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageInfoBox.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/SendingMessage/SendingMessageText.d.ts +0 -3
- package/dist/esm/types/ui/Conversation/SystemMessage/SystemMessageBox.d.ts +0 -6
- package/dist/esm/types/ui/Thread/ThreadActions.d.ts +0 -2
- package/dist/esm/types/ui/common/Avatar.d.ts +0 -6
- package/dist/esm/types/ui/common/Icon.d.ts +0 -22
- package/dist/esm/types/ui/common/MessageSkeleton.d.ts +0 -5
- package/dist/index.d.ts +0 -13384
- package/src/ui/ChatGroup/List/ChatList.tsx +0 -41
- /package/dist/{esm/types → types}/core/api/index.d.ts +0 -0
- /package/dist/{esm/types → types}/core/constants.d.ts +0 -0
- /package/dist/{esm/types → types}/core/debounce.d.ts +0 -0
- /package/dist/{esm/types → types}/core/index.d.ts +0 -0
- /package/dist/{esm/types → types}/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Chat/ChatContext.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Chat/ChatPanel.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Chat/Members/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Chat/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/ChatGroup/ChatGroupContext.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/ChatGroup/Create/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/ChatGroup/Layout/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/ChatGroup/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/InputBox/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/Message/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/NextObserver/NextMessagesObserver.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/NextObserver/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/ReadObserver/MessageReadObserver.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/ReadObserver/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/SendingMessage/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/SystemMessage/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Conversation/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Thread/ThreadPanel.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/Thread/index.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/color.d.ts +0 -0
- /package/dist/{esm/types → types}/ui/useFormatter.d.ts +0 -0
- /package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemAvatar.tsx +0 -0
- /package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemLastMessage.tsx +0 -0
- /package/src/ui/{ChatGroup/List → common/ChatList}/ChatListItemName.tsx +0 -0
|
@@ -14,7 +14,7 @@ export const ChatMembersPreview = customize('ChatMembersPreview', () => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<AntdAvatar.Group
|
|
17
|
+
<AntdAvatar.Group max={{ count: 5 }}>
|
|
18
18
|
{chat.members.map((x) => (
|
|
19
19
|
<Tooltip key={x.id} title={x.name}>
|
|
20
20
|
<Avatar account={x} />
|
|
@@ -2,7 +2,7 @@ import { CSSProperties, FC, useEffect, useMemo, useRef } from 'react';
|
|
|
2
2
|
import { Localizer, LocalizerContext, defaultLocalizer } from '../localizer';
|
|
3
3
|
import { CreateChatPanelCustomizeValue } from './Create';
|
|
4
4
|
import { ChatGroupBody, ChatGroupFooter, ChatGroupHeader, ChatGroupLayoutCustomizeValue } from './Layout';
|
|
5
|
-
import {
|
|
5
|
+
import { ChatListPanelCustomizeValue } from './List';
|
|
6
6
|
import { ChatGroupContext, useChatGroupContext } from './ChatGroupContext';
|
|
7
7
|
import { chatifyApi } from '../../core';
|
|
8
8
|
import { CustomizeContext } from '../customize';
|
|
@@ -11,7 +11,7 @@ import { ChatViewCustomizeValue } from '../Chat';
|
|
|
11
11
|
export interface ChatGroupCustomizeValue
|
|
12
12
|
extends ChatViewCustomizeValue,
|
|
13
13
|
CreateChatPanelCustomizeValue,
|
|
14
|
-
|
|
14
|
+
ChatListPanelCustomizeValue,
|
|
15
15
|
ChatGroupLayoutCustomizeValue {}
|
|
16
16
|
|
|
17
17
|
export interface ChatifyProps {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { customize } from '../../customize';
|
|
2
|
-
import {
|
|
2
|
+
import { ChatListPanel } from '../List';
|
|
3
3
|
import { CreateChatButton } from '../Create/CreateChatButton';
|
|
4
4
|
|
|
5
5
|
export const ChatGroupAside = customize('ChatGroupAside', () => {
|
|
6
6
|
return (
|
|
7
7
|
<div className="wxchtf-aside">
|
|
8
8
|
<CreateChatButton />
|
|
9
|
-
<
|
|
9
|
+
<ChatListPanel />
|
|
10
10
|
</div>
|
|
11
11
|
);
|
|
12
12
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { chatifyApi } from '../../../core';
|
|
3
|
+
import { customize } from '../../customize';
|
|
4
|
+
import { useChatGroupContext } from '../ChatGroupContext';
|
|
5
|
+
import { ChatListValue, ChatList } from '../../common';
|
|
6
|
+
|
|
7
|
+
function useData() {
|
|
8
|
+
const { data: chats } = chatifyApi.useGetChatListQuery();
|
|
9
|
+
return useMemo(
|
|
10
|
+
() =>
|
|
11
|
+
chats?.map(
|
|
12
|
+
(x): ChatListValue => ({
|
|
13
|
+
id: x.id,
|
|
14
|
+
name: x.name,
|
|
15
|
+
lastMessage: x.message,
|
|
16
|
+
lastReadMessageId: x.lastReadMessageId,
|
|
17
|
+
}),
|
|
18
|
+
) ?? [],
|
|
19
|
+
[chats],
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const ChatListPanel = customize('ChatListPanel', () => {
|
|
24
|
+
const { chatId, openChat } = useChatGroupContext();
|
|
25
|
+
const data = useData();
|
|
26
|
+
|
|
27
|
+
return <ChatList items={data} selected={chatId} onSelect={openChat} />;
|
|
28
|
+
});
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ChatListItemBox } from './ChatListItemBox';
|
|
4
|
-
import { ChatListItemLastMessage } from './ChatListItemLastMessage';
|
|
5
|
-
import { ChatListItemLastMessageAuthor } from './ChatListItemLastMessageAuthor';
|
|
6
|
-
import { ChatListItemLastMessageContent } from './ChatListItemLastMessageContent';
|
|
7
|
-
import { ChatListItemLastMessageSentAt } from './ChatListItemLastMessageSentAt';
|
|
8
|
-
import { ChatListItemName } from './ChatListItemName';
|
|
9
|
-
import { ChatListItemUnreadCount } from './ChatListItemUnreadCount';
|
|
1
|
+
import { ChatListCustomizeValue } from '../../common';
|
|
2
|
+
import { ChatListPanel } from './ChatListPanel';
|
|
10
3
|
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './ChatListItemAvatar';
|
|
13
|
-
export * from './ChatListItemBox';
|
|
14
|
-
export * from './ChatListItemLastMessage';
|
|
15
|
-
export * from './ChatListItemLastMessageAuthor';
|
|
16
|
-
export * from './ChatListItemLastMessageContent';
|
|
17
|
-
export * from './ChatListItemLastMessageSentAt';
|
|
18
|
-
export * from './ChatListItemName';
|
|
19
|
-
export * from './ChatListItemUnreadCount';
|
|
4
|
+
export * from './ChatListPanel';
|
|
20
5
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
ChatListItemBox?: typeof ChatListItemBox.Component | null;
|
|
25
|
-
ChatListItemLastMessage?: typeof ChatListItemLastMessage.Component | null;
|
|
26
|
-
ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
|
|
27
|
-
ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
|
|
28
|
-
ChatListItemLastMessageSentAt?: typeof ChatListItemLastMessageSentAt.Component | null;
|
|
29
|
-
ChatListItemName?: typeof ChatListItemName.Component | null;
|
|
30
|
-
ChatListItemUnreadCount?: typeof ChatListItemUnreadCount.Component | null;
|
|
31
|
-
}
|
|
6
|
+
export type ChatListPanelCustomizeValue = ChatListCustomizeValue & {
|
|
7
|
+
ChatListPanel?: typeof ChatListPanel.Component | null;
|
|
8
|
+
};
|
package/src/ui/Chatify.tsx
CHANGED
|
@@ -2,8 +2,14 @@ import { ChatPanel } from './Chat';
|
|
|
2
2
|
import { ChatGroupPanel } from './ChatGroup';
|
|
3
3
|
import { ThreadPanel } from './Thread';
|
|
4
4
|
|
|
5
|
+
export interface ChatifyType {
|
|
6
|
+
Thread: typeof ThreadPanel;
|
|
7
|
+
ChatGroup: typeof ChatGroupPanel;
|
|
8
|
+
Chat: typeof ChatPanel;
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
export const Chatify = {
|
|
6
12
|
Thread: ThreadPanel,
|
|
7
13
|
ChatGroup: ChatGroupPanel,
|
|
8
14
|
Chat: ChatPanel,
|
|
9
|
-
};
|
|
15
|
+
} as unknown as ChatifyType;
|
|
@@ -30,7 +30,19 @@ export interface ConversationCustomizeValue
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export const Conversation = customize('Conversation', (props: ConversationProps) => {
|
|
33
|
-
const {
|
|
33
|
+
const {
|
|
34
|
+
value,
|
|
35
|
+
hasMore,
|
|
36
|
+
messages,
|
|
37
|
+
nextLoading,
|
|
38
|
+
onNext,
|
|
39
|
+
onRead,
|
|
40
|
+
onSend,
|
|
41
|
+
isReading,
|
|
42
|
+
noReadTracking,
|
|
43
|
+
onClose,
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
34
46
|
const { id, active, name, lastReadMessageId } = value;
|
|
35
47
|
|
|
36
48
|
const context = useMemo<ConversationContextValue>(
|
|
@@ -47,6 +59,7 @@ export const Conversation = customize('Conversation', (props: ConversationProps)
|
|
|
47
59
|
onSend,
|
|
48
60
|
isReading,
|
|
49
61
|
noReadTracking,
|
|
62
|
+
onClose,
|
|
50
63
|
}),
|
|
51
64
|
[
|
|
52
65
|
id,
|
|
@@ -61,6 +74,7 @@ export const Conversation = customize('Conversation', (props: ConversationProps)
|
|
|
61
74
|
lastReadMessageId,
|
|
62
75
|
isReading,
|
|
63
76
|
noReadTracking,
|
|
77
|
+
onClose,
|
|
64
78
|
],
|
|
65
79
|
);
|
|
66
80
|
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { Button } from 'antd';
|
|
1
2
|
import { customize } from '../customize';
|
|
3
|
+
import { useConversation } from './ConversationContext';
|
|
4
|
+
import { Icon } from '../common';
|
|
2
5
|
|
|
3
6
|
export const ConversationActions = customize('ConversationActions', () => {
|
|
4
|
-
|
|
7
|
+
const { onClose } = useConversation();
|
|
8
|
+
|
|
9
|
+
if (!onClose) return null;
|
|
10
|
+
|
|
11
|
+
return <Button onClick={onClose} type="link" icon={<Icon type="close" />} />;
|
|
5
12
|
});
|
|
@@ -15,11 +15,12 @@ export interface ConversationContextValue extends ConversationValue {
|
|
|
15
15
|
nextLoading: boolean;
|
|
16
16
|
noReadTracking?: boolean;
|
|
17
17
|
|
|
18
|
-
isReading
|
|
18
|
+
isReading?: (id: string) => boolean;
|
|
19
19
|
onNext: () => void;
|
|
20
|
-
onSend
|
|
21
|
-
onRead
|
|
20
|
+
onSend?: (message: MessageBody) => void;
|
|
21
|
+
onRead?: (id: string) => void;
|
|
22
22
|
flippo?: Flippo;
|
|
23
|
+
onClose?: () => void;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const ConversationContext = React.createContext<ConversationContextValue>(undefined!);
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { Col, Row } from 'antd';
|
|
2
|
-
import { customize
|
|
2
|
+
import { customize } from '../customize';
|
|
3
3
|
import { ConversationName } from './ConversationName';
|
|
4
4
|
import { ConversationActions } from './ConversationActions';
|
|
5
5
|
|
|
6
6
|
export const ConversationHeader = customize('ConversationHeader', () => {
|
|
7
|
-
const Actions = useCustomize(ConversationActions);
|
|
8
|
-
|
|
9
7
|
return (
|
|
10
8
|
<div className="wxchtf-conversation-header">
|
|
11
9
|
<Row justify="space-between" align="middle">
|
|
12
10
|
<Col>
|
|
13
11
|
<ConversationName />
|
|
14
12
|
</Col>
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Col>
|
|
19
|
-
)}
|
|
13
|
+
<Col className="wxchtf-conversation-actions">
|
|
14
|
+
<ConversationActions />
|
|
15
|
+
</Col>
|
|
20
16
|
</Row>
|
|
21
17
|
</div>
|
|
22
18
|
);
|
|
@@ -15,6 +15,10 @@ function useFormState() {
|
|
|
15
15
|
const { onUpload, files, loading, setFiles, showFileBox, onDeleteFile } = useFlippoInputFileBox();
|
|
16
16
|
|
|
17
17
|
const onSubmit = useCallback(() => {
|
|
18
|
+
if (!onSend) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
const textValue = text.trim().length === 0 ? null : text.trim();
|
|
19
23
|
|
|
20
24
|
if ((!textValue && files.length === 0) || loading) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Input } from 'antd';
|
|
2
2
|
import { customize } from '../../customize';
|
|
3
|
-
import isHotkey from 'is-hotkey';
|
|
3
|
+
import { isHotkey } from 'is-hotkey';
|
|
4
4
|
import { RefObject, memo, useCallback } from 'react';
|
|
5
5
|
import { useLocalizer } from '../../localizer';
|
|
6
6
|
import { TextAreaProps } from 'antd/es/input';
|
|
@@ -12,7 +12,7 @@ export const MessageInfoBox = customize('MessageInfoBox', (props: MessageBoxProp
|
|
|
12
12
|
const my = sentBy.id === me;
|
|
13
13
|
const localizer = useLocalizer();
|
|
14
14
|
const isRead = lastReadMessageId != null && id.localeCompare(lastReadMessageId) <= 0;
|
|
15
|
-
const reading = !isRead && isReading(id);
|
|
15
|
+
const reading = !isRead && isReading?.(id);
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<div className="wxchtf-message-info-box">
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Menu, MenuProps } from 'antd';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { ChatListItemBox } from './ChatListItemBox';
|
|
4
|
+
import { customize } from '../../customize';
|
|
5
|
+
import { ChatListValue } from './ChatListValue';
|
|
6
|
+
import { useLocalizer } from '../../localizer';
|
|
7
|
+
import { messageSequencePart } from '../../../core';
|
|
8
|
+
|
|
9
|
+
export interface ChatListProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
items: ChatListValue[];
|
|
12
|
+
selected: string | null;
|
|
13
|
+
onSelect?: (id: string) => void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* If true, do not show read status.
|
|
17
|
+
*/
|
|
18
|
+
noRead?: boolean;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* If set, shows a message at the bottom indicating that only the top N chats are shown.
|
|
22
|
+
*/
|
|
23
|
+
top?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function useOnSelect(props: ChatListProps) {
|
|
27
|
+
const { onSelect } = props;
|
|
28
|
+
|
|
29
|
+
return useMemo(
|
|
30
|
+
() =>
|
|
31
|
+
onSelect
|
|
32
|
+
? (info: Parameters<NonNullable<MenuProps['onSelect']>>[0]) => onSelect(info.key as string)
|
|
33
|
+
: undefined,
|
|
34
|
+
[onSelect],
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function useMenuItems(props: ChatListProps) {
|
|
39
|
+
//28b2a1a6-c052-4761-ad2d-95ce36d59f06-000000001
|
|
40
|
+
const { items, noRead, top } = props;
|
|
41
|
+
const localizer = useLocalizer();
|
|
42
|
+
|
|
43
|
+
return useMemo<MenuProps['items']>(() => {
|
|
44
|
+
const result = items
|
|
45
|
+
?.slice()
|
|
46
|
+
.sort(
|
|
47
|
+
(a, b) => -messageSequencePart(a.lastMessage.id).localeCompare(messageSequencePart(b.lastMessage.id)),
|
|
48
|
+
)
|
|
49
|
+
.map((x) => ({ key: x.id, label: <ChatListItemBox chat={x} noRead={noRead} /> }));
|
|
50
|
+
|
|
51
|
+
if (top != null) {
|
|
52
|
+
return [
|
|
53
|
+
...result,
|
|
54
|
+
{
|
|
55
|
+
type: 'item',
|
|
56
|
+
key: 'top',
|
|
57
|
+
disabled: true,
|
|
58
|
+
label: (
|
|
59
|
+
<div style={{ textAlign: 'center', cursor: 'text', fontStyle: 'italic' }}>
|
|
60
|
+
{localizer.chatList.topShown(top)}
|
|
61
|
+
</div>
|
|
62
|
+
),
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return result;
|
|
68
|
+
}, [items, noRead, top, localizer]);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const ChatList = customize('ChatList', (props: ChatListProps) => {
|
|
72
|
+
const { selected: selectedChatId } = props;
|
|
73
|
+
const selected = useMemo(() => (selectedChatId ? [selectedChatId] : []), [selectedChatId]);
|
|
74
|
+
const onSelect = useOnSelect(props);
|
|
75
|
+
const items = useMenuItems(props);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
{items && (
|
|
80
|
+
<Menu className="wxchtf-chat-list" selectedKeys={selected} onSelect={onSelect} items={items} />
|
|
81
|
+
)}
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
});
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { ChatListItem as ChatListItemModel } from '../../../core';
|
|
2
1
|
import { customize } from '../../customize';
|
|
3
2
|
import { ChatListItemName } from './ChatListItemName';
|
|
4
3
|
import { ChatListItemUnreadCount } from './ChatListItemUnreadCount';
|
|
5
4
|
import { ChatListItemLastMessage } from './ChatListItemLastMessage';
|
|
6
5
|
import { ChatListItemAvatar } from './ChatListItemAvatar';
|
|
6
|
+
import { ChatListValue } from './ChatListValue';
|
|
7
7
|
|
|
8
8
|
export interface ChatListItemBoxProps {
|
|
9
|
-
chat:
|
|
9
|
+
chat: ChatListValue;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* If true, do not show read status.
|
|
13
|
+
*/
|
|
14
|
+
noRead?: boolean;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
export const ChatListItemBox = customize('ChatListItemBox', (props: ChatListItemBoxProps) => {
|
|
13
|
-
const {
|
|
14
|
-
const
|
|
18
|
+
const { noRead = false } = props;
|
|
19
|
+
const { lastMessage, lastReadMessageId } = props.chat;
|
|
20
|
+
const read = lastReadMessageId != null && lastReadMessageId.localeCompare(lastMessage.id) >= 0;
|
|
15
21
|
|
|
16
22
|
return (
|
|
17
|
-
<div className={'wxchtf-chat' + (!read ? ' --unread' : '')}>
|
|
23
|
+
<div className={'wxchtf-chat' + (!read && !noRead ? ' --unread' : '')}>
|
|
18
24
|
<ChatListItemAvatar {...props} />
|
|
19
25
|
<span className="wxchtf-chat-info">
|
|
20
26
|
<ChatListItemName {...props} />
|
|
@@ -4,12 +4,12 @@ import type { ChatListItemBoxProps } from './ChatListItemBox';
|
|
|
4
4
|
export const ChatListItemLastMessageAuthor = customize(
|
|
5
5
|
'ChatListItemLastMessageAuthor',
|
|
6
6
|
(props: ChatListItemBoxProps) => {
|
|
7
|
-
const {
|
|
7
|
+
const { lastMessage } = props.chat;
|
|
8
8
|
|
|
9
|
-
if (
|
|
9
|
+
if (lastMessage.sentBy.id === 'chatify::system') {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
return <div className="wxchtf-chat-last-author">{
|
|
13
|
+
return <div className="wxchtf-chat-last-author">{lastMessage.sentBy.name}</div>;
|
|
14
14
|
},
|
|
15
15
|
);
|
|
@@ -7,14 +7,14 @@ import type { ChatListItemBoxProps } from './ChatListItemBox';
|
|
|
7
7
|
export const ChatListItemLastMessageContent = customize<FC<ChatListItemBoxProps>>(
|
|
8
8
|
'ChatListItemLastMessageContent',
|
|
9
9
|
(props) => {
|
|
10
|
-
const {
|
|
10
|
+
const { lastMessage } = props.chat;
|
|
11
11
|
const localizer = useLocalizer();
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<div className="wxchtf-chat-last-message">
|
|
15
|
-
{
|
|
16
|
-
?
|
|
17
|
-
:
|
|
15
|
+
{lastMessage.sentBy.id === 'chatify::system'
|
|
16
|
+
? lastMessage.text && formatSystemMessage(localizer, lastMessage.text)
|
|
17
|
+
: lastMessage.text}
|
|
18
18
|
</div>
|
|
19
19
|
);
|
|
20
20
|
},
|
|
@@ -4,7 +4,7 @@ import { ChatListItemBoxProps } from './ChatListItemBox';
|
|
|
4
4
|
export const ChatListItemUnreadCount = customize('ChatListItemUnreadCount', (props: ChatListItemBoxProps) => {
|
|
5
5
|
const { totalUnreadCount: unreadCount } = props.chat;
|
|
6
6
|
|
|
7
|
-
if (unreadCount <= 0) {
|
|
7
|
+
if (unreadCount == null || unreadCount <= 0) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChatList } from './ChatList';
|
|
2
|
+
import { ChatListItemAvatar } from './ChatListItemAvatar';
|
|
3
|
+
import { ChatListItemBox } from './ChatListItemBox';
|
|
4
|
+
import { ChatListItemLastMessage } from './ChatListItemLastMessage';
|
|
5
|
+
import { ChatListItemLastMessageAuthor } from './ChatListItemLastMessageAuthor';
|
|
6
|
+
import { ChatListItemLastMessageContent } from './ChatListItemLastMessageContent';
|
|
7
|
+
import { ChatListItemLastMessageSentAt } from './ChatListItemLastMessageSentAt';
|
|
8
|
+
import { ChatListItemName } from './ChatListItemName';
|
|
9
|
+
import { ChatListItemUnreadCount } from './ChatListItemUnreadCount';
|
|
10
|
+
|
|
11
|
+
export * from './ChatList';
|
|
12
|
+
export * from './ChatListItemAvatar';
|
|
13
|
+
export * from './ChatListItemBox';
|
|
14
|
+
export * from './ChatListItemLastMessage';
|
|
15
|
+
export * from './ChatListItemLastMessageAuthor';
|
|
16
|
+
export * from './ChatListItemLastMessageContent';
|
|
17
|
+
export * from './ChatListItemLastMessageSentAt';
|
|
18
|
+
export * from './ChatListItemName';
|
|
19
|
+
export * from './ChatListItemUnreadCount';
|
|
20
|
+
export * from './ChatListValue';
|
|
21
|
+
|
|
22
|
+
export interface ChatListCustomizeValue {
|
|
23
|
+
ChatList?: typeof ChatList.Component | null;
|
|
24
|
+
ChatListItemAvatar?: typeof ChatListItemAvatar.Component | null;
|
|
25
|
+
ChatListItemBox?: typeof ChatListItemBox.Component | null;
|
|
26
|
+
ChatListItemLastMessage?: typeof ChatListItemLastMessage.Component | null;
|
|
27
|
+
ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
|
|
28
|
+
ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
|
|
29
|
+
ChatListItemLastMessageSentAt?: typeof ChatListItemLastMessageSentAt.Component | null;
|
|
30
|
+
ChatListItemName?: typeof ChatListItemName.Component | null;
|
|
31
|
+
ChatListItemUnreadCount?: typeof ChatListItemUnreadCount.Component | null;
|
|
32
|
+
}
|
package/src/ui/common/Icon.tsx
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { customize } from '../customize';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
import {
|
|
4
|
+
SendOutlined,
|
|
5
|
+
PaperClipOutlined,
|
|
6
|
+
UserAddOutlined,
|
|
7
|
+
UsergroupAddOutlined,
|
|
8
|
+
UserDeleteOutlined,
|
|
9
|
+
UsergroupDeleteOutlined,
|
|
10
|
+
TeamOutlined,
|
|
11
|
+
EditOutlined,
|
|
12
|
+
CloseOutlined,
|
|
13
|
+
EyeInvisibleOutlined,
|
|
14
|
+
EyeOutlined,
|
|
15
|
+
DeleteOutlined,
|
|
16
|
+
DownloadOutlined,
|
|
17
|
+
} from '@ant-design/icons';
|
|
16
18
|
|
|
17
19
|
export type IconType = keyof typeof ICONS;
|
|
18
20
|
|
package/src/ui/common/index.ts
CHANGED
package/src/ui/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import '../styles/index.scss';
|
|
2
|
+
|
|
1
3
|
export * from './color';
|
|
2
4
|
export * from './customize';
|
|
3
5
|
export * from './Chatify';
|
|
@@ -6,6 +8,4 @@ export * from './Chat';
|
|
|
6
8
|
export * from './ChatGroup';
|
|
7
9
|
export * from './Conversation';
|
|
8
10
|
export * from './Thread';
|
|
9
|
-
export * from './common
|
|
10
|
-
export * from './common/Avatar';
|
|
11
|
-
export * from './common/MessageSkeleton';
|
|
11
|
+
export * from './common';
|
package/src/ui/localizer.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { SystemMessageText } from '../core';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface LocalizerBase {
|
|
6
6
|
isToday: (value: string) => boolean;
|
|
7
7
|
timestamp: (value: string) => string;
|
|
8
8
|
dateTime: (value: string) => string;
|
|
@@ -39,15 +39,21 @@ export interface Localizer {
|
|
|
39
39
|
kb: (value: number) => string;
|
|
40
40
|
mb: (value: number) => string;
|
|
41
41
|
};
|
|
42
|
+
|
|
43
|
+
chatList: {
|
|
44
|
+
topShown: (count: number) => string;
|
|
45
|
+
};
|
|
42
46
|
}
|
|
43
47
|
|
|
48
|
+
export interface Localizer extends LocalizerBase {}
|
|
49
|
+
|
|
44
50
|
export const LocalizerContext = React.createContext<Localizer>(null!);
|
|
45
51
|
|
|
46
52
|
export function useLocalizer() {
|
|
47
53
|
return useContext(LocalizerContext);
|
|
48
54
|
}
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
const base: LocalizerBase = {
|
|
51
57
|
isToday: (value: string) => dayjs(value).isSame(dayjs(), 'day'),
|
|
52
58
|
timestamp: (value: string) => dayjs(value).format('HH:mm'),
|
|
53
59
|
dateTime: (value: string) => dayjs(value).format('DD/MM/YYYY HH:mm'),
|
|
@@ -93,4 +99,10 @@ export const defaultLocalizer: Localizer = {
|
|
|
93
99
|
mb: (value: number) =>
|
|
94
100
|
`${value.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 2 })} MB`,
|
|
95
101
|
},
|
|
102
|
+
|
|
103
|
+
chatList: {
|
|
104
|
+
topShown: (count: number) => `Latest active ${count} chat${count !== 1 ? 's' : ''} shown`,
|
|
105
|
+
},
|
|
96
106
|
};
|
|
107
|
+
|
|
108
|
+
export const defaultLocalizer: Localizer = base as unknown as Localizer;
|