diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc6e18cb9..9931e53506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- [#6838](https://github.com/blockscout/blockscout/pull/6838) - Disable dark mode env var - [#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/assets/js/lib/history_chart.js b/apps/block_scout_web/assets/js/lib/history_chart.js index ef0884665c..efd1b5c673 100644 --- a/apps/block_scout_web/assets/js/lib/history_chart.js +++ b/apps/block_scout_web/assets/js/lib/history_chart.js @@ -21,10 +21,14 @@ const grid = { function isDarkMode () { // @ts-ignore const permanentDarkModeEnabled = document.getElementById('permanent-dark-mode').textContent === 'true' - if (!permanentDarkModeEnabled) { - return Cookies.get('chakra-ui-color-mode') === 'dark' - } else { + // @ts-ignore + const permanentLightModeEnabled = document.getElementById('permanent-light-mode').textContent === 'true' + if (permanentLightModeEnabled) { + return false + } else if (permanentDarkModeEnabled) { return true + } else { + return Cookies.get('chakra-ui-color-mode') === 'dark' } } diff --git a/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js b/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js index 0284c9e478..610e4d47b4 100644 --- a/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js +++ b/apps/block_scout_web/assets/js/pages/dark-mode-switcher.js @@ -1,22 +1,12 @@ import Cookies from 'js-cookie' -const permantDarkModeEl = document.getElementById('permanent-dark-mode') -// @ts-ignore -const permanentDarkModeEnabled = false || (permantDarkModeEl && permantDarkModeEl.textContent === 'true') // @ts-ignore const darkModeChangerEl = document.getElementsByClassName('dark-mode-changer')[0] -if (permanentDarkModeEnabled) { - // @ts-ignore - darkModeChangerEl.style.display = 'none' -} - darkModeChangerEl && darkModeChangerEl.addEventListener('click', function () { - if (!permanentDarkModeEnabled) { - if (Cookies.get('chakra-ui-color-mode') === 'dark') { - Cookies.set('chakra-ui-color-mode', 'light') - } else { - Cookies.set('chakra-ui-color-mode', 'dark') - } - document.location.reload() + if (Cookies.get('chakra-ui-color-mode') === 'dark') { + Cookies.set('chakra-ui-color-mode', 'light') + } else { + Cookies.set('chakra-ui-color-mode', 'dark') } + document.location.reload() }) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex index 07a1ee0d13..352304462d 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/csv_export/index.html.eex @@ -34,7 +34,10 @@ 'sitekey': reCaptchaClientKey, 'theme': function () { const permanentDarkModeEnabled = document.getElementById('permanent-dark-mode').textContent === 'true' - if (permanentDarkModeEnabled) { + const permanentLightModeEnabled = document.getElementById('permanent-light-mode').textContent === 'true' + if (permanentLightModeEnabled) { + return 'light' + } else if (permanentDarkModeEnabled) { return 'dark' } else { return getCookie('chakra-ui-color-mode') diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex index 494934049d..2d8c4feb42 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex @@ -176,11 +176,13 @@ - + <%= unless Application.get_env(:block_scout_web, :permanent_light_mode_enabled) || Application.get_env(:block_scout_web, :permanent_dark_mode_enabled) do %> + + <% end %> <%= render BlockScoutWeb.LayoutView, "_account_menu_item.html", conn: @conn, current_user: @current_user %> <%= render BlockScoutWeb.LayoutView, "_search.html", conn: @conn, id: "main-search-autocomplete", additional_classes: ["mobile-search-hide"] %> 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 25a4d36fb2..f970aff1fd 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 @@ -157,6 +157,7 @@