// Copyright 2015, 2016 Parity Technologies (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 React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import moment from 'moment';
import ContentCreate from 'material-ui/svg-icons/content/create';
import ActionDelete from 'material-ui/svg-icons/action/delete';
import ContentSend from 'material-ui/svg-icons/content/send';
import SettingsIcon from 'material-ui/svg-icons/action/settings';
import { nullableProptype } from '~/util/proptypes';
import { EditMeta, Transfer, WalletSettings } from '~/modals';
import { Actionbar, Button, Page, Loading } from '~/ui';
import Delete from '../Address/Delete';
import Header from '../Account/Header';
import WalletDetails from './Details';
import WalletConfirmations from './Confirmations';
import WalletTransactions from './Transactions';
import { setVisibleAccounts } from '~/redux/providers/personalActions';
import styles from './wallet.css';
class WalletContainer extends Component {
static propTypes = {
isTest: PropTypes.any
};
render () {
const { isTest, ...others } = this.props;
if (isTest !== false && isTest !== true) {
return (
);
}
return (
);
}
}
class Wallet extends Component {
static contextTypes = {
api: PropTypes.object.isRequired
};
static propTypes = {
setVisibleAccounts: PropTypes.func.isRequired,
balance: nullableProptype(PropTypes.object.isRequired),
images: PropTypes.object.isRequired,
address: PropTypes.string.isRequired,
wallets: PropTypes.object.isRequired,
wallet: PropTypes.object.isRequired,
isTest: PropTypes.bool.isRequired
};
state = {
showEditDialog: false,
showSettingsDialog: false,
showTransferDialog: false,
showDeleteDialog: false
};
componentDidMount () {
this.setVisibleAccounts();
}
componentWillReceiveProps (nextProps) {
const prevAddress = this.props.address;
const nextAddress = nextProps.address;
if (prevAddress !== nextAddress) {
this.setVisibleAccounts(nextProps);
}
}
componentWillUnmount () {
this.props.setVisibleAccounts([]);
}
setVisibleAccounts (props = this.props) {
const { address, setVisibleAccounts } = props;
const addresses = [ address ];
setVisibleAccounts(addresses);
}
render () {
const { wallets, balance, address } = this.props;
const wallet = (wallets || {})[address];
if (!wallet) {
return null;
}
const { owners, require, dailylimit } = this.props.wallet;
return (