Browse Source

more ui tweaks for block-details pages:

- add back previous/next block hashes to top summary table (and remove back/forward buttons recently added to header)
- make better use of horizontal space on large screens by splitting the top summary table when possible
- better semantic grouping of transactions
fix-133-memory-crash
Dan Janosik 7 years ago
parent
commit
536d94ccad
  1. 11
      views/block.pug
  2. 80
      views/includes/block-content.pug

11
views/block.pug

@ -4,21 +4,10 @@ block headContent
title Block #{blockHash}
block content
div(class="row")
div(class="col-md-8")
h1(class="h2") Block
small(style="width: 100%;", class="monospace") ##{result.getblock.height.toLocaleString()}
br
small(style="width: 100%;", class="monospace word-wrap") #{result.getblock.hash}
div(class="col-md-4")
div(class="text-md-right mb-2")
if (result.getblock.height > 0)
a(href=("/block/" + result.getblock.previousblockhash), class="btn btn-primary", data-toggle="tooltip", title=("Block " + result.getblock.previousblockhash)) ◀ ##{(result.getblock.height - 1).toLocaleString()}
if (result.getblock.nextblockhash)
a(href=("/block/" + result.getblock.nextblockhash), class="btn btn-primary", data-toggle="tooltip", title=("Block " + result.getblock.nextblockhash)) ##{(result.getblock.height + 1).toLocaleString()} ▶
hr
include includes/block-content.pug

80
views/includes/block-content.pug

@ -31,26 +31,21 @@ div(class="tab-content")
a(href=sbInfo.referenceUrl) Read more
div(class="row")
div(class="col-md-6")
table(class="table")
if (false)
tr
th(class="table-active properties-header") Previous Block
td(class="monospace word-wrap")
if (result.getblock.previousblockhash)
a(class="word-wrap", href=("/block/" + result.getblock.previousblockhash)) #{(result.getblock.height - 1).toLocaleString()}
a(class="word-wrap", href=("/block/" + result.getblock.previousblockhash)) #{result.getblock.previousblockhash}
br
span(class="text-muted") ##{(result.getblock.height - 1).toLocaleString()}
else if (result.getblock.hash == genesisBlockHash)
span None
if (false)
tr
th(class="table-active properties-header") Next Block
td(class="monospace word-wrap")
if (result.getblock.nextblockhash)
a(href=("/block/" + result.getblock.nextblockhash)) #{(result.getblock.height + 1).toLocaleString()}
else
span None
span(class="text-muted") (latest block)
br
span(class="text-muted") (genesis block)
if (false)
tr
@ -97,6 +92,32 @@ div(class="tab-content")
strong(class="text-warning") #{result.getblock.confirmations}
else
strong(class="text-success") #{result.getblock.confirmations.toLocaleString()}
tr
th(class="table-active text-right") Miner
td(class="monospace word-wrap")
if (result.getblock.miner)
span #{result.getblock.miner.name}
if (result.getblock.miner.identifiedBy)
a(href=coinConfig.miningPoolsConfigUrl, data-toggle="tooltip", title=("Identified by: " + result.getblock.miner.identifiedBy), target="_blank")
i(class="fas fa-info-circle")
else
span ?
a(href=coinConfig.miningPoolsConfigUrl, data-toggle="tooltip", title=("Unable to identify (click to see config)"), target="_blank")
i(class="fas fa-info-circle")
div(class="col-md-6")
table(class="table")
tr
th(class="table-active properties-header") Next Block
td(class="monospace word-wrap")
if (result.getblock.nextblockhash)
a(href=("/block/" + result.getblock.nextblockhash)) #{result.getblock.nextblockhash}
br
span(class="text-muted") ##{(result.getblock.height + 1).toLocaleString()}
else
span None
br
span(class="text-muted") (latest block)
tr
- var scales = [ {val:1000000000000000, name:"quadrillion"}, {val:1000000000000, name:"trillion"}, {val:1000000000, name:"billion"}, {val:1000000, name:"million"} ];
@ -134,26 +155,13 @@ div(class="tab-content")
th(class="table-active text-right") Chainwork
td(class="monospace word-wrap") #{result.getblock.chainwork}
tr
th(class="table-active text-right") Miner
td(class="monospace word-wrap")
if (result.getblock.miner)
span #{result.getblock.miner.name}
if (result.getblock.miner.identifiedBy)
a(href=coinConfig.miningPoolsConfigUrl, data-toggle="tooltip", title=("Identified by: " + result.getblock.miner.identifiedBy), target="_blank")
i(class="fas fa-info-circle")
else
span ?
a(href=coinConfig.miningPoolsConfigUrl, data-toggle="tooltip", title=("Unable to identify (click to see config)"), target="_blank")
i(class="fas fa-info-circle")
hr
div(class="card mb-3")
div(class="card-header")
div(class="row")
div(class="col-md-4")
h2(class="h4 mb-0") #{txCount.toLocaleString()}
h2(class="h5 mb-0") #{txCount.toLocaleString()}
if (txCount == 1)
span Transaction
else
@ -173,25 +181,21 @@ div(class="tab-content")
a(href=(paginationBaseUrl + "?limit=3000"), class="btn btn-sm btn-primary px-2", class=(limit >= txCount ? "active" : false)) all
if (false)
h2(class="h4") Transactions (#{txCount.toLocaleString()})
small - Showing
if (txCount <= limit)
span all
else
span #{(offset + 1)} - #{Math.min(offset + limit, txCount)}
div(class="card-body")
each tx, txIndex in result.transactions
//pre
// code #{JSON.stringify(tx, null, 4)}
div(class="card mb-3")
div(class="xcard mb-3")
div(class="card-header")
div(class="row")
div(class="col-md-10")
if (tx && tx.txid)
strong ##{(txIndex + offset).toLocaleString()}
span &ndash;
a(href=("/tx/" + tx.txid), class="monospace") #{tx.txid}
div(class="row")
div(class="col-md-10")
div(class="col-md-2 text-right")
span ##{(txIndex + offset).toLocaleString()}
div(class="card-body")
//pre
// code #{JSON.stringify(result.txInputsByTransaction[tx.txid], null, 4)}

Loading…
Cancel
Save