Browse Source

receive / send comp own props connect

all-modes
pbca26 7 years ago
parent
commit
2d54f8c351
  1. 3
      react/src/components/dashboard/jumblr/jumblr.scss
  2. 38
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  3. 1
      react/src/components/dashboard/walletsData/walletsData.js
  4. 13
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js

3
react/src/components/dashboard/jumblr/jumblr.scss

@ -1,4 +1,7 @@
.jumblr {
.alert-info {
width: 100%;
}
p {
width: calc(100% - 100px);
}

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

@ -217,17 +217,33 @@ class ReceiveCoin extends React.Component {
return null;
}
}
const mapStateToProps = (state) => {
return {
coin: state.ActiveCoin.coin,
mode: state.ActiveCoin.mode,
receive: state.ActiveCoin.receive,
balance: state.ActiveCoin.balance,
cache: state.ActiveCoin.cache,
activeSection: state.ActiveCoin.activeSection,
activeAddress: state.ActiveCoin.activeAddress,
addresses: state.ActiveCoin.addresses,
};
const mapStateToProps = (state, props) => {
if (props &&
props.activeSection &&
props.renderTableOnly) {
return {
coin: state.ActiveCoin.coin,
mode: state.ActiveCoin.mode,
receive: state.ActiveCoin.receive,
balance: state.ActiveCoin.balance,
cache: state.ActiveCoin.cache,
activeSection: props.activeSection,
activeAddress: state.ActiveCoin.activeAddress,
addresses: state.ActiveCoin.addresses,
renderTableOnly: props.renderTableOnly,
};
} else {
return {
coin: state.ActiveCoin.coin,
mode: state.ActiveCoin.mode,
receive: state.ActiveCoin.receive,
balance: state.ActiveCoin.balance,
cache: state.ActiveCoin.cache,
activeSection: state.ActiveCoin.activeSection,
activeAddress: state.ActiveCoin.activeAddress,
addresses: state.ActiveCoin.addresses,
};
}
};
export default connect(mapStateToProps)(ReceiveCoin);

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

@ -335,6 +335,7 @@ class WalletsData extends React.Component {
}
// TODO: clean
// TODO: figure out why changing ActiveCoin props doesn't trigger comp update
if (this.props.ActiveCoin.txhistory &&
this.props.ActiveCoin.txhistory !== 'loading' &&
this.props.ActiveCoin.txhistory !== 'no data' &&

13
react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js

@ -453,8 +453,8 @@ class WalletsNativeSend extends React.Component {
}
}
const mapStateToProps = (state) => {
return {
const mapStateToProps = (state, props) => {
let _mappedProps = {
ActiveCoin: {
addresses: state.ActiveCoin.addresses,
coin: state.ActiveCoin.coin,
@ -464,6 +464,15 @@ const mapStateToProps = (state) => {
activeSection: state.ActiveCoin.activeSection,
},
};
if (props &&
props.activeSection &&
props.renderFormOnly) {
_mappedProps.ActiveCoin.activeSection = props.activeSection,
_mappedProps.renderFormOnly = props.renderFormOnly;
}
return _mappedProps;
};
export default connect(mapStateToProps)(WalletsNativeSend);

Loading…
Cancel
Save