fix: replace Cell from recharts with data-level fill to avoid babel error
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
kkfluous
2026-06-09 13:50:19 +08:00
parent dccc595eda
commit 58637b800b

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend, BarChart, Bar, Cell } from 'recharts';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend, BarChart, Bar } from 'recharts';
import { StatCard } from '../ui/StatCard';
import { Users, Truck, Smartphone } from 'lucide-react';
@@ -16,12 +16,12 @@ const driverGrowth = [
];
const driverByStation = [
{ name: '嘉兴嘉锦', value: 10 },
{ name: '嘉兴嘉燃', value: 8 },
{ name: '嘉燃经开', value: 5 },
{ name: '如皋华神', value: 3 },
{ name: '桐乡绿能', value: 2 },
{ name: '花桥/嘉善等', value: 2 },
{ name: '嘉兴嘉锦', value: 10, fill: '#f59e0b' },
{ name: '嘉兴嘉燃', value: 8, fill: '#94a3b8' },
{ name: '嘉燃经开', value: 5, fill: '#94a3b8' },
{ name: '如皋华神', value: 3, fill: '#94a3b8' },
{ name: '桐乡绿能', value: 2, fill: '#94a3b8' },
{ name: '花桥/嘉善等', value: 2, fill: '#94a3b8' },
];
export function UsersView() {
@@ -87,11 +87,7 @@ export function UsersView() {
<XAxis type="number" hide />
<YAxis dataKey="name" type="category" axisLine={false} tickLine={false} tick={{fill: '#475569', fontSize: 12, fontWeight: 500}} width={80} />
<Tooltip cursor={{fill: '#f8fafc'}} contentStyle={{ borderRadius: '12px', border: '1px solid #e2e8f0' }}/>
<Bar dataKey="value" radius={[0, 6, 6, 0]} barSize={28}>
{driverByStation.map((entry, index) => (
<Cell key={`cell-${index}`} fill={index === 0 ? '#f59e0b' : '#94a3b8'} />
))}
</Bar>
<Bar dataKey="value" radius={[0, 6, 6, 0]} barSize={28} />
</BarChart>
</ResponsiveContainer>
</div>