Merge pull request #253 from poanetwork/ui-bug-fixes

Ui bug fixes
pull/281/head
Jimmy Lauzau 7 years ago committed by GitHub
commit 1e449cca99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apps/explorer_web/assets/css/_code.scss
  2. 6
      apps/explorer_web/assets/css/_typography.scss
  3. 5
      apps/explorer_web/assets/css/components/_header.scss
  4. 4
      apps/explorer_web/lib/explorer_web/controllers/transaction_controller.ex
  5. 20
      apps/explorer_web/lib/explorer_web/templates/address/_link.html.eex
  6. 4
      apps/explorer_web/lib/explorer_web/templates/address_internal_transaction/index.html.eex
  7. 4
      apps/explorer_web/lib/explorer_web/templates/address_transaction/index.html.eex
  8. 4
      apps/explorer_web/lib/explorer_web/templates/block_transaction/index.html.eex
  9. 2
      apps/explorer_web/lib/explorer_web/templates/chain/_blocks.html.eex
  10. 4
      apps/explorer_web/lib/explorer_web/templates/chain/_transactions.html.eex
  11. 4
      apps/explorer_web/lib/explorer_web/templates/layout/_topnav.html.eex
  12. 4
      apps/explorer_web/lib/explorer_web/templates/pending_transaction/index.html.eex
  13. 4
      apps/explorer_web/lib/explorer_web/templates/transaction/index.html.eex
  14. 2
      apps/explorer_web/lib/explorer_web/templates/transaction/overview.html.eex
  15. 4
      apps/explorer_web/lib/explorer_web/templates/transaction_internal_transaction/index.html.eex
  16. 3
      apps/explorer_web/lib/explorer_web/views/address_view.ex
  17. 4
      apps/explorer_web/priv/gettext/default.pot
  18. 4
      apps/explorer_web/priv/gettext/en/LC_MESSAGES/default.po
  19. 14
      apps/explorer_web/test/explorer_web/views/address_view_test.exs

@ -5,3 +5,7 @@
word-break: break-all;
}
}
.pre-scrollable-shorty {
max-height: $pre-scrollable-max-height / 7;
}

@ -41,12 +41,12 @@ p {
a {
text-decoration: none;
color: $gray-800;
font-size: 12px;
color: $primary;
font-size: 13px;
&:hover,
&:focus {
text-decoration: none;
text-decoration: underline;
}
}
.monospace {

@ -115,3 +115,8 @@ input::-webkit-input-placeholder {
.topnav-dropdown-items {
padding-left: 12px;
}
.topnav-nav-link {
margin-top: 3px;
color: $gray-800;
}

@ -28,7 +28,9 @@ defmodule ExplorerWeb.TransactionController do
Keyword.merge(
[
necessity_by_association: %{
block: :required
block: :required,
from_address: :optional,
to_address: :optional
},
paging_options: @default_paging_options
],

@ -1,14 +1,18 @@
<div class="address-link">
<%= if @address_hash do %>
<%= link to: address_path(@conn, :show, @conn.assigns.locale, @address_hash),
"data-toggle": "tooltip",
"data-placement": "top",
class: "address-link__font",
title: @address_hash do %>
<%= if @address do %>
<%= link to: address_path(@conn, :show, @conn.assigns.locale, @address),
"data-toggle": "tooltip",
"data-placement": "top",
class: "address-link__font",
title: @address do %>
<%= if contract?(@address) do %>
<i class="address-link__type fas fa-file"></i>
<% else %>
<i class="address-link__type fas fa-address-card"></i>
<%= @address_hash |> hash() |> String.slice(0..3) %><i class="fas fa-ellipsis-v address-link__seperator"></i><%= @address_hash |> hash() |> String.slice(-4..-1) %>
<% end %>
<%= @address |> hash() |> String.slice(0..3) %><i class="fas fa-ellipsis-v address-link__seperator"></i><%= @address |> hash() |> String.slice(-4..-1) %>
<% end %>
<button class="address-link__copy-button" data-clipboard-text="<%= @address_hash %>" aria-label="copy address">
<button class="address-link__copy-button" data-clipboard-text="<%= @address %>" aria-label="copy address">
<i class="fa fa-copy"></i>
</button>
<% end %>

@ -96,10 +96,10 @@
</td>
<td><%= ExplorerWeb.BlockView.age(internal_transaction.transaction.block) %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.from_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.from_address %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.to_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.to_address %>
</td>
<td><%= ExplorerWeb.TransactionView.value(internal_transaction, include_label: false) %></td>
</tr>

@ -103,11 +103,11 @@
</td>
<td><%= transaction.block.timestamp |> Timex.from_now %></td>
<td class="address-cell">
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
</td>
<td class="u-text-center"><i class="fas fa-arrow-circle-right"></i></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
</td>
<td><%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %></td>
<td><%= ExplorerWeb.TransactionView.formatted_fee(transaction, denomination: :ether) %></td>

@ -164,11 +164,11 @@
<%= transaction.block.timestamp |> Timex.from_now %>
</td>
<td class="address-cell">
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
</td>
<td class="u-text-center"><i class="fas fa-arrow-circle-right"></i></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
</td>
<td>
<%= ExplorerWeb.TransactionView.value(transaction) %>

@ -21,7 +21,7 @@
<td><%= block.transactions |> Enum.count %></td>
<td><%= block.gas_used |> Cldr.Number.to_string! %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: block.miner_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: block.miner %>
</td>
</tr>
<% end %>

@ -17,10 +17,10 @@
<%= render ExplorerWeb.TransactionView, "_link.html", conn: @conn, transaction: transaction %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
</td>
<td><%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %> </td>
<td><%= transaction.block.timestamp |> Timex.from_now() %></td>

@ -16,13 +16,13 @@
<% end %>
</li>
<li calss="nav-item">
<%= link to: block_path(@conn, :index, Gettext.get_locale), class: "nav-link" do %>
<%= link to: block_path(@conn, :index, Gettext.get_locale), class: "nav-link topnav-nav-link" do %>
<img src="<%= static_path(@conn, "/images/block.svg") %>" />
<%= gettext("Blocks") %>
<% end %>
</li>
<li calss="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="topnav-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="<%= static_path(@conn, "/images/transaction.svg") %>" />
<%= gettext("Transactions") %>
</a>

@ -50,10 +50,10 @@
</td>
<td><%= last_seen(transaction) %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
</td>
<td>
<%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %>

@ -59,10 +59,10 @@
<%= transaction.block.timestamp %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.from_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.from_address %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: transaction.to_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: transaction.to_address %>
</td>
<td>
<%= ExplorerWeb.TransactionView.value(transaction, include_label: false) %>

@ -180,7 +180,7 @@
<td title="<%= @transaction.input %>">
<div class="card bg-light">
<div class="card-body">
<pre class="pre-scrollable pre-wrap mb-0">
<pre class="pre-scrollable pre-scrollable-shorty pre-wrap mb-0">
<code>
<%= @transaction.input %>
</code>

@ -38,10 +38,10 @@
<tr>
<td><%= internal_transaction.call_type %></td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.from_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.from_address %>
</td>
<td>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address_hash: internal_transaction.to_address_hash %>
<%= render ExplorerWeb.AddressView, "_link.html", conn: @conn, address: internal_transaction.to_address %>
</td>
<td><%= ExplorerWeb.TransactionView.value(internal_transaction, include_label: false) %></td>
<td><%= ExplorerWeb.TransactionView.gas(internal_transaction) %></td>

@ -2,7 +2,6 @@ defmodule ExplorerWeb.AddressView do
use ExplorerWeb, :view
alias Explorer.Chain.{Address, Wei}
alias Explorer.Chain.Hash
alias Explorer.ExchangeRates.Token
alias ExplorerWeb.ExchangeRates.USD
@ -42,7 +41,7 @@ defmodule ExplorerWeb.AddressView do
end
end
def hash(%Hash{} = hash) do
def hash(%Address{hash: hash}) do
to_string(hash)
end

@ -155,7 +155,7 @@ msgstr ""
#: lib/explorer_web/templates/address/overview.html.eex:11
#: lib/explorer_web/templates/transaction_log/index.html.eex:29
#: lib/explorer_web/views/address_view.ex:18
#: lib/explorer_web/views/address_view.ex:17
msgid "Address"
msgstr ""
@ -496,7 +496,7 @@ msgstr ""
msgid "Contract"
msgstr ""
#: lib/explorer_web/views/address_view.ex:16
#: lib/explorer_web/views/address_view.ex:15
msgid "Contract Address"
msgstr ""

@ -167,7 +167,7 @@ msgstr "%{count} transactions in this block"
#: lib/explorer_web/templates/address/overview.html.eex:11
#: lib/explorer_web/templates/transaction_log/index.html.eex:29
#: lib/explorer_web/views/address_view.ex:18
#: lib/explorer_web/views/address_view.ex:17
msgid "Address"
msgstr "Address"
@ -508,7 +508,7 @@ msgstr ""
msgid "Contract"
msgstr ""
#: lib/explorer_web/views/address_view.ex:16
#: lib/explorer_web/views/address_view.ex:15
msgid "Contract Address"
msgstr ""

@ -1,9 +1,23 @@
defmodule ExplorerWeb.AddressViewTest do
use ExplorerWeb.ConnCase, async: true
alias Explorer.Chain.Data
alias ExplorerWeb.AddressView
alias Explorer.ExchangeRates.Token
describe "contract?/1" do
test "with a smart contract" do
{:ok, code} = Data.cast("0x000000000000000000000000862d67cb0773ee3f8ce7ea89b328ffea861ab3ef")
address = insert(:address, contract_code: code)
assert AddressView.contract?(address)
end
test "with an account" do
address = insert(:address, contract_code: nil)
refute AddressView.contract?(address)
end
end
describe "formatted_usd/2" do
test "without a fetched_balance returns nil" do
address = build(:address, fetched_balance: nil)

Loading…
Cancel
Save