From 50c819cbd1d483fe4509246d5358238af443957c Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Tue, 12 Jul 2022 12:28:53 +0200 Subject: [PATCH] Dashboard: ajustable grid Signed-off-by: Romein van Buren --- gui/dashboard/app.css | 5 ++-- gui/dashboard/app.svelte | 11 +++++--- gui/dashboard/lib.js | 8 +++++- gui/dashboard/modal.svelte | 5 +++- gui/dashboard/settings.svelte | 50 +++++++++++------------------------ gui/dashboard/tile.svelte | 1 + 6 files changed, 37 insertions(+), 43 deletions(-) diff --git a/gui/dashboard/app.css b/gui/dashboard/app.css index ab0e6c0..3163516 100644 --- a/gui/dashboard/app.css +++ b/gui/dashboard/app.css @@ -1,5 +1,6 @@ html, body { --body-bg: #000; + --body-fg: #fff; --tile-bg: #181818; --grey: grey; --red: red; @@ -9,8 +10,6 @@ html, body { --cols: 4; --rows: 3; - background-color: var(--body-bg); - color: #fff; padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; @@ -19,6 +18,7 @@ html, body { .theme-light { --body-bg: #fff; + --body-fg: #000; --tile-bg: #dedede; --dark: #c2c2c2; } @@ -56,7 +56,6 @@ label { label input, label select { display: block; - width: 100%; margin-top: 0.5rem; font-size: 1rem; font-family: inherit; diff --git a/gui/dashboard/app.svelte b/gui/dashboard/app.svelte index 2231678..0e13d8c 100644 --- a/gui/dashboard/app.svelte +++ b/gui/dashboard/app.svelte @@ -3,10 +3,10 @@ import TileRawValue from './tile-rawvalue.svelte'; import Settings from './settings.svelte'; import { flip } from 'svelte/animate'; - import { shuffle, ringBell } from './lib'; + import { settings, shuffle, ringBell } from './lib'; const [ send, receive ] = shuffle; - const size = 3 * 4 - 1; + const size = ($settings.cols || 4) * ($settings.rows || 3) - 1; let pageNum = -1; let tiles = []; let time = ''; @@ -91,7 +91,10 @@ -
+
@@ -116,6 +119,8 @@ justify-content: center; width: 100vw; height: 100vh; + background-color: var(--body-bg); + color: var(--body-fg); } .ratio { diff --git a/gui/dashboard/lib.js b/gui/dashboard/lib.js index e8d6cfd..5e0faa8 100644 --- a/gui/dashboard/lib.js +++ b/gui/dashboard/lib.js @@ -3,13 +3,19 @@ import { quintOut } from 'svelte/easing'; import { crossfade } from 'svelte/transition'; function createSettingsStore() { - const s = writable(0); + const s = writable({ + theme: 'dark', + cols: 4, + rows: 3, + }); function updateStorage(val) { window.localStorage.setItem('statusdash', JSON.stringify(val)); s.set(val); } + updateStorage(JSON.parse(window.localStorage.getItem('statusdash'))); + return { subscribe: s.subscribe, set: val => updateStorage(val), diff --git a/gui/dashboard/modal.svelte b/gui/dashboard/modal.svelte index 903178c..3e59bf8 100644 --- a/gui/dashboard/modal.svelte +++ b/gui/dashboard/modal.svelte @@ -1,4 +1,6 @@ -