From 07144f6b6ac8fe59019956d4bc1c70b391f95cfd Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Mon, 13 Nov 2023 14:01:20 +0100 Subject: [PATCH] UI improvements --- data/src/css/style.scss | 26 ++++++++-- data/src/index.html | 102 ++++++++++++++++++++++------------------ data/src/js/script.ts | 8 ++-- src/lib/led_handler.cpp | 5 +- 4 files changed, 85 insertions(+), 56 deletions(-) diff --git a/data/src/css/style.scss b/data/src/css/style.scss index 194a86e..2fb55d2 100644 --- a/data/src/css/style.scss +++ b/data/src/css/style.scss @@ -17,6 +17,8 @@ $form-range-track-bg: #fff; @import "../node_modules/bootstrap/scss/grid"; @import "../node_modules/bootstrap/scss/forms"; @import "../node_modules/bootstrap/scss/buttons"; +@import "../node_modules/bootstrap/scss/button-group"; + @import "../node_modules/bootstrap/scss/navbar"; @import "../node_modules/bootstrap/scss/nav"; @import "../node_modules/bootstrap/scss/card"; @@ -54,6 +56,24 @@ nav { margin: 0 auto; } +div#output .btclock { + border: 1px solid darkgray; + background: #000; + border-radius: 5px; + padding: 10px; + max-width: 700px; + margin: 0 auto; + + .digit, + .splitText + { + border: 2px solid gold; + border-radius: 8px; + min-width: 70px; + text-align: center; + } +} + .btclock { display: flex; flex-direction: row; @@ -96,9 +116,9 @@ nav { } .splitText { - font-size: 2.2rem; - padding-top: 5px; - padding-bottom: 5px; + font-size: 1.8rem; + padding-top: 19px !important; + padding-bottom: 20px !important; text-align: center; } diff --git a/data/src/index.html b/data/src/index.html index ec16f39..0d9e73f 100644 --- a/data/src/index.html +++ b/data/src/index.html @@ -22,7 +22,7 @@

Status

-
+
{{#each screens }} @@ -96,7 +96,7 @@
-
+

Custom text

@@ -133,7 +133,7 @@
- +
Loading, please wait...
@@ -143,48 +143,56 @@

Settings

- +
-
- +
-
- +
-
- +
+ minutes
- +
-
- +
+ minutes
- +
-
+
+ + seconds +
+
Short amounts might shorten lifespan.
+
+
+
+ +
+
min @@ -192,14 +200,18 @@
A restart is required to apply TZ offset.
+
- -
-
- - sec -
-
Short amounts might shorten lifespan.
+ +
+ +
+
+
+ +
+
@@ -221,7 +233,8 @@
- +
@@ -249,35 +262,30 @@
-
- -
- -
-
-
- -
- -
-
- -

Screens

-
- - +

Screens

+
+
+ + +
+
@@ -285,7 +293,7 @@
- +
diff --git a/data/src/js/script.ts b/data/src/js/script.ts index ad48c44..1c9d1ff 100644 --- a/data/src/js/script.ts +++ b/data/src/js/script.ts @@ -98,10 +98,10 @@ fetch('/api/settings', { .then(response => response.json()) .then(jsonData => { var fgColor = ("0x" + jsonData.fgColor.toString(16).toUpperCase()); - if (jsonData.epdColors == 2) { - document.getElementById('fgColor').querySelector('[value="0xF800"]').remove(); - document.getElementById('bgColor').querySelector('[value="0xF800"]').remove(); - } + // if (jsonData.epdColors == 2) { + // document.getElementById('fgColor').querySelector('[value="0xF800"]').remove(); + // document.getElementById('bgColor').querySelector('[value="0xF800"]').remove(); + // } document.getElementById('customText').setAttribute('maxlength', jsonData.numScreens); document.getElementById('output').classList.add("fg-" + jsonData.fgColor.toString(16)); diff --git a/src/lib/led_handler.cpp b/src/lib/led_handler.cpp index fa49108..8a525b2 100644 --- a/src/lib/led_handler.cpp +++ b/src/lib/led_handler.cpp @@ -245,14 +245,15 @@ void setLights(int r, int g, int b) void setLights(uint32_t color) { - preferences.putUInt("ledColor", color); bool ledStatus = true; if (color == pixels.Color(0, 0, 0)) { ledStatus = false; + } else { + preferences.putUInt("ledColor", color); } - preferences.putBool("ledStatus", false); + preferences.putBool("ledStatus", ledStatus); for (int i = 0; i < NEOPIXEL_COUNT; i++) {