// Copyright 2015, 2016 Ethcore (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Parity is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Parity. If not, see . import BigNumber from 'bignumber.js'; import React, { Component, PropTypes } from 'react'; import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; import ContentClear from 'material-ui/svg-icons/content/clear'; import NavigationArrowBack from 'material-ui/svg-icons/navigation/arrow-back'; import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward'; import { BusyStep, CompletedStep, Button, IdentityIcon, Modal, TxHash } from '../../ui'; import Details from './Details'; import Extras from './Extras'; import ERRORS from './errors'; import styles from './transfer.css'; const DEFAULT_GAS = '21000'; const DEFAULT_GASPRICE = '20000000000'; const TITLES = { transfer: 'transfer details', sending: 'sending', complete: 'complete', extras: 'extra information' }; const STAGES_BASIC = [TITLES.transfer, TITLES.sending, TITLES.complete]; const STAGES_EXTRA = [TITLES.transfer, TITLES.extras, TITLES.sending, TITLES.complete]; export default class Transfer extends Component { static contextTypes = { api: PropTypes.object.isRequired, store: PropTypes.object.isRequired } static propTypes = { account: PropTypes.object, balance: PropTypes.object, balances: PropTypes.object, images: PropTypes.object.isRequired, onClose: PropTypes.func } state = { stage: 0, data: '', dataError: null, extras: false, gas: DEFAULT_GAS, gasEst: '0', gasError: null, gasPrice: DEFAULT_GASPRICE, gasPriceHistogram: {}, gasPriceError: null, recipient: '', recipientError: ERRORS.requireRecipient, sending: false, tag: 'ETH', total: '0.0', totalError: null, value: '0.0', valueAll: false, valueError: null, isEth: true, busyState: null } componentDidMount () { this.getDefaults(); } render () { const { stage, extras } = this.state; return ( { this.renderPage() } ); } renderAccount () { const { account } = this.props; return (
{ account.name || 'Unnamed' }
{ account.address }
); } renderPage () { const { extras, stage } = this.state; if (stage === 0) { return this.renderDetailsPage(); } else if (stage === 1 && extras) { return this.renderExtrasPage(); } return this.renderCompletePage(); } renderCompletePage () { const { sending, txhash, busyState } = this.state; if (sending) { return ( ); } return ( ); } renderDetailsPage () { const { account, balance, images } = this.props; return (
); } renderExtrasPage () { if (!this.state.gasPriceHistogram) { return null; } return ( ); } renderDialogActions () { const { account } = this.props; const { extras, sending, stage } = this.state; const cancelBtn = (