diff --git a/CHANGELOG.md b/CHANGELOG.md index c8caf7d10a..d2f63b453c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex index 2e396b2b50..4d61ff571b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex @@ -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() diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index df65d5a225..3f33bae0fb 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -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 "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index df65d5a225..3f33bae0fb 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -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 ""