From ae560b9de481555aaf0b4acb61cf8161947bb2f8 Mon Sep 17 00:00:00 2001 From: Oliver Giles Date: Sat, 27 Jun 2020 10:45:47 +1200 Subject: [PATCH] webui refresh WebUI rewritten in a more modern style, bootstrap is dropped in favour of plain css/grid. Hand-crafted svgs replace utf-8 glyphs for a more uniform look and smoother animation. webmanifest added for better mobile behaviour. No doubt minor tweaks will follow... resolves #57 --- CMakeLists.txt | 6 +- src/resources.cpp | 16 +- src/resources/index.html | 462 ++++++++++------------------- src/resources/js/app.js | 98 +++--- src/resources/manifest.webmanifest | 21 ++ src/resources/style.css | 236 +++++++++++++++ 6 files changed, 465 insertions(+), 374 deletions(-) create mode 100644 src/resources/manifest.webmanifest create mode 100644 src/resources/style.css diff --git a/CMakeLists.txt b/CMakeLists.txt index c58f45e..ff3b6f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ add_custom_command(OUTPUT laminar.capnp.c++ laminar.capnp.h # Zip and compile statically served resources generate_compressed_bins(${CMAKE_SOURCE_DIR}/src/resources index.html js/app.js - favicon.ico favicon-152.png icon.png) + style.css manifest.webmanifest favicon.ico favicon-152.png icon.png) # The code that allows dynamic modifying of index.html requires knowing its original size add_custom_command(OUTPUT index_html_size.h @@ -78,11 +78,9 @@ file(DOWNLOAD https://raw.githubusercontent.com/drudru/ansi_up/v1.3.0/ansi_up.js js/ansi_up.js EXPECTED_MD5 158566dc1ff8f2804de972f7e841e2f6) file(DOWNLOAD https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js js/Chart.min.js EXPECTED_MD5 f6c8efa65711e0cbbc99ba72997ecd0e) -file(DOWNLOAD https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css - css/bootstrap.min.css EXPECTED_MD5 5d5357cb3704e1f43a1f5bfed2aebf42) # ...and compile them generate_compressed_bins(${CMAKE_BINARY_DIR} js/vue-router.min.js js/vue.min.js - js/ansi_up.js js/Chart.min.js css/bootstrap.min.css) + js/ansi_up.js js/Chart.min.js) # (see resources.cpp where these are fetched) set(LAMINARD_CORE_SOURCES diff --git a/src/resources.cpp b/src/resources.cpp index a8561d7..021905b 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -1,5 +1,5 @@ /// -/// Copyright 2015-2019 Oliver Giles +/// Copyright 2015-2020 Oliver Giles /// /// This file is part of Laminar /// @@ -27,11 +27,12 @@ extern const char _binary_##name##_z_end[]; \ resources.emplace(route, Resource{_binary_ ## name ## _z_start, _binary_ ## name ## _z_end, content_type}) -#define CONTENT_TYPE_HTML "text/html; charset=utf-8" -#define CONTENT_TYPE_ICO "image/x-icon" -#define CONTENT_TYPE_PNG "image/png" -#define CONTENT_TYPE_JS "application/javascript; charset=utf-8" -#define CONTENT_TYPE_CSS "text/css; charset=utf-8" +#define CONTENT_TYPE_HTML "text/html; charset=utf-8" +#define CONTENT_TYPE_ICO "image/x-icon" +#define CONTENT_TYPE_PNG "image/png" +#define CONTENT_TYPE_JS "application/javascript; charset=utf-8" +#define CONTENT_TYPE_CSS "text/css; charset=utf-8" +#define CONTENT_TYPE_MANIFEST "application/manifest+json; charset=utf-8" #define GZIP_FORMAT 16 @@ -46,7 +47,8 @@ Resources::Resources() INIT_RESOURCE("/js/vue-router.min.js", js_vue_router_min_js, CONTENT_TYPE_JS); INIT_RESOURCE("/js/ansi_up.js", js_ansi_up_js, CONTENT_TYPE_JS); INIT_RESOURCE("/js/Chart.min.js", js_Chart_min_js, CONTENT_TYPE_JS); - INIT_RESOURCE("/css/bootstrap.min.css", css_bootstrap_min_css, CONTENT_TYPE_CSS); + INIT_RESOURCE("/style.css", style_css, CONTENT_TYPE_CSS); + INIT_RESOURCE("/manifest.webmanifest", manifest_webmanifest, CONTENT_TYPE_MANIFEST); // Configure the default template setHtmlTemplate(std::string()); } diff --git a/src/resources/index.html b/src/resources/index.html index e27b80e..f84ebea 100644 --- a/src/resources/index.html +++ b/src/resources/index.html @@ -8,334 +8,200 @@ + Laminar - - - + + -