From 6793cbf8f52b1ac72469694898a0dbcb42422480 Mon Sep 17 00:00:00 2001 From: Egor Date: Fri, 16 Jan 2026 01:49:16 +0300 Subject: [PATCH] Update Balance.tsx --- src/pages/Balance.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pages/Balance.tsx b/src/pages/Balance.tsx index b35594f..3d48dab 100644 --- a/src/pages/Balance.tsx +++ b/src/pages/Balance.tsx @@ -212,7 +212,13 @@ export default function Balance() { ) : transactions?.items && transactions.items.length > 0 ? (
- {transactions.items.map((tx) => ( + {transactions.items.map((tx) => { + // Determine if this is a debit (negative) or credit (positive) transaction + const isDebit = normalizeType(tx.type) === 'SUBSCRIPTION_PAYMENT' || normalizeType(tx.type) === 'WITHDRAWAL' + const sign = isDebit ? '-' : '+' + const colorClass = isDebit ? 'text-error-400' : 'text-success-400' + + return (
{tx.description}
)}
-
0 ? 'text-success-400' : 'text-error-400'}`}> - {tx.amount_kopeks > 0 ? '+' : ''}{formatAmount(tx.amount_rubles)} {currencySymbol} +
+ {sign}{formatAmount(tx.amount_rubles)} {currencySymbol}
- ))} + ) + })} ) : (