// Copyright 2015-2018 Parity Technologies (UK) Ltd. // This file is part of Parity. // // SPDX-License-Identifier: BSD-3-Clause import React, { Component } from 'react'; import { findDOMNode } from 'react-dom'; import { FormField, Header } from 'fether-ui'; import { inject, observer } from 'mobx-react'; import { Link } from 'react-router-dom'; import ReactTooltip from 'react-tooltip'; import { withProps } from 'recompose'; import TokenBalance from '../../Tokens/TokensList/TokenBalance'; @inject('sendStore', 'tokensStore') @withProps(({ match: { params: { tokenAddress } }, tokensStore }) => ({ token: tokensStore.tokens[tokenAddress] })) @observer class Signer extends Component { state = { error: null, isSending: false, password: '' }; handleAccept = event => { const { history, sendStore } = this.props; const { password } = this.state; event.preventDefault(); this.setState({ isSending: true }, () => { sendStore .send(password) .then(() => history.push('/send/sent')) .catch(error => { this.setState({ error, isSending: false }, () => ReactTooltip.show(findDOMNode(this.tooltip)) ); }); }); }; handleCancel = () => { const { history } = this.props; history.goBack(); }; handleChangePassword = ({ target: { value } }) => { this.setState({ error: null, password: value }); }; /** * TODO All this tooltips refs etc should go inside a React validation * library. */ handleTooltipRef = ref => { this.tooltip = ref; }; render () { const { sendStore: { tx }, token } = this.props; const { error, isSending, password } = this.state; return (
Close } title={

Send {token.name}

} />
{tx.amount} {token.symbol}
{tx.to}
,

Enter your password to confirm this transaction.

]} onClick={null} token={token} />
); } } export default Signer;