@tencentcloud/chat-uikit-react 1.1.0 → 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/README.md +8 -8
- 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,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Profile } from '@tencentcloud/chat';
|
|
4
|
+
import { Avatar, defaultUserAvatar } from '../../Avatar';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
profile: Profile;
|
|
8
|
+
}
|
|
9
|
+
export function UnMemoizedBasicInfo<T extends Props>(
|
|
10
|
+
props: T,
|
|
11
|
+
): React.ReactElement {
|
|
12
|
+
const { profile } = props;
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const {
|
|
15
|
+
userID, nick, selfSignature, avatar,
|
|
16
|
+
} = profile;
|
|
17
|
+
return (
|
|
18
|
+
<div className="tui-contact-info-header">
|
|
19
|
+
<div className="header-container">
|
|
20
|
+
<div className="header-container-avatar">
|
|
21
|
+
<Avatar size={60} image={avatar || defaultUserAvatar} />
|
|
22
|
+
<div className="header-container-name">{nick || userID}</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div className="header-container-text">{`ID:${userID}`}</div>
|
|
25
|
+
<div className="header-container-text">
|
|
26
|
+
{t('TUIContact.Signature')}
|
|
27
|
+
:
|
|
28
|
+
{selfSignature || ''}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
export const BasicInfo = React.memo(UnMemoizedBasicInfo);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Profile } from '@tencentcloud/chat';
|
|
4
|
+
import { useTUIKitContext } from '../../../context';
|
|
5
|
+
import { BasicInfo } from './basicInfo';
|
|
6
|
+
import { Switch } from '../../Switch';
|
|
7
|
+
import useContactInfo from './hooks/useContactInfo';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
profile: Profile;
|
|
11
|
+
}
|
|
12
|
+
export function UnMemoizedBlockInfo<T extends Props>(
|
|
13
|
+
props: T,
|
|
14
|
+
): React.ReactElement {
|
|
15
|
+
const { profile } = props;
|
|
16
|
+
const { contactData, setActiveContact } = useTUIKitContext('TUIContact');
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const [isAddToBlocklist, setIsAddToBlocklist] = useState(false);
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
removeFromBlocklist,
|
|
22
|
+
} = useContactInfo();
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
setIsAddToBlocklist(true);
|
|
26
|
+
}, [contactData]);
|
|
27
|
+
|
|
28
|
+
const removeFromBlocklistHandler = async () => {
|
|
29
|
+
await removeFromBlocklist(profile.userID);
|
|
30
|
+
setIsAddToBlocklist(false);
|
|
31
|
+
setActiveContact();
|
|
32
|
+
};
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<BasicInfo profile={profile} />
|
|
36
|
+
<div className="tui-contact-info-content">
|
|
37
|
+
<div className="content-item">
|
|
38
|
+
<p className="content-item-label">{t('TUIContact.block')}</p>
|
|
39
|
+
<Switch className="content-item-text" onChange={removeFromBlocklistHandler} checked={isAddToBlocklist} />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
export const BlockInfo = React.memo(UnMemoizedBlockInfo);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import TencentCloudChat, { FriendApplication } from '@tencentcloud/chat';
|
|
4
|
+
import { useTUIKitContext } from '../../../context';
|
|
5
|
+
import { Avatar, defaultUserAvatar } from '../../Avatar';
|
|
6
|
+
import useContactInfo from './hooks/useContactInfo';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
application: FriendApplication;
|
|
10
|
+
}
|
|
11
|
+
export function UnMemoizedFriendApplication<T extends Props>(
|
|
12
|
+
props: T,
|
|
13
|
+
): React.ReactElement {
|
|
14
|
+
const { setActiveContact } = useTUIKitContext('TUIContact');
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const { application } = props;
|
|
17
|
+
const {
|
|
18
|
+
userID,
|
|
19
|
+
nick,
|
|
20
|
+
avatar,
|
|
21
|
+
type,
|
|
22
|
+
wording,
|
|
23
|
+
} = application;
|
|
24
|
+
const {
|
|
25
|
+
acceptFriendApplication,
|
|
26
|
+
refuseFriendApplication,
|
|
27
|
+
} = useContactInfo();
|
|
28
|
+
const acceptFriendApplicationHandler = () => {
|
|
29
|
+
setActiveContact();
|
|
30
|
+
acceptFriendApplication(userID);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const refuseFriendApplicationHandler = () => {
|
|
34
|
+
setActiveContact();
|
|
35
|
+
refuseFriendApplication(userID);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<div className="tui-contact-info-header">
|
|
41
|
+
<div className="header-container">
|
|
42
|
+
<div className="header-container-avatar">
|
|
43
|
+
<Avatar size={60} image={avatar || defaultUserAvatar} />
|
|
44
|
+
<div className="header-container-name">{nick || userID}</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div className="header-container-text">{`ID:${userID}`}</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div className="tui-contact-info-content">
|
|
50
|
+
<div className="content-item">
|
|
51
|
+
<p className="content-item-label">{t('TUIContact.verification info')}</p>
|
|
52
|
+
<p className="content-item-text">{wording}</p>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
{type === TencentCloudChat.TYPES.SNS_APPLICATION_SENT_TO_ME && (
|
|
56
|
+
<div className="tui-contact-info-content">
|
|
57
|
+
<div className="content-btn-container">
|
|
58
|
+
<div className="content-item-btn delete-btn" role="button" tabIndex={0} onClick={refuseFriendApplicationHandler}>{t('TUIContact.Refuse')}</div>
|
|
59
|
+
<div className="content-item-btn confirm-btn" role="button" tabIndex={0} onClick={acceptFriendApplicationHandler}>{t('TUIContact.Agree')}</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
export const FriendApplicationInfo = React.memo(UnMemoizedFriendApplication);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Friend } from '@tencentcloud/chat';
|
|
4
|
+
import { useTUIKitContext } from '../../../context';
|
|
5
|
+
import { BasicInfo } from './basicInfo';
|
|
6
|
+
import { Switch } from '../../Switch';
|
|
7
|
+
import useContactInfo from './hooks/useContactInfo';
|
|
8
|
+
import { DivWithEdit } from '../../DivWithEdit';
|
|
9
|
+
import { useConversation } from '../../../hooks';
|
|
10
|
+
import '../index.scss';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
friend: Friend;
|
|
14
|
+
openChat?: () => void,
|
|
15
|
+
}
|
|
16
|
+
export function UnMemoizedFriendInfo<T extends Props>(
|
|
17
|
+
props: T,
|
|
18
|
+
): React.ReactElement {
|
|
19
|
+
const {
|
|
20
|
+
chat, contactData, setActiveContact, setActiveConversation,
|
|
21
|
+
} = useTUIKitContext('TUIContact');
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const { friend, openChat } = props;
|
|
24
|
+
const { userID, profile, remark } = friend;
|
|
25
|
+
const [isEditName, setIsEditRemark] = useState('');
|
|
26
|
+
const [remarkValue, setRemarkValue] = useState('');
|
|
27
|
+
const [isAddToBlocklist, setIsAddToBlocklist] = useState(false);
|
|
28
|
+
const {
|
|
29
|
+
addToBlocklist,
|
|
30
|
+
deleteFriend,
|
|
31
|
+
} = useContactInfo();
|
|
32
|
+
const { createConversation } = useConversation(chat);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setIsAddToBlocklist(false);
|
|
35
|
+
setRemarkValue(remark);
|
|
36
|
+
}, [contactData, remark]);
|
|
37
|
+
|
|
38
|
+
const handleSetEditRemark = () => {
|
|
39
|
+
setIsEditRemark('remark');
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const editText = (data?: any) => {
|
|
43
|
+
chat.updateFriend({
|
|
44
|
+
userID,
|
|
45
|
+
remark: data?.value,
|
|
46
|
+
});
|
|
47
|
+
setRemarkValue(data?.value);
|
|
48
|
+
setIsEditRemark('');
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const addToBlocklistHandler = async () => {
|
|
52
|
+
await addToBlocklist(userID);
|
|
53
|
+
setIsAddToBlocklist(true);
|
|
54
|
+
// 清空右侧 container 内容
|
|
55
|
+
setActiveContact();
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const deleteFriendHandler = async () => {
|
|
59
|
+
await deleteFriend(userID);
|
|
60
|
+
setActiveContact();
|
|
61
|
+
};
|
|
62
|
+
const openC2CConversation = async () => {
|
|
63
|
+
const conversation = await createConversation(`C2C${userID}`);
|
|
64
|
+
setActiveConversation(conversation);
|
|
65
|
+
openChat();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
<BasicInfo profile={profile} />
|
|
71
|
+
<div className="tui-contact-info-content">
|
|
72
|
+
<div className="content-item">
|
|
73
|
+
<p className="content-item-label">{t('TUIContact.remark')}</p>
|
|
74
|
+
<DivWithEdit
|
|
75
|
+
name="remark"
|
|
76
|
+
className="content-item-text"
|
|
77
|
+
value={remarkValue}
|
|
78
|
+
type="text"
|
|
79
|
+
toggle={handleSetEditRemark}
|
|
80
|
+
isEdit={isEditName === 'remark'}
|
|
81
|
+
confirm={editText}
|
|
82
|
+
close={() => {
|
|
83
|
+
setIsEditRemark('');
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
<div className="content-item">
|
|
88
|
+
<p className="content-item-label">{t('TUIContact.block')}</p>
|
|
89
|
+
<Switch
|
|
90
|
+
className="content-item-text"
|
|
91
|
+
onChange={addToBlocklistHandler}
|
|
92
|
+
checked={isAddToBlocklist}
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
<div className="content-btn-container">
|
|
96
|
+
<div className="content-item-btn delete-btn" role="button" tabIndex={0} onClick={deleteFriendHandler}>{t('TUIContact.Delete friend')}</div>
|
|
97
|
+
<div className="content-item-btn confirm-btn" role="button" tabIndex={0} onClick={openC2CConversation}>{t('TUIContact.Send Message')}</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
export const FriendInfo = React.memo(UnMemoizedFriendInfo);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import TencentCloudChat from '@tencentcloud/chat';
|
|
3
|
+
import { Toast } from '../../../Toast';
|
|
4
|
+
import { useTUIKitContext } from '../../../../context';
|
|
5
|
+
|
|
6
|
+
function useContactInfo() {
|
|
7
|
+
const { chat } = useTUIKitContext('useContactInfo');
|
|
8
|
+
|
|
9
|
+
// 移除黑名单
|
|
10
|
+
const removeFromBlocklist = useCallback((userID: string) => {
|
|
11
|
+
chat.removeFromBlacklist({
|
|
12
|
+
userIDList: [userID],
|
|
13
|
+
});
|
|
14
|
+
}, [chat]);
|
|
15
|
+
|
|
16
|
+
// 添加好友
|
|
17
|
+
const addFriend = useCallback((param: any) => {
|
|
18
|
+
chat.addFriend({
|
|
19
|
+
to: param?.userID,
|
|
20
|
+
source: 'AddSource_Type_Web',
|
|
21
|
+
remark: param?.remark,
|
|
22
|
+
wording: param?.wording,
|
|
23
|
+
}).catch((error: any) => {
|
|
24
|
+
console.warn('delete friend failed:', error);
|
|
25
|
+
Toast({
|
|
26
|
+
text: error,
|
|
27
|
+
type: 'error',
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}, [chat]);
|
|
31
|
+
|
|
32
|
+
// 删除好友
|
|
33
|
+
const deleteFriend = useCallback((userID: string) => {
|
|
34
|
+
chat.deleteFriend({
|
|
35
|
+
userIDList: [userID],
|
|
36
|
+
});
|
|
37
|
+
}, [chat]);
|
|
38
|
+
|
|
39
|
+
// 添加黑名单
|
|
40
|
+
const addToBlocklist = useCallback((userID: string) => {
|
|
41
|
+
chat.addToBlacklist({
|
|
42
|
+
userIDList: [userID],
|
|
43
|
+
});
|
|
44
|
+
}, [chat]);
|
|
45
|
+
|
|
46
|
+
const acceptFriendApplication = useCallback((userID: string) => {
|
|
47
|
+
chat.acceptFriendApplication({
|
|
48
|
+
userID,
|
|
49
|
+
type: TencentCloudChat.TYPES.SNS_APPLICATION_AGREE_AND_ADD,
|
|
50
|
+
});
|
|
51
|
+
}, [chat]);
|
|
52
|
+
|
|
53
|
+
const refuseFriendApplication = useCallback((userID: string) => {
|
|
54
|
+
chat.refuseFriendApplication({
|
|
55
|
+
userID,
|
|
56
|
+
});
|
|
57
|
+
}, [chat]);
|
|
58
|
+
// 好友相关
|
|
59
|
+
// 判断是否为双向好友关系
|
|
60
|
+
const isFriend = (info: any): Promise<boolean> => (
|
|
61
|
+
new Promise((resolve, reject) => {
|
|
62
|
+
chat.checkFriend({
|
|
63
|
+
userIDList: [info?.userID],
|
|
64
|
+
type: TencentCloudChat.TYPES.SNS_CHECK_TYPE_BOTH,
|
|
65
|
+
})
|
|
66
|
+
.then((res: any) => {
|
|
67
|
+
switch (res?.data?.successUserIDList[0]?.relation) {
|
|
68
|
+
// 无好友关系:A 的好友表中没有 B,B 的好友表中也没有 A
|
|
69
|
+
case TencentCloudChat.TYPES.SNS_TYPE_NO_RELATION:
|
|
70
|
+
resolve(false);
|
|
71
|
+
break;
|
|
72
|
+
// 单项好友:A 的好友表中有 B,但 B 的好友表中没有 A
|
|
73
|
+
case TencentCloudChat.TYPES.SNS_TYPE_A_WITH_B:
|
|
74
|
+
resolve(false);
|
|
75
|
+
break;
|
|
76
|
+
// 单项好友:A 的好友表中没有 B,但 B 的好友表中有 A
|
|
77
|
+
case TencentCloudChat.TYPES.SNS_TYPE_B_WITH_A:
|
|
78
|
+
resolve(false);
|
|
79
|
+
break;
|
|
80
|
+
// 双向好友关系
|
|
81
|
+
case TencentCloudChat.TYPES.SNS_TYPE_BOTH_WAY:
|
|
82
|
+
resolve(true);
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
resolve(false);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
.catch((error: any) => {
|
|
90
|
+
console.warn('checkFriend error', error);
|
|
91
|
+
reject(error);
|
|
92
|
+
});
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
const isBlock = async (userID: string) => {
|
|
96
|
+
const { data } = await chat.getBlacklist();
|
|
97
|
+
return data.includes(userID);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
addToBlocklist,
|
|
102
|
+
removeFromBlocklist,
|
|
103
|
+
isFriend,
|
|
104
|
+
isBlock,
|
|
105
|
+
addFriend,
|
|
106
|
+
deleteFriend,
|
|
107
|
+
acceptFriendApplication,
|
|
108
|
+
refuseFriendApplication,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default useContactInfo;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
.tui-contact-info {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
padding: 60px;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
.tui-contact-info-header {
|
|
10
|
+
padding-bottom: 15px;
|
|
11
|
+
border-bottom: 1px solid #ddd;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
width: 100%;
|
|
15
|
+
.header-container {
|
|
16
|
+
flex: 1;
|
|
17
|
+
.header-container-avatar {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 10px;
|
|
21
|
+
}
|
|
22
|
+
.header-container-name {
|
|
23
|
+
font-size: 24px;
|
|
24
|
+
padding: 15px;
|
|
25
|
+
}
|
|
26
|
+
.header-container-text {
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
line-height: 50px;
|
|
29
|
+
font-weight: 400;
|
|
30
|
+
color: #999999;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.tui-contact-info-content {
|
|
35
|
+
padding: 15px 0;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
.content-item {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: row;
|
|
40
|
+
align-items: center;
|
|
41
|
+
padding: 6px 0;
|
|
42
|
+
font-size: 16px;
|
|
43
|
+
font-weight: 400;
|
|
44
|
+
min-height: 56px;
|
|
45
|
+
}
|
|
46
|
+
.content-item-wording {
|
|
47
|
+
padding: 6px 0;
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
min-height: 56px;
|
|
51
|
+
}
|
|
52
|
+
.content-item-wording-text {
|
|
53
|
+
margin-top: 5px;
|
|
54
|
+
flex: 1;
|
|
55
|
+
border: 1px solid #e8e8e9;
|
|
56
|
+
border-radius: 4px;
|
|
57
|
+
padding: 4px;
|
|
58
|
+
color: inherit;
|
|
59
|
+
resize: none;
|
|
60
|
+
height: 100px;
|
|
61
|
+
width: 95%;
|
|
62
|
+
}
|
|
63
|
+
.content-item-label {
|
|
64
|
+
color: #999;
|
|
65
|
+
margin-right: 5px;
|
|
66
|
+
}
|
|
67
|
+
.content-item-text {
|
|
68
|
+
flex: 1;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
color: #333;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
.content-btn-container {
|
|
75
|
+
display: flex;
|
|
76
|
+
padding: 30px;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
.content-item-btn {
|
|
79
|
+
margin: 15px;
|
|
80
|
+
width: 122px;
|
|
81
|
+
height: 26px;
|
|
82
|
+
padding: 8px 20px;
|
|
83
|
+
border-radius: 25px;
|
|
84
|
+
border: none;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
text-align: center;
|
|
87
|
+
line-height: 26px;
|
|
88
|
+
font-weight: 400;
|
|
89
|
+
letter-spacing: 0;
|
|
90
|
+
min-width: 100px;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
-webkit-user-select: none;
|
|
93
|
+
user-select: none;
|
|
94
|
+
}
|
|
95
|
+
.delete-btn {
|
|
96
|
+
border: 1px solid #e54545;
|
|
97
|
+
background: transparent;
|
|
98
|
+
color: #e54545;
|
|
99
|
+
}
|
|
100
|
+
.confirm-btn {
|
|
101
|
+
border: 1px solid #006eff;
|
|
102
|
+
background: #006eff;
|
|
103
|
+
color: #fff;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import TencentCloudChat from '@tencentcloud/chat';
|
|
4
|
+
import { useTUIKitContext, useTUIContactContext } from '../../../context';
|
|
5
|
+
import useContactInfo from '../TUIContactInfo/hooks/useContactInfo';
|
|
6
|
+
|
|
7
|
+
import { Avatar, defaultUserAvatar } from '../../Avatar';
|
|
8
|
+
import rightArrow from '../../Icon/images/right-arrow.svg';
|
|
9
|
+
import downArrow from '../../Icon/images/down-arrow.png';
|
|
10
|
+
|
|
11
|
+
import './index.scss';
|
|
12
|
+
|
|
13
|
+
function UnMemoizedTUIContactList<T>(): React.ReactElement {
|
|
14
|
+
const { setActiveContact } = useTUIKitContext();
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const {
|
|
17
|
+
isShowContactList, friendList, blocklistProfile, friendApplicationList,
|
|
18
|
+
} = useTUIContactContext('TUIContactList');
|
|
19
|
+
const {
|
|
20
|
+
acceptFriendApplication,
|
|
21
|
+
} = useContactInfo();
|
|
22
|
+
|
|
23
|
+
const [iShowFriendApplication, setShowFriendApplication] = useState(false);
|
|
24
|
+
const [iShowFriends, setShowFriends] = useState(false);
|
|
25
|
+
const [isShowBlocklist, setShowBlocklist] = useState(false);
|
|
26
|
+
|
|
27
|
+
const acceptFriendApplicationHandle = (e: any, userID: string) => {
|
|
28
|
+
e.stopPropagation();
|
|
29
|
+
acceptFriendApplication(userID);
|
|
30
|
+
setActiveContact();
|
|
31
|
+
};
|
|
32
|
+
return (
|
|
33
|
+
isShowContactList && (
|
|
34
|
+
<div className="tui-contacts-list">
|
|
35
|
+
<div
|
|
36
|
+
className="tui-contacts-title"
|
|
37
|
+
role="button"
|
|
38
|
+
tabIndex={0}
|
|
39
|
+
onClick={() => setShowFriendApplication(!iShowFriendApplication)}
|
|
40
|
+
>
|
|
41
|
+
<p className="tui-contacts-list-title">{t('TUIContact.New Contacts')}</p>
|
|
42
|
+
<div className="tui-contacts-list-icon">
|
|
43
|
+
<img src={iShowFriendApplication ? downArrow : rightArrow} alt="" />
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
{iShowFriendApplication
|
|
47
|
+
&& friendApplicationList.map((item, index) => {
|
|
48
|
+
const {
|
|
49
|
+
userID, avatar, nick, wording, type,
|
|
50
|
+
} = item;
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
role="button"
|
|
54
|
+
tabIndex={0}
|
|
55
|
+
className="tui-contacts-list-item"
|
|
56
|
+
key={userID}
|
|
57
|
+
onClick={(e) => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
setActiveContact({
|
|
60
|
+
type: 'friendApplication',
|
|
61
|
+
data: item,
|
|
62
|
+
});
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<Avatar size={30} image={avatar || defaultUserAvatar} />
|
|
66
|
+
<div className="tui-contacts-list-item-card">
|
|
67
|
+
<div>
|
|
68
|
+
<p className="tui-contacts-list-item-name text-ellipsis">
|
|
69
|
+
{nick || userID}
|
|
70
|
+
</p>
|
|
71
|
+
{wording !== '' && (
|
|
72
|
+
<p className="tui-contacts-list-item-text text-ellipsis">
|
|
73
|
+
{wording}
|
|
74
|
+
</p>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
{type === TencentCloudChat.TYPES.SNS_APPLICATION_SENT_BY_ME && (
|
|
78
|
+
<p className="tui-contacts-list-btn-text text-ellipsis">{t('TUIContact.waiting for verification')}</p>
|
|
79
|
+
)}
|
|
80
|
+
{type === TencentCloudChat.TYPES.SNS_APPLICATION_SENT_TO_ME && (
|
|
81
|
+
<div
|
|
82
|
+
className="application-btn"
|
|
83
|
+
role="button"
|
|
84
|
+
tabIndex={0}
|
|
85
|
+
onClick={(e) => {
|
|
86
|
+
acceptFriendApplicationHandle(e, userID);
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{t('TUIContact.Agree')}
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
})}
|
|
96
|
+
<div
|
|
97
|
+
className="tui-contacts-title"
|
|
98
|
+
role="button"
|
|
99
|
+
tabIndex={0}
|
|
100
|
+
onClick={() => setShowBlocklist(!isShowBlocklist)}
|
|
101
|
+
>
|
|
102
|
+
<div className="tui-contacts-list-title">{t('TUIContact.Blocked List')}</div>
|
|
103
|
+
<div className="tui-contacts-list-icon">
|
|
104
|
+
<img src={isShowBlocklist ? downArrow : rightArrow} alt="" />
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
{isShowBlocklist
|
|
108
|
+
&& blocklistProfile.map((item, index) => {
|
|
109
|
+
const { userID, avatar, nick } = item;
|
|
110
|
+
return (
|
|
111
|
+
<div
|
|
112
|
+
role="button"
|
|
113
|
+
tabIndex={0}
|
|
114
|
+
className="tui-contacts-list-item"
|
|
115
|
+
key={userID}
|
|
116
|
+
onClick={() => {
|
|
117
|
+
setActiveContact({ type: 'block', data: item });
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<Avatar size={30} image={avatar || defaultUserAvatar} />
|
|
121
|
+
<div className="tui-contacts-list-item-container">
|
|
122
|
+
<p className="tui-contacts-list-item-name">{ nick || userID}</p>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
})}
|
|
127
|
+
<div
|
|
128
|
+
className="tui-contacts-title"
|
|
129
|
+
role="button"
|
|
130
|
+
tabIndex={0}
|
|
131
|
+
onClick={() => setShowFriends(!iShowFriends)}
|
|
132
|
+
>
|
|
133
|
+
<div className="tui-contacts-list-title">{t('TUIContact.Friend')}</div>
|
|
134
|
+
<div className="tui-contacts-list-icon">
|
|
135
|
+
<img src={iShowFriends ? downArrow : rightArrow} alt="" />
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
{iShowFriends
|
|
139
|
+
&& friendList.map((item, index) => {
|
|
140
|
+
const { userID, avatar, nick } = item.profile;
|
|
141
|
+
return (
|
|
142
|
+
<div
|
|
143
|
+
className="tui-contacts-list-item"
|
|
144
|
+
key={userID}
|
|
145
|
+
role="button"
|
|
146
|
+
tabIndex={0}
|
|
147
|
+
onClick={() => {
|
|
148
|
+
setActiveContact({ type: 'friend', data: item });
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
<Avatar size={30} image={avatar || defaultUserAvatar} />
|
|
152
|
+
<div className="tui-contacts-list-item-container">
|
|
153
|
+
<p className="tui-contacts-list-item-name">{item.remark || nick || userID}</p>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
);
|
|
157
|
+
})}
|
|
158
|
+
</div>
|
|
159
|
+
)
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
export const TUIContactList = React.memo(UnMemoizedTUIContactList);
|