@webinex/chatify 1.0.0-rc2 → 1.0.0-rc3
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/css/chatify.css +183 -141
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/core/action.d.ts +110 -42
- package/dist/esm/types/core/client.d.ts +2 -1
- package/dist/esm/types/core/index.d.ts +11 -8
- package/dist/esm/types/core/models.d.ts +10 -4
- package/dist/esm/types/core/state.d.ts +36 -7
- package/dist/esm/types/core/useAddChatMutation.d.ts +2 -0
- package/dist/esm/types/core/useAddMemberMutation.d.ts +2 -0
- package/dist/esm/types/core/useFetchNextMutation.d.ts +3 -0
- package/dist/esm/types/core/useGetAccountsQuery.d.ts +1 -0
- package/dist/esm/types/core/useGetChatListQuery.d.ts +1 -0
- package/dist/{cjs/types/core/useChat.d.ts → esm/types/core/useGetChatQuery.d.ts} +1 -1
- package/dist/esm/types/core/useGetMessagesQuery.d.ts +4 -0
- package/dist/esm/types/core/useRemoveMemberMutation.d.ts +2 -0
- package/dist/esm/types/core/useSendMutation.d.ts +2 -0
- package/dist/esm/types/core/useUpdateChatNameMutation.d.ts +2 -0
- package/dist/esm/types/ui/AddChatButton.d.ts +2 -2
- package/dist/esm/types/ui/Avatar.d.ts +2 -2
- package/dist/esm/types/ui/ChatList/ChatList.d.ts +2 -0
- package/dist/esm/types/ui/ChatList/ChatListItemBox.d.ts +6 -0
- package/dist/esm/types/ui/ChatList/ChatListItemLastMessage.d.ts +3 -0
- package/dist/esm/types/ui/ChatList/ChatListItemLastMessageAuthor.d.ts +3 -0
- package/dist/esm/types/ui/ChatList/ChatListItemLastMessageContent.d.ts +3 -0
- package/dist/esm/types/ui/ChatList/ChatListItemName.d.ts +3 -0
- package/dist/esm/types/ui/ChatList/ChatListItemUnreadCount.d.ts +3 -0
- package/dist/esm/types/ui/ChatList/index.d.ts +7 -0
- package/dist/esm/types/ui/ChatName.d.ts +2 -2
- package/dist/esm/types/ui/ChatPanel/ChatBody.d.ts +5 -0
- package/dist/esm/types/ui/ChatPanel/ChatHeader.d.ts +5 -0
- package/dist/esm/types/ui/ChatPanel/ChatHeaderMembers.d.ts +5 -0
- package/dist/esm/types/ui/ChatPanel/ChatHeaderName.d.ts +5 -0
- package/dist/esm/types/ui/ChatPanel/ChatMembersButton.d.ts +5 -0
- package/dist/esm/types/ui/ChatPanel/ChatMembersPanel.d.ts +5 -0
- package/dist/esm/types/ui/ChatPanel/ChatPanel.d.ts +5 -0
- package/dist/esm/types/ui/ChatPanel/index.d.ts +6 -0
- package/dist/esm/types/ui/Chatify.d.ts +45 -23
- package/dist/esm/types/ui/CreateChatPanel/CreateChatForm.d.ts +11 -0
- package/dist/esm/types/ui/CreateChatPanel/CreateChatMemberInput.d.ts +5 -0
- package/dist/esm/types/ui/CreateChatPanel/CreateChatNameInput.d.ts +5 -0
- package/dist/esm/types/ui/CreateChatPanel/CreateChatPanel.d.ts +2 -0
- package/dist/esm/types/ui/CreateChatPanel/index.d.ts +4 -0
- package/dist/esm/types/ui/Icon.d.ts +13 -4
- package/dist/esm/types/ui/InputBox/InputBox.d.ts +2 -0
- package/dist/esm/types/ui/InputBox/InputFilesBox.d.ts +2 -0
- package/dist/esm/types/ui/InputBox/InputSubmitButtonBox.d.ts +5 -0
- package/dist/esm/types/ui/InputBox/InputTextBox.d.ts +7 -0
- package/dist/esm/types/ui/InputBox/index.d.ts +4 -0
- package/dist/esm/types/ui/Layout/Aside.d.ts +2 -0
- package/dist/esm/types/ui/Layout/Body.d.ts +2 -0
- package/dist/esm/types/ui/Layout/Footer.d.ts +2 -0
- package/dist/esm/types/ui/Layout/Header.d.ts +2 -0
- package/dist/esm/types/ui/Layout/Main.d.ts +2 -0
- package/dist/esm/types/ui/Layout/index.d.ts +5 -0
- package/dist/esm/types/ui/Message/MessageAuthor.d.ts +3 -0
- package/dist/esm/types/ui/Message/MessageBox.d.ts +6 -0
- package/dist/esm/types/ui/Message/MessageContent.d.ts +3 -0
- package/dist/esm/types/ui/Message/MessageInfoBox.d.ts +3 -0
- package/dist/esm/types/ui/Message/MessageRow.d.ts +6 -0
- package/dist/esm/types/ui/Message/MessageText.d.ts +3 -0
- package/dist/esm/types/ui/Message/index.d.ts +6 -0
- package/dist/esm/types/ui/MessageReadObserver.d.ts +6 -0
- package/dist/esm/types/ui/Next.d.ts +4 -0
- package/dist/esm/types/ui/SendingMessage/SendingMessageBox.d.ts +7 -0
- package/dist/esm/types/ui/SendingMessage/SendingMessageContent.d.ts +3 -0
- package/dist/esm/types/ui/SendingMessage/SendingMessageInfoBox.d.ts +3 -0
- package/dist/esm/types/ui/SendingMessage/SendingMessageText.d.ts +3 -0
- package/dist/esm/types/ui/SendingMessage/index.d.ts +4 -0
- package/dist/esm/types/ui/SystemMessage/SystemMessageBox.d.ts +6 -0
- package/dist/esm/types/ui/SystemMessage/SystemMessageRow.d.ts +9 -0
- package/dist/esm/types/ui/SystemMessage/index.d.ts +2 -0
- package/dist/esm/types/{util → ui}/customize.d.ts +2 -3
- package/dist/esm/types/ui/index.d.ts +6 -6
- package/dist/esm/types/ui/localizer.d.ts +5 -0
- package/dist/esm/types/util/index.d.ts +0 -1
- package/dist/index.d.ts +353 -142
- package/package.json +3 -1
- package/src/core/action.tsx +319 -233
- package/src/core/client.ts +6 -0
- package/src/core/index.ts +11 -8
- package/src/core/models.tsx +11 -4
- package/src/core/reducer.tsx +2 -1
- package/src/core/state.ts +68 -14
- package/src/core/useAddChatMutation.tsx +22 -0
- package/src/core/useAddMemberMutation.tsx +25 -0
- package/src/core/useFetchNextMutation.tsx +28 -0
- package/src/core/useGetAccountsQuery.tsx +33 -0
- package/src/core/useGetChatListQuery.tsx +33 -0
- package/src/core/useGetChatQuery.tsx +34 -0
- package/src/core/useGetMessagesQuery.tsx +35 -0
- package/src/core/useReadMonitor.tsx +8 -7
- package/src/core/useRemoveMemberMutation.tsx +23 -0
- package/src/core/useSendMutation.tsx +24 -0
- package/src/core/useSignalRMonitor.tsx +19 -5
- package/src/core/useUpdateChatNameMutation.tsx +23 -0
- package/src/{ui/styles → styles}/aside.scss +1 -1
- package/src/styles/chat.scss +222 -0
- package/src/styles/index.scss +79 -0
- package/src/styles/settings.scss +5 -0
- package/src/ui/AddChatButton.tsx +4 -8
- package/src/ui/Avatar.tsx +1 -1
- package/src/ui/ChatList/ChatList.tsx +42 -0
- package/src/ui/ChatList/ChatListItemBox.tsx +22 -0
- package/src/ui/ChatList/ChatListItemLastMessage.tsx +13 -0
- package/src/ui/ChatList/ChatListItemLastMessageAuthor.tsx +20 -0
- package/src/ui/ChatList/ChatListItemLastMessageContent.tsx +21 -0
- package/src/ui/ChatList/ChatListItemName.tsx +13 -0
- package/src/ui/ChatList/ChatListItemUnreadCount.tsx +12 -0
- package/src/ui/ChatList/index.ts +7 -0
- package/src/ui/ChatName.tsx +3 -8
- package/src/ui/ChatPanel/ChatBody.tsx +44 -0
- package/src/ui/ChatPanel/ChatHeader.tsx +33 -0
- package/src/ui/{ChatHeaderMembers.tsx → ChatPanel/ChatHeaderMembers.tsx} +5 -9
- package/src/ui/ChatPanel/ChatHeaderName.tsx +67 -0
- package/src/ui/ChatPanel/ChatMembersButton.tsx +21 -0
- package/src/ui/ChatPanel/ChatMembersPanel.tsx +117 -0
- package/src/ui/ChatPanel/ChatPanel.tsx +27 -0
- package/src/ui/ChatPanel/index.ts +6 -0
- package/src/ui/Chatify.tsx +78 -36
- package/src/ui/CreateChatPanel/CreateChatForm.tsx +36 -0
- package/src/ui/CreateChatPanel/CreateChatMemberInput.tsx +66 -0
- package/src/ui/CreateChatPanel/CreateChatNameInput.tsx +25 -0
- package/src/ui/CreateChatPanel/CreateChatPanel.tsx +33 -0
- package/src/ui/CreateChatPanel/index.ts +4 -0
- package/src/ui/Icon.tsx +18 -6
- package/src/ui/InputBox/InputBox.tsx +38 -0
- package/src/ui/InputBox/InputFilesBox.tsx +9 -0
- package/src/ui/InputBox/InputSubmitButtonBox.tsx +17 -0
- package/src/ui/InputBox/InputTextBox.tsx +50 -0
- package/src/ui/InputBox/index.ts +4 -0
- package/src/ui/Layout/Aside.tsx +10 -0
- package/src/ui/Layout/Body.tsx +10 -0
- package/src/ui/Layout/Footer.tsx +3 -0
- package/src/ui/Layout/Header.tsx +10 -0
- package/src/ui/Layout/Main.tsx +15 -0
- package/src/ui/Layout/index.ts +5 -0
- package/src/ui/Message/MessageAuthor.tsx +13 -0
- package/src/ui/Message/MessageBox.tsx +20 -0
- package/src/ui/Message/MessageContent.tsx +13 -0
- package/src/ui/Message/MessageInfoBox.tsx +25 -0
- package/src/ui/Message/MessageRow.tsx +24 -0
- package/src/ui/Message/MessageText.tsx +7 -0
- package/src/ui/Message/index.ts +6 -0
- package/src/ui/MessageReadObserver.tsx +45 -0
- package/src/ui/{LoadMore.tsx → Next.tsx} +16 -8
- package/src/ui/SendingMessage/SendingMessageBox.tsx +16 -0
- package/src/ui/SendingMessage/SendingMessageContent.tsx +13 -0
- package/src/ui/SendingMessage/SendingMessageInfoBox.tsx +13 -0
- package/src/ui/SendingMessage/SendingMessageText.tsx +7 -0
- package/src/ui/SendingMessage/index.ts +4 -0
- package/src/ui/SystemMessage/SystemMessageBox.tsx +20 -0
- package/src/ui/SystemMessage/SystemMessageRow.tsx +43 -0
- package/src/ui/SystemMessage/index.ts +2 -0
- package/src/{util → ui}/customize.tsx +5 -5
- package/src/ui/index.ts +6 -6
- package/src/ui/localizer.tsx +12 -0
- package/src/util/index.ts +0 -1
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types/ChatifyContext.d.ts +0 -11
- package/dist/cjs/types/core/action.d.ts +0 -76
- package/dist/cjs/types/core/client.d.ts +0 -35
- package/dist/cjs/types/core/index.d.ts +0 -14
- package/dist/cjs/types/core/models.d.ts +0 -64
- package/dist/cjs/types/core/reducer.d.ts +0 -11
- package/dist/cjs/types/core/state.d.ts +0 -25
- package/dist/cjs/types/core/useAccounts.d.ts +0 -1
- package/dist/cjs/types/core/useAddChat.d.ts +0 -2
- package/dist/cjs/types/core/useAddMember.d.ts +0 -2
- package/dist/cjs/types/core/useAddMessage.d.ts +0 -5
- package/dist/cjs/types/core/useChatList.d.ts +0 -1
- package/dist/cjs/types/core/useLoadMore.d.ts +0 -3
- package/dist/cjs/types/core/useMessages.d.ts +0 -15
- package/dist/cjs/types/core/useMutation.d.ts +0 -12
- package/dist/cjs/types/core/useQuery.d.ts +0 -7
- package/dist/cjs/types/core/useReadMonitor.d.ts +0 -1
- package/dist/cjs/types/core/useRemoveMember.d.ts +0 -2
- package/dist/cjs/types/core/useSignalRMonitor.d.ts +0 -2
- package/dist/cjs/types/index.d.ts +0 -3
- package/dist/cjs/types/ui/AddChat.d.ts +0 -1
- package/dist/cjs/types/ui/AddChatButton.d.ts +0 -2
- package/dist/cjs/types/ui/Aside.d.ts +0 -1
- package/dist/cjs/types/ui/Avatar.d.ts +0 -6
- package/dist/cjs/types/ui/Chat.d.ts +0 -4
- package/dist/cjs/types/ui/ChatBody.d.ts +0 -4
- package/dist/cjs/types/ui/ChatHeader.d.ts +0 -4
- package/dist/cjs/types/ui/ChatHeaderMembers.d.ts +0 -5
- package/dist/cjs/types/ui/ChatHeaderSettingsButton.d.ts +0 -5
- package/dist/cjs/types/ui/ChatListItem.d.ts +0 -11
- package/dist/cjs/types/ui/ChatName.d.ts +0 -5
- package/dist/cjs/types/ui/ChatSettings.d.ts +0 -1
- package/dist/cjs/types/ui/Chatify.d.ts +0 -49
- package/dist/cjs/types/ui/Footer.d.ts +0 -2
- package/dist/cjs/types/ui/Header.d.ts +0 -2
- package/dist/cjs/types/ui/Icon.d.ts +0 -7
- package/dist/cjs/types/ui/InputForm.d.ts +0 -1
- package/dist/cjs/types/ui/LoadMore.d.ts +0 -4
- package/dist/cjs/types/ui/Main.d.ts +0 -1
- package/dist/cjs/types/ui/Message.d.ts +0 -18
- package/dist/cjs/types/ui/MessageSkeleton.d.ts +0 -4
- package/dist/cjs/types/ui/SendingMessage.d.ts +0 -10
- package/dist/cjs/types/ui/SystemMessage.d.ts +0 -8
- package/dist/cjs/types/ui/index.d.ts +0 -11
- package/dist/cjs/types/ui/localizer.d.ts +0 -32
- package/dist/cjs/types/util/customize.d.ts +0 -12
- package/dist/cjs/types/util/index.d.ts +0 -3
- package/dist/cjs/types/util/uniqBy.d.ts +0 -1
- package/dist/cjs/types/util/uniqId.d.ts +0 -1
- package/dist/esm/types/core/useAccounts.d.ts +0 -1
- package/dist/esm/types/core/useAddChat.d.ts +0 -2
- package/dist/esm/types/core/useAddMember.d.ts +0 -2
- package/dist/esm/types/core/useAddMessage.d.ts +0 -5
- package/dist/esm/types/core/useChat.d.ts +0 -3
- package/dist/esm/types/core/useChatList.d.ts +0 -1
- package/dist/esm/types/core/useLoadMore.d.ts +0 -3
- package/dist/esm/types/core/useMessages.d.ts +0 -15
- package/dist/esm/types/core/useMutation.d.ts +0 -12
- package/dist/esm/types/core/useQuery.d.ts +0 -7
- package/dist/esm/types/core/useRemoveMember.d.ts +0 -2
- package/dist/esm/types/ui/AddChat.d.ts +0 -1
- package/dist/esm/types/ui/Aside.d.ts +0 -1
- package/dist/esm/types/ui/Chat.d.ts +0 -4
- package/dist/esm/types/ui/ChatBody.d.ts +0 -4
- package/dist/esm/types/ui/ChatHeader.d.ts +0 -4
- package/dist/esm/types/ui/ChatHeaderMembers.d.ts +0 -5
- package/dist/esm/types/ui/ChatHeaderSettingsButton.d.ts +0 -5
- package/dist/esm/types/ui/ChatListItem.d.ts +0 -11
- package/dist/esm/types/ui/ChatSettings.d.ts +0 -1
- package/dist/esm/types/ui/Footer.d.ts +0 -2
- package/dist/esm/types/ui/Header.d.ts +0 -2
- package/dist/esm/types/ui/InputForm.d.ts +0 -1
- package/dist/esm/types/ui/LoadMore.d.ts +0 -4
- package/dist/esm/types/ui/Main.d.ts +0 -1
- package/dist/esm/types/ui/Message.d.ts +0 -18
- package/dist/esm/types/ui/SendingMessage.d.ts +0 -10
- package/dist/esm/types/ui/SystemMessage.d.ts +0 -8
- package/src/core/useAccounts.tsx +0 -11
- package/src/core/useAddChat.tsx +0 -12
- package/src/core/useAddMember.tsx +0 -12
- package/src/core/useAddMessage.tsx +0 -40
- package/src/core/useChat.tsx +0 -12
- package/src/core/useChatList.tsx +0 -10
- package/src/core/useLoadMore.tsx +0 -42
- package/src/core/useMessages.tsx +0 -23
- package/src/core/useMutation.tsx +0 -48
- package/src/core/useQuery.tsx +0 -45
- package/src/core/useRemoveMember.tsx +0 -12
- package/src/ui/AddChat.tsx +0 -55
- package/src/ui/Aside.tsx +0 -41
- package/src/ui/Chat.tsx +0 -26
- package/src/ui/ChatBody.tsx +0 -43
- package/src/ui/ChatHeader.tsx +0 -33
- package/src/ui/ChatHeaderSettingsButton.tsx +0 -26
- package/src/ui/ChatListItem.tsx +0 -101
- package/src/ui/ChatSettings.tsx +0 -59
- package/src/ui/Footer.tsx +0 -7
- package/src/ui/Header.tsx +0 -14
- package/src/ui/InputForm.tsx +0 -51
- package/src/ui/Main.tsx +0 -16
- package/src/ui/Message.tsx +0 -118
- package/src/ui/SendingMessage.tsx +0 -50
- package/src/ui/SystemMessage.tsx +0 -32
- package/src/ui/styles/index.scss +0 -248
- /package/src/{ui/styles → styles}/keyframes.scss +0 -0
- /package/src/{ui/styles → styles}/mixins.scss +0 -0
- /package/src/{ui/styles → styles}/variables.scss +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
.wxchtf-chatify {
|
|
2
|
+
.wxchtf-chat-panel {
|
|
3
|
+
flex: auto;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-flow: row nowrap;
|
|
6
|
+
|
|
7
|
+
.wxchtf-chat-main {
|
|
8
|
+
flex: 1;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-flow: column nowrap;
|
|
11
|
+
|
|
12
|
+
.wxchtf-chat-header {
|
|
13
|
+
border-bottom: $border;
|
|
14
|
+
padding: 0.5rem 1rem;
|
|
15
|
+
|
|
16
|
+
.wxchtf-chat-name {
|
|
17
|
+
font-weight: 600;
|
|
18
|
+
flex: none;
|
|
19
|
+
|
|
20
|
+
&.--editable {
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.wxchtf-chat-body {
|
|
27
|
+
flex: 1 1 auto;
|
|
28
|
+
height: 100px;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
background: $chatBodyBackground;
|
|
31
|
+
padding: 2rem 1rem;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-flow: column-reverse nowrap;
|
|
34
|
+
|
|
35
|
+
@include scrollbar();
|
|
36
|
+
|
|
37
|
+
@media only screen and (min-width: 1120px) {
|
|
38
|
+
padding-right: 30%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.wxchtf-message,
|
|
42
|
+
.wxchtf-sending-message {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-flow: row nowrap;
|
|
45
|
+
width: 100%;
|
|
46
|
+
align-items: flex-end;
|
|
47
|
+
|
|
48
|
+
&.--my {
|
|
49
|
+
direction: rtl;
|
|
50
|
+
justify-content: flex-start;
|
|
51
|
+
|
|
52
|
+
.wxchtf-message-author {
|
|
53
|
+
margin-right: 0;
|
|
54
|
+
margin-left: 15px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.wxchtf-message-content,
|
|
58
|
+
.wxchtf-sending-message-content {
|
|
59
|
+
direction: ltr;
|
|
60
|
+
border-bottom-left-radius: 10px;
|
|
61
|
+
border-bottom-right-radius: 0;
|
|
62
|
+
background-color: $myMessageBackground;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.wxchtf-message-author {
|
|
67
|
+
margin-right: 15px;
|
|
68
|
+
|
|
69
|
+
.ant-avatar {
|
|
70
|
+
@include avatarSize($avatarSize);
|
|
71
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.wxchtf-message-content,
|
|
76
|
+
.wxchtf-sending-message-content {
|
|
77
|
+
min-width: 300px;
|
|
78
|
+
max-width: 70%;
|
|
79
|
+
border-radius: $messageBorderRadius;
|
|
80
|
+
padding: 0.75rem 1rem;
|
|
81
|
+
background: white;
|
|
82
|
+
border-bottom-left-radius: 0;
|
|
83
|
+
background-color: $messageBackground;
|
|
84
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
85
|
+
display: block;
|
|
86
|
+
white-space: pre-wrap;
|
|
87
|
+
overflow-wrap: break-word;
|
|
88
|
+
|
|
89
|
+
.wxchtf-message-info-box,
|
|
90
|
+
.wxchtf-sending-message-info-box {
|
|
91
|
+
text-align: right;
|
|
92
|
+
|
|
93
|
+
.wxchtf-message-sent-at,
|
|
94
|
+
.wxchtf-message-read-box,
|
|
95
|
+
.wxchtf-sending-message-sending-box {
|
|
96
|
+
display: inline-block;
|
|
97
|
+
font-style: italic;
|
|
98
|
+
font-size: 0.75em;
|
|
99
|
+
margin-top: 0.5rem;
|
|
100
|
+
opacity: 0.5;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.wxchtf-message-read-box,
|
|
104
|
+
.wxchtf-sending-message-sending-box {
|
|
105
|
+
margin-left: 5px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.wxchtf-system-message {
|
|
112
|
+
font-style: italic;
|
|
113
|
+
position: relative;
|
|
114
|
+
text-align: center;
|
|
115
|
+
|
|
116
|
+
.wxchtf-text,
|
|
117
|
+
.wxchtf-timestamp {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
opacity: 0.9;
|
|
120
|
+
font-size: 0.85em;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.wxchtf-timestamp {
|
|
124
|
+
margin-left: 1rem;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.wxchtf-message,
|
|
129
|
+
.wxchtf-sending-message,
|
|
130
|
+
.wxchtf-system-message,
|
|
131
|
+
.wxchtf-message-skeleton {
|
|
132
|
+
margin-bottom: 2rem;
|
|
133
|
+
|
|
134
|
+
&:first-child {
|
|
135
|
+
margin-bottom: 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.wxchtf-message-skeleton {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-flow: row nowrap;
|
|
142
|
+
align-items: flex-end;
|
|
143
|
+
|
|
144
|
+
.wxchtf-avatar {
|
|
145
|
+
margin-right: 15px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.wxchtf-avatar .ant-skeleton-avatar {
|
|
149
|
+
width: $avatarSize;
|
|
150
|
+
height: $avatarSize;
|
|
151
|
+
line-height: $avatarSize;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.wxchtf-content {
|
|
155
|
+
width: 300px;
|
|
156
|
+
height: 100px;
|
|
157
|
+
border-radius: $messageBorderRadius;
|
|
158
|
+
border-bottom-left-radius: 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.wxchtf-input-form {
|
|
164
|
+
flex: none;
|
|
165
|
+
max-height: 300px;
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-flow: column nowrap;
|
|
168
|
+
|
|
169
|
+
.wxchtf-input-box {
|
|
170
|
+
flex: none;
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-flow: row nowrap;
|
|
173
|
+
padding: 1rem 0;
|
|
174
|
+
border-top: $border;
|
|
175
|
+
|
|
176
|
+
@mixin iconBtn {
|
|
177
|
+
flex: none;
|
|
178
|
+
display: flex;
|
|
179
|
+
padding: 0 1rem;
|
|
180
|
+
align-items: flex-end;
|
|
181
|
+
|
|
182
|
+
.ant-btn.ant-btn-icon-only .anticon {
|
|
183
|
+
font-size: 1.5rem;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.wxchtf-add-files-box {
|
|
188
|
+
@include iconBtn();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.wxchtf-text-input-box {
|
|
192
|
+
flex: auto;
|
|
193
|
+
|
|
194
|
+
textarea {
|
|
195
|
+
resize: none;
|
|
196
|
+
border: none;
|
|
197
|
+
outline: none;
|
|
198
|
+
box-shadow: none;
|
|
199
|
+
|
|
200
|
+
@include scrollbar();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.wxchtf-submit-btn-box {
|
|
205
|
+
@include iconBtn();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.wxchtf-chat-members-panel {
|
|
212
|
+
min-width: 300px;
|
|
213
|
+
border-left: $border;
|
|
214
|
+
|
|
215
|
+
.wxchtf-chat-members-list {
|
|
216
|
+
.wxchtf-chat-members-list-item {
|
|
217
|
+
padding-inline: 1rem;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
@import './variables.scss';
|
|
2
|
+
@import './mixins.scss';
|
|
3
|
+
@import './keyframes.scss';
|
|
4
|
+
@import './aside.scss';
|
|
5
|
+
@import './settings.scss';
|
|
6
|
+
@import './chat.scss';
|
|
7
|
+
|
|
8
|
+
.wxchtf-chatify {
|
|
9
|
+
border: $border;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-flow: column nowrap;
|
|
12
|
+
background: $background;
|
|
13
|
+
border-radius: $radius;
|
|
14
|
+
|
|
15
|
+
.wxchtf-header {
|
|
16
|
+
min-height: 2rem;
|
|
17
|
+
border-bottom: $border;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.wxchtf-body {
|
|
21
|
+
flex: 1 0;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-flow: row nowrap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.wxchtf-footer {
|
|
27
|
+
min-height: 2rem;
|
|
28
|
+
border-top: $border;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.wxchtf-main {
|
|
33
|
+
flex: auto;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-flow: column nowrap;
|
|
36
|
+
|
|
37
|
+
.wxchtf-create-chat {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-flow: column nowrap;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
height: 100%;
|
|
43
|
+
|
|
44
|
+
form {
|
|
45
|
+
padding: 2rem;
|
|
46
|
+
max-width: 700px;
|
|
47
|
+
width: 100%;
|
|
48
|
+
|
|
49
|
+
.wxchtf-create-chat-member-input-list {
|
|
50
|
+
max-height: 15rem;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
|
|
53
|
+
.ant-list-item {
|
|
54
|
+
padding-inline: 0.5rem;
|
|
55
|
+
|
|
56
|
+
&.--selected {
|
|
57
|
+
background-color: #e6f4ff;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ant-checkbox-wrapper {
|
|
61
|
+
width: 100%;
|
|
62
|
+
|
|
63
|
+
& > span:last-child {
|
|
64
|
+
flex: 1;
|
|
65
|
+
|
|
66
|
+
.ant-list-item-meta {
|
|
67
|
+
align-items: center;
|
|
68
|
+
|
|
69
|
+
.ant-list-item-meta-content h4 {
|
|
70
|
+
margin-bottom: 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
package/src/ui/AddChatButton.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Button } from 'antd';
|
|
2
2
|
import { useDispatch } from '../core';
|
|
3
|
-
import {
|
|
4
|
-
import { customize } from '
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { customize } from './customize';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
export const AddChatButton = customize('AddChatButton', () => {
|
|
7
7
|
const dispatch = useDispatch();
|
|
8
8
|
const onAddChat = useCallback(() => dispatch({ type: 'new_chat_open', data: undefined }), [dispatch]);
|
|
9
9
|
|
|
@@ -12,8 +12,4 @@ const _AddChatButton: FC = () => {
|
|
|
12
12
|
Add chat
|
|
13
13
|
</Button>
|
|
14
14
|
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
_AddChatButton.displayName = 'AddChatButton';
|
|
18
|
-
|
|
19
|
-
export const AddChatButton = customize('AddChatButton', _AddChatButton);
|
|
15
|
+
});
|
package/src/ui/Avatar.tsx
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Menu, MenuProps } from 'antd';
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import type { MenuItemType } from 'antd/es/menu/hooks/useItems';
|
|
4
|
+
import { useGetChatListQuery, useDispatch, useSelect } from '../../core';
|
|
5
|
+
import { ChatListItemBox } from './ChatListItemBox';
|
|
6
|
+
import { customize } from '../customize';
|
|
7
|
+
|
|
8
|
+
function useOnSelect() {
|
|
9
|
+
const dispatch = useDispatch();
|
|
10
|
+
|
|
11
|
+
return useCallback(
|
|
12
|
+
(info: Parameters<NonNullable<MenuProps['onSelect']>>[0]) =>
|
|
13
|
+
dispatch({ type: 'chat_open', data: { chatId: info.selectedKeys[0] } }),
|
|
14
|
+
[dispatch],
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function useMenuItems() {
|
|
19
|
+
const { data: chats } = useGetChatListQuery();
|
|
20
|
+
|
|
21
|
+
return useMemo<MenuItemType[] | undefined>(() => {
|
|
22
|
+
return chats
|
|
23
|
+
?.slice()
|
|
24
|
+
.sort((a, b) => -a.message.id.substring(47).localeCompare(b.message.id.substring(47)))
|
|
25
|
+
.map((x) => ({ key: x.id, label: <ChatListItemBox chat={x} /> }));
|
|
26
|
+
}, [chats]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const ChatList = customize('ChatList', () => {
|
|
30
|
+
const activeChatId = useSelect((x) => x.ui.chatId, []);
|
|
31
|
+
const selected = useMemo(() => (activeChatId ? [activeChatId] : []), [activeChatId]);
|
|
32
|
+
const onSelect = useOnSelect();
|
|
33
|
+
const items = useMenuItems();
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
{items && (
|
|
38
|
+
<Menu className="wxchtf-chat-list" selectedKeys={selected} onSelect={onSelect} items={items} />
|
|
39
|
+
)}
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChatListItem as ChatListItemModel } from '../../core';
|
|
2
|
+
import { customize } from '../customize';
|
|
3
|
+
import { ChatListItemName } from './ChatListItemName';
|
|
4
|
+
import { ChatListItemUnreadCount } from './ChatListItemUnreadCount';
|
|
5
|
+
import { ChatListItemLastMessage } from './ChatListItemLastMessage';
|
|
6
|
+
|
|
7
|
+
export interface ChatListItemBoxProps {
|
|
8
|
+
chat: ChatListItemModel;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ChatListItemBox = customize('ChatListItemBox', (props: ChatListItemBoxProps) => {
|
|
12
|
+
const { message, lastReadMessageId } = props.chat;
|
|
13
|
+
const read = lastReadMessageId != null && lastReadMessageId.localeCompare(message.id) >= 0;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className={'wxchtf-chat' + (!read ? ' --unread' : '')}>
|
|
17
|
+
<ChatListItemName {...props} />
|
|
18
|
+
<ChatListItemUnreadCount {...props} />
|
|
19
|
+
<ChatListItemLastMessage {...props} />
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { customize } from '../customize';
|
|
2
|
+
import type { ChatListItemBoxProps } from './ChatListItemBox';
|
|
3
|
+
import { ChatListItemLastMessageContent } from './ChatListItemLastMessageContent';
|
|
4
|
+
import { ChatListItemLastMessageAuthor } from './ChatListItemLastMessageAuthor';
|
|
5
|
+
|
|
6
|
+
export const ChatListItemLastMessage = customize('ChatListItemLastMessage', (props: ChatListItemBoxProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<div className="wxchtf-chat-last">
|
|
9
|
+
<ChatListItemLastMessageAuthor {...props} />
|
|
10
|
+
<ChatListItemLastMessageContent {...props} />
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Avatar } from '../Avatar';
|
|
2
|
+
import { customize } from '../customize';
|
|
3
|
+
import type { ChatListItemBoxProps } from './ChatListItemBox';
|
|
4
|
+
|
|
5
|
+
export const ChatListItemLastMessageAuthor = customize(
|
|
6
|
+
'ChatListItemLastMessageAuthor',
|
|
7
|
+
(props: ChatListItemBoxProps) => {
|
|
8
|
+
const { message } = props.chat;
|
|
9
|
+
|
|
10
|
+
if (message.sentBy.id === 'chatify::system') {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="wxchtf-chat-last-author">
|
|
16
|
+
<Avatar account={message.sentBy} /> {message.sentBy.name}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useLocalizer } from '../localizer';
|
|
2
|
+
import { formatSystemMessage } from '../SystemMessage/SystemMessageRow';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { customize } from '../customize';
|
|
5
|
+
import type { ChatListItemBoxProps } from './ChatListItemBox';
|
|
6
|
+
|
|
7
|
+
export const ChatListItemLastMessageContent = customize<FC<ChatListItemBoxProps>>(
|
|
8
|
+
'ChatListItemLastMessageContent',
|
|
9
|
+
(props) => {
|
|
10
|
+
const { message } = props.chat;
|
|
11
|
+
const localizer = useLocalizer();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className="wxchtf-chat-last-message">
|
|
15
|
+
{message.sentBy.id === 'chatify::system'
|
|
16
|
+
? formatSystemMessage(localizer, message.text)
|
|
17
|
+
: message.text}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
},
|
|
21
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChatName } from '../ChatName';
|
|
2
|
+
import { customize } from '../customize';
|
|
3
|
+
import type { ChatListItemBoxProps } from './ChatListItemBox';
|
|
4
|
+
|
|
5
|
+
export const ChatListItemName = customize('ChatListItemName', (props: ChatListItemBoxProps) => {
|
|
6
|
+
const { name } = props.chat;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div className="wxchtf-chat-name">
|
|
10
|
+
<ChatName name={name} />
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { customize } from '../customize';
|
|
2
|
+
import { ChatListItemBoxProps } from './ChatListItemBox';
|
|
3
|
+
|
|
4
|
+
export const ChatListItemUnreadCount = customize('ChatListItemUnreadCount', (props: ChatListItemBoxProps) => {
|
|
5
|
+
const { totalUnreadCount: unreadCount } = props.chat;
|
|
6
|
+
|
|
7
|
+
if (unreadCount <= 0) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return <div className="wxchtf-unread-count">{unreadCount}</div>;
|
|
12
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './ChatList';
|
|
2
|
+
export * from './ChatListItemBox';
|
|
3
|
+
export * from './ChatListItemLastMessage';
|
|
4
|
+
export * from './ChatListItemLastMessageAuthor';
|
|
5
|
+
export * from './ChatListItemLastMessageContent';
|
|
6
|
+
export * from './ChatListItemName';
|
|
7
|
+
export * from './ChatListItemUnreadCount';
|
package/src/ui/ChatName.tsx
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { customize } from '../util';
|
|
1
|
+
import { customize } from './customize';
|
|
3
2
|
|
|
4
3
|
export interface ChatNameProps {
|
|
5
4
|
name: string;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
|
-
const
|
|
7
|
+
export const ChatName = customize('ChatName', (props: ChatNameProps) => {
|
|
9
8
|
const { name } = props;
|
|
10
9
|
return <>{name}</>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
_ChatName.displayName = 'ChatName';
|
|
14
|
-
|
|
15
|
-
export const ChatName = customize('ChatName', _ChatName);
|
|
10
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MessageBox } from '../Message';
|
|
2
|
+
import { useGetMessagesQuery } from '../../core';
|
|
3
|
+
import { Next } from '../Next';
|
|
4
|
+
import { SendingMessageBox } from '../SendingMessage';
|
|
5
|
+
import { SystemMessageBox } from '../SystemMessage/SystemMessageBox';
|
|
6
|
+
import { MessageSkeleton } from '../MessageSkeleton';
|
|
7
|
+
import { customize } from '../customize';
|
|
8
|
+
|
|
9
|
+
export interface ChatBodyProps {
|
|
10
|
+
id: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ChatBody = customize('ChatBody', (props: ChatBodyProps) => {
|
|
14
|
+
const { id } = props;
|
|
15
|
+
const { data: messages } = useGetMessagesQuery({ chatId: id });
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className="wxchtf-chat-body">
|
|
19
|
+
{!messages && <MessageSkeleton count={5} />}
|
|
20
|
+
{messages?.map((x, index) => {
|
|
21
|
+
if (x.type === 'message' && x.sentBy.id === 'chatify::system') {
|
|
22
|
+
return <SystemMessageBox key={x.id} message={x} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (x.type) {
|
|
26
|
+
case 'message': {
|
|
27
|
+
return <MessageBox message={x} key={x.id} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
case 'sending': {
|
|
31
|
+
return <SendingMessageBox key={x.requestId} text={x.text} files={x.files} />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
case 'next': {
|
|
35
|
+
return <Next key={'next-' + messages.length + '-' + index} chatId={id} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
default:
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
})}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Col, Row, Space } from 'antd';
|
|
2
|
+
import { ChatHeaderMembers } from './ChatHeaderMembers';
|
|
3
|
+
import { ChatMembersButton } from './ChatMembersButton';
|
|
4
|
+
import { customize } from '../customize';
|
|
5
|
+
import { ChatHeaderName } from './ChatHeaderName';
|
|
6
|
+
import { useSelect } from '../../core';
|
|
7
|
+
|
|
8
|
+
export interface ChatHeaderProps {
|
|
9
|
+
id: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ChatHeader = customize('ChatHeader', (props: ChatHeaderProps) => {
|
|
13
|
+
const { id } = props;
|
|
14
|
+
const chat = useSelect((x) => x.query.chatList.data!.find((x) => x.id === id)!, [id]);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className="wxchtf-chat-header">
|
|
18
|
+
<Row justify="space-between" align="middle">
|
|
19
|
+
<Col>
|
|
20
|
+
<ChatHeaderName id={id} />
|
|
21
|
+
</Col>
|
|
22
|
+
{chat.active && (
|
|
23
|
+
<Col className="wxchtf-chat-members">
|
|
24
|
+
<Space align="center">
|
|
25
|
+
<ChatHeaderMembers id={id} />
|
|
26
|
+
<ChatMembersButton id={id} />
|
|
27
|
+
</Space>
|
|
28
|
+
</Col>
|
|
29
|
+
)}
|
|
30
|
+
</Row>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
});
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useChat } from '../core';
|
|
1
|
+
import { useGetChatQuery } from '../../core';
|
|
3
2
|
import { Avatar, Tooltip } from 'antd';
|
|
4
|
-
import { customize } from '../
|
|
3
|
+
import { customize } from '../customize';
|
|
5
4
|
|
|
6
5
|
export interface ChatHeaderMembersProps {
|
|
7
6
|
id: string;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
const
|
|
9
|
+
export const ChatHeaderMembers = customize('ChatHeaderMembers', (props: ChatHeaderMembersProps) => {
|
|
11
10
|
const { id } = props;
|
|
12
|
-
const { data: chat } =
|
|
11
|
+
const { data: chat } = useGetChatQuery({ chatId: id });
|
|
13
12
|
|
|
14
13
|
if (!chat?.members) {
|
|
15
14
|
return null;
|
|
@@ -24,7 +23,4 @@ const _ChatHeaderMembers: FC<ChatHeaderMembersProps> = (props) => {
|
|
|
24
23
|
))}
|
|
25
24
|
</Avatar.Group>
|
|
26
25
|
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
_ChatHeaderMembers.displayName = 'ChatHeaderMembers';
|
|
30
|
-
export const ChatHeaderMembers = customize('ChatHeaderMembers', _ChatHeaderMembers);
|
|
26
|
+
});
|