From 3bcb84ed41f956a4b4673bdbba742f9eb722b793 Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Tue, 21 Apr 2026 06:11:19 +0000 Subject: [PATCH] fix: positions totals row aligned with DataTable columns, restore $ prefix --- frontend/src/components/DataTable.tsx | 7 +++++++ frontend/src/pages/Positions.tsx | 30 ++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/frontend/src/components/DataTable.tsx b/frontend/src/components/DataTable.tsx index 8274c48..d384ec5 100644 --- a/frontend/src/components/DataTable.tsx +++ b/frontend/src/components/DataTable.tsx @@ -17,6 +17,7 @@ interface Props { onRowClick?: (row: T) => void; filterFn?: (row: T, query: string) => boolean; emptyMessage?: string; + footerRow?: ReactNode; } export function DataTable({ @@ -27,6 +28,7 @@ export function DataTable({ onRowClick, filterFn, emptyMessage = 'No data', + footerRow, }: Props) { const [sortKey, setSortKey] = useState(null); const [sortDir, setSortDir] = useState<'asc' | 'desc'>('asc'); @@ -122,6 +124,11 @@ export function DataTable({ )) )} + {footerRow && ( + + {footerRow} + + )} diff --git a/frontend/src/pages/Positions.tsx b/frontend/src/pages/Positions.tsx index 53a314b..5d0194d 100644 --- a/frontend/src/pages/Positions.tsx +++ b/frontend/src/pages/Positions.tsx @@ -41,6 +41,18 @@ export function PositionsPage() { { quantity: 0, unrealized_pnl: 0, realized_pnl: 0, market_value: 0, cost_basis: 0 }, ); + const footer = positions.length > 0 ? ( + + Totals + {totals.quantity} + {fmtUsd(totals.cost_basis)} + {fmtUsd(totals.market_value)} + {fmtUsd(totals.unrealized_pnl)} + {fmtUsd(totals.realized_pnl)} + + + ) : undefined; + return (

Positions

@@ -48,24 +60,8 @@ export function PositionsPage() { data={positions} columns={columns} keyField="id" + footerRow={footer} /> - {positions.length > 0 && ( -
- - - - - - - - - - - -
Totals{totals.quantity}{fmtUsd(totals.cost_basis)}{fmtUsd(totals.market_value)}{fmtUsd(totals.unrealized_pnl)}{fmtUsd(totals.realized_pnl)} -
-
- )}
); }