From 48a73eddd05aa36b1c44d66df03f933943d46ddf Mon Sep 17 00:00:00 2001 From: petitPapillon Date: Sat, 17 Jun 2017 23:34:46 +0200 Subject: [PATCH] Merge the walletsTxInfo and walletsNativeTxInfo components --- .../dashboard/main/dashboard.render.js | 2 - .../walletsNative/walletsNative.render.js | 1 - .../walletsNativeTxInfo.js | 44 ----- .../walletsNativeTxInfo.render.js | 156 ------------------ .../dashboard/walletsTxInfo/walletsTxInfo.js | 4 + .../walletsTxInfo/walletsTxInfo.render.js | 66 +++++++- 6 files changed, 68 insertions(+), 205 deletions(-) delete mode 100644 react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.js delete mode 100644 react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.render.js diff --git a/react/src/components/dashboard/main/dashboard.render.js b/react/src/components/dashboard/main/dashboard.render.js index 32a36c9..0bd6116 100644 --- a/react/src/components/dashboard/main/dashboard.render.js +++ b/react/src/components/dashboard/main/dashboard.render.js @@ -14,7 +14,6 @@ import Settings from '../settings/settings'; import ReceiveCoin from '../receiveCoin/receiveCoin'; import About from '../about/about'; import WalletsNative from '../walletsNative/walletsNative'; -import WalletsNativeTxInfo from '../walletsNativeTxInfo/walletsNativeTxInfo'; import WalletsTxInfo from '../walletsTxInfo/walletsTxInfo'; const DashboardRender = function() { @@ -34,7 +33,6 @@ const DashboardRender = function() { -
diff --git a/react/src/components/dashboard/walletsNative/walletsNative.render.js b/react/src/components/dashboard/walletsNative/walletsNative.render.js index c661416..c59e429 100644 --- a/react/src/components/dashboard/walletsNative/walletsNative.render.js +++ b/react/src/components/dashboard/walletsNative/walletsNative.render.js @@ -30,7 +30,6 @@ const WalletsNativeRender = function() { -
diff --git a/react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.js b/react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.js deleted file mode 100644 index 39deb98..0000000 --- a/react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import { toggleDashboardTxInfoModal } from '../../../actions/actionCreators'; -import Store from '../../../store'; - -class WalletsNativeTxInfo extends React.Component { - constructor(props) { - super(props); - this.state = { - activeTab: 0, - }; - this.toggleTxInfoModal = this.toggleTxInfoModal.bind(this); - } - - toggleTxInfoModal() { - Store.dispatch(toggleDashboardTxInfoModal(false)); - } - - openTab(tab) { - this.setState(Object.assign({}, this.state, { - activeTab: tab, - })); - } - - handleKeydown(e) { - if (e.key === 'Escape') { - this.toggleTxInfoModal(); - } - } - - render() { - if (this.props && - this.props.ActiveCoin.showTransactionInfo && - this.props.ActiveCoin.nativeActiveSection === 'default' && - this.props.ActiveCoin.mode === 'native') { - const txInfo = this.props.ActiveCoin.txhistory[this.props.ActiveCoin.showTransactionInfoTxIndex]; - - return WalletsNativeTxInfoRender.call(this, txInfo); - } else { - return null; - } - } -} - -export default WalletsNativeTxInfo; diff --git a/react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.render.js b/react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.render.js deleted file mode 100644 index 064d597..0000000 --- a/react/src/components/dashboard/walletsNativeTxInfo/walletsNativeTxInfo.render.js +++ /dev/null @@ -1,156 +0,0 @@ -import React from 'react'; -import { translate } from '../../../translate/translate'; -import { secondsToString } from '../../../util/time'; - -const WalletsNativeTxInfoRender = function(txInfo) { - return ( -
this.handleKeydown(event) }> -
-
-
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
amount - { txInfo.amount } -
fee - { txInfo.fee } -
confirmations - { txInfo.confirmations } -
blockhash - { txInfo.blockhash } -
blockindex - { txInfo.blockindex } -
blocktime - { secondsToString(txInfo.blocktime) } -
txid - { txInfo.txid } -
walletconflicts - { txInfo.walletconflicts.length } -
time - { secondsToString(txInfo.time) } -
timereceived - { secondsToString(txInfo.timereceived) } -
-
-
- - - - - - - - - - - -
vjoinsplit - { txInfo.vjoinsplit } -
details - { txInfo.details } -
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- ); -}; - -export default WalletsNativeTxInfoRender; \ No newline at end of file diff --git a/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.js b/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.js index 0eac017..3742cea 100644 --- a/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.js +++ b/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.js @@ -28,6 +28,10 @@ class WalletsTxInfo extends React.Component { } } + isNativeMode() { + return this.props.ActiveCoin.mode === 'native'; + } + render() { if (this.props && this.props.ActiveCoin.showTransactionInfo && diff --git a/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js b/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js index 093aab2..a9dfa98 100644 --- a/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js +++ b/react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js @@ -18,8 +18,25 @@ const WalletsTxInfoRender = function(txInfo) { TxID Info -
  • - this.openTab(1) }> + + { this.isNativeMode() && +
  • + this.openTab(1) }> + Vjointsplits, Details + +
  • + } + + { this.isNativeMode() && +
  • + this.openTab(2) }> + Hex + +
  • + } + +
  • + this.openTab(3) }> Raw info
  • @@ -71,10 +88,55 @@ const WalletsTxInfoRender = function(txInfo) { { txInfo.txid } + + walletconflicts + + { txInfo.walletconflicts.length } + + + + time + + { secondsToString(txInfo.time) } + + + + timereceived + + { secondsToString(txInfo.timereceived) } + + +
    + + + + + + + + + + + +
    vjoinsplit + { txInfo.vjoinsplit } +
    details + { txInfo.details } +
    +
    +
    + +
    + +