From 8550205a77b07234c356ea9d0fa3c486fb0e042a Mon Sep 17 00:00:00 2001 From: Humberto Alfonso Díaz Date: Tue, 8 Oct 2019 14:23:41 +0200 Subject: FUNCT Add network status integration --- src/config.json | 9 ++++++++- src/config.xml | 5 +++++ src/index.html | 8 ++++---- src/js/apps.js | 13 ++++++++----- src/js/main.js | 4 ++++ src/js/network.js | 29 +++++++++++++++++++++++++++++ src/js/weather.js | 5 +++++ src/styles/fonts/icomoon.eot | Bin 7052 -> 7340 bytes src/styles/fonts/icomoon.svg | 2 ++ src/styles/fonts/icomoon.ttf | Bin 6888 -> 7176 bytes src/styles/fonts/icomoon.woff | Bin 6964 -> 7252 bytes src/styles/main.scss | 21 +++++++++++++++++++++ src/styles/style.css | 16 +++++++++++----- 13 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 src/js/network.js create mode 100644 src/js/weather.js (limited to 'src') diff --git a/src/config.json b/src/config.json index 6a68312..930da03 100644 --- a/src/config.json +++ b/src/config.json @@ -16,5 +16,12 @@ "id": "navigation", "icon": "icon icon-location" } - ] + ], + "network": { + "bluetooth": "icon-bluetooth", + "ethernet": "icon-ethernet", + "wifi": "icon-wifi", + "p2p": "icon-p2p", + "cellular": "icon-signal" + } } \ No newline at end of file diff --git a/src/config.xml b/src/config.xml index 3a470b8..6ef5cd5 100644 --- a/src/config.xml +++ b/src/config.xml @@ -8,6 +8,8 @@ APL 2.0 + + @@ -15,6 +17,9 @@ + + + \ No newline at end of file diff --git a/src/index.html b/src/index.html index 3a6d612..1cd4732 100644 --- a/src/index.html +++ b/src/index.html @@ -44,10 +44,10 @@ 20ºC -
-
-
-
+
+
diff --git a/src/js/apps.js b/src/js/apps.js index 73d926e..b9829ad 100644 --- a/src/js/apps.js +++ b/src/js/apps.js @@ -20,11 +20,14 @@ function load_application_list() { configjson.apps.forEach(function(app) { var internalApp = locateApp(app.id, result); - renderApp({ - id: internalApp.id, - name: internalApp.name, - icon: app.icon - }); + if( internalApp ) { + renderApp({ + id: internalApp.id, + name: internalApp.name, + icon: app.icon + }); + } + }); }); } diff --git a/src/js/main.js b/src/js/main.js index c68f572..d26f701 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1,5 +1,9 @@ import { init as init_apps } from './apps'; +import { init as init_weather } from './weather'; +import { init as init_network } from './network'; export function init() { init_apps(); + init_weather(); + init_network(); } \ No newline at end of file diff --git a/src/js/network.js b/src/js/network.js new file mode 100644 index 0000000..bb60a1d --- /dev/null +++ b/src/js/network.js @@ -0,0 +1,29 @@ +import { network } from 'agl-js-api'; +import Mustache from 'mustache'; + +var configjson = require('../config.json'); +var template; + +function render_network_item(networkItem) { + document.getElementById('networkStatusContainer').innerHTML += Mustache.render(template, networkItem); +} + +function load_network_state() { + network.technologies().then(function(result) { + result.values.forEach(function(networkItem) { + networkItem.icon = configjson.network[networkItem.technology]; + render_network_item(networkItem); + }); + }); + +} + +export function init() { + template = document.getElementById('network-status-template').innerHTML; + Mustache.parse(template); + load_network_state(); + + network.on_global_state(function(result) { + console.log('GLOBAL SATATE', result); + }); +} \ No newline at end of file diff --git a/src/js/weather.js b/src/js/weather.js new file mode 100644 index 0000000..26c64b9 --- /dev/null +++ b/src/js/weather.js @@ -0,0 +1,5 @@ +import { weather } from 'agl-js-api'; + +export function init() { + console.log('TBD'); +} \ No newline at end of file diff --git a/src/styles/fonts/icomoon.eot b/src/styles/fonts/icomoon.eot index fb813fa..7e69c11 100755 Binary files a/src/styles/fonts/icomoon.eot and b/src/styles/fonts/icomoon.eot differ diff --git a/src/styles/fonts/icomoon.svg b/src/styles/fonts/icomoon.svg index 53dbfbe..2d33d65 100755 --- a/src/styles/fonts/icomoon.svg +++ b/src/styles/fonts/icomoon.svg @@ -10,6 +10,7 @@ + @@ -21,6 +22,7 @@ + diff --git a/src/styles/fonts/icomoon.ttf b/src/styles/fonts/icomoon.ttf index eef51d4..cb60c5f 100755 Binary files a/src/styles/fonts/icomoon.ttf and b/src/styles/fonts/icomoon.ttf differ diff --git a/src/styles/fonts/icomoon.woff b/src/styles/fonts/icomoon.woff index d65137a..f650b1f 100755 Binary files a/src/styles/fonts/icomoon.woff and b/src/styles/fonts/icomoon.woff differ diff --git a/src/styles/main.scss b/src/styles/main.scss index 8f41eee..df68cc4 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -86,6 +86,27 @@ body { text-align: center; font-size: 42px; color: map-get($colors, grey); + + .powered { + color: map-get($colors, font); + } + + .connected { + color: map-get($colors, primary); + } + + .tethering { + color: map-get($colors, primary); + animation: blink-animation 2s linear infinite; + } + + @keyframes blink-animation { + 0%{opacity: 0;} + 25%{opacity: .5;} + 50%{opacity: 1;} + 75%{opacity: .5;} + 100%{opacity: 0;} + } } } diff --git a/src/styles/style.css b/src/styles/style.css index 8d529c9..d5e91a9 100755 --- a/src/styles/style.css +++ b/src/styles/style.css @@ -1,10 +1,10 @@ @font-face { font-family: 'icomoon'; - src: url('fonts/icomoon.eot?g2uktq'); - src: url('fonts/icomoon.eot?g2uktq#iefix') format('embedded-opentype'), - url('fonts/icomoon.ttf?g2uktq') format('truetype'), - url('fonts/icomoon.woff?g2uktq') format('woff'), - url('fonts/icomoon.svg?g2uktq#icomoon') format('svg'); + src: url('fonts/icomoon.eot?a4dqxr'); + src: url('fonts/icomoon.eot?a4dqxr#iefix') format('embedded-opentype'), + url('fonts/icomoon.ttf?a4dqxr') format('truetype'), + url('fonts/icomoon.woff?a4dqxr') format('woff'), + url('fonts/icomoon.svg?a4dqxr#icomoon') format('svg'); font-weight: normal; font-style: normal; font-display: block; @@ -25,6 +25,9 @@ -moz-osx-font-smoothing: grayscale; } +.icon-ethernet:before { + content: "\e903"; +} .icon-sunrise:before { content: "\e900"; } @@ -67,6 +70,9 @@ .icon-home:before { content: "\f015"; } +.icon-p2p:before { + content: "\f109"; +} .icon-location:before { content: "\f124"; } -- cgit 1.2.3-korg