From 3b7cde7128330b525b5c5f8a5b3ae0d816a8950c Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Sat, 6 May 2017 21:26:29 +0200 Subject: [PATCH] fix(browserAction): hide quick upload when no peers --- add-on/src/popup/browser-action.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/add-on/src/popup/browser-action.js b/add-on/src/popup/browser-action.js index 29c6d98c4..824754346 100644 --- a/add-on/src/popup/browser-action.js +++ b/add-on/src/popup/browser-action.js @@ -89,13 +89,15 @@ async function updatePopup () { const peerCount = await background.getSwarmPeerCount() set('swarm-peers-val', peerCount < 0 ? offline : peerCount) ipfsIcon.src = peerCount > 0 ? ipfsIconOn : ipfsIconOff - if (peerCount > 0) { + if (peerCount > 0) { // API is online & there are peers show('quick-upload') } else { hide('quick-upload') - if (peerCount < 0) { - hide('open-webui') - } + } + if (peerCount < 0) { // API is offline + hide('open-webui') + } else { + show('open-webui') } } catch (error) { console.error(`Unable update peer count due to ${error}`) @@ -107,6 +109,8 @@ async function updatePopup () { } // run on initial popup load +hide('quick-upload') +hide('open-webui') updatePopup() // listen to any changes and update diagnostics