feat: conditionally render resend button in MessageMenubar
- Updated MessageMenubar to display the resend button only for user messages, enhancing user experience and preventing unnecessary actions for other roles. - Refactored the children prop of TextEditPopup to include conditional rendering logic based on message role.
This commit is contained in:
parent
00d91ecf01
commit
4d201059ad
@ -100,16 +100,17 @@ const MessageMenubar: FC<Props> = (props) => {
|
|||||||
|
|
||||||
const editedText = await TextEditPopup.show({
|
const editedText = await TextEditPopup.show({
|
||||||
text: message.content,
|
text: message.content,
|
||||||
children: (props) => (
|
children: (props) =>
|
||||||
<ReSendButton
|
message.role === 'user' ? (
|
||||||
icon={<i className="iconfont icon-ic_send" style={{ color: 'var(--color-primary)' }} />}
|
<ReSendButton
|
||||||
onClick={() => {
|
icon={<i className="iconfont icon-ic_send" style={{ color: 'var(--color-primary)' }} />}
|
||||||
props.onOk?.()
|
onClick={() => {
|
||||||
resendMessage = true
|
props.onOk?.()
|
||||||
}}>
|
resendMessage = true
|
||||||
{t('chat.resend')}
|
}}>
|
||||||
</ReSendButton>
|
{t('chat.resend')}
|
||||||
)
|
</ReSendButton>
|
||||||
|
) : null
|
||||||
})
|
})
|
||||||
|
|
||||||
editedText && onEditMessage?.({ ...message, content: editedText })
|
editedText && onEditMessage?.({ ...message, content: editedText })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user