From 4ebfacfc219f1f63c7c21fec2f741168c8f95e45 Mon Sep 17 00:00:00 2001 From: WrBug Date: Sun, 1 Mar 2026 06:48:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E4=BC=98=E5=8C=96=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=20UI=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A9=BA=E7=8A=B6=E6=80=81=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化 AccountList、BacktestList、CopyTradingList、CryptoTailStrategyList、LeaderList、TemplateList、UserList 页面操作栏 - 添加空数据状态提示 - 添加相关多语言翻译 key Made-with: Cursor --- frontend/src/locales/en/common.json | 16 +- frontend/src/locales/zh-CN/common.json | 16 +- frontend/src/locales/zh-TW/common.json | 16 +- frontend/src/pages/AccountList.tsx | 422 ++++++------ frontend/src/pages/BacktestList.tsx | 636 +++++++++++------- frontend/src/pages/CopyTradingList.tsx | 343 +++++----- frontend/src/pages/CryptoTailStrategyList.tsx | 201 +++--- frontend/src/pages/LeaderList.tsx | 23 +- frontend/src/pages/TemplateList.tsx | 343 ++++++---- frontend/src/pages/UserList.tsx | 192 +++++- 10 files changed, 1288 insertions(+), 920 deletions(-) diff --git a/frontend/src/locales/en/common.json b/frontend/src/locales/en/common.json index 2ecb7c7..fbe3f3a 100644 --- a/frontend/src/locales/en/common.json +++ b/frontend/src/locales/en/common.json @@ -42,7 +42,8 @@ "pageOf": "Page", "ascending": "Ascending", "descending": "Descending", - "day": "day" + "day": "day", + "orders": "orders" }, "account": { "title": "Account Management", @@ -176,7 +177,8 @@ "updateFailed": "Failed to update account", "getDetailFailedForEdit": "Failed to get account detail", "loading": "Loading...", - "fetchFailed": "Failed to get account list" + "fetchFailed": "Failed to get account list", + "noData": "No account data" }, "accountImport": { "title": "Import Account", @@ -660,7 +662,8 @@ "deleteSuccess": "User deleted successfully", "deleteFailed": "Failed to delete user", "deleteConfirm": "Are you sure you want to delete this user?", - "total": "Total {{total}} items" + "total": "Total {{total}} items", + "noData": "No user data" }, "statistics": { "title": "Statistics", @@ -1121,7 +1124,9 @@ "updateStatusFailed": "Failed to update copy trading status", "deleteSuccess": "Copy trading deleted successfully", "deleteFailed": "Failed to delete copy trading", - "deleteConfirm": "Are you sure you want to delete this copy trading relationship?" + "deleteConfirm": "Are you sure you want to delete this copy trading relationship?", + "profitRate": "Profit Rate", + "noData": "No copy trading configuration" }, "notificationSettings": { "title": "Notification Settings", @@ -1351,6 +1356,8 @@ "title": "Backtest", "taskName": "Task Name", "leader": "Leader", + "balance": "Balance (Init→Final)", + "profit": "Profit (Amount/Rate)", "initialBalance": "Initial Balance", "backtestDays": "Backtest Days", "status": "Status", @@ -1399,6 +1406,7 @@ "createCopyTradingSuccess": "Copy trading config created successfully", "noTasks": "No backtest tasks", "noTrades": "No trade records", + "noData": "No backtest data", "fetchTasksFailed": "Failed to fetch task list", "fetchTaskDetailFailed": "Failed to fetch task detail", "fetchTradesFailed": "Failed to fetch trade records", diff --git a/frontend/src/locales/zh-CN/common.json b/frontend/src/locales/zh-CN/common.json index 853c74c..c7f34bd 100644 --- a/frontend/src/locales/zh-CN/common.json +++ b/frontend/src/locales/zh-CN/common.json @@ -42,7 +42,8 @@ "copyFailed": "复制失败", "ascending": "升序", "descending": "降序", - "day": "天" + "day": "天", + "orders": "单" }, "login": { "title": "登录", @@ -176,7 +177,8 @@ "updateFailed": "更新账户失败", "getDetailFailedForEdit": "获取账户详情失败", "loading": "加载中...", - "fetchFailed": "获取账户列表失败" + "fetchFailed": "获取账户列表失败", + "noData": "暂无账户数据" }, "accountImport": { "title": "导入账户", @@ -660,7 +662,8 @@ "deleteSuccess": "删除用户成功", "deleteFailed": "删除用户失败", "deleteConfirm": "确定要删除这个用户吗?", - "total": "共 {{total}} 条" + "total": "共 {{total}} 条", + "noData": "暂无用户数据" }, "statistics": { "title": "统计信息", @@ -1121,7 +1124,9 @@ "updateStatusFailed": "更新跟单状态失败", "deleteSuccess": "删除跟单成功", "deleteFailed": "删除跟单失败", - "deleteConfirm": "确定要删除这个跟单关系吗?" + "deleteConfirm": "确定要删除这个跟单关系吗?", + "profitRate": "收益率", + "noData": "暂无跟单配置" }, "notificationSettings": { "title": "消息推送设置", @@ -1351,6 +1356,8 @@ "title": "回测", "taskName": "任务名称", "leader": "Leader", + "balance": "资金 (初始→最终)", + "profit": "收益 (金额/比例)", "initialBalance": "初始资金", "backtestDays": "回测天数", "status": "状态", @@ -1399,6 +1406,7 @@ "createCopyTradingSuccess": "跟单配置创建成功", "noTasks": "暂无回测任务", "noTrades": "暂无交易记录", + "noData": "暂无回测数据", "fetchTasksFailed": "获取任务列表失败", "fetchTaskDetailFailed": "获取任务详情失败", "fetchTradesFailed": "获取交易记录失败", diff --git a/frontend/src/locales/zh-TW/common.json b/frontend/src/locales/zh-TW/common.json index e4ea674..7b149d0 100644 --- a/frontend/src/locales/zh-TW/common.json +++ b/frontend/src/locales/zh-TW/common.json @@ -42,7 +42,8 @@ "pageOf": "第", "ascending": "升序", "descending": "降序", - "day": "天" + "day": "天", + "orders": "單" }, "account": { "title": "賬戶管理", @@ -176,7 +177,8 @@ "updateFailed": "更新賬戶失敗", "getDetailFailedForEdit": "獲取賬戶詳情失敗", "loading": "加載中...", - "fetchFailed": "獲取賬戶列表失敗" + "fetchFailed": "獲取賬戶列表失敗", + "noData": "暫無賬戶數據" }, "accountImport": { "title": "導入賬戶", @@ -660,7 +662,8 @@ "deleteSuccess": "刪除用戶成功", "deleteFailed": "刪除用戶失敗", "deleteConfirm": "確定要刪除這個用戶嗎?", - "total": "共 {{total}} 條" + "total": "共 {{total}} 條", + "noData": "暫無用戶數據" }, "statistics": { "title": "統計信息", @@ -1121,7 +1124,9 @@ "updateStatusFailed": "更新跟單狀態失敗", "deleteSuccess": "刪除跟單成功", "deleteFailed": "刪除跟單失敗", - "deleteConfirm": "確定要刪除這個跟單關係嗎?" + "deleteConfirm": "確定要刪除這個跟單關係嗎?", + "profitRate": "收益率", + "noData": "暫無跟單配置" }, "notificationSettings": { "title": "消息推送設置", @@ -1351,6 +1356,8 @@ "title": "回測", "taskName": "任務名稱", "leader": "Leader", + "balance": "資金 (初始→最終)", + "profit": "收益 (金額/比例)", "initialBalance": "初始資金", "backtestDays": "回測天數", "status": "狀態", @@ -1399,6 +1406,7 @@ "createCopyTradingSuccess": "跟單配置創建成功", "noTasks": "暫無回測任務", "noTrades": "暫無交易記錄", + "noData": "暫無回測數據", "fetchTasksFailed": "獲取任務列表失敗", "fetchTaskDetailFailed": "獲取任務詳情失敗", "fetchTradesFailed": "獲取交易記錄失敗", diff --git a/frontend/src/pages/AccountList.tsx b/frontend/src/pages/AccountList.tsx index 0ed3693..e9b5f7f 100644 --- a/frontend/src/pages/AccountList.tsx +++ b/frontend/src/pages/AccountList.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' -import { Card, Table, Button, Space, Tag, Popconfirm, message, Typography, Spin, Modal, Descriptions, Divider, Form, Input, Alert } from 'antd' -import { PlusOutlined, ReloadOutlined, EditOutlined, CopyOutlined } from '@ant-design/icons' +import { Card, Table, Button, Space, Tag, Popconfirm, message, Typography, Spin, Modal, Descriptions, Divider, Form, Input, Alert, Tooltip, List, Empty } from 'antd' +import { PlusOutlined, ReloadOutlined, EditOutlined, CopyOutlined, EyeOutlined, DeleteOutlined, WalletOutlined } from '@ant-design/icons' import { useTranslation } from 'react-i18next' import { useAccountStore } from '../store/accountStore' import type { Account } from '../types' @@ -331,171 +331,79 @@ const AccountList: React.FC = () => { { title: t('accountList.action'), key: 'action', + width: 140, render: (_: any, record: Account) => ( - - - - handleDelete(record)} - okText={t('accountList.deleteConfirmOk')} - cancelText={t('common.cancel')} - okButtonProps={{ danger: true }} - > - - - - ) - } - ] - - const mobileColumns = [ - { - title: t('accountList.accountName'), - key: 'info', - render: (_: any, record: Account) => { - return ( -
-
- {record.accountName || `${t('accountList.accountName')} ${record.id}`} -
-
-
- {t('accountList.walletAddress')}: {record.walletAddress ? `${record.walletAddress.slice(0, 6)}...${record.walletAddress.slice(-4)}` : '-'} -
-
- {t('accountList.proxyAddress')}: {record.proxyAddress ? `${record.proxyAddress.slice(0, 6)}...${record.proxyAddress.slice(-4)}` : '-'} -
- {record.walletType && ( -
- {t('accountList.walletType')}:{' '} - - {record.walletType.toLowerCase() === 'magic' ? 'Magic' : 'Safe'} - -
- )} -
-
- {t('accountList.totalBalance')}: {balanceLoading[record.id] ? ( - - ) : balanceMap[record.id]?.total && balanceMap[record.id].total !== '-' ? ( - `${formatUSDC(balanceMap[record.id].total)} USDC` - ) : ( - '-' - )} -
- {balanceMap[record.id] && balanceMap[record.id].available !== '-' && ( -
- {t('accountList.available')}: {formatUSDC(balanceMap[record.id].available)} USDC | {t('accountList.position')}: {formatUSDC(balanceMap[record.id].position)} USDC -
- )} -
- ) - } - }, - { - title: t('accountList.action'), - key: 'action', - width: 100, - render: (_: any, record: Account) => ( - - - - handleDelete(record)} - okText={t('accountList.deleteConfirmOk')} - cancelText={t('common.cancel')} - okButtonProps={{ danger: true }} - > - + + + + + +
handleShowEdit(record)} + style={{ + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + width: '32px', + height: '32px', + cursor: 'pointer', + borderRadius: '6px', + transition: 'background-color 0.2s' + }} + onMouseEnter={(e) => e.currentTarget.style.backgroundColor = '#f0f0f0'} + onMouseLeave={(e) => e.currentTarget.style.backgroundColor = 'transparent'} + > + +
+
+ + handleDelete(record)} + okText={t('accountList.deleteConfirmOk')} + cancelText={t('common.cancel')} + okButtonProps={{ danger: true }} + > + +
e.currentTarget.style.backgroundColor = '#fff1f0'} + onMouseLeave={(e) => e.currentTarget.style.backgroundColor = 'transparent'} + > + +
+
) @@ -519,16 +427,15 @@ const AccountList: React.FC = () => { {t('accountList.title')} - + +