diff --git a/src/components/Blockchain.vue b/src/components/Blockchain.vue index 9ef6948..dbf95ba 100644 --- a/src/components/Blockchain.vue +++ b/src/components/Blockchain.vue @@ -44,7 +44,11 @@ - + {{ blockTime(block.timestamp) }} @@ -72,60 +76,6 @@ export default { syncPercent: state => state.bitcoin.percent, blocks: state => state.bitcoin.blocks }) - // blocks() { - // const currentBlock = this.$store.state.bitcoin.currentBlock; - // if (currentBlock) { - // return [ - // { - // number: currentBlock, //block number - // txs: 1802, //num of txs in block - // timestamp: "few secs ago" //block's mining timestamp - // }, - // { - // number: currentBlock - 1, - // txs: 1934, - // timestamp: "12 mins ago" - // }, - // { - // number: currentBlock - 2, - // txs: 1783, - // timestamp: "19 mins ago" - // }, - // { - // number: currentBlock - 3, - // txs: 1723, - // timestamp: "27 mins ago" - // }, - // { - // number: currentBlock - 4, - // txs: 1982, - // timestamp: "34 mins ago" - // }, - // { - // number: currentBlock - 5, - // txs: 1934, - // timestamp: "47 mins ago" - // }, - // { - // number: currentBlock - 6, - // txs: 1783, - // timestamp: "58 mins ago" - // }, - // { - // number: currentBlock - 7, - // txs: 1723, - // timestamp: "1 hr ago" - // }, - // { - // number: currentBlock - 8, - // txs: 1982, - // timestamp: "1 hr ago" - // } - // ]; - // } else { - // return []; - // } - // } }, methods: { async fetchBlocks() { @@ -155,6 +105,9 @@ export default { } else { return "now"; } + }, + blockReadableTime(timestamp) { + return moment(timestamp * 1000).format("MMMM D, h:mm:ss a"); } }, created() { diff --git a/src/views/Bitcoin.vue b/src/views/Bitcoin.vue index edce0c6..98a1595 100644 --- a/src/views/Bitcoin.vue +++ b/src/views/Bitcoin.vue @@ -67,7 +67,11 @@ - + @@ -190,6 +194,7 @@ export default { computed: { ...mapState({ syncPercent: state => state.bitcoin.percent, + blocks: state => state.bitcoin.blocks, version: state => state.bitcoin.version, currentBlock: state => state.bitcoin.currentBlock, blockHeight: state => state.bitcoin.blockHeight diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 7aa30ef..a33576c 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -27,7 +27,7 @@ }" sub-title="Synchronized" icon="icon-app-bitcoin.svg" - :loading="syncPercent !== 100" + :loading="syncPercent !== 100 || blocks.length === 0" >