From 93c7479e57ff8b40fb9f6a105030a25eb992f47d Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Wed, 8 Feb 2023 16:48:08 +0300 Subject: [PATCH] Add env variable to hide Add to MM button --- CHANGELOG.md | 1 + .../layout/_add_chain_to_mm.html.eex | 26 +++++++++---------- .../templates/layout/app.html.eex | 2 ++ apps/block_scout_web/priv/gettext/default.pot | 4 +-- .../priv/gettext/en/LC_MESSAGES/default.po | 4 +-- config/runtime.exs | 1 + 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23c81cd503..c5cb181ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features - [#6838](https://github.com/blockscout/blockscout/pull/6838) - Disable dark mode env var +- [#6843](https://github.com/blockscout/blockscout/pull/6843) - Add env variable to hide Add to MM button - [#6744](https://github.com/blockscout/blockscout/pull/6744) - API v2: smart contracts verification - [#6763](https://github.com/blockscout/blockscout/pull/6763) - Permanent UI dark mode - [#6721](https://github.com/blockscout/blockscout/pull/6721) - Implement fetching internal transactions from callTracer diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex index 0e777ee945..469a398ecd 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex @@ -1,13 +1,13 @@ - - -<% sub_network = Keyword.get(Application.get_env(:block_scout_web, BlockScoutWeb.Chain), :subnetwork) %> - - -
  • - - <%= gettext("Add") <> " #{sub_network}" %> - -
  • \ No newline at end of file +<%= unless Application.get_env(:block_scout_web, :disable_add_to_mm_button) do %> + + <% sub_network = Keyword.get(Application.get_env(:block_scout_web, BlockScoutWeb.Chain), :subnetwork) %> + +
  • + + <%= gettext("Add") <> " #{sub_network}" %> + +
  • +<% end %> \ No newline at end of file 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 f13c7083c8..6971516ca3 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 @@ -61,6 +61,8 @@
    <%= Application.get_env(:block_scout_web, :permanent_dark_mode_enabled) %>
    <%= Application.get_env(:block_scout_web, :permanent_light_mode_enabled) %>
    <%= Application.get_env(:indexer, :first_block) %>
    + + <% show_maintenance_alert = Application.get_env(:block_scout_web, BlockScoutWeb.Chain)[:show_maintenance_alert] %> <%= if show_maintenance_alert do %> diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 5a9faaea32..4dc122cd89 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -81,7 +81,7 @@ msgstr "" msgid ") may be added for each contract. Click the Add Library button to add an additional one." msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:81 +#: lib/block_scout_web/templates/layout/app.html.eex:83 #, elixir-autogen, elixir-format msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgstr "" @@ -176,7 +176,7 @@ msgstr "" #: lib/block_scout_web/templates/account/api_key/form.html.eex:7 #: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 -#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:11 +#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:10 #, elixir-autogen, elixir-format msgid "Add" 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 d4889e764b..f2edfd2b3b 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 @@ -81,7 +81,7 @@ msgstr "" msgid ") may be added for each contract. Click the Add Library button to add an additional one." msgstr "" -#: lib/block_scout_web/templates/layout/app.html.eex:81 +#: lib/block_scout_web/templates/layout/app.html.eex:83 #, elixir-autogen, elixir-format msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgstr "" @@ -176,7 +176,7 @@ msgstr "" #: lib/block_scout_web/templates/account/api_key/form.html.eex:7 #: lib/block_scout_web/templates/account/custom_abi/form.html.eex:8 -#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:11 +#: lib/block_scout_web/templates/layout/_add_chain_to_mm.html.eex:10 #, elixir-autogen, elixir-format msgid "Add" msgstr "" diff --git a/config/runtime.exs b/config/runtime.exs index ecb0d7fe52..33f0f04165 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -100,6 +100,7 @@ config :block_scout_web, new_tags: System.get_env("NEW_TAGS"), chain_id: System.get_env("CHAIN_ID"), json_rpc: System.get_env("JSON_RPC"), + disable_add_to_mm_button: System.get_env("DISABLE_ADD_TO_MM_BUTTON", "false") == "true", verification_max_libraries: verification_max_libraries, permanent_dark_mode_enabled: System.get_env("PERMANENT_DARK_MODE_ENABLED", "false") == "true", permanent_light_mode_enabled: System.get_env("PERMANENT_LIGHT_MODE_ENABLED", "false") == "true"