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() && <WalletsProgress /> }
{ !this.isNativeMode() && <WalletsBalance />} { !this.isNativeMode() && <WalletsBalance />}
<SendCoin /> <SendCoin />
{ !this.isNativeMode() && <ReceiveCoin {...this.props.ActiveCoin} /> } { !this.isNativeMode() && <ReceiveCoin /> }
{ !this.isNativeMode() && <WalletsData {...this.props} /> } { !this.isNativeMode() && <WalletsData /> }
<WalletsTxInfo {...this.props} /> <WalletsTxInfo {...this.props} />
<WalletsNative {...this.props} /> <WalletsNative {...this.props} />
</div> </div>

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

@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux';
import { import {
copyCoinAddress, copyCoinAddress,
checkAddressBasilisk, checkAddressBasilisk,
@ -18,8 +19,8 @@ import {
// TODO: fallback to localstorage/stores data in case iguana is taking too long to respond // TODO: fallback to localstorage/stores data in case iguana is taking too long to respond
class ReceiveCoin extends React.Component { class ReceiveCoin extends React.Component {
constructor(props) { constructor() {
super(props); super();
this.state = { this.state = {
openDropMenu: false, openDropMenu: false,
@ -216,5 +217,18 @@ class ReceiveCoin extends React.Component {
return null; return null;
} }
} }
const mapStateToProps = (state) => {
export default ReceiveCoin; 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 React from 'react';
import { connect } from 'react-redux';
import { basiliskConnection } from '../../../actions/actionCreators'; import { basiliskConnection } from '../../../actions/actionCreators';
import Store from '../../../store'; import Store from '../../../store';
import WalletsBasiliskConnectionRender from './walletsBasiliskConnection.render'; import WalletsBasiliskConnectionRender from './walletsBasiliskConnection.render';
class WalletsBasiliskConnection extends React.Component { class WalletsBasiliskConnection extends React.Component {
constructor(props) { constructor() {
super(props); super();
this.basiliskConnectionAction = this.basiliskConnectionAction.bind(this); 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 React from 'react';
import { connect } from 'react-redux';
import WalletsBasiliskRefreshRender from './walletsBasiliskRefresh.render'; import WalletsBasiliskRefreshRender from './walletsBasiliskRefresh.render';
class WalletsBasiliskRefresh extends React.Component { class WalletsBasiliskRefresh extends React.Component {
@ -15,5 +16,11 @@ class WalletsBasiliskRefresh extends React.Component {
return null; return null;
} }
} }
const mapStateToProps = (state) => {
export default WalletsBasiliskRefresh; 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 React from 'react';
import { connect } from 'react-redux';
import { secondsToString } from '../../../util/time'; import { secondsToString } from '../../../util/time';
import { toggleViewCacheModal } from '../../../actions/actionCreators'; import { toggleViewCacheModal } from '../../../actions/actionCreators';
import Store from '../../../store'; import Store from '../../../store';
@ -8,8 +9,8 @@ import WalletsCacheDataRender from './walletsCacheData.render';
// TODO: refresh data render // TODO: refresh data render
class WalletsCacheData extends React.Component { class WalletsCacheData extends React.Component {
constructor(props) { constructor() {
super(props); super();
this.closeViewCacheModal = this.closeViewCacheModal.bind(this); 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 React from 'react';
import { connect } from 'react-redux';
import { translate } from '../../../translate/translate'; import { translate } from '../../../translate/translate';
import { sortByDate } from '../../../util/sort'; import { sortByDate } from '../../../util/sort';
import { formatValue } from '../../../util/formatValue'; 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() { export const WalletsDataRender = function() {
return ( return (
<span> <span>
<WalletsBasiliskRefresh {...this.props} /> <WalletsBasiliskRefresh />
<WalletsBasiliskConnection {...this.props} /> <WalletsBasiliskConnection />
<WalletsNotariesList {...this.props} /> <WalletsNotariesList />
<WalletsCacheData {...this.props} /> <WalletsCacheData />
<div id="edexcoin_dashboardinfo"> <div id="edexcoin_dashboardinfo">
<div className="col-xs-12 margin-top-20 backround-gray"> <div className="col-xs-12 margin-top-20 backround-gray">
<div className="panel nav-tabs-horizontal"> <div className="panel nav-tabs-horizontal">

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

@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux';
import { translate } from '../../../translate/translate'; import { translate } from '../../../translate/translate';
import { displayNotariesModal } from '../../../actions/actionCreators'; import { displayNotariesModal } from '../../../actions/actionCreators';
import Store from '../../../store'; import Store from '../../../store';
@ -9,8 +10,8 @@ import {
} from './walletsNotariesList.render'; } from './walletsNotariesList.render';
class WalletsNotariesList extends React.Component { class WalletsNotariesList extends React.Component {
constructor(props) { constructor() {
super(props); super();
this.closeNotariesModal = this.closeNotariesModal.bind(this); this.closeNotariesModal = this.closeNotariesModal.bind(this);
} }
@ -58,5 +59,15 @@ class WalletsNotariesList extends React.Component {
return null; 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