import React, { PropsWithChildren, } from 'react'; import TencentCloudChat, { Message } from '@tencentcloud/chat'; import { MESSAGE_FLOW } from '../../constants'; import { messageShowType } from '../../context'; export interface MessageNameProps { CustomName?: React.ReactElement, className?: string, message?: Message, showType?: messageShowType, } export function MessageName ( props: PropsWithChildren, ):React.ReactElement { const { className, CustomName, message, showType, } = props; const show = (showType === messageShowType.ALL || message?.flow === showType) && message?.conversationType === TencentCloudChat.TYPES.CONV_GROUP; if (!show || showType === messageShowType.NONE) { return null; } if (CustomName) { return CustomName; } return ( ); }