From 1e1a9fe4a09026dcca8a390f60537f5a2300e566 Mon Sep 17 00:00:00 2001 From: jonas Date: Tue, 10 Mar 2026 23:22:38 +0100 Subject: [PATCH] Fixed dark light colors for charts --- client/src/App.tsx | 2 +- client/src/pages/StatsPage.tsx | 57 ++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 9e91844..0d1a21e 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -56,7 +56,7 @@ export default function App() {
} /> - } /> + } /> } />
diff --git a/client/src/pages/StatsPage.tsx b/client/src/pages/StatsPage.tsx index c6e5a00..c2e9fb4 100644 --- a/client/src/pages/StatsPage.tsx +++ b/client/src/pages/StatsPage.tsx @@ -7,11 +7,21 @@ import { api } from '../api'; import type { StatsResponse } from '../types'; import { STATUS_LABELS, type ItemStatus } from '../types'; -const COLORS = ['#111827', '#6b7280', '#3b82f6', '#ef4444', '#f59e0b', '#10b981', '#8b5cf6', '#ec4899']; +const COLORS_LIGHT = ['#111827', '#6b7280', '#3b82f6', '#ef4444', '#f59e0b', '#10b981', '#8b5cf6', '#ec4899']; +const COLORS_DARK = ['#e5e7eb', '#9ca3af', '#60a5fa', '#f87171', '#fbbf24', '#34d399', '#a78bfa', '#f472b6']; -export default function StatsPage() { +export default function StatsPage({ dark }: { dark: boolean }) { const [stats, setStats] = useState(null); + const colors = dark ? COLORS_DARK : COLORS_LIGHT; + const gridColor = dark ? '#374151' : '#f3f4f6'; + const tickColor = dark ? '#9ca3af' : '#6b7280'; + const tooltipBg = dark ? '#1f2937' : '#ffffff'; + const tooltipBorder = dark ? '#374151' : '#e5e7eb'; + const barFill = dark ? '#e5e7eb' : '#111827'; + const barFillAlt = dark ? '#9ca3af' : '#6b7280'; + const areaStroke = dark ? '#e5e7eb' : '#111827'; + useEffect(() => { api.getStats().then(setStats); }, []); @@ -48,13 +58,13 @@ export default function StatsPage() { - - - - - - - + + + + + + + @@ -72,15 +82,16 @@ export default function StatsPage() { innerRadius={50} outerRadius={80} dataKey="value" - label={({ name, value }) => `${name}: ${value}`} + label={({ x, y, name, value }: { x: number; y: number; name: string; value: number }) => ( + {name}: {value} + )} labelLine={false} - style={{ fontSize: 11 }} > {statusData.map((_, i) => ( - + ))} - + @@ -91,11 +102,11 @@ export default function StatsPage() { - - `${v} kr`} /> - - [`${v.toLocaleString('sv-SE')} kr`, 'Value']} /> - + + `${v} kr`} /> + + [`${v.toLocaleString('sv-SE')} kr`, 'Value']} /> + @@ -106,11 +117,11 @@ export default function StatsPage() { - - `${v} kr`} /> - - [`${v.toLocaleString('sv-SE')} kr`, 'Value']} /> - + + `${v} kr`} /> + + [`${v.toLocaleString('sv-SE')} kr`, 'Value']} /> +