refactor(notification): 优化模板配置布局并完善多语言支持

- 布局优化:模板类型改为顶部Tabs,内容区70%+变量面板30%
- 变量Tag UI优化:更精致的样式和悬浮效果
- 多语言:添加模板类型描述、变量label/description的i18n key(三语言)
- 后端精简:移除DTO中冗余的label/description/templateTypeName字段
- 清理:移除未使用的templates状态和fetchTemplates方法

Made-with: Cursor
This commit is contained in:
WrBug
2026-03-02 22:02:00 +08:00
parent e7af4d4821
commit 8f0a49493c
7 changed files with 284 additions and 162 deletions
+54 -1
View File
@@ -1193,7 +1193,52 @@
"redeemVariables": "Redeem Variables",
"errorVariables": "Error Variables",
"filterVariables": "Filter Variables",
"strategyVariables": "Strategy Variables"
"strategyVariables": "Strategy Variables",
"contentPlaceholder": "Enter template content here, use {{variable}} to insert dynamic content",
"variableLabels": {
"account_name": "Account Name",
"wallet_address": "Wallet Address",
"time": "Time",
"order_id": "Order ID",
"market_title": "Market Title",
"market_link": "Market Link",
"side": "Side",
"outcome": "Outcome",
"price": "Price",
"quantity": "Quantity",
"amount": "Amount",
"available_balance": "Available Balance",
"leader_name": "Leader Name",
"config_name": "Copy Trading Config Name",
"error_message": "Error Message",
"filter_type": "Filter Type",
"filter_reason": "Filter Reason",
"strategy_name": "Strategy Name",
"transaction_hash": "Transaction Hash",
"total_value": "Total Redeem Value"
},
"variableDescriptions": {
"account_name": "Account name executing the order",
"wallet_address": "Wallet address (masked)",
"time": "Notification send time",
"order_id": "Unique order identifier",
"market_title": "Market/Event name",
"market_link": "Polymarket market link",
"side": "Order direction (Buy/Sell)",
"outcome": "Market outcome (YES/NO, etc.)",
"price": "Order price",
"quantity": "Order quantity (shares)",
"amount": "Order amount (USDC)",
"available_balance": "Account available balance (USDC)",
"leader_name": "Leader name/alias being copied",
"config_name": "Copy trading configuration name",
"error_message": "Order failure reason",
"filter_type": "Type of order filter",
"filter_reason": "Detailed reason for order filtering",
"strategy_name": "Crypto spread strategy name",
"transaction_hash": "Redeem transaction hash",
"total_value": "Total redeem value (USDC)"
}
},
"templateTypes": {
"ORDER_SUCCESS": "Order Success",
@@ -1202,6 +1247,14 @@
"CRYPTO_TAIL_SUCCESS": "Crypto Spread Strategy Success",
"REDEEM_SUCCESS": "Position Redeem Success",
"REDEEM_NO_RETURN": "Position Settled (No Return)"
},
"templateTypeDescriptions": {
"ORDER_SUCCESS": "Notification sent when order is successfully created",
"ORDER_FAILED": "Notification sent when order creation fails",
"ORDER_FILTERED": "Notification sent when order is filtered by risk control",
"CRYPTO_TAIL_SUCCESS": "Notification sent when crypto spread strategy order succeeds",
"REDEEM_SUCCESS": "Notification sent when position is successfully redeemed",
"REDEEM_NO_RETURN": "Notification sent when position is settled with no return"
}
},
"telegramConfig": {
+54 -1
View File
@@ -1193,7 +1193,52 @@
"redeemVariables": "赎回变量",
"errorVariables": "错误变量",
"filterVariables": "过滤变量",
"strategyVariables": "策略变量"
"strategyVariables": "策略变量",
"contentPlaceholder": "在此输入模板内容,使用 {{变量名}} 插入动态内容",
"variableLabels": {
"account_name": "账户名称",
"wallet_address": "钱包地址",
"time": "时间",
"order_id": "订单ID",
"market_title": "市场标题",
"market_link": "市场链接",
"side": "方向",
"outcome": "市场方向",
"price": "价格",
"quantity": "数量",
"amount": "金额",
"available_balance": "可用余额",
"leader_name": "Leader 名称",
"config_name": "跟单配置名",
"error_message": "错误信息",
"filter_type": "过滤类型",
"filter_reason": "过滤原因",
"strategy_name": "策略名称",
"transaction_hash": "交易哈希",
"total_value": "赎回总价值"
},
"variableDescriptions": {
"account_name": "执行订单的账户名称",
"wallet_address": "钱包地址(已脱敏)",
"time": "通知发送时间",
"order_id": "订单唯一标识",
"market_title": "市场/事件名称",
"market_link": "Polymarket 市场链接",
"side": "订单方向(买入/卖出)",
"outcome": "市场方向(YES/NO 等)",
"price": "订单价格",
"quantity": "订单数量(shares",
"amount": "订单金额(USDC",
"available_balance": "账户可用余额(USDC",
"leader_name": "跟单的 Leader 名称/备注",
"config_name": "跟单配置名称",
"error_message": "订单失败原因",
"filter_type": "订单被过滤的类型",
"filter_reason": "订单被过滤的详细原因",
"strategy_name": "加密价差策略名称",
"transaction_hash": "赎回交易的哈希值",
"total_value": "赎回的总价值(USDC"
}
},
"templateTypes": {
"ORDER_SUCCESS": "订单成功通知",
@@ -1202,6 +1247,14 @@
"CRYPTO_TAIL_SUCCESS": "加密价差策略成功通知",
"REDEEM_SUCCESS": "仓位赎回成功通知",
"REDEEM_NO_RETURN": "仓位结算(无收益)通知"
},
"templateTypeDescriptions": {
"ORDER_SUCCESS": "订单创建成功时发送的通知",
"ORDER_FAILED": "订单创建失败时发送的通知",
"ORDER_FILTERED": "订单被风控过滤时发送的通知",
"CRYPTO_TAIL_SUCCESS": "加密价差策略下单成功时发送的通知",
"REDEEM_SUCCESS": "仓位赎回成功时发送的通知",
"REDEEM_NO_RETURN": "仓位结算但无收益时发送的通知"
}
},
"telegramConfig": {
+54 -1
View File
@@ -1193,7 +1193,52 @@
"redeemVariables": "贖回變量",
"errorVariables": "錯誤變量",
"filterVariables": "過濾變量",
"strategyVariables": "策略變量"
"strategyVariables": "策略變量",
"contentPlaceholder": "在此輸入模板內容,使用 {{變量名}} 插入動態內容",
"variableLabels": {
"account_name": "賬戶名稱",
"wallet_address": "錢包地址",
"time": "時間",
"order_id": "訂單ID",
"market_title": "市場標題",
"market_link": "市場鏈接",
"side": "方向",
"outcome": "市場方向",
"price": "價格",
"quantity": "數量",
"amount": "金額",
"available_balance": "可用餘額",
"leader_name": "Leader 名稱",
"config_name": "跟單配置名",
"error_message": "錯誤信息",
"filter_type": "過濾類型",
"filter_reason": "過濾原因",
"strategy_name": "策略名稱",
"transaction_hash": "交易哈希",
"total_value": "贖回總價值"
},
"variableDescriptions": {
"account_name": "執行訂單的賬戶名稱",
"wallet_address": "錢包地址(已脫敏)",
"time": "通知發送時間",
"order_id": "訂單唯一標識",
"market_title": "市場/事件名稱",
"market_link": "Polymarket 市場鏈接",
"side": "訂單方向(買入/賣出)",
"outcome": "市場方向(YES/NO 等)",
"price": "訂單價格",
"quantity": "訂單數量(shares",
"amount": "訂單金額(USDC",
"available_balance": "賬戶可用餘額(USDC",
"leader_name": "跟單的 Leader 名稱/備註",
"config_name": "跟單配置名稱",
"error_message": "訂單失敗原因",
"filter_type": "訂單被過濾的類型",
"filter_reason": "訂單被過濾的詳細原因",
"strategy_name": "加密價差策略名稱",
"transaction_hash": "贖回交易的哈希值",
"total_value": "贖回的總價值(USDC"
}
},
"templateTypes": {
"ORDER_SUCCESS": "訂單成功通知",
@@ -1202,6 +1247,14 @@
"CRYPTO_TAIL_SUCCESS": "加密價差策略成功通知",
"REDEEM_SUCCESS": "倉位贖回成功通知",
"REDEEM_NO_RETURN": "倉位結算(無收益)通知"
},
"templateTypeDescriptions": {
"ORDER_SUCCESS": "訂單創建成功時發送的通知",
"ORDER_FAILED": "訂單創建失敗時發送的通知",
"ORDER_FILTERED": "訂單被風控過濾時發送的通知",
"CRYPTO_TAIL_SUCCESS": "加密價差策略下單成功時發送的通知",
"REDEEM_SUCCESS": "倉位贖回成功時發送的通知",
"REDEEM_NO_RETURN": "倉位結算但無收益時發送的通知"
}
},
"telegramConfig": {