From 51e268c34ecfeb541c187f5a361c5c5baa76fbca Mon Sep 17 00:00:00 2001 From: Humberto Alfonso Díaz Date: Wed, 18 Dec 2019 21:45:12 +0100 Subject: FUNCT Update launcher --- package.json | 2 + src/config.json | 14 +++- src/index.html | 15 +--- src/index.js | 6 +- src/js/app.js | 81 +++++++++----------- src/js/templates.js | 19 +++++ src/styles/720.scss | 5 ++ src/styles/app.scss | 22 +++--- src/styles/main.scss | 53 ++++--------- src/styles/portrait.scss | 3 + src/templates/apps.json | 158 +++++++++++++++++++++++++++++++++++++++ src/templates/apps.template.html | 17 +++++ webpack.config.js | 17 +++++ 13 files changed, 293 insertions(+), 119 deletions(-) create mode 100644 src/js/templates.js create mode 100644 src/templates/apps.json create mode 100644 src/templates/apps.template.html diff --git a/package.json b/package.json index daa7cd5..2913742 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "automotivegradelinux" ], "devDependencies": { + "@fortawesome/fontawesome-free": "^5.11.2", "clean-webpack-plugin": "^1.0.1", "copy-webpack-plugin": "^4.6.0", "css-loader": "^2.1.0", @@ -36,6 +37,7 @@ }, "dependencies": { "agl-js-api": "https://github.com/AGL-web-applications/agl-js-api.git#master", + "bootstrap": "4.4.1", "mustache": "^3.0.1" } } diff --git a/src/config.json b/src/config.json index 1373f1e..e5f7d0e 100644 --- a/src/config.json +++ b/src/config.json @@ -1,5 +1,15 @@ { "black_list": [ - "webapps-html5-launcher@1.0", "homescreen@0.1" - ] + "webapps-html5-launcher@1.0", "homescreen@0.1", "webapps-html5-homescreen@1.0" + ], + "icons": { + "webapps-aquarium": "fas fa-fish", + "webapps-falling-blocks": "fas fa-cubes", + "webapps-mixer": "fas fa-volume-up", + "taskmanager": "fas fa-tasks", + "browser": "fab fa-chrome", + "webapps-hvac": "fas fa-thermometer-half", + "webapps-youtube": "fab fa-youtube", + "webapps-settings": "fas fa-cogs" + } } diff --git a/src/index.html b/src/index.html index 574b2ab..7bd906b 100644 --- a/src/index.html +++ b/src/index.html @@ -21,19 +21,6 @@ -
- -
-
- -
+ \ No newline at end of file diff --git a/src/index.js b/src/index.js index 775b3af..a73afa3 100644 --- a/src/index.js +++ b/src/index.js @@ -15,11 +15,11 @@ */ /* JS */ -import { init, launch } from './js/app.js'; +import * as app from './js/app.js'; /* CSS */ import './styles/app.scss'; -window.launch = launch; +window.app = app; -document.addEventListener('DOMContentLoaded', init); \ No newline at end of file +document.addEventListener('DOMContentLoaded', app.init); \ No newline at end of file diff --git a/src/js/app.js b/src/js/app.js index 603bc88..43d5c62 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -15,63 +15,45 @@ */ import Mustache from 'mustache'; +import { load as load_template } from './templates'; import { afmMain, api, homescreen } from 'agl-js-api'; var configjson = require('../config.json'); var template; +var page = { + apps: [] +}; -function log(smgs) { - document.getElementById('log').innerHTML += '
'+smgs+'
'; +function render() { + document.body.innerHTML = Mustache.render(template, page); } -function show_app(app) { - document.getElementById("app-"+app.id).style["display"]="block"; -} - -function display_icon(app) { - return new Promise(function(resolve, reject) { - var iconInactiveURL = '/images/icons/'+app.name.toLowerCase()+'_inactive.svg'; - var iconActiveURL = '/images/icons/'+app.name.toLowerCase()+'_active.svg'; - var image = new Image(); - - image.onload = function() { - document.getElementById("icon-inactive-"+app.id).src = iconInactiveURL; - document.getElementById("icon-enabled-"+app.id).src = iconActiveURL; - resolve(); - } - - image.onerror = function(){ - resolve(); - } - - image.src = iconInactiveURL; - - }); -} +function load_application_list() { + load_template('apps.json').then(function(apps) { + apps = JSON.parse(apps); + page.apps = []; + for( var i=0; i", + "author-email": "", + "width": "", + "height": "", + "icon": "/var/local/lib/afm/applications/taskmanager/0.1/icon.png", + "http-port": 31037 + }, + { + "description": "AGL widget service for Chromium browser", + "name": "browser", + "shortname": "", + "id": "browser@-7dabb46-dirty", + "version": "-7dabb46-dirty", + "author": "Jose Dapena Paz ", + "author-email": "", + "width": "", + "height": "", + "icon": "/var/local/lib/afm/applications/browser/-7dabb46-dirty/icon.png", + "http-port": 31029 + }, + { + "description": "Blob demo using WebGL", + "name": "WebGL Blob", + "shortname": "", + "id": "webapps-blob@0.0", + "version": "0.0.10", + "author": "Google Inc.", + "author-email": "", + "width": "", + "height": "", + "icon": "/var/local/lib/afm/applications/webapps-blob/0.0/icon_128.png", + "http-port": 31039 + }, + { + "description": "HTML5 HVAC demo", + "name": "HVAC", + "shortname": "", + "id": "webapps-hvac@0.0", + "version": "0.0.0", + "author": "Igalia, S.L.", + "author-email": "", + "width": "", + "height": "", + "icon": "/var/local/lib/afm/applications/webapps-hvac/0.0/icon.svg", + "http-port": 31030 + }, + { + "description": "YouTube", + "name": "YouTube", + "shortname": "", + "id": "webapps-youtube@1.0", + "version": "1.0.0", + "author": "LGE-SVL", + "author-email": "", + "width": "", + "height": "", + "icon": "/var/local/lib/afm/applications/webapps-youtube/1.0/icon.png", + "http-port": 31042 + }, + { + "description": "HTML5 SETTINGS demo", + "name": "SETTINGS", + "shortname": "", + "id": "webapps-settings@0.0", + "version": "0.0.0", + "author": "Igalia, S.L.", + "author-email": "", + "width": "", + "height": "", + "icon": "/var/local/lib/afm/applications/webapps-settings/0.0/icon.svg", + "http-port": 31035 + } +] \ No newline at end of file diff --git a/src/templates/apps.template.html b/src/templates/apps.template.html new file mode 100644 index 0000000..3b0f74e --- /dev/null +++ b/src/templates/apps.template.html @@ -0,0 +1,17 @@ +
+ {{ #apps }} +
+ +
+ {{ /apps }} +
\ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 02ea4d1..9e80342 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -42,6 +42,11 @@ module.exports = { from: 'src/images/icons/*', to: 'images/icons/', flatten: true + }, + { + from: 'src/templates/*', + to: 'templates/', + flatten: true } ]), new HtmlWebpackPlugin({ @@ -77,6 +82,18 @@ module.exports = { "sass-loader" ] }, + { + test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/, + use: [ + { + loader: 'file-loader', + options: { + name: '[name].[ext]', + outputPath: 'fonts/' + } + } + ] + }, { test: /\.(gif|png|jpe?g|svg)$/i, use: [ -- cgit 1.2.3-korg