@tencentcloud/chat-uikit-react 1.1.1 → 1.2.0
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/CHANGELOG.md +6 -0
- package/dist/cjs/_virtual/extends.js +1 -0
- package/dist/cjs/components/Checkbox/index.d.ts +2 -1
- package/dist/cjs/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationCreate.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
- package/dist/cjs/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
- package/dist/cjs/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
- package/dist/cjs/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
- package/dist/cjs/components/ConversationPreview/utils.js +1 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.d.ts +2 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchInput.js +1 -1
- package/dist/cjs/components/ConversationSearch/ConversationSearchResult.js +1 -1
- package/dist/cjs/components/DivWithEdit/DivWithEdit.d.ts +2 -1
- package/dist/cjs/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +2 -1
- package/dist/cjs/components/Icon/Icon.d.ts +2 -1
- package/dist/cjs/components/Icon/config.js +1 -1
- package/dist/cjs/components/Icon/images/add-friend.svg.js +1 -0
- package/dist/cjs/components/Icon/images/down-arrow.png.js +1 -0
- package/dist/cjs/components/Icon/images/right-arrow.svg.js +1 -0
- package/dist/cjs/components/Icon/type.d.ts +2 -1
- package/dist/cjs/components/Icon/type.js +1 -1
- package/dist/cjs/components/Input/Input.d.ts +1 -0
- package/dist/cjs/components/Input/Input.js +1 -1
- package/dist/cjs/components/Plugins/index.d.ts +1 -0
- package/dist/cjs/components/Plugins/index.js +1 -1
- package/dist/cjs/components/Popup/index.d.ts +1 -0
- package/dist/cjs/components/Popup/index.js +1 -1
- package/dist/cjs/components/Switch/Switch.d.ts +2 -1
- package/dist/cjs/components/TUIChat/TUIChat.js +1 -1
- package/dist/cjs/components/TUIChat/hooks/useHandleMessageList.js +1 -1
- package/dist/cjs/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
- package/dist/cjs/components/TUIContact/TUIContact.d.ts +6 -0
- package/dist/cjs/components/TUIContact/TUIContact.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +10 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/basicInfo.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/blockInfo.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/friendApplication.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/friendInfo.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -0
- package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.d.ts +6 -0
- package/dist/cjs/components/TUIContact/TUIContactList/TUIContactList.js +1 -0
- package/dist/cjs/components/TUIContact/hooks/useTUIContact.js +1 -0
- package/dist/cjs/components/TUIContactSearch/TUIContactSearch.js +1 -0
- package/dist/cjs/components/TUIContactSearch/hooks/useContactSearch.js +1 -0
- package/dist/cjs/components/TUIConversationList/TUIConversationList.js +1 -1
- package/dist/cjs/components/TUIKit/TUIKit.d.ts +1 -0
- package/dist/cjs/components/TUIKit/TUIKit.js +1 -1
- package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +4 -0
- package/dist/cjs/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -1
- package/dist/cjs/components/TUIKit/hooks/useTUIKit.d.ts +23 -3
- package/dist/cjs/components/TUIKit/hooks/useTUIKit.js +1 -1
- package/dist/cjs/components/TUIManage/TUIManage.d.ts +3 -1
- package/dist/cjs/components/TUIManage/TUIManage.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageContext.js +1 -1
- package/dist/cjs/components/TUIMessage/MessagePlugins.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageRevoke.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageStatus.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageSystem.js +1 -1
- package/dist/cjs/components/TUIMessage/MessageTip.js +1 -1
- package/dist/cjs/components/TUIMessage/TUIMessage.js +1 -1
- package/dist/cjs/components/TUIMessage/hooks/useMessageHandler.js +1 -1
- package/dist/cjs/components/TUIMessage/utils/emojiMap.js +1 -1
- package/dist/cjs/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIForward.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInput.js +1 -1
- package/dist/cjs/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useCreateMessageInputContext.js +1 -1
- package/dist/cjs/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
- package/dist/cjs/components/TUIMessageList/TUIMessageList.js +1 -1
- package/dist/cjs/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
- package/dist/cjs/components/TUIProfile/TUIProfile.js +1 -1
- package/dist/cjs/components/TUIProfile/TUIProfileDefault.js +1 -1
- package/dist/cjs/components/untils.js +1 -1
- package/dist/cjs/context/ComponentContext.d.ts +2 -1
- package/dist/cjs/context/TUIContactContext.d.ts +18 -0
- package/dist/cjs/context/TUIContactContext.js +1 -0
- package/dist/cjs/context/TUIConversationContext.js +1 -1
- package/dist/cjs/context/TUIKitContext.d.ts +4 -0
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.d.css +266 -13
- package/dist/cjs/index.d.ts +5 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/locales/en/TUIChat.js +1 -0
- package/dist/cjs/locales/en/TUIContact.js +1 -0
- package/dist/cjs/locales/en/TUIConversation.js +1 -0
- package/dist/cjs/locales/en/TUIProfile.js +1 -0
- package/dist/cjs/locales/en/index.js +1 -0
- package/dist/cjs/locales/index.js +1 -0
- package/dist/cjs/locales/zh_cn/TUIChat.js +1 -0
- package/dist/cjs/locales/zh_cn/TUIContact.js +1 -0
- package/dist/cjs/locales/zh_cn/TUIConversation.js +1 -0
- package/dist/cjs/locales/zh_cn/TUIProfile.js +1 -0
- package/dist/cjs/locales/zh_cn/index.js +1 -0
- package/dist/esm/_virtual/extends.js +1 -0
- package/dist/esm/components/Checkbox/index.d.ts +2 -1
- package/dist/esm/components/ConversationCreate/ConversationCreatGroupDetail.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationCreate.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationCreateUserSelectList.js +1 -1
- package/dist/esm/components/ConversationCreate/ConversationGroupTypeInfo.js +1 -1
- package/dist/esm/components/ConversationCreate/hooks/useConversationCreate.js +1 -1
- package/dist/esm/components/ConversationPreview/ConversationPreview.js +1 -1
- package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
- package/dist/esm/components/ConversationPreview/utils.js +1 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.d.ts +2 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchInput.js +1 -1
- package/dist/esm/components/ConversationSearch/ConversationSearchResult.js +1 -1
- package/dist/esm/components/DivWithEdit/DivWithEdit.d.ts +2 -1
- package/dist/esm/components/EmptyStateIndicator/EmptyStateIndicator.d.ts +2 -1
- package/dist/esm/components/Icon/Icon.d.ts +2 -1
- package/dist/esm/components/Icon/config.js +1 -1
- package/dist/esm/components/Icon/images/add-friend.svg.js +1 -0
- package/dist/esm/components/Icon/images/down-arrow.png.js +1 -0
- package/dist/esm/components/Icon/images/right-arrow.svg.js +1 -0
- package/dist/esm/components/Icon/type.d.ts +2 -1
- package/dist/esm/components/Icon/type.js +1 -1
- package/dist/esm/components/Input/Input.d.ts +1 -0
- package/dist/esm/components/Input/Input.js +1 -1
- package/dist/esm/components/Plugins/index.d.ts +1 -0
- package/dist/esm/components/Plugins/index.js +1 -1
- package/dist/esm/components/Popup/index.d.ts +1 -0
- package/dist/esm/components/Popup/index.js +1 -1
- package/dist/esm/components/Switch/Switch.d.ts +2 -1
- package/dist/esm/components/TUIChat/TUIChat.js +1 -1
- package/dist/esm/components/TUIChat/hooks/useHandleMessageList.js +1 -1
- package/dist/esm/components/TUIChatHeader/TUIChatHeaderDefault.js +1 -1
- package/dist/esm/components/TUIContact/TUIContact.d.ts +6 -0
- package/dist/esm/components/TUIContact/TUIContact.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.d.ts +10 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/TUIContactInfo.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/addFriendInfo.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/basicInfo.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/blockInfo.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/friendApplication.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/friendInfo.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactInfo/hooks/useContactInfo.js +1 -0
- package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.d.ts +6 -0
- package/dist/esm/components/TUIContact/TUIContactList/TUIContactList.js +1 -0
- package/dist/esm/components/TUIContact/hooks/useTUIContact.js +1 -0
- package/dist/esm/components/TUIContactSearch/TUIContactSearch.js +1 -0
- package/dist/esm/components/TUIContactSearch/hooks/useContactSearch.js +1 -0
- package/dist/esm/components/TUIConversationList/TUIConversationList.js +1 -1
- package/dist/esm/components/TUIKit/TUIKit.d.ts +1 -0
- package/dist/esm/components/TUIKit/TUIKit.js +1 -1
- package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.d.ts +4 -0
- package/dist/esm/components/TUIKit/hooks/useCreateTUIKitContext.js +1 -1
- package/dist/esm/components/TUIKit/hooks/useTUIKit.d.ts +23 -3
- package/dist/esm/components/TUIKit/hooks/useTUIKit.js +1 -1
- package/dist/esm/components/TUIManage/TUIManage.d.ts +3 -1
- package/dist/esm/components/TUIManage/TUIManage.js +1 -1
- package/dist/esm/components/TUIMessage/MessageContext.js +1 -1
- package/dist/esm/components/TUIMessage/MessagePlugins.js +1 -1
- package/dist/esm/components/TUIMessage/MessageRevoke.js +1 -1
- package/dist/esm/components/TUIMessage/MessageStatus.js +1 -1
- package/dist/esm/components/TUIMessage/MessageSystem.js +1 -1
- package/dist/esm/components/TUIMessage/MessageTip.js +1 -1
- package/dist/esm/components/TUIMessage/TUIMessage.js +1 -1
- package/dist/esm/components/TUIMessage/hooks/useMessageHandler.js +1 -1
- package/dist/esm/components/TUIMessage/utils/emojiMap.js +1 -1
- package/dist/esm/components/TUIMessageInput/InputPluginsDefalut.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIForward.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInput.js +1 -1
- package/dist/esm/components/TUIMessageInput/TUIMessageInputDefault.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useCreateMessageInputContext.js +1 -1
- package/dist/esm/components/TUIMessageInput/hooks/useEmojiPicker.js +1 -1
- package/dist/esm/components/TUIMessageList/TUIMessageList.js +1 -1
- package/dist/esm/components/TUIMessageList/hooks/useMessageListElement.js +1 -1
- package/dist/esm/components/TUIProfile/TUIProfile.js +1 -1
- package/dist/esm/components/TUIProfile/TUIProfileDefault.js +1 -1
- package/dist/esm/components/untils.js +1 -1
- package/dist/esm/context/ComponentContext.d.ts +2 -1
- package/dist/esm/context/TUIContactContext.d.ts +18 -0
- package/dist/esm/context/TUIContactContext.js +1 -0
- package/dist/esm/context/TUIConversationContext.js +1 -1
- package/dist/esm/context/TUIKitContext.d.ts +4 -0
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.d.css +266 -13
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/locales/en/TUIChat.js +1 -0
- package/dist/esm/locales/en/TUIContact.js +1 -0
- package/dist/esm/locales/en/TUIConversation.js +1 -0
- package/dist/esm/locales/en/TUIProfile.js +1 -0
- package/dist/esm/locales/en/index.js +1 -0
- package/dist/esm/locales/index.js +1 -0
- package/dist/esm/locales/zh_cn/TUIChat.js +1 -0
- package/dist/esm/locales/zh_cn/TUIContact.js +1 -0
- package/dist/esm/locales/zh_cn/TUIConversation.js +1 -0
- package/dist/esm/locales/zh_cn/TUIProfile.js +1 -0
- package/dist/esm/locales/zh_cn/index.js +1 -0
- package/package.json +5 -1
- package/src/components/ConversationCreate/ConversationCreatGroupDetail.tsx +10 -8
- package/src/components/ConversationCreate/ConversationCreate.tsx +4 -1
- package/src/components/ConversationCreate/ConversationCreateUserSelectList.tsx +6 -4
- package/src/components/ConversationCreate/ConversationGroupTypeInfo.tsx +7 -3
- package/src/components/ConversationCreate/hooks/useConversationCreate.tsx +0 -1
- package/src/components/ConversationPreview/ConversationPreview.tsx +6 -5
- package/src/components/ConversationPreview/ConversationPreviewContent.tsx +4 -2
- package/src/components/ConversationPreview/utils.tsx +12 -27
- package/src/components/ConversationSearch/ConversationSearchInput.tsx +3 -1
- package/src/components/Icon/config.ts +5 -0
- package/src/components/Icon/images/add-friend.svg +15 -0
- package/src/components/Icon/images/down-arrow.png +0 -0
- package/src/components/Icon/images/right-arrow.svg +3 -0
- package/src/components/Icon/styles/index.scss +0 -1
- package/src/components/Icon/type.ts +1 -0
- package/src/components/Input/Input.tsx +11 -2
- package/src/components/Plugins/index.tsx +26 -2
- package/src/components/Popup/index.tsx +20 -2
- package/src/components/TUIChat/hooks/useHandleMessageList.tsx +3 -8
- package/src/components/TUIChatHeader/TUIChatHeaderDefault.tsx +3 -3
- package/src/components/TUIContact/TUIContact.tsx +96 -0
- package/src/components/TUIContact/TUIContactInfo/TUIContactInfo.tsx +32 -0
- package/src/components/TUIContact/TUIContactInfo/addFriendInfo.tsx +86 -0
- package/src/components/TUIContact/TUIContactInfo/basicInfo.tsx +34 -0
- package/src/components/TUIContact/TUIContactInfo/blockInfo.tsx +45 -0
- package/src/components/TUIContact/TUIContactInfo/friendApplication.tsx +66 -0
- package/src/components/TUIContact/TUIContactInfo/friendInfo.tsx +103 -0
- package/src/components/TUIContact/TUIContactInfo/hooks/useContactInfo.tsx +112 -0
- package/src/components/TUIContact/TUIContactInfo/index.scss +108 -0
- package/src/components/TUIContact/TUIContactList/TUIContactList.tsx +162 -0
- package/src/components/TUIContact/TUIContactList/index.scss +90 -0
- package/src/components/TUIContact/hooks/useTUIContact.tsx +76 -0
- package/src/components/TUIContact/index.scss +67 -0
- package/src/components/TUIContact/index.ts +3 -0
- package/src/components/TUIContactSearch/TUIContactSearch.tsx +100 -0
- package/src/components/TUIContactSearch/hooks/useContactSearch.tsx +32 -0
- package/src/components/TUIContactSearch/index.scss +24 -0
- package/src/components/TUIConversationList/TUIConversationList.tsx +3 -4
- package/src/components/TUIConversationList/index.scss +2 -2
- package/src/components/TUIKit/TUIKit.tsx +9 -2
- package/src/components/TUIKit/hooks/useCreateTUIKitContext.tsx +8 -0
- package/src/components/TUIKit/hooks/useTUIKit.tsx +43 -4
- package/src/components/TUIManage/TUIManage.tsx +5 -3
- package/src/components/TUIMessage/MessagePlugins.tsx +17 -7
- package/src/components/TUIMessage/MessageRevoke.tsx +5 -4
- package/src/components/TUIMessage/MessageStatus.tsx +3 -3
- package/src/components/TUIMessage/hooks/useMessageHandler.ts +4 -2
- package/src/components/TUIMessage/styles/layout.scss +2 -9
- package/src/components/TUIMessage/utils/emojiMap.ts +6 -2
- package/src/components/TUIMessageInput/InputPluginsDefalut.tsx +5 -3
- package/src/components/TUIMessageInput/TUIForward.tsx +8 -27
- package/src/components/TUIMessageInput/TUIMessageInputDefault.tsx +3 -1
- package/src/components/TUIMessageInput/hooks/useCreateMessageInputContext.ts +3 -3
- package/src/components/TUIMessageInput/hooks/useEmojiPicker.tsx +7 -1
- package/src/components/TUIMessageInput/styles/layout.scss +0 -1
- package/src/components/TUIMessageList/TUIMessageList.tsx +3 -1
- package/src/components/TUIMessageList/hooks/useMessageListElement.tsx +3 -2
- package/src/components/TUIProfile/TUIProfile.tsx +18 -7
- package/src/components/TUIProfile/TUIProfileDefault.tsx +64 -6
- package/src/components/TUIProfile/styles/layout.scss +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/untils.ts +26 -6
- package/src/context/TUIContactContext.tsx +32 -0
- package/src/context/TUIKitContext.tsx +5 -0
- package/src/context/index.ts +1 -0
- package/src/hooks/useConversation.tsx +3 -3
- package/src/locales/en/TUIChat.ts +27 -0
- package/src/locales/en/TUIContact.ts +28 -0
- package/src/locales/en/TUIConversation.ts +34 -0
- package/src/locales/en/TUIProfile.ts +14 -0
- package/src/locales/en/index.ts +11 -0
- package/src/locales/index.ts +23 -0
- package/src/locales/zh_cn/TUIChat.ts +27 -0
- package/src/locales/zh_cn/TUIContact.ts +29 -0
- package/src/locales/zh_cn/TUIConversation.ts +33 -0
- package/src/locales/zh_cn/TUIProfile.ts +14 -0
- package/src/locales/zh_cn/index.ts +11 -0
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
.tui-contacts-list {
|
|
2
|
+
flex: 1 1 auto;
|
|
3
|
+
min-width: 360px;
|
|
4
|
+
max-width: 360px;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
position: relative;
|
|
8
|
+
border-right: 1px solid #F9FAFB;
|
|
9
|
+
text-align: initial;
|
|
10
|
+
overflow-y: scroll;
|
|
11
|
+
overflow-x: hidden;
|
|
12
|
+
.tui-contacts-title {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
}
|
|
16
|
+
.tui-contacts-list-title {
|
|
17
|
+
display: flex;
|
|
18
|
+
padding: 10px 20px;
|
|
19
|
+
}
|
|
20
|
+
.tui-contacts-list-icon {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
margin-right: 20px;
|
|
25
|
+
}
|
|
26
|
+
.tui-contacts-list-item {
|
|
27
|
+
align-items: center;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
display: flex;
|
|
30
|
+
padding: 10px 20px;
|
|
31
|
+
text-align: center;
|
|
32
|
+
font-family: PingFangSC-Medium;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
line-height: 20px;
|
|
35
|
+
.tui-contacts-list-item-card {
|
|
36
|
+
display: flex;
|
|
37
|
+
padding: 0 10px;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
flex: 1;
|
|
42
|
+
}
|
|
43
|
+
.tui-contacts-list-item-container {
|
|
44
|
+
margin-left: 10px;
|
|
45
|
+
}
|
|
46
|
+
.tui-contacts-list-item-text {
|
|
47
|
+
color: #999;
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
text-align: left;
|
|
50
|
+
@extend .text-ellipsis
|
|
51
|
+
}
|
|
52
|
+
.tui-contacts-list-btn-text {
|
|
53
|
+
color: #999;
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
text-align: left;
|
|
56
|
+
}
|
|
57
|
+
.tui-contacts-list-item-name {
|
|
58
|
+
color: #000;
|
|
59
|
+
font-weight: 400;
|
|
60
|
+
text-align: left;
|
|
61
|
+
@extend .text-ellipsis
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
.text-ellipsis {
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
}
|
|
70
|
+
.application-btn {
|
|
71
|
+
width: 30px;
|
|
72
|
+
height: 14px;
|
|
73
|
+
padding: 5px;
|
|
74
|
+
border-radius: 15px;
|
|
75
|
+
border: none;
|
|
76
|
+
font-size: 10px;
|
|
77
|
+
text-align: center;
|
|
78
|
+
line-height: 14px;
|
|
79
|
+
letter-spacing: 0;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
-webkit-user-select: none;
|
|
82
|
+
user-select: none;
|
|
83
|
+
border: 1px solid #006EFF;
|
|
84
|
+
background: #006EFF;
|
|
85
|
+
color: #fff;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
::-webkit-scrollbar {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import TencentCloudChat from '@tencentcloud/chat';
|
|
3
|
+
import { useTUIKitContext } from '../../../context';
|
|
4
|
+
|
|
5
|
+
function useTUIContact() {
|
|
6
|
+
const { chat } = useTUIKitContext();
|
|
7
|
+
const [friendList, setFriendList] = useState([]);
|
|
8
|
+
const [blockList, setBlockList] = useState([]);
|
|
9
|
+
const [friendApplicationList, setFriendApplicationList] = useState([]);
|
|
10
|
+
const [blocklistProfile, setBlocklistProfile] = useState([]);
|
|
11
|
+
const [isShowContactList, setShowContactList] = useState(true);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
getFriendList();
|
|
15
|
+
getBlocklist();
|
|
16
|
+
getFriendApplicationList();
|
|
17
|
+
}, [chat]);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
chat?.on(TencentCloudChat.EVENT.BLACKLIST_UPDATED, onBlocklistUpdated);
|
|
21
|
+
chat?.on(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED, onFriendListUpdated);
|
|
22
|
+
chat?.on(
|
|
23
|
+
TencentCloudChat.EVENT.FRIEND_APPLICATION_LIST_UPDATED,
|
|
24
|
+
onFriendApplicationListUpdated,
|
|
25
|
+
);
|
|
26
|
+
}, [chat]);
|
|
27
|
+
const getFriendApplicationList = async () => {
|
|
28
|
+
const { data } = await chat.getFriendApplicationList();
|
|
29
|
+
setFriendApplicationList(data?.friendApplicationList);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const getFriendList = async () => {
|
|
33
|
+
const { code, data } = await chat.getFriendList();
|
|
34
|
+
if (code === 0) {
|
|
35
|
+
setFriendList(data);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// todo: 获取 100个
|
|
39
|
+
const getBlocklist = async () => {
|
|
40
|
+
const { data: _blocklist } = await chat.getBlacklist();
|
|
41
|
+
if (_blocklist.length === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setBlockList(_blocklist);
|
|
45
|
+
getBlocklistProfile(_blocklist);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const getBlocklistProfile = async (_blocklist: Array<string>) => {
|
|
49
|
+
const { data } = await chat.getUserProfile({
|
|
50
|
+
userIDList: _blocklist,
|
|
51
|
+
});
|
|
52
|
+
setBlocklistProfile(data);
|
|
53
|
+
};
|
|
54
|
+
const onFriendApplicationListUpdated = (event) => {
|
|
55
|
+
setFriendApplicationList(event?.data?.friendApplicationList);
|
|
56
|
+
};
|
|
57
|
+
const onBlocklistUpdated = (event) => {
|
|
58
|
+
setBlockList(event.data);
|
|
59
|
+
getBlocklistProfile(event.data);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onFriendListUpdated = (event) => {
|
|
63
|
+
setFriendList(event.data);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
friendList,
|
|
68
|
+
blocklistProfile,
|
|
69
|
+
friendApplicationList,
|
|
70
|
+
blockList,
|
|
71
|
+
isShowContactList,
|
|
72
|
+
setShowContactList,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default useTUIContact;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.tui-contacts {
|
|
2
|
+
height: 100%;
|
|
3
|
+
min-width: 360px;
|
|
4
|
+
max-width: 360px;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
position: relative;
|
|
8
|
+
text-align: initial;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
.tui-contacts-header {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: 10px 20px 10px 10px;
|
|
15
|
+
}
|
|
16
|
+
.tui-contact-input {
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
.tui-contacts-add {
|
|
20
|
+
display: flex;
|
|
21
|
+
color: #147AFF;
|
|
22
|
+
font-size: 20px;
|
|
23
|
+
align-items: center;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
display: flex;
|
|
26
|
+
text-align: center;
|
|
27
|
+
.tui-conversation-create-icon {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
.tui-contacts-add-header {
|
|
34
|
+
align-items: center;
|
|
35
|
+
background-color: #f9fafb;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
padding: 16px 20px;
|
|
39
|
+
text-align: center;
|
|
40
|
+
margin-bottom: 10px;
|
|
41
|
+
.tui-contacts-add-header-title {
|
|
42
|
+
color: #000;
|
|
43
|
+
font-family: PingFangSC-Medium;
|
|
44
|
+
font-size: 20px;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
letter-spacing: -.41px;
|
|
47
|
+
line-height: 32px;
|
|
48
|
+
margin-left: 10px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.no-result {
|
|
52
|
+
padding: 0 20px;
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
align-items: center;
|
|
56
|
+
&-icon {
|
|
57
|
+
margin: 100px auto 50px;
|
|
58
|
+
}
|
|
59
|
+
&-message {
|
|
60
|
+
color: #999999;
|
|
61
|
+
font-weight: 400;
|
|
62
|
+
font-size: 16px;
|
|
63
|
+
font-family: PingFangSC-Medium;
|
|
64
|
+
line-height: 22px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useTUIKitContext, useTUIContactContext } from '../../context';
|
|
4
|
+
import useContactSearch from './hooks/useContactSearch';
|
|
5
|
+
import { Icon, IconTypes } from '../Icon';
|
|
6
|
+
import { Avatar, defaultUserAvatar } from '../Avatar';
|
|
7
|
+
import { Input } from '../Input';
|
|
8
|
+
import './index.scss';
|
|
9
|
+
|
|
10
|
+
export function UnMemoizedTUIContactSearch<T>(): React.ReactElement {
|
|
11
|
+
const { chat, setActiveContact } = useTUIKitContext('TUIContactSearch');
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const { friendList, setShowContactList } = useTUIContactContext('TUIContactList');
|
|
14
|
+
const [isShowSearchResult, setShowSearchResult] = useState(false);
|
|
15
|
+
const { checkFriend, isBlock, getUserProfile } = useContactSearch();
|
|
16
|
+
const [searchedValue, setSearchedValue] = useState('');
|
|
17
|
+
const [searchResult, setSearchResult] = useState([]);
|
|
18
|
+
|
|
19
|
+
const searchValueChange = (e) => {
|
|
20
|
+
if (e.target?.value === '') {
|
|
21
|
+
setShowContactList(true);
|
|
22
|
+
setShowSearchResult(false);
|
|
23
|
+
setSearchResult([]);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setShowSearchResult(true);
|
|
27
|
+
setSearchedValue(e.target?.value);
|
|
28
|
+
setShowContactList(false);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const searchValueBlur = (e) => {
|
|
32
|
+
setSearchedValue(e.target?.value);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const onFocusSearch = () => {
|
|
36
|
+
setActiveContact();
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getUserProfileHandler = async () => {
|
|
40
|
+
if (searchedValue) {
|
|
41
|
+
getUserProfile(searchedValue).then((res) => {
|
|
42
|
+
const { data: userProfile } = res;
|
|
43
|
+
setSearchResult(userProfile);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const setContactProfile = async (profile: any) => {
|
|
48
|
+
const isFriend = await checkFriend(profile);
|
|
49
|
+
if (isFriend) {
|
|
50
|
+
const friendProfile = friendList.find((item) => item.userID === searchedValue);
|
|
51
|
+
setActiveContact({ type: 'friend', data: friendProfile });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (isBlock(profile.userID)) {
|
|
55
|
+
setActiveContact({ type: 'block', data: profile });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// set 数据
|
|
59
|
+
setActiveContact({ type: 'addFriend', data: profile });
|
|
60
|
+
};
|
|
61
|
+
return (
|
|
62
|
+
<div className="tui-contact-search">
|
|
63
|
+
<Input
|
|
64
|
+
className="tui-contact-search-input"
|
|
65
|
+
placeholder={t('TUIContact.Enter a userID')}
|
|
66
|
+
clearable
|
|
67
|
+
value={searchedValue}
|
|
68
|
+
onBlur={searchValueBlur}
|
|
69
|
+
onFocus={onFocusSearch}
|
|
70
|
+
onChange={searchValueChange}
|
|
71
|
+
onKeyDown={getUserProfileHandler}
|
|
72
|
+
prefix={<Icon type={IconTypes.SEARCH} height={16} width={16} />}
|
|
73
|
+
/>
|
|
74
|
+
{isShowSearchResult && searchResult.length === 0
|
|
75
|
+
? (
|
|
76
|
+
<div className="tui-contact-search-item">
|
|
77
|
+
{t('TUIContact.No Result')}
|
|
78
|
+
|
|
79
|
+
</div>
|
|
80
|
+
) : searchResult.map((item, index) => {
|
|
81
|
+
const { userID, avatar, nick } = item;
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
className="tui-contact-search-item"
|
|
85
|
+
role="button"
|
|
86
|
+
tabIndex={0}
|
|
87
|
+
key={userID}
|
|
88
|
+
onClick={() => {
|
|
89
|
+
setContactProfile(item);
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<Avatar size={30} image={avatar || defaultUserAvatar} />
|
|
93
|
+
<div className="search-item-name">{nick || userID}</div>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
export const TUIContactSearch = React.memo(UnMemoizedTUIContactSearch);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import TencentCloudChat from '@tencentcloud/chat';
|
|
2
|
+
import { useTUIKitContext, useTUIContactContext } from '../../../context';
|
|
3
|
+
|
|
4
|
+
function useContactSearch() {
|
|
5
|
+
const { blockList } = useTUIContactContext('TUIContactList');
|
|
6
|
+
const { chat } = useTUIKitContext('TUIContactSearch');
|
|
7
|
+
|
|
8
|
+
// 好友相关
|
|
9
|
+
// 判断是否为双向好友关系
|
|
10
|
+
const checkFriend = (info: any): Promise<any> => chat.checkFriend({
|
|
11
|
+
userIDList: [info?.userID],
|
|
12
|
+
type: TencentCloudChat.TYPES.SNS_CHECK_TYPE_BOTH,
|
|
13
|
+
}).then((res: any) => res?.data?.successUserIDList[0]?.relation
|
|
14
|
+
=== TencentCloudChat.TYPES.SNS_TYPE_BOTH_WAY);
|
|
15
|
+
|
|
16
|
+
const isBlock = (userID: string) => (
|
|
17
|
+
blockList.includes(userID)
|
|
18
|
+
);
|
|
19
|
+
const getUserProfile = (userID: string) => (
|
|
20
|
+
chat.getUserProfile({
|
|
21
|
+
userIDList: [userID],
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
checkFriend,
|
|
27
|
+
isBlock,
|
|
28
|
+
getUserProfile,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default useContactSearch;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.tui-contact-search {
|
|
2
|
+
width: 100%;
|
|
3
|
+
position: relative;
|
|
4
|
+
text-align: initial;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
.tui-contact-search-input {
|
|
8
|
+
margin: 0 10px;
|
|
9
|
+
}
|
|
10
|
+
.tui-contact-search-text {
|
|
11
|
+
color: #147AFF;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
}
|
|
14
|
+
.tui-contact-search-item {
|
|
15
|
+
position: absolute;
|
|
16
|
+
margin: 10px 20px;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
.search-item-name {
|
|
20
|
+
padding-left: 10px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import { Conversation } from '@tencentcloud/chat';
|
|
3
4
|
import { useTUIKitContext } from '../../context';
|
|
4
5
|
import useConversationList from './hooks/useConversationList';
|
|
@@ -8,7 +9,6 @@ import {
|
|
|
8
9
|
ConversationListContainer,
|
|
9
10
|
ConversationListContainerProps,
|
|
10
11
|
} from '../ConversationPreview/ConversationListContainer';
|
|
11
|
-
import { Profile } from '../Profile';
|
|
12
12
|
import { ConversationSearchInput, ConversationSearchResult } from '../ConversationSearch';
|
|
13
13
|
import { ConversationCreate } from '../ConversationCreate';
|
|
14
14
|
import { Icon, IconTypes } from '../Icon';
|
|
@@ -35,6 +35,7 @@ export function UnMemoTUIConversationList<T extends Props>(props: T):React.React
|
|
|
35
35
|
onConversationListUpdated,
|
|
36
36
|
filterConversation: propsFilterConversation,
|
|
37
37
|
} = props;
|
|
38
|
+
const { t } = useTranslation();
|
|
38
39
|
const {
|
|
39
40
|
chat, customClasses, conversation, setActiveConversation, setTUIProfileShow,
|
|
40
41
|
} = useTUIKitContext('TUIConversationList');
|
|
@@ -85,7 +86,6 @@ export function UnMemoTUIConversationList<T extends Props>(props: T):React.React
|
|
|
85
86
|
setSearchValue('');
|
|
86
87
|
setConversationCreated(true);
|
|
87
88
|
};
|
|
88
|
-
const { myProfile } = useTUIKitContext();
|
|
89
89
|
const conversationListRef = useRef(null);
|
|
90
90
|
return (
|
|
91
91
|
<div className={`tui-conversation ${customClasses || ''}`} ref={conversationListRef}>
|
|
@@ -99,7 +99,6 @@ export function UnMemoTUIConversationList<T extends Props>(props: T):React.React
|
|
|
99
99
|
)
|
|
100
100
|
: (
|
|
101
101
|
<>
|
|
102
|
-
<Profile profile={myProfile} handleAvatar={() => { setTUIProfileShow(true); }} />
|
|
103
102
|
<div className="tui-conversation-header">
|
|
104
103
|
<ConversationSearchInput
|
|
105
104
|
value={searchValue}
|
|
@@ -121,7 +120,7 @@ export function UnMemoTUIConversationList<T extends Props>(props: T):React.React
|
|
|
121
120
|
? (
|
|
122
121
|
<div className="no-result">
|
|
123
122
|
<Icon className="no-result-icon" type={IconTypes.EFFORT} width={42} height={42} />
|
|
124
|
-
<div className="no-result-message">No conversation</div>
|
|
123
|
+
<div className="no-result-message">{t('TUIConversation.No conversation')}</div>
|
|
125
124
|
</div>
|
|
126
125
|
)
|
|
127
126
|
: searchValue
|
|
@@ -7,9 +7,11 @@ import './styles/index.scss';
|
|
|
7
7
|
import { TUIConversation } from '../TUIConversation';
|
|
8
8
|
import { TUIChat } from '../TUIChat';
|
|
9
9
|
import { TUIManage } from '../TUIManage';
|
|
10
|
+
import '../../locales/index';
|
|
10
11
|
|
|
11
12
|
export interface ChatProps {
|
|
12
13
|
chat?: ChatSDK | null,
|
|
14
|
+
language?: string,
|
|
13
15
|
customClasses?: unknown,
|
|
14
16
|
activeConversation?: Conversation,
|
|
15
17
|
}
|
|
@@ -19,21 +21,25 @@ export function TUIKit<
|
|
|
19
21
|
props:PropsWithChildren<T>,
|
|
20
22
|
):React.ReactElement {
|
|
21
23
|
const {
|
|
22
|
-
children, chat, customClasses, activeConversation,
|
|
24
|
+
children, chat, customClasses, activeConversation, language,
|
|
23
25
|
} = props;
|
|
24
26
|
(window as any).tencent_cloud_im_csig_react_uikit_23F_xa = true;
|
|
25
27
|
const {
|
|
26
28
|
conversation,
|
|
29
|
+
contactData,
|
|
27
30
|
setActiveConversation,
|
|
28
31
|
myProfile,
|
|
29
32
|
TUIManageShow,
|
|
30
33
|
setTUIManageShow,
|
|
31
34
|
TUIProfileShow,
|
|
32
35
|
setTUIProfileShow,
|
|
33
|
-
|
|
36
|
+
setActiveContact,
|
|
37
|
+
} = useTUIKit({ chat, activeConversation, language });
|
|
34
38
|
const chatContextValue = useCreateTUIKitContext({
|
|
35
39
|
chat,
|
|
40
|
+
language,
|
|
36
41
|
conversation,
|
|
42
|
+
contactData,
|
|
37
43
|
setActiveConversation,
|
|
38
44
|
customClasses,
|
|
39
45
|
myProfile,
|
|
@@ -41,6 +47,7 @@ export function TUIKit<
|
|
|
41
47
|
setTUIManageShow,
|
|
42
48
|
TUIProfileShow,
|
|
43
49
|
setTUIProfileShow,
|
|
50
|
+
setActiveContact,
|
|
44
51
|
});
|
|
45
52
|
|
|
46
53
|
return (
|
|
@@ -4,7 +4,9 @@ import { TUIKitContextValue } from '../../../context/TUIKitContext';
|
|
|
4
4
|
export const useCreateTUIKitContext = (value:TUIKitContextValue) => {
|
|
5
5
|
const {
|
|
6
6
|
chat,
|
|
7
|
+
language,
|
|
7
8
|
conversation,
|
|
9
|
+
contactData,
|
|
8
10
|
customClasses,
|
|
9
11
|
setActiveConversation,
|
|
10
12
|
myProfile,
|
|
@@ -12,12 +14,15 @@ export const useCreateTUIKitContext = (value:TUIKitContextValue) => {
|
|
|
12
14
|
setTUIManageShow,
|
|
13
15
|
TUIProfileShow,
|
|
14
16
|
setTUIProfileShow,
|
|
17
|
+
setActiveContact,
|
|
15
18
|
} = value;
|
|
16
19
|
|
|
17
20
|
const TUIKitContext = useMemo(
|
|
18
21
|
() => ({
|
|
19
22
|
chat,
|
|
23
|
+
language,
|
|
20
24
|
conversation,
|
|
25
|
+
contactData,
|
|
21
26
|
customClasses,
|
|
22
27
|
setActiveConversation,
|
|
23
28
|
myProfile,
|
|
@@ -25,9 +30,12 @@ export const useCreateTUIKitContext = (value:TUIKitContextValue) => {
|
|
|
25
30
|
setTUIManageShow,
|
|
26
31
|
TUIProfileShow,
|
|
27
32
|
setTUIProfileShow,
|
|
33
|
+
setActiveContact,
|
|
28
34
|
}),
|
|
29
35
|
[
|
|
36
|
+
language,
|
|
30
37
|
conversation,
|
|
38
|
+
contactData,
|
|
31
39
|
customClasses,
|
|
32
40
|
chat,
|
|
33
41
|
TUIManageShow,
|
|
@@ -1,27 +1,61 @@
|
|
|
1
1
|
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import {
|
|
3
4
|
ChatSDK,
|
|
4
5
|
Conversation,
|
|
5
|
-
Group,
|
|
6
6
|
Profile,
|
|
7
|
+
Friend,
|
|
8
|
+
FriendApplication,
|
|
7
9
|
} from '@tencentcloud/chat';
|
|
8
10
|
|
|
11
|
+
interface blockData {
|
|
12
|
+
type: 'block',
|
|
13
|
+
data: Profile
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface friendData {
|
|
17
|
+
type: 'friend',
|
|
18
|
+
data: Friend
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface friendApplicationData {
|
|
22
|
+
type: 'friendApplication',
|
|
23
|
+
data: FriendApplication
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface addFriendData {
|
|
27
|
+
type: 'addFriend',
|
|
28
|
+
data: Profile
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type UseContactParams = blockData | friendData |
|
|
32
|
+
friendApplicationData | addFriendData| undefined;
|
|
33
|
+
|
|
9
34
|
export interface UseChatParams{
|
|
10
35
|
chat: ChatSDK,
|
|
11
36
|
activeConversation?: Conversation,
|
|
37
|
+
language?: string,
|
|
12
38
|
}
|
|
13
|
-
|
|
39
|
+
|
|
40
|
+
export const useTUIKit = ({
|
|
41
|
+
chat, activeConversation: paramsActiveConversation,
|
|
42
|
+
language,
|
|
43
|
+
}:UseChatParams) => {
|
|
44
|
+
const { i18n } = useTranslation();
|
|
14
45
|
const [conversation, setConversation] = useState<Conversation>(paramsActiveConversation);
|
|
15
46
|
const [myProfile, setMyProfile] = useState<Profile>();
|
|
16
47
|
const [TUIManageShow, setTUIManageShow] = useState<boolean>(false);
|
|
17
48
|
const [TUIProfileShow, setTUIProfileShow] = useState<boolean>(false);
|
|
49
|
+
const [contactData, setContactData] = useState<UseContactParams>();
|
|
50
|
+
|
|
18
51
|
useEffect(() => {
|
|
52
|
+
i18n.changeLanguage(language);
|
|
19
53
|
const getMyProfile = async () => {
|
|
20
54
|
const res = await chat?.getMyProfile();
|
|
21
55
|
setMyProfile(res?.data);
|
|
22
56
|
};
|
|
23
57
|
getMyProfile();
|
|
24
|
-
}, [chat]);
|
|
58
|
+
}, [chat, language]);
|
|
25
59
|
const setActiveConversation = useCallback(
|
|
26
60
|
(activeConversation?: Conversation) => {
|
|
27
61
|
if (activeConversation) {
|
|
@@ -34,17 +68,22 @@ export const useTUIKit = ({ chat, activeConversation: paramsActiveConversation }
|
|
|
34
68
|
},
|
|
35
69
|
[chat],
|
|
36
70
|
);
|
|
71
|
+
const setActiveContact = (actionContactData: UseContactParams) => {
|
|
72
|
+
setContactData(actionContactData);
|
|
73
|
+
};
|
|
37
74
|
|
|
38
75
|
useEffect(() => {
|
|
39
76
|
setConversation(paramsActiveConversation);
|
|
40
77
|
}, [paramsActiveConversation]);
|
|
41
78
|
return {
|
|
42
79
|
conversation,
|
|
80
|
+
contactData,
|
|
43
81
|
setActiveConversation,
|
|
44
82
|
myProfile,
|
|
45
83
|
TUIManageShow,
|
|
46
84
|
setTUIManageShow,
|
|
47
85
|
TUIProfileShow,
|
|
48
86
|
setTUIProfileShow,
|
|
87
|
+
setActiveContact,
|
|
49
88
|
};
|
|
50
89
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import './styles/index.scss';
|
|
3
4
|
import { Icon, IconTypes } from '../Icon';
|
|
4
5
|
import { Avatar, defaultGroupAvatarWork, defaultUserAvatar } from '../Avatar';
|
|
@@ -9,6 +10,7 @@ import { useConversationUpdate } from '../TUIConversationList/hooks/useConversat
|
|
|
9
10
|
import { useConversation } from '../../hooks';
|
|
10
11
|
|
|
11
12
|
export function TUIManage() {
|
|
13
|
+
const { t } = useTranslation();
|
|
12
14
|
const [conversation, setConversation] = useState(null);
|
|
13
15
|
const [profile, setProfile] = useState(null);
|
|
14
16
|
const [isPinned, setIsPinned] = useState(false);
|
|
@@ -48,7 +50,7 @@ export function TUIManage() {
|
|
|
48
50
|
<div className="tui-manage">
|
|
49
51
|
<div className="tui-manage-title">
|
|
50
52
|
<Icon type={IconTypes.CANCEL} width={16} height={16} onClick={close} />
|
|
51
|
-
<span>Conversation Information</span>
|
|
53
|
+
<span>{t('TUIConversation.Conversation Information')}</span>
|
|
52
54
|
</div>
|
|
53
55
|
<div className="tui-manage-container">
|
|
54
56
|
<div className="tui-manage-info">
|
|
@@ -70,14 +72,14 @@ export function TUIManage() {
|
|
|
70
72
|
</div>
|
|
71
73
|
<div className="tui-manage-handle">
|
|
72
74
|
<div className="manage-handle-box">
|
|
73
|
-
<div className="manage-handle-title">Pin</div>
|
|
75
|
+
<div className="manage-handle-title">{t('TUIConversation.Pin')}</div>
|
|
74
76
|
<Switch
|
|
75
77
|
onChange={pinChatChange}
|
|
76
78
|
checked={isPinned}
|
|
77
79
|
/>
|
|
78
80
|
</div>
|
|
79
81
|
<div className="manage-handle-box" role="presentation" onClick={handleDelete}>
|
|
80
|
-
<div className="manage-handle-title red">Delete</div>
|
|
82
|
+
<div className="manage-handle-title red">{t('TUIConversation.Delete')}</div>
|
|
81
83
|
</div>
|
|
82
84
|
</div>
|
|
83
85
|
</div>
|