From 2d54f8c351a878699c199c6d2fe2581e75a16a5e Mon Sep 17 00:00:00 2001 From: pbca26 Date: Wed, 6 Sep 2017 11:47:23 +0300 Subject: [PATCH] receive / send comp own props connect --- .../components/dashboard/jumblr/jumblr.scss | 3 ++ .../dashboard/receiveCoin/receiveCoin.js | 38 +++++++++++++------ .../dashboard/walletsData/walletsData.js | 1 + .../walletsNativeSend/walletsNativeSend.js | 13 ++++++- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/react/src/components/dashboard/jumblr/jumblr.scss b/react/src/components/dashboard/jumblr/jumblr.scss index 38953a2..80861e6 100644 --- a/react/src/components/dashboard/jumblr/jumblr.scss +++ b/react/src/components/dashboard/jumblr/jumblr.scss @@ -1,4 +1,7 @@ .jumblr { + .alert-info { + width: 100%; + } p { width: calc(100% - 100px); } diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.js b/react/src/components/dashboard/receiveCoin/receiveCoin.js index 97d87cc..21b71f6 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.js +++ b/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); \ No newline at end of file diff --git a/react/src/components/dashboard/walletsData/walletsData.js b/react/src/components/dashboard/walletsData/walletsData.js index 12d5c25..c0975ec 100644 --- a/react/src/components/dashboard/walletsData/walletsData.js +++ b/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' && diff --git a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js b/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js index 7f6a850..567b272 100644 --- a/react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js +++ b/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);