Merge pull request #2164 from poanetwork/ab-fix-large-numbers-balance

fix large number in balance view card
pull/2199/head
Victor Baranov 6 years ago committed by GitHub
commit 0fffc425b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 1
      apps/block_scout_web/assets/js/lib/currency.js
  3. 12
      apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex
  4. 6
      apps/block_scout_web/priv/gettext/default.pot
  5. 6
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -6,6 +6,7 @@
- [#2151](https://github.com/poanetwork/blockscout/pull/2151) - hide dropdown menu then other networks list is empty
### Fixes
- [#2164](https://github.com/poanetwork/blockscout/pull/2164) - fix large numbers in balance view card
- [#2155](https://github.com/poanetwork/blockscout/pull/2155) - fix pending transaction query
- [#2183](https://github.com/poanetwork/blockscout/pull/2183) - tile content aligning for mobile resolution fix, dai logo fix
- [#2162](https://github.com/poanetwork/blockscout/pull/2162) - contract creation tile color changed

@ -18,6 +18,7 @@ function formatCurrencyValue (value, symbol) {
if (value < 0.000001) return `${window.localized['Less than']} ${symbol}0.000001`
if (value < 1) return `${symbol}${numeral(value).format('0.000000')}`
if (value < 100000) return `${symbol}${numeral(value).format('0,0.00')}`
if (value > 1000000000) return `${symbol}${numeral(value).format('0.000e+0')}`
return `${symbol}${numeral(value).format('0,0')}`
}

@ -57,13 +57,19 @@ defmodule BlockScoutWeb.WeiHelpers do
converted_value =
wei
|> Wei.to(unit)
|> Cldr.Number.to_string!(format: "#,##0.##################")
formatted_value =
if Decimal.cmp(converted_value, 1_000_000_000_000) == :gt do
Cldr.Number.to_string!(converted_value, format: "0.###E+0")
else
Cldr.Number.to_string!(converted_value, format: "#,##0.##################")
end
if Keyword.get(options, :include_unit_label, true) do
display_unit = display_unit(unit)
"#{converted_value} #{display_unit}"
"#{formatted_value} #{display_unit}"
else
converted_value
formatted_value
end
end

@ -378,7 +378,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/overview.html.eex:192
#: lib/block_scout_web/views/wei_helpers.ex:72
#: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether"
msgstr ""
@ -436,7 +436,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/views/block_view.ex:20
#: lib/block_scout_web/views/wei_helpers.ex:71
#: lib/block_scout_web/views/wei_helpers.ex:77
msgid "Gwei"
msgstr ""
@ -982,7 +982,7 @@ msgid "Wallet addresses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/wei_helpers.ex:70
#: lib/block_scout_web/views/wei_helpers.ex:76
msgid "Wei"
msgstr ""

@ -378,7 +378,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:30
#: lib/block_scout_web/templates/transaction/overview.html.eex:192
#: lib/block_scout_web/views/wei_helpers.ex:72
#: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether"
msgstr "POA"
@ -436,7 +436,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/views/block_view.ex:20
#: lib/block_scout_web/views/wei_helpers.ex:71
#: lib/block_scout_web/views/wei_helpers.ex:77
msgid "Gwei"
msgstr ""
@ -982,7 +982,7 @@ msgid "Wallet addresses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/wei_helpers.ex:70
#: lib/block_scout_web/views/wei_helpers.ex:76
msgid "Wei"
msgstr ""

Loading…
Cancel
Save