Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFT instance: link to the app #3279

Merged
merged 5 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Current

### Features
- [#3279](https://github.com/poanetwork/blockscout/pull/3279) - NFT instance: link to the app
- [#3278](https://github.com/poanetwork/blockscout/pull/3278) - Support of fetching of NFT tokens metadata from IPFS
- [#3273](https://github.com/poanetwork/blockscout/pull/3273) - Update token metadata at burn/mint events
- [#3268](https://github.com/poanetwork/blockscout/pull/3268) - Token total supply on-demand fetcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@

<div class="d-flex flex-column flex-md-row justify-content-start text-muted">
<div class="d-flex flex-row justify-content-start text-muted">
<%= if external_url(@token_instance.instance) do %>
<span class="mr-4">
<a data-test="external_url" href=<%=external_url(@token_instance.instance) %> target="_blank">
View In App <span class="external-token-icon"><%= render BlockScoutWeb.IconsView, "_external_link.html" %></span>
</a>
</span>
<% end %>
<span class="mr-4"> <%= @token.type %> </span>
<span class="mr-4"><%= @total_token_transfers %> <%= gettext "Transfers" %></span>
<%= if decimals?(@token) do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
if String.trim(result) == "", do: image_src(nil), else: result
end

def external_url(nil), do: nil

def external_url(instance) do
result =
if instance.metadata && instance.metadata["external_url"] do
instance.metadata["external_url"]
else
external_url(nil)
end

if String.trim(result) == "", do: external_url(nil), else: result
end

def total_supply_usd(token) do
tokens = CurrencyHelpers.divide_decimals(token.total_supply, token.decimals)
price = token.usd_value
Expand Down
14 changes: 7 additions & 7 deletions apps/block_scout_web/priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ msgstr ""
#: 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:346
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:98
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:111
#: lib/block_scout_web/views/tokens/overview_view.ex:37
#: lib/block_scout_web/views/transaction_view.ex:394
msgid "Token Transfers"
Expand Down Expand Up @@ -1175,7 +1175,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:133
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:101
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:116
msgid "QR Code"
Expand Down Expand Up @@ -1716,8 +1716,8 @@ msgstr ""
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:134
#: lib/block_scout_web/templates/address/overview.html.eex:142
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:95
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:103
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:110
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:125
msgid "Close"
Expand All @@ -1735,7 +1735,7 @@ msgid "Copy Token ID"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:69
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:76
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74
msgid "Decimals"
msgstr ""
Expand Down Expand Up @@ -1768,7 +1768,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:99
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:112
msgid "Metadata"
msgstr ""

Expand All @@ -1783,7 +1783,7 @@ msgid "Total transactions"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:67
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:74
msgid "Transfers"
msgstr ""

Expand Down
14 changes: 7 additions & 7 deletions apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ msgstr ""
#: 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:346
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:98
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:111
#: lib/block_scout_web/views/tokens/overview_view.ex:37
#: lib/block_scout_web/views/transaction_view.ex:394
msgid "Token Transfers"
Expand Down Expand Up @@ -1175,7 +1175,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:133
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:101
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:116
msgid "QR Code"
Expand Down Expand Up @@ -1716,8 +1716,8 @@ msgstr ""
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:134
#: lib/block_scout_web/templates/address/overview.html.eex:142
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:95
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:103
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:110
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:125
msgid "Close"
Expand All @@ -1735,7 +1735,7 @@ msgid "Copy Token ID"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:69
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:76
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74
msgid "Decimals"
msgstr ""
Expand Down Expand Up @@ -1768,7 +1768,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:99
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:112
msgid "Metadata"
msgstr ""

Expand All @@ -1783,7 +1783,7 @@ msgid "Total transactions"
msgstr ""

#, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:67
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:74
msgid "Transfers"
msgstr ""

Expand Down