From a5133b2d800448864d59f9c27e62d96e595fbd94 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 5 Mar 2023 17:27:09 +0800 Subject: [PATCH] feat: add toast for message item action --- client/shared/i18n/langs/en-US/translation.json | 3 +++ client/shared/i18n/langs/zh-CN/translation.json | 3 +++ .../ChatBox/ChatMessageList/useChatMessageItemAction.tsx | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/client/shared/i18n/langs/en-US/translation.json b/client/shared/i18n/langs/en-US/translation.json index 2f637897..909ecd04 100644 --- a/client/shared/i18n/langs/en-US/translation.json +++ b/client/shared/i18n/langs/en-US/translation.json @@ -163,6 +163,7 @@ "k78e52ed0": "Accept", "k7a89720": "Open in new window", "k7c232f9e": "Panel", + "k7cf4e7ff": "Message deleted successfully", "k7daa1233": "Are you sure you want to mute {{name}}", "k7daefc98": "Invite you to join the group", "k7ec9199a": "Friend request waiting for process", @@ -179,6 +180,7 @@ "k872b58dd": "Send OTP code to email", "k87a609ad": "Please do not install plugins from unknown sources, it may steal your personal information in Tailchat", "k87dd7754": "Mention (@) your message will appear here", + "k887e1f4b": "Copy plain text succeeded", "k89df1d1e": "The network is abnormal", "k8abdba5c": "Has been sent", "k8acbe00": "Current service available", @@ -320,6 +322,7 @@ "ke2431c67": "Plugin render function does not exist", "ke3d797fd": "Drop files to send into current converse", "ke59ffe49": "Muted, there are {{remain}} left", + "ke6da074f": "The message was withdrawn successfully", "kea977d95": "The following users are offline", "kec46a57f": "Add members", "kecb51e2c": "Old password", diff --git a/client/shared/i18n/langs/zh-CN/translation.json b/client/shared/i18n/langs/zh-CN/translation.json index a979557c..013944c6 100644 --- a/client/shared/i18n/langs/zh-CN/translation.json +++ b/client/shared/i18n/langs/zh-CN/translation.json @@ -163,6 +163,7 @@ "k78e52ed0": "接受", "k7a89720": "在新窗口打开", "k7c232f9e": "面板", + "k7cf4e7ff": "消息删除成功", "k7daa1233": "确定要禁言 {{name}} 么", "k7daefc98": "邀请您加入群组", "k7ec9199a": "等待对方处理的好友请求", @@ -179,6 +180,7 @@ "k872b58dd": "向邮箱发送校验码", "k87a609ad": "请不要安装不明来源的插件,这可能会盗取你在 Tailchat 的个人信息", "k87dd7754": "提及(@)您的消息会在这里出现哦", + "k887e1f4b": "复制纯文本成功", "k89df1d1e": "网络出现异常", "k8abdba5c": "已发送", "k8acbe00": "当前服务可用", @@ -320,6 +322,7 @@ "ke2431c67": "插件渲染函数不存在", "ke3d797fd": "拖放文件以发送到当前会话", "ke59ffe49": "禁言中, 还剩 {{remain}}", + "ke6da074f": "消息撤回成功", "kea977d95": "以下用户已离线", "kec46a57f": "添加成员", "kecb51e2c": "旧密码", diff --git a/client/web/src/components/ChatBox/ChatMessageList/useChatMessageItemAction.tsx b/client/web/src/components/ChatBox/ChatMessageList/useChatMessageItemAction.tsx index 224e0260..64accc17 100644 --- a/client/web/src/components/ChatBox/ChatMessageList/useChatMessageItemAction.tsx +++ b/client/web/src/components/ChatBox/ChatMessageList/useChatMessageItemAction.tsx @@ -7,6 +7,7 @@ import { PERMISSION, recallMessage, sharedEvent, + showSuccessToasts, t, useAsyncRequest, useChatBoxContext, @@ -36,17 +37,20 @@ export function useChatMessageItemAction( const handleCopy = useCallback(() => { copy(getMessageTextDecorators().serialize(payload.content)); + showSuccessToasts(t('复制纯文本成功')); }, [payload.content]); const [, handleRecallMessage] = useAsyncRequest(async () => { if (await openReconfirmModalP()) { await recallMessage(payload._id); + showSuccessToasts(t('消息撤回成功')); } }, [payload._id]); const [, handleDeleteMessage] = useAsyncRequest(async () => { if (await openReconfirmModalP()) { await deleteMessage(payload._id); + showSuccessToasts(t('消息删除成功')); } }, [payload._id]);