2018-11-23 15:23:41 -08:00
|
|
|
// @flow
|
2018-12-20 06:33:00 -08:00
|
|
|
import React, { PureComponent } from 'react';
|
2019-01-21 13:42:50 -08:00
|
|
|
import styled, { keyframes } from 'styled-components';
|
2019-01-09 05:14:02 -08:00
|
|
|
import { BigNumber } from 'bignumber.js';
|
2018-11-23 15:23:41 -08:00
|
|
|
|
2018-12-20 09:18:45 -08:00
|
|
|
import FEES from '../constants/fees';
|
|
|
|
|
2018-12-19 13:41:43 -08:00
|
|
|
import { InputLabelComponent } from '../components/input-label';
|
|
|
|
import { InputComponent } from '../components/input';
|
|
|
|
import { TextComponent } from '../components/text';
|
|
|
|
import { SelectComponent } from '../components/select';
|
2018-12-20 06:10:44 -08:00
|
|
|
import { RowComponent } from '../components/row';
|
|
|
|
import { ColumnComponent } from '../components/column';
|
|
|
|
import { Divider } from '../components/divider';
|
|
|
|
import { Button } from '../components/button';
|
2019-01-21 08:29:06 -08:00
|
|
|
import { ConfirmDialogComponent } from '../components/confirm-dialog';
|
2018-11-23 15:23:41 -08:00
|
|
|
|
2018-12-20 11:00:35 -08:00
|
|
|
import formatNumber from '../utils/formatNumber';
|
|
|
|
|
2018-12-21 07:44:29 -08:00
|
|
|
import type { SendTransactionInput } from '../containers/send';
|
2019-01-10 06:51:32 -08:00
|
|
|
import type { State as SendState } from '../redux/modules/send';
|
2018-12-21 07:44:29 -08:00
|
|
|
|
2019-01-21 08:29:06 -08:00
|
|
|
import SentIcon from '../assets/images/transaction_sent_icon.svg';
|
2019-01-21 10:16:16 -08:00
|
|
|
import MenuIcon from '../assets/images/menu_icon.svg';
|
|
|
|
import ValidIcon from '../assets/images/green_check.png';
|
|
|
|
import InvalidIcon from '../assets/images/error_icon.png';
|
2019-01-21 13:42:50 -08:00
|
|
|
import LoadingIcon from '../assets/images/sync_icon.png';
|
2019-01-21 10:16:16 -08:00
|
|
|
|
|
|
|
import theme from '../theme';
|
2019-01-21 08:29:06 -08:00
|
|
|
|
2019-01-21 13:42:50 -08:00
|
|
|
const rotate = keyframes`
|
|
|
|
from {
|
|
|
|
transform: rotate(0deg);
|
|
|
|
}
|
|
|
|
|
|
|
|
to {
|
|
|
|
transform: rotate(360deg);
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Loader = styled.img`
|
|
|
|
width: 25px;
|
|
|
|
height: 25px;
|
|
|
|
animation: 2s linear infinite;
|
|
|
|
animation-name: ${rotate};
|
|
|
|
margin-bottom: 10px;
|
|
|
|
`;
|
|
|
|
|
2018-12-20 06:10:44 -08:00
|
|
|
const FormWrapper = styled.div`
|
2018-12-19 13:41:43 -08:00
|
|
|
margin-top: ${props => props.theme.layoutContentPaddingTop};
|
2019-01-10 19:30:46 -08:00
|
|
|
width: 71%;
|
2018-12-20 06:10:44 -08:00
|
|
|
`;
|
|
|
|
|
|
|
|
const SendWrapper = styled(ColumnComponent)`
|
|
|
|
margin-top: 60px;
|
2019-01-10 19:30:46 -08:00
|
|
|
width: 25%;
|
2018-12-19 13:41:43 -08:00
|
|
|
`;
|
|
|
|
|
2019-01-22 12:08:41 -08:00
|
|
|
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;
|
|
|
|
`;
|
|
|
|
|
2019-01-23 19:10:08 -08:00
|
|
|
// const ShowFeeButton = styled.button`
|
|
|
|
// align-items: center;
|
|
|
|
// background: none;
|
|
|
|
// border: none;
|
|
|
|
// cursor: pointer;
|
|
|
|
// display: flex;
|
|
|
|
// width: 100%;
|
|
|
|
// color: ${props => props.theme.colors.text};
|
|
|
|
// outline: none;
|
|
|
|
// margin-bottom: 15px;
|
|
|
|
// margin-top: 15px;
|
|
|
|
// `;
|
|
|
|
|
2018-12-19 13:41:43 -08:00
|
|
|
const ShowFeeButton = styled.button`
|
|
|
|
background: none;
|
|
|
|
border: none;
|
|
|
|
cursor: pointer;
|
|
|
|
width: 100%;
|
|
|
|
color: ${props => props.theme.colors.text};
|
|
|
|
outline: none;
|
2019-01-21 10:50:37 -08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2019-01-23 19:10:08 -08:00
|
|
|
margin-top: 30px;
|
|
|
|
opacity: 0.7;
|
2018-12-19 13:41:43 -08:00
|
|
|
|
|
|
|
&:hover {
|
2019-01-23 19:10:08 -08:00
|
|
|
opacity: 1;
|
2018-12-19 13:41:43 -08:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-01-21 10:50:37 -08:00
|
|
|
const SeeMoreIcon = styled.img`
|
|
|
|
width: 25px;
|
|
|
|
height: 25px;
|
2019-01-23 19:10:08 -08:00
|
|
|
border: 1px solid ${props => props.theme.colors.text};
|
|
|
|
border-radius: 100%;
|
|
|
|
margin-right: 11.5px;
|
2019-01-21 10:50:37 -08:00
|
|
|
`;
|
|
|
|
|
|
|
|
const FeeWrapper = styled.div`
|
|
|
|
background-color: #000;
|
|
|
|
border-radius: 6px;
|
|
|
|
padding: 13px 19px;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
`;
|
|
|
|
|
2018-12-20 06:10:44 -08:00
|
|
|
const InfoCard = styled.div`
|
|
|
|
width: 100%;
|
|
|
|
background-color: ${props => props.theme.colors.cardBackgroundColor};
|
|
|
|
border-radius: ${props => props.theme.boxBorderRadius};
|
|
|
|
`;
|
|
|
|
|
|
|
|
const InfoContent = styled.div`
|
|
|
|
padding: 15px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const InfoCardLabel = styled(TextComponent)`
|
|
|
|
opacity: 0.5;
|
|
|
|
margin-bottom: 10px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const InfoCardUSD = styled(TextComponent)`
|
|
|
|
opacity: 0.5;
|
|
|
|
margin-top: 2.5px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const FormButton = styled(Button)`
|
|
|
|
margin: 10px 0;
|
|
|
|
border-color: ${props => (props.focused
|
|
|
|
? props.theme.colors.activeItem
|
|
|
|
: props.theme.colors.inactiveItem)};
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
border-color: ${props => (props.focused
|
|
|
|
? props.theme.colors.activeItem
|
|
|
|
: props.theme.colors.inactiveItem)};
|
|
|
|
background-color: ${props => (props.focused
|
|
|
|
? props.theme.colors.activeItem
|
|
|
|
: props.theme.colors.inactiveItem)};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-01-21 13:42:50 -08:00
|
|
|
const ModalContent = styled(ColumnComponent)`
|
|
|
|
min-height: 400px;
|
2019-01-10 06:51:32 -08:00
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2019-01-21 13:42:50 -08:00
|
|
|
|
|
|
|
p {
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
2019-01-10 06:51:32 -08:00
|
|
|
`;
|
|
|
|
|
2019-01-21 08:29:06 -08:00
|
|
|
const ConfirmItemWrapper = styled(RowComponent)`
|
|
|
|
padding: 22.5px 33.5px;
|
|
|
|
width: 100%;
|
|
|
|
`;
|
|
|
|
|
2019-01-21 10:16:16 -08:00
|
|
|
const ItemLabel = styled(TextComponent)`
|
2019-01-21 08:29:06 -08:00
|
|
|
font-weight: ${props => props.theme.fontWeight.bold};
|
|
|
|
font-size: ${props => props.theme.fontSize.small};
|
2019-01-21 10:16:16 -08:00
|
|
|
color: ${props => props.color || props.theme.colors.modalItemLabel};
|
2019-01-21 08:29:06 -08:00
|
|
|
margin-bottom: 3.5px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const SendZECValue = styled(TextComponent)`
|
|
|
|
color: ${props => props.theme.colors.transactionSent};
|
|
|
|
font-size: ${props => `${props.theme.fontSize.large}em`};
|
|
|
|
font-weight: ${props => props.theme.fontWeight.bold};
|
|
|
|
`;
|
|
|
|
|
|
|
|
const SendUSDValue = styled(TextComponent)`
|
|
|
|
opacity: 0.5;
|
|
|
|
font-weight: ${props => props.theme.fontWeight.light};
|
|
|
|
font-size: ${props => `${props.theme.fontSize.medium}em`};
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Icon = styled.img`
|
|
|
|
width: 35px;
|
|
|
|
height: 35px;
|
|
|
|
margin-left: 15px;
|
|
|
|
`;
|
|
|
|
|
2019-01-21 10:16:16 -08:00
|
|
|
const ValidateStatusIcon = styled.img`
|
|
|
|
width: 13px;
|
|
|
|
height: 13px;
|
|
|
|
margin-right: 7px;
|
|
|
|
`;
|
|
|
|
|
2019-01-10 06:51:32 -08:00
|
|
|
type Props = SendState & {
|
2018-12-20 11:00:35 -08:00
|
|
|
balance: number,
|
|
|
|
zecPrice: number,
|
|
|
|
addresses: string[],
|
2018-12-21 07:44:29 -08:00
|
|
|
sendTransaction: SendTransactionInput => void,
|
2019-01-10 06:51:32 -08:00
|
|
|
resetSendView: () => void,
|
2019-01-21 10:16:16 -08:00
|
|
|
validateAddress: ({ address: string }) => void,
|
2018-12-20 11:00:35 -08:00
|
|
|
};
|
2019-01-10 06:51:32 -08:00
|
|
|
|
2018-12-19 13:41:43 -08:00
|
|
|
type State = {
|
|
|
|
showFee: boolean,
|
|
|
|
from: string,
|
2019-01-07 10:59:27 -08:00
|
|
|
amount: string,
|
2018-12-19 13:41:43 -08:00
|
|
|
to: string,
|
2018-12-20 09:18:45 -08:00
|
|
|
feeType: string | number,
|
|
|
|
fee: number | null,
|
2018-12-19 13:41:43 -08:00
|
|
|
memo: string,
|
|
|
|
};
|
|
|
|
|
2019-01-10 06:51:32 -08:00
|
|
|
const initialState = {
|
|
|
|
showFee: false,
|
|
|
|
from: '',
|
2019-01-21 11:23:55 -08:00
|
|
|
amount: '',
|
2019-01-10 06:51:32 -08:00
|
|
|
to: '',
|
|
|
|
feeType: FEES.LOW,
|
|
|
|
fee: FEES.LOW,
|
|
|
|
memo: '',
|
|
|
|
};
|
|
|
|
|
2018-12-19 13:41:43 -08:00
|
|
|
export class SendView extends PureComponent<Props, State> {
|
2019-01-10 06:51:32 -08:00
|
|
|
state = initialState;
|
2018-12-19 13:41:43 -08:00
|
|
|
|
2019-01-10 10:16:23 -08:00
|
|
|
componentDidMount() {
|
|
|
|
const { resetSendView } = this.props;
|
2019-01-21 13:42:50 -08:00
|
|
|
|
2019-01-10 10:16:23 -08:00
|
|
|
resetSendView();
|
|
|
|
}
|
2018-12-19 13:41:43 -08:00
|
|
|
|
|
|
|
handleChange = (field: string) => (value: string) => {
|
2019-01-21 10:16:16 -08:00
|
|
|
const { validateAddress } = this.props;
|
|
|
|
|
2019-01-21 13:42:50 -08:00
|
|
|
if (field === 'to') {
|
2019-01-21 10:16:16 -08:00
|
|
|
// eslint-disable-next-line max-len
|
|
|
|
this.setState({ [field]: value }, () => validateAddress({ address: value }));
|
2019-01-10 19:38:57 -08:00
|
|
|
} else {
|
|
|
|
this.setState(() => ({ [field]: value }));
|
|
|
|
}
|
2018-12-19 13:41:43 -08:00
|
|
|
};
|
|
|
|
|
2018-12-20 09:18:45 -08:00
|
|
|
handleChangeFeeType = (value: string) => {
|
2019-01-21 08:29:06 -08:00
|
|
|
if (value === FEES.CUSTOM) {
|
|
|
|
this.setState({
|
|
|
|
feeType: FEES.CUSTOM,
|
2018-12-20 09:18:45 -08:00
|
|
|
fee: null,
|
2019-01-21 08:29:06 -08:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
const fee = new BigNumber(value);
|
|
|
|
|
2019-01-21 10:16:16 -08:00
|
|
|
this.setState({
|
|
|
|
feeType: fee.toString(),
|
|
|
|
fee: fee.toNumber(),
|
|
|
|
});
|
2019-01-21 08:29:06 -08:00
|
|
|
}
|
2018-12-20 09:18:45 -08:00
|
|
|
};
|
|
|
|
|
2018-12-21 07:44:29 -08:00
|
|
|
handleSubmit = () => {
|
|
|
|
const {
|
|
|
|
from, amount, to, memo, fee,
|
|
|
|
} = this.state;
|
|
|
|
const { sendTransaction } = this.props;
|
|
|
|
|
2019-01-07 10:59:27 -08:00
|
|
|
if (!from || !amount || !to || !fee) return;
|
2018-12-21 07:44:29 -08:00
|
|
|
|
|
|
|
sendTransaction({
|
|
|
|
from,
|
|
|
|
to,
|
|
|
|
amount,
|
|
|
|
fee,
|
|
|
|
memo,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2019-01-21 08:29:06 -08:00
|
|
|
showModal = (toggle: void => void) => () => {
|
|
|
|
const {
|
|
|
|
from, amount, to, fee,
|
|
|
|
} = this.state;
|
2019-01-21 13:42:50 -08:00
|
|
|
const { isToAddressValid } = this.props;
|
2019-01-21 08:29:06 -08:00
|
|
|
|
2019-01-21 13:42:50 -08:00
|
|
|
if (!from || !amount || !to || !fee || !isToAddressValid) return;
|
2019-01-21 08:29:06 -08:00
|
|
|
|
|
|
|
toggle();
|
|
|
|
};
|
|
|
|
|
2019-01-10 06:51:32 -08:00
|
|
|
reset = () => {
|
|
|
|
const { resetSendView } = this.props;
|
|
|
|
|
|
|
|
this.setState(initialState, () => resetSendView());
|
|
|
|
};
|
|
|
|
|
2019-01-21 08:29:06 -08:00
|
|
|
getFeeText = () => {
|
|
|
|
const { fee } = this.state;
|
|
|
|
|
|
|
|
const feeValue = new BigNumber(fee);
|
|
|
|
|
|
|
|
if (feeValue.isEqualTo(FEES.LOW)) return `Low ZEC ${feeValue.toString()}`;
|
|
|
|
// eslint-disable-next-line max-len
|
|
|
|
if (feeValue.isEqualTo(FEES.MEDIUM)) return `Medium ZEC ${feeValue.toString()}`;
|
|
|
|
if (feeValue.isEqualTo(FEES.HIGH)) return `High ZEC ${feeValue.toString()}`;
|
|
|
|
|
|
|
|
return `Custom ZEC ${feeValue.toString()}`;
|
|
|
|
};
|
|
|
|
|
2019-01-21 10:16:16 -08:00
|
|
|
renderValidationStatus = () => {
|
|
|
|
const { isToAddressValid } = this.props;
|
|
|
|
|
|
|
|
return isToAddressValid ? (
|
|
|
|
<RowComponent alignItems='center'>
|
|
|
|
<ValidateStatusIcon src={ValidIcon} />
|
|
|
|
<ItemLabel value='VALID' color={theme.colors.transactionReceived} />
|
|
|
|
</RowComponent>
|
|
|
|
) : (
|
|
|
|
<RowComponent alignItems='center'>
|
|
|
|
<ValidateStatusIcon src={InvalidIcon} />
|
|
|
|
<ItemLabel value='INVALID' color={theme.colors.transactionSent} />
|
|
|
|
</RowComponent>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-01-21 13:42:50 -08:00
|
|
|
renderModalContent = ({
|
|
|
|
valueSent,
|
|
|
|
valueSentInUsd,
|
|
|
|
toggle,
|
|
|
|
}: {
|
|
|
|
valueSent: string,
|
|
|
|
valueSentInUsd: string,
|
|
|
|
toggle: () => void,
|
|
|
|
}) => {
|
|
|
|
const { operationId, isSending, error } = this.props;
|
|
|
|
const { from, to } = this.state;
|
|
|
|
|
|
|
|
if (isSending) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Loader src={LoadingIcon} />
|
|
|
|
<TextComponent value='Processing transaction...' />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (operationId) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<TextComponent
|
|
|
|
value={`Transaction ID: ${operationId}`}
|
|
|
|
align='center'
|
|
|
|
/>
|
|
|
|
<button
|
|
|
|
type='button'
|
|
|
|
onClick={() => {
|
|
|
|
this.reset();
|
|
|
|
toggle();
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Send again!
|
|
|
|
</button>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) return <TextComponent value={error} />;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ConfirmItemWrapper alignItems='center'>
|
|
|
|
<ColumnComponent>
|
|
|
|
<ItemLabel value='AMOUNT' />
|
|
|
|
<SendZECValue value={`-${valueSent}`} />
|
|
|
|
<SendUSDValue value={`-${valueSentInUsd}`} />
|
|
|
|
</ColumnComponent>
|
|
|
|
<ColumnComponent>
|
|
|
|
<Icon src={SentIcon} alt='Transaction Type Icon' />
|
|
|
|
</ColumnComponent>
|
|
|
|
</ConfirmItemWrapper>
|
|
|
|
<Divider opacity={0.3} />
|
|
|
|
<ConfirmItemWrapper alignItems='center'>
|
|
|
|
<ColumnComponent>
|
|
|
|
<ItemLabel value='FEE' />
|
|
|
|
<TextComponent value={this.getFeeText()} />
|
|
|
|
</ColumnComponent>
|
|
|
|
</ConfirmItemWrapper>
|
|
|
|
<Divider opacity={0.3} />
|
|
|
|
<ConfirmItemWrapper alignItems='center'>
|
|
|
|
<ColumnComponent>
|
|
|
|
<ItemLabel value='FROM' />
|
|
|
|
<TextComponent value={from} />
|
|
|
|
</ColumnComponent>
|
|
|
|
</ConfirmItemWrapper>
|
|
|
|
<Divider opacity={0.3} />
|
|
|
|
<ConfirmItemWrapper alignItems='center'>
|
|
|
|
<ColumnComponent>
|
|
|
|
<ItemLabel value='TO' />
|
|
|
|
<TextComponent value={to} />
|
|
|
|
</ColumnComponent>
|
|
|
|
</ConfirmItemWrapper>
|
|
|
|
<Divider opacity={0.3} marginBottom='27.5px' />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2018-12-19 13:41:43 -08:00
|
|
|
render() {
|
2018-12-21 07:44:29 -08:00
|
|
|
const {
|
2019-01-10 06:51:32 -08:00
|
|
|
addresses,
|
|
|
|
balance,
|
|
|
|
zecPrice,
|
|
|
|
isSending,
|
|
|
|
error,
|
|
|
|
operationId,
|
2018-12-21 07:44:29 -08:00
|
|
|
} = this.props;
|
2018-12-19 13:41:43 -08:00
|
|
|
const {
|
2019-01-21 08:29:06 -08:00
|
|
|
showFee, from, amount, to, memo, fee, feeType,
|
2018-12-19 13:41:43 -08:00
|
|
|
} = this.state;
|
|
|
|
|
2019-01-22 12:08:41 -08:00
|
|
|
const isEmpty = amount === '';
|
|
|
|
|
|
|
|
const fixedAmount = isEmpty ? '0.00' : amount;
|
2019-01-22 11:07:59 -08:00
|
|
|
|
2018-12-20 11:00:35 -08:00
|
|
|
const zecBalance = formatNumber({ value: balance, append: 'ZEC ' });
|
|
|
|
const zecBalanceInUsd = formatNumber({
|
2019-01-10 19:30:46 -08:00
|
|
|
value: new BigNumber(balance).times(zecPrice).toNumber(),
|
2018-12-20 11:00:35 -08:00
|
|
|
append: 'USD $',
|
|
|
|
});
|
2019-01-07 10:59:27 -08:00
|
|
|
const valueSent = formatNumber({
|
2019-01-22 11:07:59 -08:00
|
|
|
value: new BigNumber(fixedAmount).toFormat(2),
|
2019-01-07 10:59:27 -08:00
|
|
|
append: 'ZEC ',
|
|
|
|
});
|
2018-12-20 11:00:35 -08:00
|
|
|
const valueSentInUsd = formatNumber({
|
2019-01-10 19:30:46 -08:00
|
|
|
value: new BigNumber(amount).times(zecPrice).toNumber(),
|
2018-12-20 11:00:35 -08:00
|
|
|
append: 'USD $',
|
|
|
|
});
|
|
|
|
|
2019-01-21 13:42:50 -08:00
|
|
|
return (
|
2018-12-20 06:10:44 -08:00
|
|
|
<RowComponent justifyContent='space-between'>
|
|
|
|
<FormWrapper>
|
|
|
|
<InputLabelComponent value='From' />
|
|
|
|
<SelectComponent
|
|
|
|
onChange={this.handleChange('from')}
|
|
|
|
value={from}
|
|
|
|
placeholder='Select a address'
|
2018-12-20 11:00:35 -08:00
|
|
|
options={addresses.map(addr => ({ value: addr, label: addr }))}
|
2018-12-20 06:10:44 -08:00
|
|
|
/>
|
|
|
|
<InputLabelComponent value='Amount' />
|
2019-01-22 12:08:41 -08:00
|
|
|
<AmountWrapper isEmpty={isEmpty}>
|
|
|
|
<AmountInput
|
|
|
|
isEmpty={isEmpty}
|
|
|
|
type='number'
|
|
|
|
onChange={this.handleChange('amount')}
|
|
|
|
value={String(amount)}
|
|
|
|
placeholder='ZEC 0.0'
|
|
|
|
min={0.01}
|
|
|
|
/>
|
|
|
|
</AmountWrapper>
|
2018-12-20 06:10:44 -08:00
|
|
|
<InputLabelComponent value='To' />
|
|
|
|
<InputComponent
|
|
|
|
onChange={this.handleChange('to')}
|
|
|
|
value={to}
|
2019-01-10 09:51:51 -08:00
|
|
|
placeholder='Enter Address'
|
2019-01-21 10:16:16 -08:00
|
|
|
renderRight={to ? this.renderValidationStatus : () => null}
|
2018-12-19 13:41:43 -08:00
|
|
|
/>
|
2018-12-20 06:10:44 -08:00
|
|
|
<InputLabelComponent value='Memo' />
|
|
|
|
<InputComponent
|
|
|
|
onChange={this.handleChange('memo')}
|
|
|
|
value={memo}
|
|
|
|
inputType='textarea'
|
|
|
|
placeholder='Enter a text here'
|
|
|
|
/>
|
|
|
|
<ShowFeeButton
|
|
|
|
onClick={() => this.setState(state => ({ showFee: !state.showFee }))
|
|
|
|
}
|
|
|
|
>
|
2019-01-21 10:16:16 -08:00
|
|
|
<SeeMoreIcon src={MenuIcon} alt='Show more icon' />
|
2018-12-20 06:10:44 -08:00
|
|
|
<TextComponent
|
|
|
|
value={`${showFee ? 'Hide' : 'Show'} Additional Options`}
|
2018-12-19 13:41:43 -08:00
|
|
|
/>
|
2018-12-20 06:10:44 -08:00
|
|
|
</ShowFeeButton>
|
|
|
|
{showFee && (
|
2019-01-21 10:50:37 -08:00
|
|
|
<FeeWrapper>
|
|
|
|
<RowComponent alignItems='flex-end' justifyContent='space-between'>
|
|
|
|
<ColumnComponent width='74%'>
|
|
|
|
<InputLabelComponent value='Fee' />
|
|
|
|
<InputComponent
|
|
|
|
type='number'
|
|
|
|
onChange={this.handleChange('fee')}
|
|
|
|
value={String(fee)}
|
|
|
|
disabled={feeType !== FEES.CUSTOM}
|
|
|
|
bgColor={theme.colors.blackTwo}
|
|
|
|
/>
|
|
|
|
</ColumnComponent>
|
|
|
|
<ColumnComponent width='25%'>
|
|
|
|
<SelectComponent
|
|
|
|
onChange={this.handleChangeFeeType}
|
|
|
|
value={String(feeType)}
|
|
|
|
options={Object.keys(FEES).map(cur => ({
|
|
|
|
label: cur.toLowerCase(),
|
|
|
|
value: String(FEES[cur]),
|
|
|
|
}))}
|
|
|
|
placement='top'
|
|
|
|
bgColor={theme.colors.blackTwo}
|
|
|
|
/>
|
|
|
|
</ColumnComponent>
|
|
|
|
</RowComponent>
|
|
|
|
</FeeWrapper>
|
2018-12-20 06:10:44 -08:00
|
|
|
)}
|
2018-12-20 11:04:00 -08:00
|
|
|
{feeType === FEES.CUSTOM && (
|
|
|
|
<TextComponent value='Custom fees may compromise your privacy since fees are transparent' />
|
|
|
|
)}
|
2018-12-20 06:10:44 -08:00
|
|
|
</FormWrapper>
|
|
|
|
<SendWrapper>
|
|
|
|
<InfoCard>
|
|
|
|
<InfoContent>
|
|
|
|
<InfoCardLabel value='Available Funds:' />
|
2019-01-10 09:51:51 -08:00
|
|
|
<TextComponent value={zecBalance} size={1.25} isBold />
|
|
|
|
<InfoCardUSD value={zecBalanceInUsd} size={0.84375} />
|
2018-12-20 06:10:44 -08:00
|
|
|
</InfoContent>
|
2019-01-21 08:29:06 -08:00
|
|
|
<Divider opacity={0.3} />
|
2018-12-20 06:10:44 -08:00
|
|
|
<InfoContent>
|
|
|
|
<InfoCardLabel value='Sending' />
|
2019-01-10 09:51:51 -08:00
|
|
|
<TextComponent value={valueSent} size={1.25} isBold />
|
|
|
|
<InfoCardUSD value={valueSentInUsd} size={0.84375} />
|
2018-12-20 06:10:44 -08:00
|
|
|
</InfoContent>
|
|
|
|
</InfoCard>
|
2019-01-21 08:29:06 -08:00
|
|
|
<ConfirmDialogComponent
|
|
|
|
title='Please Confirm Transaction Details'
|
|
|
|
onConfirm={this.handleSubmit}
|
|
|
|
renderTrigger={toggle => (
|
|
|
|
<FormButton
|
|
|
|
label='Send'
|
|
|
|
variant='secondary'
|
|
|
|
focused
|
|
|
|
onClick={this.showModal(toggle)}
|
|
|
|
/>
|
|
|
|
)}
|
2019-01-21 13:42:50 -08:00
|
|
|
showButtons={!isSending && !error && !operationId}
|
|
|
|
onClose={this.reset}
|
2019-01-21 08:29:06 -08:00
|
|
|
>
|
2019-01-21 13:42:50 -08:00
|
|
|
{toggle => (
|
|
|
|
<ModalContent>
|
|
|
|
{this.renderModalContent({ valueSent, valueSentInUsd, toggle })}
|
|
|
|
</ModalContent>
|
|
|
|
)}
|
2019-01-21 08:29:06 -08:00
|
|
|
</ConfirmDialogComponent>
|
2018-12-20 06:10:44 -08:00
|
|
|
<FormButton label='Cancel' variant='secondary' />
|
|
|
|
</SendWrapper>
|
|
|
|
</RowComponent>
|
2018-12-19 13:41:43 -08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|