Fix long NFT id

pull/3424/head
Victor Baranov 4 years ago
parent 14a0c32fed
commit cf1656f407
  1. 1
      CHANGELOG.md
  2. 4
      apps/block_scout_web/assets/css/components/_tile.scss
  3. 16
      apps/block_scout_web/assets/css/theme/_dai_variables.scss
  4. 4
      apps/block_scout_web/assets/css/theme/_dark-theme.scss
  5. 9
      apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex
  6. 10
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_token_transfer.html.eex
  7. 8
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_total_transfers.html.eex
  8. 27
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  9. 11
      apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex
  10. 14
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  11. 2
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  12. 16
      apps/block_scout_web/priv/gettext/default.pot
  13. 16
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -15,6 +15,7 @@
### Fixes ### Fixes
- [#3424](https://github.com/poanetwork/blockscout/pull/3424) - Fix display of long NFT IDs
- [#3422](https://github.com/poanetwork/blockscout/pull/3422) - Fix contract reader: tuple type - [#3422](https://github.com/poanetwork/blockscout/pull/3422) - Fix contract reader: tuple type
- [#3408](https://github.com/poanetwork/blockscout/pull/3408) - Fix (total) difficulty display - [#3408](https://github.com/poanetwork/blockscout/pull/3408) - Fix (total) difficulty display
- [#3401](https://github.com/poanetwork/blockscout/pull/3401) - Fix procedure of marking internal transactions as failed - [#3401](https://github.com/poanetwork/blockscout/pull/3401) - Fix procedure of marking internal transactions as failed

@ -171,6 +171,10 @@ $tile-body-a-color: #5959d8 !default;
color: $tile-body-a-color; color: $tile-body-a-color;
} }
a[data-test=token_link] {
color: $tile-body-a-color;
}
.tile-body { .tile-body {
a { a {
color: $tile-body-a-color; color: $tile-body-a-color;

@ -48,6 +48,7 @@ $btn-contract-color: $secondary;
$tile-body-a-color: $secondary; $tile-body-a-color: $secondary;
$tile-type-block-color: $secondary; $tile-type-block-color: $secondary;
$tile-type-progress-bar-color: $secondary; $tile-type-progress-bar-color: $secondary;
.tile a:hover,
a.tile-title { color: $secondary !important; } a.tile-title { color: $secondary !important; }
.card-body { .card-body {
a:not(.dropdown-item):not(.button):not([data-test=address_hash_link]):not(.alert-link):not([data-test=token_link]):not(#dropdown-tokens):not(.btn-line):not(.page-link) { a:not(.dropdown-item):not(.button):not([data-test=address_hash_link]):not(.alert-link):not([data-test=token_link]):not(#dropdown-tokens):not(.btn-line):not(.page-link) {
@ -97,7 +98,10 @@ $dark-secondary: #93d7ff;
$dark-primary-alternate: #15bba6; $dark-primary-alternate: #15bba6;
$dark-tertiary: #5a77ff; $dark-tertiary: #5a77ff;
.dark-theme-applied .tile .tile-body a, .dark-theme-applied .tile span[data-address-hash] { .dark-theme-applied .tile .tile-body a,
.dark-theme-applied .tile a:hover,
.dark-theme-applied .tile span[data-address-hash],
.dark-theme-applied .tile a[data-test=token_link] {
color: $dark-tertiary!important; color: $dark-tertiary!important;
} }
@ -119,3 +123,13 @@ $dark-tertiary: #5a77ff;
.dark-theme-applied .btn-line:hover { .dark-theme-applied .btn-line:hover {
color: $additional-font!important; color: $additional-font!important;
} }
.dark-theme-applied .card-body {
a:not(.dropdown-item):not(.button):not([data-test=address_hash_link]):not(.alert-link):not([data-test=token_link]):not(#dropdown-tokens):not(.btn-line):not(.page-link) {
color: $dark-tertiary;
&:hover {
color: $dark-tertiary;
}
}
}

@ -197,7 +197,9 @@ $dark-stakes-banned-background: #3e314c;
color: $labels-dark; color: $labels-dark;
} }
.tile .tile-body a, .tile .tile-body a,
.tile span[data-address-hash] { color: $dark-primary; } .tile a:hover,
.tile span[data-address-hash],
.tile a[data-test=token_link] { color: $dark-primary; }
.fade-up-blocks-chain .tile-type-block-animation .tile-type-line-up { .fade-up-blocks-chain .tile-type-block-animation .tile-type-line-up {
background-color: $dark-primary; background-color: $dark-primary;
} }

@ -39,14 +39,7 @@
</span> </span>
<span class="d-flex flex-md-row flex-column mt-3 mt-md-0"> <span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
<span class="tile-title"> <span class="tile-title">
<%= case token_transfer_amount(@token_transfer) do %> <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, @token_transfer) %>
<% {:ok, :erc721_instance} -> %>
<%= "TokenID ["%><%= link(@token_transfer.token_id, to: token_instance_path(@conn, :show, Address.checksum(@token_transfer.token.contract_address_hash), to_string(@token_transfer.token_id))) %><%= "]" %>
<% {:ok, value} -> %>
<%= value %>
<% end %>
<%= " "%>
<%= link(@token_transfer.token.symbol, to: token_path(BlockScoutWeb.Endpoint, :show, @token_transfer.token.contract_address_hash)) %>
</span> </span>
</span> </span>
</div> </div>

@ -19,13 +19,7 @@
<%= @token_transfer |> BlockScoutWeb.AddressView.address_partial_selector(:to, @address, true) |> BlockScoutWeb.RenderHelpers.render_partial() %> <%= @token_transfer |> BlockScoutWeb.AddressView.address_partial_selector(:to, @address, true) |> BlockScoutWeb.RenderHelpers.render_partial() %>
</span> </span>
</span> </span>
<span class="col-xs-12 col-lg-4 ml-3 ml-sm-0 text-truncate"> <span class="col-xs-12 col-lg-4 ml-3 ml-sm-0">
<%= case token_transfer_amount(@token_transfer) do %> <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, @token_transfer) %>
<% {:ok, :erc721_instance} -> %>
<%= "TokenID ["%><%= link(@token_transfer.token_id, to: token_instance_path(BlockScoutWeb.Endpoint, :show, @token_transfer.token.contract_address_hash, to_string(@token_transfer.token_id))) %><%= "] " %>
<% {:ok, value} -> %>
<%= "#{value} " %>
<% end %>
<%= link(token_symbol(@token_transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, @token_transfer.token.contract_address_hash)) %>
</span> </span>
</div> </div>

@ -0,0 +1,8 @@
<%= case token_transfer_amount(@transfer) do %>
<% {:ok, :erc721_instance} -> %>
<%= "TokenID ["%><%= link(short_token_id(@transfer.token_id, 30), to: token_instance_path(BlockScoutWeb.Endpoint, :show, @transfer.token.contract_address_hash, to_string(@transfer.token_id)), "data-test": "token_link") %><%= "]" %>
<% {:ok, value} -> %>
<%= value %>
<% end %>
<%= " "%>
<%= link(token_symbol(@transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, @transfer.token.contract_address_hash), "data-test": "token_link") %>

@ -221,14 +221,7 @@
<div class="text-right"> <div class="text-right">
<%= for transfer <- token_transfers do %> <%= for transfer <- token_transfers do %>
<h3 class="address-balance-text"> <h3 class="address-balance-text">
<%= case token_transfer_amount(transfer) do %> <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, transfer) %>
<% {:ok, :erc721_instance} -> %>
<%= "TokenID ["%><%= link(transfer.token_id, to: token_instance_path(@conn, :show, transfer.token.contract_address_hash, to_string(transfer.token_id)), "data-test": "token_link") %><%= "]" %>
<% {:ok, value} -> %>
<%= value %>
<% end %>
<%= " "%>
<%= link(token_symbol(transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, transfer.token.contract_address_hash), "data-test": "token_link") %>
</h3> </h3>
<% end %> <% end %>
</div> </div>
@ -239,14 +232,7 @@
<div class="text-right"> <div class="text-right">
<%= for transfer <- mintings do %> <%= for transfer <- mintings do %>
<h3 class="address-balance-text"> <h3 class="address-balance-text">
<%= case token_transfer_amount(transfer) do %> <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, transfer) %>
<% {:ok, :erc721_instance} -> %>
<%= "TokenID ["%><%= link(transfer.token_id, to: token_instance_path(@conn, :show, transfer.token.contract_address_hash, to_string(transfer.token_id)), "data-test": "token_link") %><%= "]" %>
<% {:ok, value} -> %>
<%= value %>
<% end %>
<%= " "%>
<%= link(token_symbol(transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, transfer.token.contract_address_hash), "data-test": "token_link") %>
</h3> </h3>
<% end %> <% end %>
</div> </div>
@ -257,14 +243,7 @@
<div class="text-right"> <div class="text-right">
<%= for transfer <- burnings do %> <%= for transfer <- burnings do %>
<h3 class="address-balance-text"> <h3 class="address-balance-text">
<%= case token_transfer_amount(transfer) do %> <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, transfer) %>
<% {:ok, :erc721_instance} -> %>
<%= "TokenID ["%><%= link(transfer.token_id, to: token_instance_path(@conn, :show, transfer.token.contract_address_hash, to_string(transfer.token_id)), "data-test": "token_link") %><%= "]" %>
<% {:ok, value} -> %>
<%= value %>
<% end %>
<%= " "%>
<%= link(token_symbol(transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, transfer.token.contract_address_hash), "data-test": "token_link") %>
</h3> </h3>
<% end %> <% end %>
</div> </div>

@ -19,15 +19,8 @@
<%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.to_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address), use_custom_tooltip: false %> <%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.to_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address), use_custom_tooltip: false %>
</span> </span>
<span class="tile-title text-truncate"> <span class="tile-title">
<%= case token_transfer_amount(@token_transfer) do%> <%= render BlockScoutWeb.TransactionView, "_total_transfers.html", Map.put(assigns, :transfer, @token_transfer) %>
<% {:ok, :erc721_instance} -> %>
<%= "TokenID2 ["%><%= link(@token_transfer.token_id, to: token_instance_path(@conn, :show, @token_transfer.token.contract_address_hash, to_string(@token_transfer.token_id))) %><%= "]" %>
<% {:ok, value} -> %>
<%= value %>
<% end %>
<%= " "%>
<%= link(token_symbol(@token_transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, @token_transfer.token.contract_address_hash)) %>
</span> </span>
</div> </div>
</div> </div>

@ -367,6 +367,20 @@ defmodule BlockScoutWeb.AddressView do
end end
def short_contract_name(name, max_length) do def short_contract_name(name, max_length) do
short_string(name, max_length)
end
def short_token_id(%Decimal{} = token_id, max_length) do
token_id
|> Decimal.to_string()
|> short_string(max_length)
end
def short_token_id(token_id, max_length) do
short_string(token_id, max_length)
end
def short_string(name, max_length) do
part_length = Kernel.trunc(max_length / 4) part_length = Kernel.trunc(max_length / 4)
if String.length(name) <= max_length, if String.length(name) <= max_length,

@ -11,7 +11,7 @@ defmodule BlockScoutWeb.TransactionView do
alias Timex.Duration alias Timex.Duration
import BlockScoutWeb.Gettext import BlockScoutWeb.Gettext
import BlockScoutWeb.AddressView, only: [from_address_hash: 1] import BlockScoutWeb.AddressView, only: [from_address_hash: 1, short_token_id: 2]
import BlockScoutWeb.Tokens.Helpers import BlockScoutWeb.Tokens.Helpers
@tabs ["token-transfers", "internal-transactions", "logs", "raw-trace"] @tabs ["token-transfers", "internal-transactions", "logs", "raw-trace"]

@ -186,7 +186,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/block/_link.html.eex:2 #: lib/block_scout_web/templates/block/_link.html.eex:2
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:28 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:28
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:57 #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:50
msgid "Block #%{number}" msgid "Block #%{number}"
msgstr "" msgstr ""
@ -641,7 +641,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:205 #: lib/block_scout_web/templates/transaction/overview.html.eex:205
#: lib/block_scout_web/templates/transaction/overview.html.eex:279 #: lib/block_scout_web/templates/transaction/overview.html.eex:258
#: lib/block_scout_web/views/wei_helpers.ex:78 #: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether" msgid "Ether"
msgstr "" msgstr ""
@ -998,7 +998,7 @@ msgid "License ID"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:307 #: lib/block_scout_web/templates/transaction/overview.html.eex:286
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
@ -1532,7 +1532,7 @@ msgid "Use the search box to find a hosted network, or select from the list of a
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:301 #: lib/block_scout_web/templates/transaction/overview.html.eex:280
msgid "Used" msgid "Used"
msgstr "" msgstr ""
@ -1563,7 +1563,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:205 #: lib/block_scout_web/templates/transaction/overview.html.eex:205
#: lib/block_scout_web/templates/transaction/overview.html.eex:279 #: lib/block_scout_web/templates/transaction/overview.html.eex:258
msgid "Value" msgid "Value"
msgstr "" msgstr ""
@ -1743,7 +1743,7 @@ msgid "Decimals"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:297 #: lib/block_scout_web/templates/transaction/overview.html.eex:276
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""
@ -1874,7 +1874,7 @@ msgid "Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:256 #: lib/block_scout_web/templates/transaction/overview.html.eex:242
msgid " Token Burning" msgid " Token Burning"
msgstr "" msgstr ""
@ -1886,7 +1886,7 @@ msgid "Token Burning"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:238 #: lib/block_scout_web/templates/transaction/overview.html.eex:231
msgid " Token Minting" msgid " Token Minting"
msgstr "" msgstr ""

@ -186,7 +186,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/block/_link.html.eex:2 #: lib/block_scout_web/templates/block/_link.html.eex:2
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:28 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:28
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:57 #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:50
msgid "Block #%{number}" msgid "Block #%{number}"
msgstr "" msgstr ""
@ -641,7 +641,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:205 #: lib/block_scout_web/templates/transaction/overview.html.eex:205
#: lib/block_scout_web/templates/transaction/overview.html.eex:279 #: lib/block_scout_web/templates/transaction/overview.html.eex:258
#: lib/block_scout_web/views/wei_helpers.ex:78 #: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether" msgid "Ether"
msgstr "" msgstr ""
@ -998,7 +998,7 @@ msgid "License ID"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:307 #: lib/block_scout_web/templates/transaction/overview.html.eex:286
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
@ -1532,7 +1532,7 @@ msgid "Use the search box to find a hosted network, or select from the list of a
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:301 #: lib/block_scout_web/templates/transaction/overview.html.eex:280
msgid "Used" msgid "Used"
msgstr "" msgstr ""
@ -1563,7 +1563,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:205 #: lib/block_scout_web/templates/transaction/overview.html.eex:205
#: lib/block_scout_web/templates/transaction/overview.html.eex:279 #: lib/block_scout_web/templates/transaction/overview.html.eex:258
msgid "Value" msgid "Value"
msgstr "" msgstr ""
@ -1743,7 +1743,7 @@ msgid "Decimals"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:297 #: lib/block_scout_web/templates/transaction/overview.html.eex:276
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""
@ -1874,7 +1874,7 @@ msgid "Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:256 #: lib/block_scout_web/templates/transaction/overview.html.eex:242
msgid " Token Burning" msgid " Token Burning"
msgstr "" msgstr ""
@ -1886,7 +1886,7 @@ msgid "Token Burning"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:238 #: lib/block_scout_web/templates/transaction/overview.html.eex:231
msgid " Token Minting" msgid " Token Minting"
msgstr "" msgstr ""

Loading…
Cancel
Save