@tencentcloud/chat-uikit-react 3.0.2 → 3.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencentcloud/chat-uikit-react",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "exports": {
@@ -43,7 +43,7 @@
43
43
  "@tencentcloud/chat": "^3.5.2",
44
44
  "@tencentcloud/chat-uikit-engine": "~2.5.1",
45
45
  "@tencentcloud/tui-core": "latest",
46
- "@tencentcloud/uikit-base-component-react": "0.1.0",
46
+ "@tencentcloud/uikit-base-component-react": "0.3.7",
47
47
  "tuikit-atomicx-react": "0.1.2",
48
48
  "@tencentcloud/universal-api": "^2.4.0",
49
49
  "@tiptap/extension-image": "2.0.0-beta.220",
@@ -3,11 +3,11 @@ import { CallMediaType } from '@tencentcloud/call-uikit-react';
3
3
  import TUIChatEngine from '@tencentcloud/chat-uikit-engine';
4
4
  import TUICore, { TUIConstants } from '@tencentcloud/tui-core';
5
5
  import { useUIKit, IconSearch, IconVideoDefault, IconCall1, IconHorizontalMoreTwo } from '@tencentcloud/uikit-base-component-react';
6
- import { useUIOpenControlState, View, useConversationListState, startCall } from 'tuikit-atomicx-react';
7
6
  import cs from 'classnames';
7
+ import { useUIOpenControlState, View, useConversationListState, startCall } from 'tuikit-atomicx-react';
8
8
  import classes from './ChatHeaderActions.module.scss';
9
9
 
10
- interface IChatHeaderActionsProps {
10
+ interface ChatHeaderActionsProps {
11
11
  /** Whether to enable call features */
12
12
  chatHeaderActions?: Array<'videoCall' | 'audioCall' | 'chatSetting' | 'search'> | undefined;
13
13
  /** Additional class names */
@@ -16,7 +16,7 @@ interface IChatHeaderActionsProps {
16
16
  style?: React.CSSProperties | undefined;
17
17
  }
18
18
 
19
- const ChatHeaderActions = (props: IChatHeaderActionsProps) => {
19
+ const ChatHeaderActions = (props: ChatHeaderActionsProps) => {
20
20
  const {
21
21
  chatHeaderActions = ['videoCall', 'audioCall', 'search', 'chatSetting'],
22
22
  className,
@@ -102,4 +102,4 @@ const ChatHeaderActions = (props: IChatHeaderActionsProps) => {
102
102
  );
103
103
  };
104
104
  export { ChatHeaderActions };
105
- export type { IChatHeaderActionsProps };
105
+ export type { ChatHeaderActionsProps };
@@ -1,14 +1,14 @@
1
1
  import type React from 'react';
2
2
  import { useUIKit, IconChevronLeft } from '@tencentcloud/uikit-base-component-react';
3
- import { useConversationListState, View, Avatar as DefaultAvatar, useUIOpenControlState } from 'tuikit-atomicx-react';
4
3
  import cs from 'classnames';
4
+ import { useConversationListState, View, Avatar as DefaultAvatar, useUIOpenControlState } from 'tuikit-atomicx-react';
5
5
  import { ChatHeaderActions } from '../ChatHeaderActions';
6
6
  import classes from './ChatHeaderUI.module.scss';
7
7
  import type { IUserStatus } from '../../../types/user';
8
8
  import type { IConversationModel } from '@tencentcloud/chat-uikit-engine';
9
9
  import type { AvatarProps } from 'tuikit-atomicx-react';
10
10
 
11
- interface IChatHeaderUIProps {
11
+ interface ChatHeaderUIProps {
12
12
  /** Custom title, if not provided, will use conversation info */
13
13
  title: string;
14
14
  /** Whether it's a group conversation */
@@ -42,7 +42,7 @@ const UserStatus = {
42
42
  Offline: 'Offline',
43
43
  };
44
44
 
45
- const ChatHeaderUI = (props: IChatHeaderUIProps) => {
45
+ const ChatHeaderUI = (props: ChatHeaderUIProps) => {
46
46
  const {
47
47
  title,
48
48
  avatar,
@@ -95,10 +95,10 @@ const ChatHeaderUI = (props: IChatHeaderUIProps) => {
95
95
  {
96
96
  Avatar
97
97
  ? (
98
- <Avatar src={avatar || ''} />
98
+ <Avatar src={avatar || ''} alt={title} />
99
99
  )
100
100
  : (
101
- <DefaultAvatar src={avatar || ''} />
101
+ <DefaultAvatar src={avatar || ''} alt={title} isShowOnlineStatus={!isGroup && enableUserStatus} isOnline={userStatus?.statusType === 1} />
102
102
  )
103
103
  }
104
104
  <View className={classes['chat-header__info']}>
@@ -59,25 +59,24 @@ function useChatHeaderState(): UseChatHeaderStoreReturn {
59
59
 
60
60
  const avatar = useMemo<string>(() => {
61
61
  if (!activeConversation) {
62
- return undefined;
62
+ return '';
63
63
  }
64
64
 
65
65
  if (isSystemConversation) {
66
- return undefined;
66
+ return '';
67
67
  }
68
68
 
69
69
  const {
70
70
  type,
71
71
  userProfile,
72
- groupProfile,
73
72
  } = activeConversation;
74
73
 
75
74
  if (type === TUIChatEngine.TYPES.CONV_C2C) {
76
- return userProfile?.avatar || defaultUserAvatar;
75
+ return userProfile?.avatar;
77
76
  }
78
77
 
79
78
  if (type === TUIChatEngine.TYPES.CONV_GROUP) {
80
- return groupProfile?.avatar || DEFAULT_GROUP_COMMON_AVATAR;
79
+ return activeConversation.getAvatar();
81
80
  }
82
81
 
83
82
  return '';