From 7c2f464f2c37da5951d297f77982e1e73942cb94 Mon Sep 17 00:00:00 2001 From: kennethcheng Date: Wed, 29 Apr 2026 01:40:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E4=BF=AE=E5=A4=8D=E7=8E=B0=E4=BB=B7?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=98=A0=E5=B0=84=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=B4=9F=E6=94=B6=E7=9B=8A=E7=BB=BF=E8=89=B2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=A2=E5=A4=B1=E8=B4=9F=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/dashboard/page.tsx | 2 +- src/actions/portfolio.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index a888e27..4c4453a 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -57,7 +57,7 @@ function formatPnl(value: string, percent: string, baseCurrency: string): { text const symbol = getCurrencySymbol(baseCurrency); const absValue = new Big(value).abs().toFixed(2); const absPercent = new Big(percent).abs().toFixed(2); - const text = `${symbol}${absValue} (${absPercent}%)`; + const text = `${symbol}${isPositive ? '' : '-'}${absValue} (${isPositive ? '' : '-'}${absPercent}%)`; const className = isPositive ? 'text-red-500' : 'text-green-500'; return { text, className }; } diff --git a/src/actions/portfolio.ts b/src/actions/portfolio.ts index a8337e5..118a5e2 100644 --- a/src/actions/portfolio.ts +++ b/src/actions/portfolio.ts @@ -37,6 +37,7 @@ interface Position { floatingPnlPercent: string; cumulativePnlNative: string; cumulativePnlPercent: string; + latestPrice: string; transactions: TransactionRecord[]; } @@ -399,6 +400,7 @@ export async function getPortfolioPositions(): Promise { floatingPnlPercent: floatingPnlPercent.toString(), cumulativePnlNative: cumulativePnlNative.toString(), cumulativePnlPercent: cumulativePnlPercent.toString(), + latestPrice: holding.latestPrice, transactions: holding.transactions, }); }