Token instance image fix

pull/5020/head
Viktor Baranov 3 years ago
parent 33d636d1a1
commit 5be5c351e8
  1. 1
      CHANGELOG.md
  2. 10
      apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex
  3. 4
      apps/block_scout_web/priv/gettext/default.pot
  4. 4
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -8,6 +8,7 @@
- [#4931](https://github.com/blockscout/blockscout/pull/4931) - Web3 modal with Wallet Connect for Write contract page and Staking Dapp
### Fixes
- [#5020](https://github.com/blockscout/blockscout/pull/5020) - Token instance image display imrovement
- [#5019](https://github.com/blockscout/blockscout/pull/5019) - Fix fetch_last_token_balance function termination
- [#5011](https://github.com/blockscout/blockscout/pull/5011) - Fix `0x0` implementation address
- [#5008](https://github.com/blockscout/blockscout/pull/5008) - Extend decimals cap in format_according_to_decimals up to 24

@ -12,6 +12,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1, blockscout_url: 2]
@tabs ["token-transfers", "metadata"]
@stub_image "/images/controller.svg"
def token_name?(%Token{name: nil}), do: false
def token_name?(%Token{name: _}), do: true
@ -22,7 +23,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
def total_supply?(%Token{total_supply: nil}), do: false
def total_supply?(%Token{total_supply: _}), do: true
def media_src(nil), do: "/images/controller.svg"
def media_src(nil), do: @stub_image
def media_src(instance) do
result =
@ -150,10 +151,17 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
|> tab_name()
end
defp retrieve_image(image) when is_nil(image), do: @stub_image
defp retrieve_image(image) when is_map(image) do
image["description"]
end
defp retrieve_image(image) when is_list(image) do
image_url = image |> Enum.at(0)
retrieve_image(image_url)
end
defp retrieve_image(image_url) do
image_url
|> URI.encode()

@ -1534,7 +1534,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 lib/block_scout_web/views/tokens/instance/overview_view.ex:179
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 lib/block_scout_web/views/tokens/instance/overview_view.ex:187
msgid "Metadata"
msgstr ""
@ -2582,7 +2582,7 @@ msgstr ""
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:3
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 lib/block_scout_web/views/address_view.ex:348
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:178 lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:186 lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/transaction_view.ex:511
msgid "Token Transfers"
msgstr ""

@ -1534,7 +1534,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 lib/block_scout_web/views/tokens/instance/overview_view.ex:179
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 lib/block_scout_web/views/tokens/instance/overview_view.ex:187
msgid "Metadata"
msgstr ""
@ -2582,7 +2582,7 @@ msgstr ""
#: lib/block_scout_web/templates/tokens/instance/transfer/index.html.eex:16 lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:3
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:14 lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 lib/block_scout_web/views/address_view.ex:348
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:178 lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:186 lib/block_scout_web/views/tokens/overview_view.ex:41
#: lib/block_scout_web/views/transaction_view.ex:511
msgid "Token Transfers"
msgstr ""

Loading…
Cancel
Save