diff --git a/README.MD b/README.MD index 54bcd5a..bc0dff9 100644 --- a/README.MD +++ b/README.MD @@ -6,5 +6,7 @@ - [X] time on countdown page - [X] one-way messaging - [ ] Better UI + - [ ] Wait for all resources to load + - [ ] Error popups - [X] Progress bar - [P] Endpoint docs diff --git a/index.js b/index.js index 3597f74..b9f6463 100644 --- a/index.js +++ b/index.js @@ -39,10 +39,16 @@ currentState.textColors = currentState.colorSegments app.get("/", function (req, res) { + const data = fs.readFileSync("templates/newAdminPanel.html", "utf8"); + res.send(data); +}); + +app.get("/old", function (req, res) { const data = fs.readFileSync("templates/adminPanel.html", "utf8"); res.send(data); }); + app.get("/timer", function (req, res) { const data = fs.readFileSync("templates/timerPage.html", "utf8"); res.send(data); diff --git a/package-lock.json b/package-lock.json index e86fe82..a3bd927 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,22 @@ "license": "ISC", "dependencies": { "body-parser": "^1.19.2", + "bootstrap": "^5.1.3", + "bootstrap-icons": "^1.8.1", "countdown": "^2.6.0", - "express": "^4.17.3" + "express": "^4.17.3", + "jquery": "^3.6.0", + "moment": "^2.29.1" + } + }, + "node_modules/@popperjs/core": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz", + "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" } }, "node_modules/accepts": { @@ -51,6 +65,26 @@ "node": ">= 0.8" } }, + "node_modules/bootstrap": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", + "integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + }, + "peerDependencies": { + "@popperjs/core": "^2.10.2" + } + }, + "node_modules/bootstrap-icons": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.8.1.tgz", + "integrity": "sha512-IXUqislddPJfwq6H+2nTkHyr9epO9h6u1AG0OZCx616w+TgzeoCjfmI3qJMQqt1J586gN2IxzB4M99Ip4sTZ1w==", + "engines": { + "node": ">=10" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -255,6 +289,11 @@ "node": ">= 0.10" } }, + "node_modules/jquery": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -306,6 +345,14 @@ "node": ">= 0.6" } }, + "node_modules/moment": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -513,6 +560,12 @@ } }, "dependencies": { + "@popperjs/core": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz", + "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==", + "peer": true + }, "accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -544,6 +597,17 @@ "type-is": "~1.6.18" } }, + "bootstrap": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", + "integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==", + "requires": {} + }, + "bootstrap-icons": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.8.1.tgz", + "integrity": "sha512-IXUqislddPJfwq6H+2nTkHyr9epO9h6u1AG0OZCx616w+TgzeoCjfmI3qJMQqt1J586gN2IxzB4M99Ip4sTZ1w==" + }, "bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -706,6 +770,11 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "jquery": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -739,6 +808,11 @@ "mime-db": "1.51.0" } }, + "moment": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", diff --git a/package.json b/package.json index 9b6e813..6dfb342 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,11 @@ "license": "ISC", "dependencies": { "body-parser": "^1.19.2", + "bootstrap": "^5.1.3", + "bootstrap-icons": "^1.8.1", "countdown": "^2.6.0", - "express": "^4.17.3" + "express": "^4.17.3", + "jquery": "^3.6.0", + "moment": "^2.29.1" } } diff --git a/static/bootstrap/dist b/static/bootstrap/dist new file mode 120000 index 0000000..8fc3423 --- /dev/null +++ b/static/bootstrap/dist @@ -0,0 +1 @@ +../../node_modules/bootstrap/dist \ No newline at end of file diff --git a/static/css/bootstrap-icons.css b/static/css/bootstrap-icons.css new file mode 120000 index 0000000..996baca --- /dev/null +++ b/static/css/bootstrap-icons.css @@ -0,0 +1 @@ +../../node_modules/bootstrap-icons/font/bootstrap-icons.css \ No newline at end of file diff --git a/static/css/mainStyle.css b/static/css/mainStyle.css new file mode 100644 index 0000000..7df8493 --- /dev/null +++ b/static/css/mainStyle.css @@ -0,0 +1,104 @@ +body { + min-height: 100vh; + min-height: -webkit-fill-available; + } + + html { + height: -webkit-fill-available; + } + + main { + display: flex; + flex-wrap: nowrap; + height: 100vh; + height: -webkit-fill-available; + max-height: 100vh; + overflow-x: auto; + overflow-y: hidden; + } + + .b-example-divider { + flex-shrink: 0; + width: 1.5rem; + height: 100vh; + background-color: rgba(0, 0, 0, .1); + border: solid rgba(0, 0, 0, .15); + border-width: 1px 0; + box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15); + } + + .bi { + vertical-align: -.125em; + pointer-events: none; + fill: currentColor; + } + + .dropdown-toggle { outline: 0; } + + .nav-flush .nav-link { + border-radius: 0; + } + + .btn-toggle { + display: inline-flex; + align-items: center; + padding: .25rem .5rem; + font-weight: 600; + color: rgba(0, 0, 0, .65); + background-color: transparent; + border: 0; + } + .btn-toggle:hover, + .btn-toggle:focus { + color: rgba(0, 0, 0, .85); + background-color: #d2f4ea; + } + + .btn-toggle::before { + width: 1.25em; + line-height: 0; + content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e"); + transition: transform .35s ease; + transform-origin: .5em 50%; + } + + .btn-toggle[aria-expanded="true"] { + color: rgba(0, 0, 0, .85); + } + .btn-toggle[aria-expanded="true"]::before { + transform: rotate(90deg); + } + + .btn-toggle-nav a { + display: inline-flex; + padding: .1875rem .5rem; + margin-top: .125rem; + margin-left: 1.25rem; + text-decoration: none; + } + .btn-toggle-nav a:hover, + .btn-toggle-nav a:focus { + background-color: #d2f4ea; + } + + .scrollarea { + overflow-y: auto; + } + + .fw-semibold { font-weight: 600; } + .lh-tight { line-height: 1.25; } + + + .hidden{ + display: none; + } + + .pageC { + padding: 20px; + } + + +placeholder { + border: red 2px dashed; + background-color: yellow; +} \ No newline at end of file diff --git a/static/css/smallerTextMod.css b/static/css/smallerTextMod.css index 1b5f4ab..211158b 100644 --- a/static/css/smallerTextMod.css +++ b/static/css/smallerTextMod.css @@ -1,3 +1,3 @@ body { - font-size:0.5em; + font-size:0.3em; } \ No newline at end of file diff --git a/static/css/styles.css b/static/css/styles.css index 5800c6c..2c0a752 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -103,4 +103,4 @@ html, body { .blink { animation:fade 1000ms infinite; -webkit-animation:fade 1000ms infinite; -} \ No newline at end of file +} diff --git a/static/js/jquery.min.js b/static/js/jquery.min.js new file mode 120000 index 0000000..08ac9f2 --- /dev/null +++ b/static/js/jquery.min.js @@ -0,0 +1 @@ +../../node_modules/jquery/dist/jquery.min.js \ No newline at end of file diff --git a/static/js/moment.js b/static/js/moment.js new file mode 120000 index 0000000..1e1714b --- /dev/null +++ b/static/js/moment.js @@ -0,0 +1 @@ +../../node_modules/moment/dist/moment.js \ No newline at end of file diff --git a/static/js/script.js b/static/js/script.js index 88211bb..8c71574 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -78,6 +78,7 @@ function handleUpdate() { var data = JSON.parse(resp); document.getElementById("incomeData").innerHTML = JSON.stringify(data) document.getElementById("timediff").innerHTML = new Date().getTime() - data.srvTime; + if(data.debug){ document.getElementById("timediff").style.display = "block"; }else{ @@ -111,6 +112,8 @@ function handleUpdate() { document.getElementById("timer").innerHTML = getTime(); document.getElementById("testImg").style.display = "none"; document.getElementById("wholeProgBar").style.display = "none"; + document.getElementById("clockSec").innerHTML = ""; + document.getElementById("timer").style.color = "white" } else if (data.mode == "timer") { @@ -145,11 +148,13 @@ function handleUpdate() { document.getElementById("timer").innerHTML = ""; document.getElementById("testImg").style.display = "none"; document.getElementById("wholeProgBar").style.display = "none"; + document.getElementById("clockSec").innerHTML = ""; } else if (data.mode == "test") { document.getElementById("timer").innerHTML = ""; document.getElementById("testImg").style.display = "block"; document.getElementById("progBar").style.display = "none"; + document.getElementById("clockSec").innerHTML = ""; } } diff --git a/templates/newAdminPanel.html b/templates/newAdminPanel.html new file mode 100644 index 0000000..e355de4 --- /dev/null +++ b/templates/newAdminPanel.html @@ -0,0 +1,383 @@ + + + + + + + + openCountdown - Admin + + + + + + + + + + + + + + + + + Bootstrap + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + Sidebar + +
+ +
+ openCountdown +
+ + + + +

Home page

+ + ToDo: Load current settings + +

Preview:

+ + +
+

Mode

+
+ + + + + + + + + + + +
+
+
+

Timer

+ + + + + + + + + + + + + + + +
+ Time duration picker + +
+

Messaging

+ + + + + + +
+

Layout

+ + + +
+ + +
+ + +
+
Colors
+ +
+
Colors
+ + + + + +
+ + + +
+
+ + + + + + \ No newline at end of file