tx/day legend wasn't live updating. now it does

pull/2480/head
slightlycyborg 5 years ago
parent b459a93bee
commit dc5ae43332
  1. 8
      apps/block_scout_web/assets/js/pages/chain.js
  2. 2
      apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex

@ -154,6 +154,7 @@ const elements = {
if (chart && !(oldState.availableSupply === state.availableSupply && oldState.marketHistoryData === state.marketHistoryData) && state.availableSupply) { if (chart && !(oldState.availableSupply === state.availableSupply && oldState.marketHistoryData === state.marketHistoryData) && state.availableSupply) {
chart.updateMarketHistory(state.availableSupply, state.marketHistoryData) chart.updateMarketHistory(state.availableSupply, state.marketHistoryData)
} }
if (chart && !(JSON.stringify(oldState.transactionStats) === JSON.stringify(state.transactionStats))) { if (chart && !(JSON.stringify(oldState.transactionStats) === JSON.stringify(state.transactionStats))) {
chart.updateTransactionHistory(state.transactionStats) chart.updateTransactionHistory(state.transactionStats)
} }
@ -195,6 +196,13 @@ const elements = {
$el.empty().append(formatUsdValue(state.usdMarketCap)) $el.empty().append(formatUsdValue(state.usdMarketCap))
} }
}, },
'[data-selector="tx_per_day"]': {
render ($el, state, oldState) {
if (!(JSON.stringify(oldState.transactionStats) === JSON.stringify(state.transactionStats))) {
$el.empty().append(state.transactionStats[0].number_of_transactions)
}
}
},
'[data-selector="chain-block-list"]': { '[data-selector="chain-block-list"]': {
load ($el) { load ($el) {
return { return {

@ -71,7 +71,7 @@
<span class="dashboard-banner-chart-legend-label"> <span class="dashboard-banner-chart-legend-label">
<%= gettext "Tx/day" %> <%= gettext "Tx/day" %>
</span> </span>
<span class="dashboard-banner-chart-legend-value" data-selector="numTransactions"> <span class="dashboard-banner-chart-legend-value" data-selector="tx_per_day">
<%= Enum.at(@transaction_stats, 0).number_of_transactions %> <%= Enum.at(@transaction_stats, 0).number_of_transactions %>
</span> </span>
</div> </div>

Loading…
Cancel
Save