@tencentcloud/chat-uikit-react 3.0.0 → 3.0.2
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 +17 -1
- package/README.md +8 -8
- package/dist/{ChatSetting-C7QlwAiq.js → ChatSetting-BtQwjHr0.js} +4996 -4920
- package/dist/components/Chat/Chat.js +10 -9
- package/dist/components/ChatHeader/ChatHeader.js +12 -11
- package/dist/components/ChatHeader/ChatHeaderActions/ChatHeaderActions.js +10 -9
- package/dist/components/ChatHeader/ChatHeaderUI/ChatHeaderUI.js +10 -9
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/IconFont/Icon.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Model/index.js +1 -1
- package/dist/components/Plugins/index.js +1 -1
- package/dist/components/Popup/index.js +1 -1
- package/dist/components/PopupNew/Popup.js +1 -1
- package/dist/components/Profile/Profile.d.ts +1 -1
- package/dist/components/Profile/Profile.js +16 -16
- package/dist/components/Profile/ProfileDefault.js +39 -39
- package/dist/components/Profile/myProfile/MyProfile.js +10 -9
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +25 -33
- package/dist/constant/avatar.d.ts +2 -1
- package/dist/constant/avatar.js +2 -1
- package/dist/context/ChatContext.js +6 -5
- package/dist/external_modules/{mui-CbGEJVT2.js → mui-BcA3SBHM.js} +1 -1
- package/dist/external_modules/{zustand-Dvydplxp.js → zustand-CDmQR4co.js} +7 -7
- package/dist/hooks/index.js +0 -1
- package/dist/index.js +2950 -1530
- package/dist/locales/en-US/TUIContact.d.ts +44 -0
- package/dist/locales/en-US/TUIContact.js +46 -1
- package/dist/locales/en-US/index.d.ts +44 -0
- package/dist/locales/ja-JP/TUIContact.d.ts +44 -0
- package/dist/locales/ja-JP/TUIContact.js +46 -1
- package/dist/locales/ja-JP/index.d.ts +44 -0
- package/dist/locales/ko-KR/TUIContact.d.ts +44 -0
- package/dist/locales/ko-KR/TUIContact.js +46 -1
- package/dist/locales/ko-KR/index.d.ts +44 -0
- package/dist/locales/zh-CN/TUIContact.d.ts +44 -0
- package/dist/locales/zh-CN/TUIContact.js +46 -1
- package/dist/locales/zh-CN/index.d.ts +44 -0
- package/dist/locales/zh-TW/TUIContact.d.ts +44 -0
- package/dist/locales/zh-TW/TUIContact.js +46 -1
- package/dist/locales/zh-TW/index.d.ts +44 -0
- package/dist/states/ChatHeaderState.js +23 -22
- package/dist/states/UIManagerState.js +1 -1
- package/dist/styles/ChatSetting.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/index2.css +1 -1
- package/dist/styles/index3.css +1 -1
- package/dist/styles/index4.css +1 -1
- package/dist/styles/index5.css +1 -1
- package/package.json +3 -3
- package/src/components/Profile/Profile.tsx +20 -17
- package/src/components/Profile/ProfileDefault.tsx +4 -6
- package/src/components/index.ts +0 -1
- package/src/constant/avatar.ts +2 -1
- package/src/hooks/index.ts +0 -2
- package/src/locales/en-US/TUIContact.ts +45 -0
- package/src/locales/ja-JP/TUIContact.ts +45 -0
- package/src/locales/ko-KR/TUIContact.ts +45 -0
- package/src/locales/zh-CN/TUIContact.ts +45 -0
- package/src/locales/zh-TW/TUIContact.ts +46 -0
- package/src/states/ChatHeaderState.ts +2 -2
- package/dist/components/Contact/Contact.d.ts +0 -3
- package/dist/components/Contact/Contact.js +0 -81
- package/dist/components/Contact/ContactInfo/ContactInfo.d.ts +0 -8
- package/dist/components/Contact/ContactInfo/ContactInfo.js +0 -27
- package/dist/components/Contact/ContactInfo/addFriendInfo.d.ts +0 -8
- package/dist/components/Contact/ContactInfo/addFriendInfo.js +0 -61
- package/dist/components/Contact/ContactInfo/basicInfo.d.ts +0 -8
- package/dist/components/Contact/ContactInfo/basicInfo.js +0 -48
- package/dist/components/Contact/ContactInfo/blockInfo.d.ts +0 -8
- package/dist/components/Contact/ContactInfo/blockInfo.js +0 -33
- package/dist/components/Contact/ContactInfo/friendApplication.d.ts +0 -8
- package/dist/components/Contact/ContactInfo/friendApplication.js +0 -47
- package/dist/components/Contact/ContactInfo/friendInfo.d.ts +0 -9
- package/dist/components/Contact/ContactInfo/friendInfo.js +0 -83
- package/dist/components/Contact/ContactInfo/groupInfo.d.ts +0 -9
- package/dist/components/Contact/ContactInfo/groupInfo.js +0 -45
- package/dist/components/Contact/ContactInfo/hooks/useContactInfo.d.ts +0 -11
- package/dist/components/Contact/ContactInfo/hooks/useContactInfo.js +0 -84
- package/dist/components/Contact/ContactList/ContactList.d.ts +0 -4
- package/dist/components/Contact/ContactList/ContactList.js +0 -152
- package/dist/components/Contact/hooks/useTUIContact.d.ts +0 -12
- package/dist/components/Contact/hooks/useTUIContact.js +0 -58
- package/dist/components/Contact/index.d.ts +0 -3
- package/dist/components/Contact/index.js +0 -10
- package/dist/components/ContactSearch/ContactSearch.d.ts +0 -3
- package/dist/components/ContactSearch/ContactSearch.js +0 -85
- package/dist/components/ContactSearch/hooks/useContactSearch.d.ts +0 -6
- package/dist/components/ContactSearch/hooks/useContactSearch.js +0 -28
- package/dist/styles/ContactInfo.css +0 -1
- package/dist/styles/ContactList.css +0 -1
- package/dist/styles/ContactSearch.css +0 -1
- package/dist/styles/index6.css +0 -1
- package/src/components/Contact/Contact.tsx +0 -97
- package/src/components/Contact/ContactInfo/ContactInfo.tsx +0 -36
- package/src/components/Contact/ContactInfo/addFriendInfo.tsx +0 -88
- package/src/components/Contact/ContactInfo/basicInfo.tsx +0 -52
- package/src/components/Contact/ContactInfo/blockInfo.tsx +0 -45
- package/src/components/Contact/ContactInfo/friendApplication.tsx +0 -68
- package/src/components/Contact/ContactInfo/friendInfo.tsx +0 -101
- package/src/components/Contact/ContactInfo/groupInfo.tsx +0 -62
- package/src/components/Contact/ContactInfo/hooks/useContactInfo.tsx +0 -101
- package/src/components/Contact/ContactInfo/index.scss +0 -136
- package/src/components/Contact/ContactList/ContactList.tsx +0 -174
- package/src/components/Contact/ContactList/index.scss +0 -111
- package/src/components/Contact/hooks/useTUIContact.tsx +0 -88
- package/src/components/Contact/index.scss +0 -91
- package/src/components/Contact/index.ts +0 -3
- package/src/components/ContactSearch/ContactSearch.tsx +0 -102
- package/src/components/ContactSearch/hooks/useContactSearch.tsx +0 -31
- package/src/components/ContactSearch/index.scss +0 -33
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
|
|
3
|
-
import { useUIKit } from '@tencentcloud/uikit-base-component-react';
|
|
4
|
-
import { defaultUserAvatar } from '../../../constant/avatar';
|
|
5
|
-
import { useUIManagerState } from '../../../states';
|
|
6
|
-
import useContactInfo from './hooks/useContactInfo';
|
|
7
|
-
import type { FriendApplication } from '@tencentcloud/chat';
|
|
8
|
-
import { Avatar } from 'tuikit-atomicx-react';
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
application: FriendApplication;
|
|
12
|
-
}
|
|
13
|
-
export function UnMemoizedFriendApplication<T extends Props>(
|
|
14
|
-
props: T,
|
|
15
|
-
): React.ReactElement {
|
|
16
|
-
const { setActiveContact } = useUIManagerState('TUIContact');
|
|
17
|
-
const { t } = useUIKit();
|
|
18
|
-
const { application } = props;
|
|
19
|
-
const {
|
|
20
|
-
userID,
|
|
21
|
-
nick,
|
|
22
|
-
avatar,
|
|
23
|
-
type,
|
|
24
|
-
wording,
|
|
25
|
-
} = application;
|
|
26
|
-
const {
|
|
27
|
-
acceptFriendApplication,
|
|
28
|
-
refuseFriendApplication,
|
|
29
|
-
} = useContactInfo();
|
|
30
|
-
const acceptFriendApplicationHandler = () => {
|
|
31
|
-
setActiveContact();
|
|
32
|
-
acceptFriendApplication(userID);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const refuseFriendApplicationHandler = () => {
|
|
36
|
-
setActiveContact();
|
|
37
|
-
refuseFriendApplication(userID);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<>
|
|
42
|
-
<div className="tui-contact-info-header">
|
|
43
|
-
<div className="header-container">
|
|
44
|
-
<div className="header-container-avatar">
|
|
45
|
-
<Avatar size='xl' src={avatar || defaultUserAvatar} />
|
|
46
|
-
<div className="header-container-name">{nick || userID}</div>
|
|
47
|
-
</div>
|
|
48
|
-
<div className="header-container-text">{`ID:${userID}`}</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
<div className="tui-contact-info-content">
|
|
52
|
-
<div className="content-item">
|
|
53
|
-
<p className="content-item-label">{t('TUIContact.verification info')}</p>
|
|
54
|
-
<p className="content-item-text">{wording}</p>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
{type === TUIChatEngine.TYPES.SNS_APPLICATION_SENT_TO_ME && (
|
|
58
|
-
<div className="tui-contact-info-content">
|
|
59
|
-
<div className="content-btn-container">
|
|
60
|
-
<div className="content-item-btn delete-btn" role="button" tabIndex={0} onClick={refuseFriendApplicationHandler}>{t('TUIContact.Refuse')}</div>
|
|
61
|
-
<div className="content-item-btn confirm-btn" role="button" tabIndex={0} onClick={acceptFriendApplicationHandler}>{t('TUIContact.Agree')}</div>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
)}
|
|
65
|
-
</>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
export const FriendApplicationInfo = React.memo(UnMemoizedFriendApplication);
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { useUIKit } from '@tencentcloud/uikit-base-component-react';
|
|
3
|
-
import { useUIManagerState } from '../../../states';
|
|
4
|
-
import { DivWithEdit } from '../../DivWithEdit';
|
|
5
|
-
import { Switch } from '../../Switch';
|
|
6
|
-
import { BasicInfo } from './basicInfo';
|
|
7
|
-
import useContactInfo from './hooks/useContactInfo';
|
|
8
|
-
import type { Friend } from '@tencentcloud/chat';
|
|
9
|
-
import '../index.scss';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
friend: Friend;
|
|
13
|
-
showChats?: (() => void) | undefined;
|
|
14
|
-
}
|
|
15
|
-
export function UnMemoizedFriendInfo<T extends Props>(
|
|
16
|
-
props: T,
|
|
17
|
-
): React.ReactElement {
|
|
18
|
-
const { chat } = useUIManagerState();
|
|
19
|
-
const {
|
|
20
|
-
contactData, setActiveContact, switchConversation,
|
|
21
|
-
} = useUIManagerState('TUIContact');
|
|
22
|
-
const { t } = useUIKit();
|
|
23
|
-
const { friend, showChats } = 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
|
-
useEffect(() => {
|
|
33
|
-
setIsAddToBlocklist(false);
|
|
34
|
-
setRemarkValue(remark);
|
|
35
|
-
}, [contactData, remark]);
|
|
36
|
-
|
|
37
|
-
const handleSetEditRemark = () => {
|
|
38
|
-
setIsEditRemark('remark');
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const editText = (data?: any) => {
|
|
42
|
-
chat.updateFriend({
|
|
43
|
-
userID,
|
|
44
|
-
remark: data?.value,
|
|
45
|
-
});
|
|
46
|
-
setRemarkValue(data?.value);
|
|
47
|
-
setIsEditRemark('');
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const addToBlocklistHandler = async () => {
|
|
51
|
-
await addToBlocklist(userID);
|
|
52
|
-
setIsAddToBlocklist(true);
|
|
53
|
-
setActiveContact();
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const deleteFriendHandler = async () => {
|
|
57
|
-
await deleteFriend(userID);
|
|
58
|
-
setActiveContact();
|
|
59
|
-
};
|
|
60
|
-
const openC2CConversation = () => {
|
|
61
|
-
const conversationID = `C2C${userID}`;
|
|
62
|
-
showChats?.();
|
|
63
|
-
switchConversation(conversationID);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<>
|
|
68
|
-
<BasicInfo profile={profile} />
|
|
69
|
-
<div className="tui-contact-info-content">
|
|
70
|
-
<div className="content-item">
|
|
71
|
-
<p className="content-item-label">{t('TUIContact.remark')}</p>
|
|
72
|
-
<DivWithEdit
|
|
73
|
-
name="remark"
|
|
74
|
-
className="content-item-text"
|
|
75
|
-
value={remarkValue}
|
|
76
|
-
type="text"
|
|
77
|
-
toggle={handleSetEditRemark}
|
|
78
|
-
isEdit={isEditName === 'remark'}
|
|
79
|
-
confirm={editText}
|
|
80
|
-
close={() => {
|
|
81
|
-
setIsEditRemark('');
|
|
82
|
-
}}
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
<div className="content-item">
|
|
86
|
-
<p className="content-item-label">{t('TUIContact.block')}</p>
|
|
87
|
-
<Switch
|
|
88
|
-
className="content-item-text"
|
|
89
|
-
onChange={addToBlocklistHandler}
|
|
90
|
-
checked={isAddToBlocklist}
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
<div className="content-btn-container">
|
|
94
|
-
<div className="content-item-btn delete-btn" role="button" tabIndex={0} onClick={deleteFriendHandler}>{t('TUIContact.Delete friend')}</div>
|
|
95
|
-
<div className="content-item-btn confirm-btn" role="button" tabIndex={0} onClick={openC2CConversation}>{t('TUIContact.Send Message')}</div>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
export const FriendInfo = React.memo(UnMemoizedFriendInfo);
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { IGroupModel } from '@tencentcloud/chat-uikit-engine';
|
|
3
|
-
import { TUIConversationService } from '@tencentcloud/chat-uikit-engine';
|
|
4
|
-
import { useUIKit } from '@tencentcloud/uikit-base-component-react';
|
|
5
|
-
import { useUIManagerState } from '../../../states';
|
|
6
|
-
import { Avatar, isH5 } from 'tuikit-atomicx-react';
|
|
7
|
-
import { Icon, IconTypes } from '../../Icon';
|
|
8
|
-
import '../index.scss';
|
|
9
|
-
import { defaultUserAvatar } from '../../../constant/avatar';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
group: IGroupModel;
|
|
13
|
-
showChats?: (() => void) | undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function UnMemoizedGroupInfo<T extends Props>(
|
|
17
|
-
props: T,
|
|
18
|
-
): React.ReactElement {
|
|
19
|
-
const { group, showChats } = props;
|
|
20
|
-
|
|
21
|
-
const { setActiveContact, switchConversation } = useUIManagerState('TUIContact');
|
|
22
|
-
const { t } = useUIKit();
|
|
23
|
-
const { groupID, name, avatar } = group;
|
|
24
|
-
|
|
25
|
-
const back = () => {
|
|
26
|
-
TUIConversationService.switchConversation('');
|
|
27
|
-
setActiveContact();
|
|
28
|
-
};
|
|
29
|
-
const openGroupConversation = () => {
|
|
30
|
-
const conversationID = `GROUP${groupID}`;
|
|
31
|
-
showChats && showChats();
|
|
32
|
-
switchConversation(conversationID);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<>
|
|
37
|
-
<div className="tui-contact-info-header">
|
|
38
|
-
{isH5 && (
|
|
39
|
-
<Icon
|
|
40
|
-
width={9}
|
|
41
|
-
height={16}
|
|
42
|
-
type={IconTypes.BACK}
|
|
43
|
-
onClick={back}
|
|
44
|
-
/>
|
|
45
|
-
)}
|
|
46
|
-
<div className="header-container">
|
|
47
|
-
<div className="header-container-avatar">
|
|
48
|
-
<Avatar size='xl' src={avatar || defaultUserAvatar} />
|
|
49
|
-
<div className="header-container-name">{name || groupID}</div>
|
|
50
|
-
</div>
|
|
51
|
-
<div className="header-container-text">{`groupID:${groupID}`}</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
<div className="tui-contact-info-content">
|
|
55
|
-
<div className="content-btn-container">
|
|
56
|
-
<div className="content-item-btn confirm-btn" role="button" tabIndex={0} onClick={openGroupConversation}>{t('TUIContact.Send Message')}</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
export const GroupInfo = React.memo(UnMemoizedGroupInfo);
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
|
|
3
|
-
import { useUIManagerState } from '../../../../states';
|
|
4
|
-
import { Toast } from '@tencentcloud/uikit-base-component-react';
|
|
5
|
-
|
|
6
|
-
function useContactInfo() {
|
|
7
|
-
const { chat } = useUIManagerState();
|
|
8
|
-
|
|
9
|
-
const removeFromBlocklist = useCallback((userID: string) => {
|
|
10
|
-
chat.removeFromBlacklist({
|
|
11
|
-
userIDList: [userID],
|
|
12
|
-
});
|
|
13
|
-
}, [chat]);
|
|
14
|
-
|
|
15
|
-
const addFriend = useCallback((param: any) => {
|
|
16
|
-
chat.addFriend({
|
|
17
|
-
to: param?.userID,
|
|
18
|
-
source: 'AddSource_Type_Web',
|
|
19
|
-
remark: param?.remark,
|
|
20
|
-
wording: param?.wording,
|
|
21
|
-
}).catch((error: any) => {
|
|
22
|
-
console.warn('delete friend failed:', error);
|
|
23
|
-
Toast.error({
|
|
24
|
-
message: error,
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}, [chat]);
|
|
28
|
-
|
|
29
|
-
const deleteFriend = useCallback((userID: string) => {
|
|
30
|
-
chat.deleteFriend({
|
|
31
|
-
userIDList: [userID],
|
|
32
|
-
});
|
|
33
|
-
}, [chat]);
|
|
34
|
-
|
|
35
|
-
const addToBlocklist = useCallback((userID: string) => {
|
|
36
|
-
chat.addToBlacklist({
|
|
37
|
-
userIDList: [userID],
|
|
38
|
-
});
|
|
39
|
-
}, [chat]);
|
|
40
|
-
|
|
41
|
-
const acceptFriendApplication = useCallback((userID: string) => {
|
|
42
|
-
chat.acceptFriendApplication({
|
|
43
|
-
userID,
|
|
44
|
-
type: TUIChatEngine.TYPES.SNS_APPLICATION_AGREE_AND_ADD,
|
|
45
|
-
});
|
|
46
|
-
}, [chat]);
|
|
47
|
-
|
|
48
|
-
const refuseFriendApplication = useCallback((userID: string) => {
|
|
49
|
-
chat.refuseFriendApplication({
|
|
50
|
-
userID,
|
|
51
|
-
});
|
|
52
|
-
}, [chat]);
|
|
53
|
-
const isFriend = (info: any): Promise<boolean> => (
|
|
54
|
-
new Promise((resolve, reject) => {
|
|
55
|
-
chat.checkFriend({
|
|
56
|
-
userIDList: [info?.userID],
|
|
57
|
-
type: TUIChatEngine.TYPES.SNS_CHECK_TYPE_BOTH,
|
|
58
|
-
})
|
|
59
|
-
.then((res: any) => {
|
|
60
|
-
switch (res?.data?.successUserIDList[0]?.relation) {
|
|
61
|
-
case TUIChatEngine.TYPES.SNS_TYPE_NO_RELATION:
|
|
62
|
-
resolve(false);
|
|
63
|
-
break;
|
|
64
|
-
case TUIChatEngine.TYPES.SNS_TYPE_A_WITH_B:
|
|
65
|
-
resolve(false);
|
|
66
|
-
break;
|
|
67
|
-
case TUIChatEngine.TYPES.SNS_TYPE_B_WITH_A:
|
|
68
|
-
resolve(false);
|
|
69
|
-
break;
|
|
70
|
-
case TUIChatEngine.TYPES.SNS_TYPE_BOTH_WAY:
|
|
71
|
-
resolve(true);
|
|
72
|
-
break;
|
|
73
|
-
default:
|
|
74
|
-
resolve(false);
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
.catch((error: any) => {
|
|
79
|
-
console.warn('checkFriend error', error);
|
|
80
|
-
reject(error);
|
|
81
|
-
});
|
|
82
|
-
})
|
|
83
|
-
);
|
|
84
|
-
const isBlock = async (userID: string) => {
|
|
85
|
-
const { data } = await chat.getBlacklist();
|
|
86
|
-
return data.includes(userID);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
addToBlocklist,
|
|
91
|
-
removeFromBlocklist,
|
|
92
|
-
isFriend,
|
|
93
|
-
isBlock,
|
|
94
|
-
addFriend,
|
|
95
|
-
deleteFriend,
|
|
96
|
-
acceptFriendApplication,
|
|
97
|
-
refuseFriendApplication,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default useContactInfo;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
@use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;
|
|
2
|
-
|
|
3
|
-
.tui-contact-info {
|
|
4
|
-
width: 100%;
|
|
5
|
-
height: 100%;
|
|
6
|
-
display: flex;
|
|
7
|
-
padding: 60px;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
|
|
11
|
-
@include theme() {
|
|
12
|
-
background-color: get(bg-color-operate);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.tui-contact-info-header {
|
|
16
|
-
padding-bottom: 15px;
|
|
17
|
-
border-bottom: 1px solid #ddd;
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
width: 100%;
|
|
21
|
-
|
|
22
|
-
.header-container {
|
|
23
|
-
flex: 1;
|
|
24
|
-
|
|
25
|
-
.header-container-avatar {
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
padding: 10px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.header-container-name {
|
|
32
|
-
font-size: 24px;
|
|
33
|
-
padding: 15px;
|
|
34
|
-
|
|
35
|
-
@include theme() {
|
|
36
|
-
color: get(text-color-primary);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.header-container-text {
|
|
41
|
-
margin-top: 20px;
|
|
42
|
-
font-size: 16px;
|
|
43
|
-
word-break: break-all;
|
|
44
|
-
|
|
45
|
-
@include theme() {
|
|
46
|
-
color: get(text-color-secondary);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.tui-contact-info-content {
|
|
53
|
-
padding: 15px 0;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
|
|
56
|
-
@include theme() {
|
|
57
|
-
color: get(text-color-secondary);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.content-item {
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: row;
|
|
63
|
-
align-items: center;
|
|
64
|
-
padding: 6px 0;
|
|
65
|
-
font-size: 16px;
|
|
66
|
-
min-height: 56px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.content-item-wording {
|
|
70
|
-
padding: 6px 0;
|
|
71
|
-
font-size: 16px;
|
|
72
|
-
min-height: 56px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.content-item-wording-text {
|
|
76
|
-
margin-top: 5px;
|
|
77
|
-
flex: 1;
|
|
78
|
-
border: 1px solid #e8e8e9;
|
|
79
|
-
border-radius: 4px;
|
|
80
|
-
padding: 4px;
|
|
81
|
-
color: inherit;
|
|
82
|
-
resize: none;
|
|
83
|
-
height: 100px;
|
|
84
|
-
width: 95%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.content-item-label {
|
|
88
|
-
margin-right: 5px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.content-item-text {
|
|
92
|
-
flex: 1;
|
|
93
|
-
display: flex;
|
|
94
|
-
flex-direction: row;
|
|
95
|
-
overflow: hidden;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.content-btn-container {
|
|
99
|
-
display: flex;
|
|
100
|
-
padding: 30px;
|
|
101
|
-
justify-content: center;
|
|
102
|
-
|
|
103
|
-
.content-item-btn {
|
|
104
|
-
margin: 15px;
|
|
105
|
-
padding: 8px 20px;
|
|
106
|
-
border-radius: 25px;
|
|
107
|
-
border: none;
|
|
108
|
-
font-size: 14px;
|
|
109
|
-
text-align: center;
|
|
110
|
-
letter-spacing: 0;
|
|
111
|
-
min-width: 100px;
|
|
112
|
-
cursor: pointer;
|
|
113
|
-
-webkit-user-select: none;
|
|
114
|
-
user-select: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.delete-btn {
|
|
118
|
-
@include theme() {
|
|
119
|
-
color: get(text-color-error);
|
|
120
|
-
border: 1px solid get(border-color-error);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.confirm-btn {
|
|
125
|
-
@include theme() {
|
|
126
|
-
color: #fff;
|
|
127
|
-
background-color: get(text-color-link);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.tui-contact-info-h5 {
|
|
135
|
-
padding: 8px;
|
|
136
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
|
|
3
|
-
import { useUIKit } from '@tencentcloud/uikit-base-component-react';
|
|
4
|
-
import { defaultUserAvatar } from '../../../constant/avatar';
|
|
5
|
-
import { useTUIContactContext } from '../../../context';
|
|
6
|
-
import { useUIManagerState } from '../../../states';
|
|
7
|
-
import { Avatar, isH5 } from 'tuikit-atomicx-react';
|
|
8
|
-
import downArrow from '../../Icon/images/down-arrow.png';
|
|
9
|
-
import rightArrow from '../../Icon/images/right-arrow.svg';
|
|
10
|
-
import useContactInfo from '../ContactInfo/hooks/useContactInfo';
|
|
11
|
-
import useTUIContact from '../hooks/useTUIContact';
|
|
12
|
-
import './index.scss';
|
|
13
|
-
|
|
14
|
-
interface RenderContactListProps {
|
|
15
|
-
type: 'group' | 'block' | 'friend';
|
|
16
|
-
isShow: boolean;
|
|
17
|
-
title: string;
|
|
18
|
-
list: any[] | undefined;
|
|
19
|
-
setShow: (value: boolean) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function UnMemoizedContactList<T>(): React.ReactElement {
|
|
23
|
-
const { setActiveContact } = useUIManagerState();
|
|
24
|
-
const { t } = useUIKit();
|
|
25
|
-
const {
|
|
26
|
-
isShowContactList, friendList, blocklistProfile, friendApplicationList,
|
|
27
|
-
} = useTUIContactContext('TUIContactList');
|
|
28
|
-
const {
|
|
29
|
-
acceptFriendApplication,
|
|
30
|
-
} = useContactInfo();
|
|
31
|
-
const { groupList } = useTUIContact();
|
|
32
|
-
const [iShowFriendApplication, setShowFriendApplication] = useState(false);
|
|
33
|
-
const [iShowFriends, setShowFriends] = useState(false);
|
|
34
|
-
const [isShowBlocklist, setShowBlocklist] = useState(false);
|
|
35
|
-
const [isShowGrouplist, setShowGrouplist] = useState(false);
|
|
36
|
-
|
|
37
|
-
const acceptFriendApplicationHandle = (e: any, userID: string) => {
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
acceptFriendApplication(userID);
|
|
40
|
-
setActiveContact();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const RenderContactList = ({ type, isShow, setShow, list, title }: RenderContactListProps) => (
|
|
44
|
-
<>
|
|
45
|
-
<div
|
|
46
|
-
className="tui-contacts-title"
|
|
47
|
-
role="button"
|
|
48
|
-
tabIndex={0}
|
|
49
|
-
onClick={() => setShow(!isShow)}
|
|
50
|
-
>
|
|
51
|
-
<div className="tui-contacts-list-title">{title}</div>
|
|
52
|
-
<div className="tui-contacts-list-icon">
|
|
53
|
-
{isShow
|
|
54
|
-
? <i className="iconfont contacts-list-icon"></i>
|
|
55
|
-
: <i className="iconfont contacts-list-icon"></i>}
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
{isShow
|
|
59
|
-
&& list?.map((item: any) => {
|
|
60
|
-
const { userID, groupID, avatar, name, nick } = item.profile || item;
|
|
61
|
-
const showName = item.remark || nick || userID || name || groupID;
|
|
62
|
-
return (
|
|
63
|
-
<div
|
|
64
|
-
role="button"
|
|
65
|
-
tabIndex={0}
|
|
66
|
-
className="tui-contacts-list-item"
|
|
67
|
-
key={userID || groupID}
|
|
68
|
-
onClick={() => {
|
|
69
|
-
setActiveContact({ type, data: item });
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<Avatar src={avatar || defaultUserAvatar} />
|
|
73
|
-
<div className="tui-contacts-list-item-container">
|
|
74
|
-
<p className="tui-contacts-list-item-name">{ showName }</p>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
);
|
|
78
|
-
})}
|
|
79
|
-
</>
|
|
80
|
-
);
|
|
81
|
-
// eslint-disable-next-line
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
return (
|
|
84
|
-
isShowContactList && (
|
|
85
|
-
<div className={`tui-contacts-list ${isH5 ? 'tui-contacts-list-h5' : ''} `}>
|
|
86
|
-
<div
|
|
87
|
-
className="tui-contacts-title"
|
|
88
|
-
role="button"
|
|
89
|
-
tabIndex={0}
|
|
90
|
-
onClick={() => setShowFriendApplication(!iShowFriendApplication)}
|
|
91
|
-
>
|
|
92
|
-
<p className="tui-contacts-list-title">{t('TUIContact.New Contacts')}</p>
|
|
93
|
-
<div className="tui-contacts-list-icon">
|
|
94
|
-
{iShowFriendApplication
|
|
95
|
-
? <i className="iconfont contacts-list-icon"></i>
|
|
96
|
-
: <i className="iconfont contacts-list-icon"></i>}
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
{iShowFriendApplication
|
|
100
|
-
&& friendApplicationList?.map((item, index) => {
|
|
101
|
-
const {
|
|
102
|
-
userID, avatar, nick, wording, type,
|
|
103
|
-
} = item;
|
|
104
|
-
return (
|
|
105
|
-
<div
|
|
106
|
-
role="button"
|
|
107
|
-
tabIndex={0}
|
|
108
|
-
className="tui-contacts-list-item"
|
|
109
|
-
key={userID}
|
|
110
|
-
onClick={(e) => {
|
|
111
|
-
e.stopPropagation();
|
|
112
|
-
setActiveContact({
|
|
113
|
-
type: 'friendApplication',
|
|
114
|
-
data: item,
|
|
115
|
-
});
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
<Avatar src={avatar || defaultUserAvatar} />
|
|
119
|
-
<div className="tui-contacts-list-item-card">
|
|
120
|
-
<div>
|
|
121
|
-
<p className="tui-contacts-list-item-name text-ellipsis">
|
|
122
|
-
{nick || userID}
|
|
123
|
-
</p>
|
|
124
|
-
{wording !== '' && (
|
|
125
|
-
<p className="tui-contacts-list-item-text text-ellipsis">
|
|
126
|
-
{wording}
|
|
127
|
-
</p>
|
|
128
|
-
)}
|
|
129
|
-
</div>
|
|
130
|
-
{type === TUIChatEngine.TYPES.SNS_APPLICATION_SENT_BY_ME && (
|
|
131
|
-
<p className="tui-contacts-list-btn-text text-ellipsis">{t('TUIContact.waiting for verification')}</p>
|
|
132
|
-
)}
|
|
133
|
-
{type === TUIChatEngine.TYPES.SNS_APPLICATION_SENT_TO_ME && (
|
|
134
|
-
<div
|
|
135
|
-
className="application-btn"
|
|
136
|
-
role="button"
|
|
137
|
-
tabIndex={0}
|
|
138
|
-
onClick={(e) => {
|
|
139
|
-
acceptFriendApplicationHandle(e, userID);
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
{t('TUIContact.Agree')}
|
|
143
|
-
</div>
|
|
144
|
-
)}
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
);
|
|
148
|
-
})}
|
|
149
|
-
<RenderContactList
|
|
150
|
-
type="block"
|
|
151
|
-
title={t('TUIContact.Blocked List')}
|
|
152
|
-
isShow={isShowBlocklist}
|
|
153
|
-
setShow={setShowBlocklist}
|
|
154
|
-
list={blocklistProfile}
|
|
155
|
-
/>
|
|
156
|
-
<RenderContactList
|
|
157
|
-
type="group"
|
|
158
|
-
title={t('TUIContact.Group List')}
|
|
159
|
-
setShow={setShowGrouplist}
|
|
160
|
-
isShow={isShowGrouplist}
|
|
161
|
-
list={groupList}
|
|
162
|
-
/>
|
|
163
|
-
<RenderContactList
|
|
164
|
-
type="friend"
|
|
165
|
-
title={t('TUIContact.Friends')}
|
|
166
|
-
setShow={setShowFriends}
|
|
167
|
-
isShow={iShowFriends}
|
|
168
|
-
list={friendList}
|
|
169
|
-
/>
|
|
170
|
-
</div>
|
|
171
|
-
)
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
export const ContactList = React.memo(UnMemoizedContactList);
|