feat(ui): 升級資產卡片展示,支持累計分紅顯示並修復數據格式化兜底

This commit is contained in:
2026-04-28 19:00:20 +08:00
parent 03e8e98260
commit 84d889fbe5
2 changed files with 14 additions and 2 deletions
+8 -1
View File
@@ -67,11 +67,12 @@ export default async function DashboardPage() {
const posPnl = new Big(pos.pnlCny);
const posPnlPositive = posPnl.gte(0);
const formattedPosPnl = formatAmount(pos.pnlCny);
const formattedDividends = formatAmount(pos.accumulatedDividendsCny);
const posPnlNative = new Big(pos.pnlNative);
const posPnlNativePositive = posPnlNative.gte(0);
const avgCostFormatted = !new Big(pos.avgCost).eq(0) && pos.avgCost !== '0' ? formatAmount(pos.avgCost) : '-';
const avgCostFormatted = !new Big(pos.avgCost).eq('0') ? formatAmount(pos.avgCost) : '-';
const dilutedCostFormatted = !new Big(pos.dilutedCost).eq(0) && pos.dilutedCost !== '0' ? formatAmount(pos.dilutedCost) : '-';
return (
@@ -141,6 +142,12 @@ export default async function DashboardPage() {
{posPnlPositive ? '+' : ''}{formattedPosPnl}
</span>
</div>
<div className="flex justify-between opacity-50">
<span className="text-muted-foreground"></span>
<span className="font-medium">
{formattedDividends}
</span>
</div>
</div>
</CardContent>
</Card>