From aec6becceb01ddaa4d35f79e920f6d143650ca7b Mon Sep 17 00:00:00 2001 From: sealer3 <125761775+sealer3@users.noreply.github.com> Date: Fri, 26 Apr 2024 01:35:11 +0100 Subject: [PATCH] Use neutral preset and explicit plus in diffs --- src/components/FiatValue.tsx | 7 ++++++- src/execution/transaction/StateDiff.tsx | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/FiatValue.tsx b/src/components/FiatValue.tsx index 836257fcb..55154f11e 100644 --- a/src/components/FiatValue.tsx +++ b/src/components/FiatValue.tsx @@ -9,6 +9,7 @@ export type FiatBoxProps = { borderColor?: string; bgColor?: string; fgColor?: string; + explicitPlus?: boolean; }; export const feePreset = { @@ -69,13 +70,17 @@ const FiatValue: FC = ({ borderColor, bgColor, fgColor, + explicitPlus = false, }) => ( - {value.isNegative() ? - : null}$ + {(explicitPlus || value.isNegative()) && !value.isZero() ? ( + {value.isNegative() ? "-" : "+"} + ) : null} + $ {formatFiatValue( value.isNegative() ? value.mul(FixedNumber.fromValue(-1n)) : value, diff --git a/src/execution/transaction/StateDiff.tsx b/src/execution/transaction/StateDiff.tsx index 74e9de61e..8f1fa747d 100644 --- a/src/execution/transaction/StateDiff.tsx +++ b/src/execution/transaction/StateDiff.tsx @@ -3,7 +3,7 @@ import React, { useContext } from "react"; import ContentFrame from "../../components/ContentFrame"; import DisplayInteger from "../../components/DisplayInteger"; import ElementDiff from "../../components/ElementDiff"; -import { balancePreset } from "../../components/FiatValue"; +import { neutralPreset } from "../../components/FiatValue"; import HexValue from "../../components/HexValue"; import NativeTokenAmountAndFiat from "../../components/NativeTokenAmountAndFiat"; import { TransactionData } from "../../types"; @@ -131,7 +131,8 @@ const buildStateDiffTree = ( {balanceDiff >= 0n ? "+" : ""} ); @@ -139,7 +140,7 @@ const buildStateDiffTree = ( formatter = (value: string) => ( ); break;