feat(dashboard): 优化资产分布图表,实现按市场维度的聚合展示与 Tooltip 交互增强

This commit is contained in:
2026-04-28 16:58:26 +08:00
parent e093b94157
commit 9342e46aad
4 changed files with 135 additions and 43 deletions
+2 -16
View File
@@ -5,17 +5,8 @@ import AllocationChart from '@/components/dashboard/allocation-chart';
import { SyncButton } from '@/components/assets/sync-button';
import Big from 'big.js';
const CHART_COLORS = [
'#3b82f6',
'#8b5cf6',
'#10b981',
'#f59e0b',
'#ef4444',
'#06b6d4',
];
export default async function DashboardPage() {
const { positions, totalCnyValue, chartData, totalPnlCny, unrealizedPnlCny } = await getPortfolioSummary();
const { positions, totalCnyValue, chartData, totalPnlCny, unrealizedPnlCny, marketAllocation } = await getPortfolioSummary();
const formattedTotal = formatAmount(totalCnyValue);
const formattedTotalPnl = formatAmount(totalPnlCny);
@@ -23,11 +14,6 @@ export default async function DashboardPage() {
const totalPnlIsPositive = new Big(totalPnlCny).gte(0);
const unrealizedIsPositive = new Big(unrealizedPnlCny).gte(0);
const displayChartData = chartData.map((item) => ({
...item,
value: Number(item.value),
}));
return (
<div className="space-y-6">
<div>
@@ -168,7 +154,7 @@ export default async function DashboardPage() {
<CardTitle></CardTitle>
</CardHeader>
<CardContent>
<AllocationChart data={displayChartData} />
<AllocationChart data={marketAllocation} />
</CardContent>
</Card>
</div>