From da1ac7182894b75178ee499cfd7a331e006002b9 Mon Sep 17 00:00:00 2001 From: icy Date: Tue, 4 Nov 2025 01:54:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Fix=20ComparisonChart=20data=20display=20is?= =?UTF-8?q?sue=20The=20chart=20was=20not=20showing=20data=20because=20the?= =?UTF-8?q?=20API=20response=20format=20changed.=20Fixed=20the=20calculati?= =?UTF-8?q?on=20of=20PnL=20percentage=20by=20computing=20it=20from=20total?= =?UTF-8?q?=5Fpnl=20and=20balance=20values=20(initial=5Fbalance=20=3D=20ba?= =?UTF-8?q?lance=20-=20total=5Fpnl).=20Now=20the=20AI=20competition=20char?= =?UTF-8?q?t=20should=20properly=20display=20performance=20comparison=20da?= =?UTF-8?q?ta.=20=F0=9F=A4=96=20Generated=20with=20[Claude=20Code](https:/?= =?UTF-8?q?/claude.ai/code)=20Co-Authored-By:=20tinkle-community=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/ComparisonChart.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/components/ComparisonChart.tsx b/web/src/components/ComparisonChart.tsx index 56810e0e..600421a3 100644 --- a/web/src/components/ComparisonChart.tsx +++ b/web/src/components/ComparisonChart.tsx @@ -92,8 +92,13 @@ export function ComparisonChart({ traders }: ComparisonChartProps) { }); } + // 计算盈亏百分比:从total_pnl和balance计算 + // 假设初始余额 = balance - total_pnl + const initialBalance = point.balance - point.total_pnl; + const pnlPct = initialBalance > 0 ? (point.total_pnl / initialBalance) * 100 : 0; + timestampMap.get(ts)!.traders.set(trader.trader_id, { - pnl_pct: point.total_pnl_pct, + pnl_pct: pnlPct, equity: point.total_equity }); }); From 4c744650751913dda236f23a195661f4d7153e61 Mon Sep 17 00:00:00 2001 From: icy Date: Tue, 4 Nov 2025 02:08:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Add=20NOFX=20watermarks=20to=20charts=20and?= =?UTF-8?q?=20fix=20empty=20state=20internationalization=20-=20Add=20NOFX?= =?UTF-8?q?=20watermark=20to=20ComparisonChart=20(competition=20page)=20-?= =?UTF-8?q?=20Add=20NOFX=20watermark=20to=20EquityChart=20(dashboard=20pag?= =?UTF-8?q?e)=20-=20Fix=20empty=20state=20handling=20and=20internationaliz?= =?UTF-8?q?ation=20in=20CompetitionPage=20=F0=9F=A4=96=20Generated=20with?= =?UTF-8?q?=20[Claude=20Code](https://claude.ai/code)=20Co-Authored-By:=20?= =?UTF-8?q?tinkle-community=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/ComparisonChart.tsx | 18 ++++++++++- web/src/components/CompetitionPage.tsx | 43 +++++++++++++++++++++++++- web/src/components/EquityChart.tsx | 18 ++++++++++- 3 files changed, 76 insertions(+), 3 deletions(-) diff --git a/web/src/components/ComparisonChart.tsx b/web/src/components/ComparisonChart.tsx index 600421a3..7a933920 100644 --- a/web/src/components/ComparisonChart.tsx +++ b/web/src/components/ComparisonChart.tsx @@ -233,7 +233,23 @@ export function ComparisonChart({ traders }: ComparisonChartProps) { return (
-
+
+ {/* NOFX Watermark */} +
+ NOFX +
diff --git a/web/src/components/CompetitionPage.tsx b/web/src/components/CompetitionPage.tsx index 3168bd14..d719472e 100644 --- a/web/src/components/CompetitionPage.tsx +++ b/web/src/components/CompetitionPage.tsx @@ -41,7 +41,7 @@ export function CompetitionPage() { setSelectedTrader(null); }; - if (!competition || !competition.traders) { + if (!competition) { return (
@@ -64,6 +64,47 @@ export function CompetitionPage() { ); } + // 如果有数据返回但没有交易员,显示空状态 + if (!competition.traders || competition.traders.length === 0) { + return ( +
+ {/* Competition Header - 精简版 */} +
+
+
+ +
+
+

+ {t('aiCompetition', language)} + + 0 {t('traders', language)} + +

+

+ {t('liveBattle', language)} +

+
+
+
+ + {/* Empty State */} +
+ +

+ {t('noTraders', language)} +

+

+ {t('createFirstTrader', language)} +

+
+
+ ); + } + // 按收益率排序 const sortedTraders = [...competition.traders].sort( (a, b) => b.total_pnl_pct - a.total_pnl_pct diff --git a/web/src/components/EquityChart.tsx b/web/src/components/EquityChart.tsx index bfa89617..e7441779 100644 --- a/web/src/components/EquityChart.tsx +++ b/web/src/components/EquityChart.tsx @@ -270,7 +270,23 @@ export function EquityChart({ traderId }: EquityChartProps) {
{/* Chart */} -
+
+ {/* NOFX Watermark */} +
+ NOFX +