Skip to content

Commit

Permalink
views/home: Use ThreeSigFigs to display difficulty on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
matthawkins90 authored Jan 24, 2024
1 parent fdb827d commit fa4fa14
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/dcrdata/public/js/controllers/homepage_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class extends Controller {

_processBlock (blockData) {
const ex = blockData.extra
this.difficultyTarget.innerHTML = humanize.decimalParts(ex.difficulty / 1000000, true, 0)
this.difficultyTarget.innerHTML = humanize.threeSigFigs(ex.difficulty)
this.bsubsidyPowTarget.innerHTML = humanize.decimalParts(ex.subsidy.pow / 100000000, false, 8, 2)
this.bsubsidyPosTarget.innerHTML = humanize.decimalParts((ex.subsidy.pos / 500000000), false, 8, 2) // 5 votes per block (usually)
this.bsubsidyDevTarget.innerHTML = humanize.decimalParts(ex.subsidy.dev / 100000000, false, 8, 2)
Expand Down
2 changes: 1 addition & 1 deletion cmd/dcrdata/views/extras.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
data-turbolinks-suppress-warning
></script>
<script
src="/dist/js/app.3f014a316578f397.bundle.js"
src="/dist/js/app.935cecaf5560c863.bundle.js"
data-turbolinks-eval="false"
data-turbolinks-suppress-warning
></script>
Expand Down
3 changes: 1 addition & 2 deletions cmd/dcrdata/views/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@
<a class="no-underline" href="/charts?chart=pow-difficulty">Difficulty</a>
</div>
<div class="mono lh1rem p03rem0 fs14-decimal fs24 p03rem0 d-flex align-items-baseline">
<span data-homepage-target="difficulty">{{template "decimalParts" (float64AsDecimalParts (divideFloat .Difficulty 1000000.0) 0 true)}}</span>
<span class="ps-1 unit lh15rem">Mil</span>
<span data-homepage-target="difficulty">{{threeSigFigs .Difficulty}}</span>
</div>
</div>
<div class="col-12 mb-3 mb-sm-2 mb-md-3 mb-lg-3">
Expand Down

0 comments on commit fa4fa14

Please sign in to comment.