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:
kangfenmao 2025-01-22 12:26:40 +08:00
parent 00d91ecf01
commit 4d201059ad

View File

@ -100,7 +100,8 @@ const MessageMenubar: FC<Props> = (props) => {
const editedText = await TextEditPopup.show({
text: message.content,
children: (props) => (
children: (props) =>
message.role === 'user' ? (
<ReSendButton
icon={<i className="iconfont icon-ic_send" style={{ color: 'var(--color-primary)' }} />}
onClick={() => {
@ -109,7 +110,7 @@ const MessageMenubar: FC<Props> = (props) => {
}}>
{t('chat.resend')}
</ReSendButton>
)
) : null
})
editedText && onEditMessage?.({ ...message, content: editedText })