From bde5f08fa391d1b2a4ee5644d875eb6573e60cc8 Mon Sep 17 00:00:00 2001 From: Petr Balashov Date: Wed, 3 May 2017 11:46:54 +0200 Subject: [PATCH] updated time util; utxo count on send coin --- react/src/components/dashboard/sendCoin.js | 34 ++++++++++++++++++++++ react/src/util/time.js | 13 +++++++++ 2 files changed, 47 insertions(+) diff --git a/react/src/components/dashboard/sendCoin.js b/react/src/components/dashboard/sendCoin.js index 071cef8..207a23a 100644 --- a/react/src/components/dashboard/sendCoin.js +++ b/react/src/components/dashboard/sendCoin.js @@ -1,6 +1,7 @@ import React from 'react'; import Config from '../../config'; import { translate } from '../../translate/translate'; +import { checkTimestamp, secondsElapsedToString, secondsToString } from '../../util/time'; import { sendToAddress, sendFromAddress, @@ -39,6 +40,38 @@ class SendCoin extends React.Component { this.toggleSendSig = this.toggleSendSig.bind(this); this.getOAdress = this.getOAdress.bind(this); this.toggleSendAPIType = this.toggleSendAPIType.bind(this); + this.renderUTXOCacheInfo = this.renderUTXOCacheInfo.bind(this); + this.fetchNewUTXOData = this.fetchNewUTXOData.bind(this); + } + + fetchNewUTXOData() { + + } + + renderUTXOCacheInfo() { + if (this.props.ActiveCoin.mode === 'basilisk' && + this.state.sendFrom && + this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.state.sendFrom] && + this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.state.sendFrom].refresh) { + const refreshCacheData = this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.state.sendFrom].refresh; + const timestamp = checkTimestamp(refreshCacheData.timestamp); + const isReadyToUpdate = timestamp > 600 ? true : false; + + return ( +
+
+ Total UTXO available: {refreshCacheData.data.length}
+ Last updated @ {secondsToString(refreshCacheData.timestamp, true)} | {secondsElapsedToString(timestamp)} ago
+
Next update available in {600 - timestamp}s
+ +
+
+ ); + } else { + return null; + } } renderAddressAmount(address) { @@ -487,6 +520,7 @@ class SendCoin extends React.Component { + {this.renderUTXOCacheInfo()}