feat: 完善 Telegram 推送通知功能
- 推送模板优化: - 优先使用账户名称而不是钱包地址 - 使用市场标题而不是16进制ID - 添加可点击的市场链接(支持 slug 和 conditionId) - 添加市场方向(outcome)显示 - 数量和价格从订单详情API获取实际值 - 失败通知只显示后端返回的msg,不显示完整堆栈 - 多语言支持: - 后端推送消息支持多语言(使用前端最后请求的语言) - 添加所有 ErrorCode 的多语言资源文件(中文简体、繁体、英文) - 通知消息文本全部使用多语言资源 - 功能改进: - 从订单详情获取实际的 side、price、size、outcome - 支持买入/卖出方向的多语言显示 - 错误信息优化,只显示后端返回的错误消息
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { Form, Input, Alert } from 'antd'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
interface DiscordConfigFormProps {
|
||||
form: any
|
||||
}
|
||||
|
||||
/**
|
||||
* Discord 配置表单组件
|
||||
*/
|
||||
const DiscordConfigForm: React.FC<DiscordConfigFormProps> = ({ form }) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<>
|
||||
<Alert
|
||||
message={t('discordConfig.title')}
|
||||
description={
|
||||
<div style={{ fontSize: '13px', lineHeight: '1.8' }}>
|
||||
<p style={{ margin: '4px 0' }}>{t('discordConfig.step1')}</p>
|
||||
<p style={{ margin: '4px 0' }}>{t('discordConfig.step2')}</p>
|
||||
<p style={{ margin: '4px 0' }}>{t('discordConfig.step3')}</p>
|
||||
</div>
|
||||
}
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ fontSize: '12px', marginBottom: 16 }}
|
||||
/>
|
||||
|
||||
<Form.Item
|
||||
label={t('notificationSettings.chatIds')}
|
||||
required
|
||||
>
|
||||
<Form.Item
|
||||
name={['config', 'webhookUrl']}
|
||||
rules={[{ required: true, message: t('discordConfig.webhookUrlRequired') }]}
|
||||
>
|
||||
<Input
|
||||
placeholder={t('discordConfig.webhookUrlPlaceholder')}
|
||||
addonBefore={t('discordConfig.webhookUrl')}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default DiscordConfigForm
|
||||
|
||||
Reference in New Issue
Block a user