From 0c7c7163ebec3c9b14cdfbc4fd35535a5263f3f9 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 9 Jul 2019 15:56:12 +0300 Subject: [PATCH 01/27] set timeout for loading message on the main page --- .../assets/js/lib/market_history_chart.js | 1 + apps/block_scout_web/assets/js/pages/chain.js | 14 ++++++++++++-- .../block_scout_web/templates/chain/show.html.eex | 8 ++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/block_scout_web/assets/js/lib/market_history_chart.js b/apps/block_scout_web/assets/js/lib/market_history_chart.js index 615f888d8a..61c2b4695a 100644 --- a/apps/block_scout_web/assets/js/lib/market_history_chart.js +++ b/apps/block_scout_web/assets/js/lib/market_history_chart.js @@ -148,6 +148,7 @@ export function createMarketHistoryChart (el) { } $('[data-chart-error-message]').on('click', _event => { + $('[data-chart-loading-message]').removeAttr('hidden') $('[data-chart-loading-message]').show() $('[data-chart-error-message]').hide() createMarketHistoryChart($('[data-chart="marketHistoryChart"]')[0]) diff --git a/apps/block_scout_web/assets/js/pages/chain.js b/apps/block_scout_web/assets/js/pages/chain.js index f4cd0e6628..cf596e0a5f 100644 --- a/apps/block_scout_web/assets/js/pages/chain.js +++ b/apps/block_scout_web/assets/js/pages/chain.js @@ -211,7 +211,10 @@ const elements = { '[data-selector="chain-block-list"] [data-selector="loading-message"]': { render ($el, state, oldState) { if (state.blocksLoading) { - $el.show() + setTimeout(function(){ + $el.removeAttr('hidden') + $el.show() + }, 1000) } else { $el.hide() } @@ -224,7 +227,14 @@ const elements = { }, '[data-selector="transactions-list"] [data-selector="loading-message"]': { render ($el, state, oldState) { - $el.toggle(state.transactionsLoading) + if (state.transactionsLoading) { + setTimeout(function(){ + $el.removeAttr('hidden') + $el.show() + }, 1000) + } else { + $el.hide() + } } }, '[data-selector="transactions-list"]': { diff --git a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex index 0c29001697..146d84f3c5 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex @@ -5,7 +5,7 @@
-
+