Browse Source

Wallets data & Receive Coin prop refactor

all-modes
Miika Turunen 8 years ago
parent
commit
b824aa34cc
  1. 4
      react/src/components/dashboard/main/dashboard.render.js
  2. 22
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  3. 16
      react/src/components/dashboard/walletsBasiliskConnection/walletsBasiliskConnection.js
  4. 11
      react/src/components/dashboard/walletsBasiliskRefresh/walletsBasiliskRefresh.js
  5. 20
      react/src/components/dashboard/walletsCacheData/walletsCacheData.js
  6. 33
      react/src/components/dashboard/walletsData/walletsData.js
  7. 9
      react/src/components/dashboard/walletsData/walletsData.render.js
  8. 17
      react/src/components/dashboard/walletsNotariesList/walletsNotariesList.js

4
react/src/components/dashboard/main/dashboard.render.js

@ -31,8 +31,8 @@ const DashboardRender = function() {
{ !this.isNativeMode() && <WalletsProgress /> }
{ !this.isNativeMode() && <WalletsBalance />}
<SendCoin />
{ !this.isNativeMode() && <ReceiveCoin {...this.props.ActiveCoin} /> }
{ !this.isNativeMode() && <WalletsData {...this.props} /> }
{ !this.isNativeMode() && <ReceiveCoin /> }
{ !this.isNativeMode() && <WalletsData /> }
<WalletsTxInfo {...this.props} />
<WalletsNative {...this.props} />
</div>

22
react/src/components/dashboard/receiveCoin/receiveCoin.js

@ -1,4 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import {
copyCoinAddress,
checkAddressBasilisk,
@ -18,8 +19,8 @@ import {
// TODO: fallback to localstorage/stores data in case iguana is taking too long to respond
class ReceiveCoin extends React.Component {
constructor(props) {
super(props);
constructor() {
super();
this.state = {
openDropMenu: false,
@ -216,5 +217,18 @@ class ReceiveCoin extends React.Component {
return null;
}
}
export default ReceiveCoin;
const mapStateToProps = (state) => {
return {
coin: state.ActiveCoin.coin,
mode: state.ActiveCoin.mode,
receive: state.ActiveCoin.receive,
balance: state.ActiveCoin.balance,
cache: state.ActiveCoin.cache,
nativeActiveSection: state.ActiveCoin.nativeActiveSection,
activeAddress: state.ActiveCoin.activeAddress,
addresses: state.ActiveCoin.addresses
};
};
export default connect(mapStateToProps)(ReceiveCoin);

16
react/src/components/dashboard/walletsBasiliskConnection/walletsBasiliskConnection.js

@ -1,11 +1,12 @@
import React from 'react';
import { connect } from 'react-redux';
import { basiliskConnection } from '../../../actions/actionCreators';
import Store from '../../../store';
import WalletsBasiliskConnectionRender from './walletsBasiliskConnection.render';
class WalletsBasiliskConnection extends React.Component {
constructor(props) {
super(props);
constructor() {
super();
this.basiliskConnectionAction = this.basiliskConnectionAction.bind(this);
}
@ -33,4 +34,13 @@ class WalletsBasiliskConnection extends React.Component {
}
}
export default WalletsBasiliskConnection;
const mapStateToProps = (state) => {
return {
Dashboard: {
basiliskConnection: state.Dashboard.basiliskConnection,
connectedNotaries: state.Dashboard.connectedNotaries,
}
};
};
export default connect(mapStateToProps)(WalletsBasiliskConnection);

11
react/src/components/dashboard/walletsBasiliskRefresh/walletsBasiliskRefresh.js

@ -1,4 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import WalletsBasiliskRefreshRender from './walletsBasiliskRefresh.render';
class WalletsBasiliskRefresh extends React.Component {
@ -15,5 +16,11 @@ class WalletsBasiliskRefresh extends React.Component {
return null;
}
}
export default WalletsBasiliskRefresh;
const mapStateToProps = (state) => {
return {
Dashboard: {
basiliskRefresh: state.Dashboard.basiliskRefresh,
}
};
};
export default connect(mapStateToProps)(WalletsBasiliskRefresh);

20
react/src/components/dashboard/walletsCacheData/walletsCacheData.js

@ -1,4 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import { secondsToString } from '../../../util/time';
import { toggleViewCacheModal } from '../../../actions/actionCreators';
import Store from '../../../store';
@ -8,8 +9,8 @@ import WalletsCacheDataRender from './walletsCacheData.render';
// TODO: refresh data render
class WalletsCacheData extends React.Component {
constructor(props) {
super(props);
constructor() {
super();
this.closeViewCacheModal = this.closeViewCacheModal.bind(this);
}
@ -183,5 +184,18 @@ class WalletsCacheData extends React.Component {
}
}
}
const mapStateToProps = (state) => {
return {
ActiveCoin: {
mode: state.ActiveCoin.mode,
cache: state.ActiveCoin.cache,
notaries: state.ActiveCoin.notaries,
},
Dashboard: {
displayViewCacheModal: state.Dashboard.displayViewCacheModal,
}
};
};
export default WalletsCacheData;
export default connect(mapStateToProps)(WalletsCacheData);

33
react/src/components/dashboard/walletsData/walletsData.js

@ -1,4 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from '../../../translate/translate';
import { sortByDate } from '../../../util/sort';
import { formatValue } from '../../../util/formatValue';
@ -647,4 +648,34 @@ class WalletsData extends React.Component {
}
}
export default WalletsData;
const mapStateToProps = (state) => {
return {
ActiveCoin: {
coin: state.ActiveCoin.coin,
mode: state.ActiveCoin.mode,
send: state.ActiveCoin.send,
receive: state.ActiveCoin.receive,
balance: state.ActiveCoin.balance,
cache: state.ActiveCoin.cache,
nativeActiveSection: state.ActiveCoin.nativeActiveSection,
activeAddress: state.ActiveCoin.activeAddress,
lastSendToResponse: state.ActiveCoin.lastSendToResponse,
addresses: state.ActiveCoin.addresses,
txhistory: state.ActiveCoin.txhistory,
showTransactionInfo: state.ActiveCoin.showTransactionInfo,
},
Dashboard: {
activeHandle: state.Dashboard.activeHandle,
displayViewCacheModal: state.Dashboard.displayViewCacheModal,
basiliskConnection: state.Dashboard.basiliskConnection,
progress: state.Dashboard.progress,
},
Main: {
coins: state.Main.coins,
}
};
};
export default connect(mapStateToProps)(WalletsData);

9
react/src/components/dashboard/walletsData/walletsData.render.js

@ -144,12 +144,13 @@ export const AddressListRender = function() {
};
export const WalletsDataRender = function() {
return (
<span>
<WalletsBasiliskRefresh {...this.props} />
<WalletsBasiliskConnection {...this.props} />
<WalletsNotariesList {...this.props} />
<WalletsCacheData {...this.props} />
<WalletsBasiliskRefresh />
<WalletsBasiliskConnection />
<WalletsNotariesList />
<WalletsCacheData />
<div id="edexcoin_dashboardinfo">
<div className="col-xs-12 margin-top-20 backround-gray">
<div className="panel nav-tabs-horizontal">

17
react/src/components/dashboard/walletsNotariesList/walletsNotariesList.js

@ -1,4 +1,5 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from '../../../translate/translate';
import { displayNotariesModal } from '../../../actions/actionCreators';
import Store from '../../../store';
@ -9,8 +10,8 @@ import {
} from './walletsNotariesList.render';
class WalletsNotariesList extends React.Component {
constructor(props) {
super(props);
constructor() {
super();
this.closeNotariesModal = this.closeNotariesModal.bind(this);
}
@ -58,5 +59,15 @@ class WalletsNotariesList extends React.Component {
return null;
}
}
const mapStateToProps = (state) => {
return {
ActiveCoin: {
mode: state.ActiveCoin.mode,
displayNotariesModal: state.ActiveCoin.displayNotariesModal,
notaries: state.ActiveCoin.notaries,
}
};
};
export default WalletsNotariesList;
export default connect(mapStateToProps)(WalletsNotariesList);

Loading…
Cancel
Save