Skip to content

Commit

Permalink
update chart links with query params, improve decimal kerning, colori…
Browse files Browse the repository at this point in the history
…ze % via bootstrap classes
  • Loading branch information
gozart1 committed Jan 29, 2019
1 parent 87112f3 commit 75e63fa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
6 changes: 3 additions & 3 deletions public/js/helpers/humanize_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ function round (value, precision) {
var humanize = {
fmtPercentage: function (val) {
var sign = '+'
var color = 'green'
var cssClass = 'text-success'
if (val < 1) {
sign = ''
color = 'red'
cssClass = 'text-danger'
}
sign = sign + val.toFixed(2)
return '<span style="color:' + color + ';">' + sign + ' % </span>'
return `<span class="${cssClass}">${sign} % </span>`
},
decimalParts: function (v, useCommas, precision, lgDecimals) {
if (isNaN(precision) || precision > 8) {
Expand Down
11 changes: 11 additions & 0 deletions public/scss/typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,14 @@ a.grayed {
.attention:hover {
color: #f55;
}

// numbers
.decimal-parts {
.int {
padding-right: 0.1em;
}

.dot {
padding-right: 0.1em;
}
}
4 changes: 2 additions & 2 deletions views/extras.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@
{{end}}

{{define "fmtPercentage"}}
{{if gt . 0.0}}<span style="color:green">+{{printf "%.2f" .}} %</span>
{{else}}<span style="color:red">{{printf "%.2f" .}} %</span>{{end}}
{{if gt . 0.0}}<span class="text-success">+{{printf "%.2f" .}} %</span>
{{else}}<span class="text-danger">{{printf "%.2f" .}} %</span>{{end}}
{{end}}

{{define "listViewRouting"}}
Expand Down
7 changes: 4 additions & 3 deletions views/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="row mt-1">
<div class="col-6 col-sm-4 col-md-6 col-lg-4 mb-3 mb-sm-2 mb-md-3 mb-lg-3">
<div class="fs13 text-secondary">
<a class="no-underline" href="/charts#ticket-price">Current Ticket Price</a>
<a class="no-underline" href="/charts?chart=ticket-price">Current Ticket Price</a>
</div>
<div class="mono lh1rem fs14-decimal fs24 pt-1 pb-1 d-flex align-items-baseline">
<span data-target="homepage.blocksdiff">{{template "decimalParts" (float64AsDecimalParts .StakeDiff 8 false 2)}}</span>
Expand Down Expand Up @@ -61,6 +61,7 @@
<div class="fs12 lh1rem text-black-50">
<span data-target="homepage.ticketReward">{{template "fmtPercentage" .TicketReward}}</span> per ~{{.RewardPeriod}}
</div>
<div class="fs12 lh1rem text-black-50" title="Annual Stake Rewards"><span class="text-success">+{{printf "%.2f" .ASR}} %</span> per year</div>
</div>
<div class="col-6 col-sm-4 col-md-6 col-lg-4 mb-3 mb-sm-2 mb-md-3 mb-lg-3">
<div class="fs13 text-secondary">Next Ticket Price Change</div>
Expand Down Expand Up @@ -122,7 +123,7 @@
<div class="row mt-1">
<div class="col-6 col-sm-4 col-md-6 col-lg-4 mb-3 mb-sm-2 mb-md-3 mb-lg-3">
<div class="fs13 text-secondary">
<a class="no-underline" href="/charts#pow-difficulty">Difficulty</a>
<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-target="homepage.difficulty">{{template "decimalParts" (float64AsDecimalParts (divideFloat .Difficulty 1000000.0) 0 true)}}</span>
Expand Down Expand Up @@ -189,7 +190,7 @@
<div class="row mt-1">
{{if .DevFund}}
<div class="col-6 col-sm-4 col-md-6 col-lg-4 mb-3 mb-sm-2 mb-md-3 mb-lg-3">
<div class="fs13 text-secondary"><a href="/address/{{.DevAddress}}">Treasury</a></div>
<div class="fs13 text-secondary"><a href="/address/{{.DevAddress}}?n=20&start=0&txntype=merged">Treasury</a></div>
<div class="mono lh1rem fs14-decimal fs24 p03rem0 d-flex align-items-baseline">
<span data-target="homepage.devFund">
{{template "decimalParts" (float64AsDecimalParts (toFloat64Amount .DevFund) 0 true)}}
Expand Down

0 comments on commit 75e63fa

Please sign in to comment.