From 344171b5a4aad7282c1111702885a36cd58d9e80 Mon Sep 17 00:00:00 2001 From: Niceguy Date: Tue, 29 Sep 2026 03:16:07 +0000 Subject: [PATCH] Return empty score history without snapshots --- server/server.ts | 11 ----------- src/components/ScoreTrendChart.tsx | 12 +++++++++--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/server/server.ts b/server/server.ts index 71a5b31..5fd78f0 100644 --- a/server/server.ts +++ b/server/server.ts @@ -129,17 +129,6 @@ app.get('/api/history/:account', (req, res) => { try { const { account } = req.params; const snapshots = db.prepare('SELECT score, timestamp FROM score_snapshots WHERE account_id = ? ORDER BY timestamp ASC').all(account); - - if (snapshots.length === 0) { - // Fallback timeline for demonstration - const now = Date.now(); - const mockSnapshots = Array.from({ length: 15 }, (_, i) => ({ - score: Math.min(100, Math.max(20, Math.round(50 + Math.sin(i / 2) * 15 + i))), - timestamp: new Date(now - (15 - i) * 86400000).toISOString(), - })); - return res.json({ account, snapshots: mockSnapshots }); - } - res.json({ account, snapshots }); } catch (err: any) { res.status(500).json({ error: err.message }); diff --git a/src/components/ScoreTrendChart.tsx b/src/components/ScoreTrendChart.tsx index 1880db2..61aed68 100644 --- a/src/components/ScoreTrendChart.tsx +++ b/src/components/ScoreTrendChart.tsx @@ -76,8 +76,13 @@ export const ScoreTrendChart: React.FC = ({ {/* Recharts Curve */} -
- +
+ {filteredData.length === 0 ? ( +

+ No score history available for this account. +

+ ) : ( + @@ -132,7 +137,8 @@ export const ScoreTrendChart: React.FC = ({ fill="url(#scoreGradient)" /> - + + )}
{/* Footer Info */}