From a28659dc71d222c26d9d42548325c7d3db8b3d64 Mon Sep 17 00:00:00 2001 From: eliabejr Date: Mon, 21 Jan 2019 16:23:55 -0300 Subject: [PATCH 1/4] fix(send-amount-value-issue): remove 0 initialState value --- app/views/send.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/send.js b/app/views/send.js index 96edeae..a63962f 100644 --- a/app/views/send.js +++ b/app/views/send.js @@ -105,7 +105,7 @@ type State = { const initialState = { showFee: false, from: '', - amount: '0', + amount: '', to: '', feeType: FEES.LOW, fee: FEES.LOW, @@ -232,10 +232,12 @@ export class SendView extends PureComponent { Date: Tue, 22 Jan 2019 15:24:44 -0300 Subject: [PATCH 2/4] fix(send-amount-value-issue): remove leading zero --- app/views/send.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/views/send.js b/app/views/send.js index a63962f..0d9c0c6 100644 --- a/app/views/send.js +++ b/app/views/send.js @@ -121,15 +121,7 @@ export class SendView extends PureComponent { } handleChange = (field: string) => (value: string) => { - if (field === 'amount') { - if (value !== '') { - this.setState(() => ({ - [field]: value, - })); - } - } else { - this.setState(() => ({ [field]: value })); - } + this.setState(() => ({ [field]: value })); }; handleChangeFeeType = (value: string) => { From 50120928f9d34054079c611bbe5c462a79877557 Mon Sep 17 00:00:00 2001 From: eliabejr Date: Tue, 22 Jan 2019 16:07:59 -0300 Subject: [PATCH 3/4] fix(send-amount-value-issue): put zeros on amount suffix --- app/views/send.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/send.js b/app/views/send.js index 0d9c0c6..4686087 100644 --- a/app/views/send.js +++ b/app/views/send.js @@ -186,13 +186,15 @@ export class SendView extends PureComponent { feeType, } = this.state; + const fixedAmount = amount === '' ? '0.00' : amount; + const zecBalance = formatNumber({ value: balance, append: 'ZEC ' }); const zecBalanceInUsd = formatNumber({ value: new BigNumber(balance).times(zecPrice).toNumber(), append: 'USD $', }); const valueSent = formatNumber({ - value: new BigNumber(amount).toNumber(), + value: new BigNumber(fixedAmount).toFormat(2), append: 'ZEC ', }); const valueSentInUsd = formatNumber({ From 2427e2a53cbbf80225a7421193ba78ec5e1c5423 Mon Sep 17 00:00:00 2001 From: eliabejr Date: Tue, 22 Jan 2019 17:08:41 -0300 Subject: [PATCH 4/4] feat(send-amount-value-issue): add ZEC preffix on amount field --- app/views/send.js | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/app/views/send.js b/app/views/send.js index 4686087..90b1973 100644 --- a/app/views/send.js +++ b/app/views/send.js @@ -29,6 +29,25 @@ const SendWrapper = styled(ColumnComponent)` width: 25%; `; +const AmountWrapper = styled.div` + width: 100%; + &:before { + content: 'ZEC'; + font-family: ${props => props.theme.fontFamily}; + position: absolute; + margin-top: 15px; + margin-left: 15px; + display: block; + transition: all 0.05s ease-in-out; + opacity: ${props => (props.isEmpty ? '0' : '1')}; + color: #fff; + } +`; + +const AmountInput = styled(InputComponent)` + padding-left: ${props => (props.isEmpty ? '15' : '50')}px; +`; + const ShowFeeButton = styled.button` background: none; border: none; @@ -186,7 +205,9 @@ export class SendView extends PureComponent { feeType, } = this.state; - const fixedAmount = amount === '' ? '0.00' : amount; + const isEmpty = amount === ''; + + const fixedAmount = isEmpty ? '0.00' : amount; const zecBalance = formatNumber({ value: balance, append: 'ZEC ' }); const zecBalanceInUsd = formatNumber({ @@ -224,15 +245,16 @@ export class SendView extends PureComponent { options={addresses.map(addr => ({ value: addr, label: addr }))} /> - + + +