From e114312c0c482f0090242e56fbb997581951c447 Mon Sep 17 00:00:00 2001 From: codyhhchen Date: Mon, 4 May 2026 16:34:03 +0800 Subject: [PATCH] fix(qa): ISSUE-001 localize leader pool statuses --- frontend/src/locales/en/common.json | 9 +++++++++ frontend/src/locales/zh-CN/common.json | 9 +++++++++ frontend/src/locales/zh-TW/common.json | 9 +++++++++ frontend/src/pages/LeaderPool.tsx | 19 ++++++------------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/frontend/src/locales/en/common.json b/frontend/src/locales/en/common.json index 3ecf22d..14a5ec1 100644 --- a/frontend/src/locales/en/common.json +++ b/frontend/src/locales/en/common.json @@ -566,6 +566,15 @@ "safetyHint": "Leader Pool will not auto-scale positions or auto-enable large copy trading.", "safetyDesc": "Trial configs created from the pool use conservative defaults and are disabled by default.", "fetchFailed": "Failed to fetch Leader Pool", + "statuses": { + "CANDIDATE": "Candidate", + "WATCH": "Watch", + "PAPER": "Paper", + "TRIAL": "Trial", + "ACTIVE": "Active", + "COOLDOWN": "Cooldown", + "RETIRED": "Retired" + }, "selectLeaderPlaceholder": "Select an existing Leader to add", "selectLeaderFirst": "Please select a Leader first", "addExistingLeader": "Add to Pool", diff --git a/frontend/src/locales/zh-CN/common.json b/frontend/src/locales/zh-CN/common.json index ae1846b..d9b7ba3 100644 --- a/frontend/src/locales/zh-CN/common.json +++ b/frontend/src/locales/zh-CN/common.json @@ -566,6 +566,15 @@ "safetyHint": "Leader 池不会自动加仓,也不会自动启用大额跟单。", "safetyDesc": "从池子创建试跟配置时会使用保守默认值,并默认禁用。你可以之后在跟单配置页手动启用。", "fetchFailed": "获取 Leader 池失败", + "statuses": { + "CANDIDATE": "候选", + "WATCH": "观察", + "PAPER": "模拟", + "TRIAL": "小额试跟", + "ACTIVE": "活跃", + "COOLDOWN": "冷却", + "RETIRED": "淘汰" + }, "selectLeaderPlaceholder": "选择已有 Leader 加入池子", "selectLeaderFirst": "请先选择一个 Leader", "addExistingLeader": "加入池子", diff --git a/frontend/src/locales/zh-TW/common.json b/frontend/src/locales/zh-TW/common.json index af30c0d..4f05a3b 100644 --- a/frontend/src/locales/zh-TW/common.json +++ b/frontend/src/locales/zh-TW/common.json @@ -566,6 +566,15 @@ "safetyHint": "Leader 池不會自動加倉,也不會自動啟用大額跟單。", "safetyDesc": "從池子創建試跟配置時會使用保守默認值,並默認禁用。你可以之後在跟單配置頁手動啟用。", "fetchFailed": "獲取 Leader 池失敗", + "statuses": { + "CANDIDATE": "候選", + "WATCH": "觀察", + "PAPER": "模擬", + "TRIAL": "小額試跟", + "ACTIVE": "活躍", + "COOLDOWN": "冷卻", + "RETIRED": "淘汰" + }, "selectLeaderPlaceholder": "選擇已有 Leader 加入池子", "selectLeaderFirst": "請先選擇一個 Leader", "addExistingLeader": "加入池子", diff --git a/frontend/src/pages/LeaderPool.tsx b/frontend/src/pages/LeaderPool.tsx index cf30f8e..9d7b130 100644 --- a/frontend/src/pages/LeaderPool.tsx +++ b/frontend/src/pages/LeaderPool.tsx @@ -40,16 +40,6 @@ const VISIBLE_STATUSES: Array<{ value: LeaderPoolStatus; color: string }> = [ type LeaderPoolFilterValue = LeaderPoolStatus | 'ALL' -const statusLabels: Record = { - CANDIDATE: '候选', - WATCH: '观察', - PAPER: '模拟', - TRIAL: '小额试跟', - ACTIVE: '活跃', - COOLDOWN: '冷却', - RETIRED: '淘汰' -} - const formatDate = (timestamp?: number) => { if (!timestamp) return '-' return dayjs(timestamp).format('YYYY-MM-DD HH:mm') @@ -83,6 +73,9 @@ const LeaderPool: React.FC = () => { const [planForm] = Form.useForm() const [trialForm] = Form.useForm() + const statusLabel = (status: LeaderPoolStatus) => + t(`leaderPool.statuses.${status}`, { defaultValue: status }) + const fetchPool = async (status = statusFilter) => { setLoading(true) try { @@ -285,7 +278,7 @@ const LeaderPool: React.FC = () => { width: 120, render: (status: LeaderPoolStatus) => { const meta = VISIBLE_STATUSES.find(item => item.value === status) - return {statusLabels[status] || status} + return {statusLabel(status)} } }, { @@ -431,7 +424,7 @@ const LeaderPool: React.FC = () => { onChange={(value: LeaderPoolFilterValue) => setStatusFilter(value === 'ALL' ? undefined : value)} options={[ { value: 'ALL', label: t('common.all') }, - ...VISIBLE_STATUSES.map(item => ({ value: item.value, label: statusLabels[item.value] })) + ...VISIBLE_STATUSES.map(item => ({ value: item.value, label: statusLabel(item.value) })) ]} /> { > - ({ value: item.value, label: statusLabel(item.value) }))} /> {({ getFieldValue }) => getFieldValue('status') === 'COOLDOWN' ? (