From e8f4fabcd058e97118f4a402b09d92acbfeb93e4 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Wed, 15 Sep 2021 18:28:48 +0800 Subject: [PATCH] [status page] crop and resize logo --- package.json | 3 +- server/routers/api-router.js | 20 ++++++- src/assets/app.scss | 17 +++++- src/pages/StatusPage.vue | 106 ++++++++++++++++++++++++++++++++--- 4 files changed, 135 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 90b75362f..f2d1456a2 100644 --- a/package.json +++ b/package.json @@ -68,14 +68,15 @@ "socket.io-client": "^4.2.0", "sqlite3": "github:mapbox/node-sqlite3#593c9d", "tcp-ping": "^0.1.1", - "timezones-list": "^3.0.1", "thirty-two": "^1.0.2", + "timezones-list": "^3.0.1", "v-pagination-3": "^0.1.6", "vue": "^3.2.8", "vue-chart-3": "^0.5.8", "vue-confirm-dialog": "^1.0.2", "vue-contenteditable": "^3.0.4", "vue-i18n": "^9.1.7", + "vue-image-crop-upload": "^3.0.3", "vue-multiselect": "^3.0.0-alpha.2", "vue-qrcode": "^1.0.0", "vue-router": "^4.0.11", diff --git a/server/routers/api-router.js b/server/routers/api-router.js index b8b1b3970..ed7480d52 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -85,14 +85,32 @@ router.get("/api/status-page/heartbeat", async (_request, response) => { } }); +router.post("/api/status-page/upload-logo", async (request, response) => { + allowDevAllOrigin(response); + + // TODO: Check Bearer token + + console.log(request); + + response.json({}); +}); + async function checkPublished() { if (! await isPublished()) { throw new Error("The status page is not published"); } } +/** + * Default is published + * @returns {Promise} + */ async function isPublished() { - return await setting("statusPagePublished"); + const value = await setting("statusPagePublished"); + if (value === null) { + return true; + } + return value; } function send403(res, msg = "") { diff --git a/src/assets/app.scss b/src/assets/app.scss index f5703799a..36150de48 100644 --- a/src/assets/app.scss +++ b/src/assets/app.scss @@ -144,7 +144,9 @@ h2 { } .shadow-box { - background-color: $dark-bg; + &:not(.alert) { + background-color: $dark-bg; + } } .form-check-input { @@ -376,12 +378,19 @@ h2 { } [contenteditable=true] { + transition: all $easing-in 0.2s; + &:focus { outline: 0 solid #eee; } &:hover, &:focus { - background-color: #efefef; + background-color: rgb(239, 239, 239); + + .dark & { + background-color: rgba(239, 239, 239, 0.2); + } + border-radius: 8px; } @@ -401,3 +410,7 @@ h2 { transform: scale(1.2); } } + +.vue-image-crop-upload .vicp-wrap { + border-radius: 10px !important; +} diff --git a/src/pages/StatusPage.vue b/src/pages/StatusPage.vue index 4739b62b5..39032a7c8 100644 --- a/src/pages/StatusPage.vue +++ b/src/pages/StatusPage.vue @@ -1,10 +1,31 @@