From 7d63604ac4f444a67a5d2d1ae59b3b1cd1246dee Mon Sep 17 00:00:00 2001 From: Andy Nogueira Date: Thu, 16 Feb 2017 15:52:03 -0500 Subject: [PATCH] Added logic to demo app to display a offline/online status connection on the Whisper tab and hide controls if offline --- demo/app/css/main.css | 23 +++++++++++++++++++++++ demo/app/index.html | 8 ++++---- demo/app/js/index.js | 4 +++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/demo/app/css/main.css b/demo/app/css/main.css index abfcd67f5..e0043e37b 100644 --- a/demo/app/css/main.css +++ b/demo/app/css/main.css @@ -24,3 +24,26 @@ div { margin-bottom: 0; } +.status-offline { + vertical-align: middle; + margin-left: 5px; + margin-top: 4px; + width: 12px; + height: 12px; + background: red; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +.status-online { + vertical-align: middle; + margin-left: 5px; + margin-top: 4px; + width: 12px; + height: 12px; + background: mediumseagreen; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} diff --git a/demo/app/index.html b/demo/app/index.html index 417f60960..6544e05d1 100644 --- a/demo/app/index.html +++ b/demo/app/index.html @@ -10,7 +10,7 @@
@@ -75,8 +75,8 @@
- The node you are using does not support whisper - + +

Listen To channel

@@ -97,7 +97,7 @@

EmbarkJS.Messages.setProvider('whisper')
- +
diff --git a/demo/app/js/index.js b/demo/app/js/index.js index e5a1ebe6b..60147b1b1 100644 --- a/demo/app/js/index.js +++ b/demo/app/js/index.js @@ -76,8 +76,11 @@ $(document).ready(function() { web3.version.getWhisper(function(err, res) { if (err) { $("#communication .error").show(); + $("#communication-controls").hide(); ++ $("#status-communication").addClass('status-offline'); } else { EmbarkJS.Messages.setProvider('whisper'); + $("#status-communication").addClass('status-online'); } }); @@ -98,4 +101,3 @@ $(document).ready(function() { }); }); -