diff --git a/gui/dashboard/app.svelte b/gui/dashboard/app.svelte index 0d391ea..0d7e6a9 100644 --- a/gui/dashboard/app.svelte +++ b/gui/dashboard/app.svelte @@ -12,6 +12,8 @@ let time = ''; let globalData = {}; let resizeTimer; + let automaticallyProportionalised = false; + let hasData = false; function onResize() { clearTimeout(resizeTimer); @@ -26,7 +28,6 @@ const tileH = 300; const availableCols = Math.floor(w / tileW); const availableRows = Math.floor(h / tileH); - console.log(w, h, availableCols, availableRows); settings.update({ cols: availableCols, @@ -87,8 +88,6 @@ } onMount(() => { - proportionalGrid(); - const ws = new WebSocket( window.location.href.replace('http', 'ws') + '/socket' ); @@ -100,6 +99,11 @@ case 'data': globalData = data; organiseGrid(); + if (!automaticallyProportionalised) { + proportionalGrid(); + automaticallyProportionalised = true; + } + hasData = true; break; case 'bell': @@ -119,7 +123,7 @@ settings.subscribe(s => { size = (s.cols || 4) * (s.rows || 3) - 1; - organiseGrid(); + if (hasData) organiseGrid(); }); return () => clearInterval(clockInterval); diff --git a/gui/dashboard/lib.js b/gui/dashboard/lib.js index 26167ba..4dea8d5 100644 --- a/gui/dashboard/lib.js +++ b/gui/dashboard/lib.js @@ -14,7 +14,7 @@ function createSettingsStore() { function updateStorage(val) { window.localStorage.setItem('statusdash', JSON.stringify({ ...defaults, - ...JSON.stringify(val), + ...val, })); s.set(val); } diff --git a/lib/dashboard/build.js b/lib/dashboard/build.js index cf4a4e5..d5cf555 100644 --- a/lib/dashboard/build.js +++ b/lib/dashboard/build.js @@ -40,7 +40,7 @@ async function build() { }); const { output } = await bundle.generate({ - sourcemap: true, + sourcemap: false, format: 'iife', name: 'app', file: 'public/build/bundle.js',