From ae64db5c721a52f3cab902a07eaecc8e88386687 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 30 Oct 2020 14:45:16 +0300 Subject: [PATCH] Spread Circles theme on all created contracts --- .../custom_contracts/_circles-theme.scss | 23 --- .../templates/address/overview.html.eex | 5 + .../templates/layout/app.html.eex | 60 ++++++- .../tokens/overview/_details.html.eex | 6 + .../templates/transaction/overview.html.eex | 6 + .../lib/block_scout_web/views/layout_view.ex | 3 + .../views/tokens/overview_view.ex | 3 + .../block_scout_web/views/transaction_view.ex | 1 + apps/block_scout_web/priv/gettext/default.pot | 158 +++++++++--------- .../priv/gettext/en/LC_MESSAGES/default.po | 158 +++++++++--------- 10 files changed, 240 insertions(+), 183 deletions(-) diff --git a/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss b/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss index 4a6f4644f1..51a22c4e54 100644 --- a/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss +++ b/apps/block_scout_web/assets/css/theme/custom_contracts/_circles-theme.scss @@ -236,21 +236,6 @@ $c-dark-text-color: #8a8dba; height: 32px; } - // table - .stakes-table-th { - background-color: $c-primary; - color: $text2; - } - .stakes-td { - border-bottom-color: darken($text2, 30); - } - .table th, .table td { - border-top-color: darken($text2, 30); - } - hr { - border-top-color: darken($text2, 30); - } - // download csv button .download-all-transactions .download-all-transactions-link svg path { fill: $c-primary; @@ -408,14 +393,6 @@ $c-dark-text-color: #8a8dba; } } - // Decoded data - .table-bordered, .table-bordered td, .table-bordered th { - border-color: darken($text2, 30); - } - .circles-theme-applied .table td, .circles-theme-applied .table th, .circles-theme-applied hr { - border-top-color: darken($text2, 30); - } - #qrModal { .modal-content { diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex index 23357981e1..d60df0b6dc 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex @@ -2,6 +2,7 @@ <% dark_forest_addresses_list = CustomContractsHelpers.get_custom_addresses_list(:dark_forest_addresses) %> <% circles_addresses_list = CustomContractsHelpers.get_custom_addresses_list(:circles_addresses) %> <% current_address = "0x" <> Base.encode16(@address.hash.bytes, case: :lower) %> + <% created_from_address_hash = if from_address_hash(@address), do: "0x" <> Base.encode16(from_address_hash(@address).bytes, case: :lower), else: nil %>
@@ -32,6 +33,10 @@
+ <% Enum.member?(circles_addresses_list, created_from_address_hash) -> %> +
+ +
<% true -> %> <%= nil %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex index 915a0d5df6..22b2109334 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex @@ -47,6 +47,8 @@ @view_module == Elixir.BlockScoutWeb.TransactionTokenTransferView ) -> %> <% to_address = @transaction && @transaction.to_address && "0x" <> Base.encode16(@transaction.to_address.hash.bytes, case: :lower) %> + <% {:ok, created_from_address} = if @transaction.to_address_hash, do: Chain.hash_to_address(@transaction.to_address_hash), else: {:ok, nil} %> + <% created_from_address_hash_str = if from_address_hash(created_from_address), do: "0x" <> Base.encode16(from_address_hash(created_from_address).bytes, case: :lower), else: nil %> - <% true -> %> + <% ( + @view_module == Elixir.BlockScoutWeb.AddressTransactionView || + @view_module == Elixir.BlockScoutWeb.AddressTokenTransferView || + @view_module == Elixir.BlockScoutWeb.AddressTokenView || + @view_module == Elixir.BlockScoutWeb.AddressInternalTransactionView || + @view_module == Elixir.BlockScoutWeb.AddressCoinBalanceView || + @view_module == Elixir.BlockScoutWeb.AddressLogsView || + @view_module == Elixir.BlockScoutWeb.AddressValidationView || + @view_module == Elixir.BlockScoutWeb.AddressContractView || + @view_module == Elixir.BlockScoutWeb.AddressReadContractView || + @view_module == Elixir.BlockScoutWeb.AddressReadProxyView || + @view_module == Elixir.BlockScoutWeb.AddressWriteContractView || + @view_module == Elixir.BlockScoutWeb.AddressWriteProxyView + ) -> %> + <% created_from_address = if @address && from_address_hash(@address), do: "0x" <> Base.encode16(from_address_hash(@address).bytes, case: :lower), else: nil %> + <% ( + @view_module == Elixir.BlockScoutWeb.Tokens.TransferView || + @view_module == Elixir.BlockScoutWeb.Tokens.ReadContractView || + @view_module == Elixir.BlockScoutWeb.Tokens.HolderView + ) -> %> + <% {:ok, created_from_address} = if @token.contract_address_hash, do: Chain.hash_to_address(@token.contract_address_hash), else: {:ok, nil} %> + <% created_from_address_hash = if from_address_hash(created_from_address), do: "0x" <> Base.encode16(from_address_hash(created_from_address).bytes, case: :lower), else: nil %> + + <% true -> %> + <%= nil %> <% end %>