From 4f7e7845b863a283ea474cb514a7b9538f9b3f13 Mon Sep 17 00:00:00 2001 From: Art Manalili Date: Mon, 8 Apr 2019 20:24:39 +0800 Subject: [PATCH] Make send confirmation fee static --- .../sendConfirmation.test.js.snap | 8 +++---- .../scenes/SendConfirmationScene.js | 23 +++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/__tests__/__snapshots__/sendConfirmation.test.js.snap b/src/__tests__/__snapshots__/sendConfirmation.test.js.snap index 9be3d0d1937..02227e28006 100644 --- a/src/__tests__/__snapshots__/sendConfirmation.test.js.snap +++ b/src/__tests__/__snapshots__/sendConfirmation.test.js.snap @@ -196,7 +196,7 @@ exports[`SendConfirmation should render with destination 1`] = ` ] } > - + Fee: + 0 (0) - + Fee: + 0 (0) - + Fee: + 0 (0) - + Fee: + 0 (0) { - {feeCalculated && ( - - {this.networkFeeSyntax()} - - )} + + {this.networkFeeSyntax()} + {!!destination && ( @@ -365,7 +363,6 @@ export class SendConfirmation extends Component { networkFeeSyntax = () => { const { networkFee, parentNetworkFee, parentDisplayDenomination, exchangeRates } = this.props - if (!networkFee && !parentNetworkFee) return '' const primaryInfo: GuiCurrencyInfo = { displayCurrencyCode: this.props.currencyCode, @@ -389,6 +386,18 @@ export class SendConfirmation extends Component { exchangeDenomination: this.state.secondaryDisplayDenomination } + if (!networkFee && !parentNetworkFee) { + const cryptoFeeSymbolParent = parentDisplayDenomination.symbol ? parentDisplayDenomination.symbol : null + const cryptoFeeSymbolPrimary = primaryInfo.displayDenomination.symbol ? primaryInfo.displayDenomination.symbol : null + const cryptoFeeSymbol = () => { + if (cryptoFeeSymbolParent) return cryptoFeeSymbolParent + if (cryptoFeeSymbolPrimary) return cryptoFeeSymbolPrimary + return '' + } + const fiatFeeSymbol = secondaryInfo.displayDenomination.symbol ? secondaryInfo.displayDenomination.symbol : '' + return sprintf(s.strings.send_confirmation_fee_line, `${cryptoFeeSymbol()} 0`, `${fiatFeeSymbol} 0`) + } + if (parentNetworkFee && bns.gt(parentNetworkFee, '0')) { const cryptoFeeSymbol = parentDisplayDenomination.symbol ? parentDisplayDenomination.symbol : '' // multiplier for display denomination @@ -441,7 +450,7 @@ export class SendConfirmation extends Component { const fiatFeeString = `${fiatFeeSymbol} ${fiatFeeAmountPretty}` return sprintf(s.strings.send_confirmation_fee_line, cryptoFeeString, fiatFeeString) } - return '' + return sprintf(s.strings.send_confirmation_fee_line, '0', '0') } }