diff --git a/app/src/lib/components/InfoDialog.svelte b/app/src/lib/components/InfoDialog.svelte index 1810f01..1d70811 100644 --- a/app/src/lib/components/InfoDialog.svelte +++ b/app/src/lib/components/InfoDialog.svelte @@ -1,51 +1,40 @@ {#if isOpen} + {/if} diff --git a/app/src/lib/components/OrientationIndicator.svelte b/app/src/lib/components/OrientationIndicator.svelte index 2f024db..ce1c4c5 100644 --- a/app/src/lib/components/OrientationIndicator.svelte +++ b/app/src/lib/components/OrientationIndicator.svelte @@ -1,15 +1,15 @@
diff --git a/app/src/lib/components/Visualization.svelte b/app/src/lib/components/Visualization.svelte index 9d93a2c..6e5b568 100644 --- a/app/src/lib/components/Visualization.svelte +++ b/app/src/lib/components/Visualization.svelte @@ -1,5 +1,5 @@ diff --git a/app/src/lib/components/layout/WidgetContainer.svelte b/app/src/lib/components/layout/WidgetContainer.svelte index a323a78..86463c5 100644 --- a/app/src/lib/components/layout/WidgetContainer.svelte +++ b/app/src/lib/components/layout/WidgetContainer.svelte @@ -1,37 +1,40 @@
-
- {#each container.widgets as widget, index (widget.id + '-' + index)} - - {#if isWidgetConfig(widget)} - {@const SvelteComponent = WidgetComponents[widget.component]} - - {:else if widget.widgets} - - {/if} - - {#if index !== container.widgets.length - 1} -
- {/if} - {/each} -
+
+ {#each container.widgets as widget, index (widget.id + '-' + index)} + + {#if isWidgetConfig(widget)} + {@const SvelteComponent = WidgetComponents[widget.component]} + + {:else if widget.widgets} + + {/if} + + {#if index !== container.widgets.length - 1} +
+
+ {/if} + {/each} +
diff --git a/app/src/lib/components/menu/Menu.svelte b/app/src/lib/components/menu/Menu.svelte index 409ddd9..357e316 100644 --- a/app/src/lib/components/menu/Menu.svelte +++ b/app/src/lib/components/menu/Menu.svelte @@ -1,9 +1,9 @@
diff --git a/app/src/lib/components/statusbar/UpdateIndicator.svelte b/app/src/lib/components/statusbar/UpdateIndicator.svelte index 9bf86f6..ea223a4 100644 --- a/app/src/lib/components/statusbar/UpdateIndicator.svelte +++ b/app/src/lib/components/statusbar/UpdateIndicator.svelte @@ -1,111 +1,109 @@ {#if update} -
- -
+
+ +
{/if} diff --git a/app/src/lib/components/widget/ChartWidget.svelte b/app/src/lib/components/widget/ChartWidget.svelte index c5b64b5..71d47a1 100644 --- a/app/src/lib/components/widget/ChartWidget.svelte +++ b/app/src/lib/components/widget/ChartWidget.svelte @@ -1,103 +1,101 @@ -
-
- -
-
\ No newline at end of file +
+ +
+
diff --git a/app/src/lib/components/widget/Selector.svelte b/app/src/lib/components/widget/Selector.svelte index 6f21957..b4666f3 100644 --- a/app/src/lib/components/widget/Selector.svelte +++ b/app/src/lib/components/widget/Selector.svelte @@ -1,20 +1,19 @@ diff --git a/app/src/lib/stores/featureFlags.ts b/app/src/lib/stores/featureFlags.ts index cd461be..febbe78 100644 --- a/app/src/lib/stores/featureFlags.ts +++ b/app/src/lib/stores/featureFlags.ts @@ -2,19 +2,19 @@ import { api } from '$lib/api'; import { notifications } from '$lib/components/toasts/notifications'; import { writable, type Writable } from 'svelte/store'; -let featureFlagsStore: Writable>; +let featureFlagsStore: Writable>; export function useFeatureFlags() { - if (!featureFlagsStore) { - featureFlagsStore = writable>({}); + if (!featureFlagsStore) { + featureFlagsStore = writable>({}); - api.get>('/api/features').then((result) => { - if (result.isOk()) featureFlagsStore.set(result.inner); - else { - notifications.error('Feature flag could not be fetched', 2500); - } - }); - } + api.get>('/api/features').then(result => { + if (result.isOk()) featureFlagsStore.set(result.inner); + else { + notifications.error('Feature flag could not be fetched', 2500); + } + }); + } - return featureFlagsStore; -} \ No newline at end of file + return featureFlagsStore; +} diff --git a/app/src/lib/stores/location-store.ts b/app/src/lib/stores/location-store.ts index 6b0d180..ad1060e 100644 --- a/app/src/lib/stores/location-store.ts +++ b/app/src/lib/stores/location-store.ts @@ -1,5 +1,5 @@ import { persistentStore } from '$lib/utilities'; import { writable } from 'svelte/store'; -import appEnv from 'app-env'; +import { PUBLIC_VITE_USE_HOST_NAME } from '$env/static/public'; -export const location = appEnv.VITE_USE_HOST_NAME ? writable('') : persistentStore('location', ''); +export const location = PUBLIC_VITE_USE_HOST_NAME ? writable('') : persistentStore('location', ''); diff --git a/app/src/lib/stores/orientation.ts b/app/src/lib/stores/orientation.ts deleted file mode 100644 index d3814eb..0000000 --- a/app/src/lib/stores/orientation.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { readable } from 'svelte/store'; - -export const heading = readable(0, (set) => { - const updateHeading = (e: any) => { - let alpha; - if (e.webkitCompassHeading) alpha = e.webkitCompassHeading; - else if (e.alpha) alpha = e.alpha; - else { - let q = e.target.quaternion; - alpha = - Math.atan2(2 * q[0] * q[1] + 2 * q[2] * q[3], 1 - 2 * q[1] * q[1] - 2 * q[2] * q[2]) * - (180 / Math.PI); - if (alpha < 0) alpha += 360; - } - set(alpha); - }; - if ('AbsoluteOrientationSensor' in window) { - var sensor = new window.AbsoluteOrientationSensor({ frequency: 60 }) as any; - sensor.addEventListener('reading', updateHeading); - sensor.start(); - } else if (window.DeviceMotionEvent) window.addEventListener('deviceorientation', updateHeading); - - return () => { - if ('AbsoluteOrientationSensor' in window) sensor.removeEventListener('reading', updateHeading); - window.addEventListener('deviceorientation', updateHeading); - }; -}); diff --git a/app/src/lib/stores/socket.ts b/app/src/lib/stores/socket.ts index 951938e..716eea3 100644 --- a/app/src/lib/stores/socket.ts +++ b/app/src/lib/stores/socket.ts @@ -17,7 +17,7 @@ const decodeMessage = (data: string | ArrayBuffer): SocketMessage | null => { } return JSON.parse(data as string); } catch (error) { - console.error(`Could not decode data: ${data} - ${error}`); + console.error(`Could not decode data: ${new Uint8Array(data as ArrayBuffer)} - ${error}`); } return null; }; diff --git a/app/src/routes/+layout.ts b/app/src/routes/+layout.ts index 8fe7cda..b0fd523 100644 --- a/app/src/routes/+layout.ts +++ b/app/src/routes/+layout.ts @@ -2,21 +2,21 @@ export const prerender = false; export const ssr = false; const registerFetchIntercept = async () => { - const { fetch: originalFetch } = window; - const fileService = (await import('$lib/services/file-service')).default; - window.fetch = async (resource, config) => { - let url = resource instanceof Request ? resource.url : resource.toString(); - let file = await fileService.getFile(url); - return file.isOk() ? new Response(file.inner) : originalFetch(resource, config); - }; + const { fetch: originalFetch } = window; + const fileService = (await import('$lib/services/file-service')).default; + window.fetch = async (resource, config) => { + let url = resource instanceof Request ? resource.url : resource.toString(); + let file = await fileService?.getFile(url); + return file?.isOk() ? new Response(file.inner) : originalFetch(resource, config); + }; }; export const load = async () => { - await registerFetchIntercept(); - return { - title: 'Spot micro controller', - github: 'runeharlyk/SpotMicroESP32-Leika', - app_name: 'Spot Micro Controller', - copyright: '2024 Rune Harlyk' - }; + await registerFetchIntercept(); + return { + title: 'Spot micro controller', + github: 'runeharlyk/SpotMicroESP32-Leika', + app_name: 'Spot Micro Controller', + copyright: '2025 Rune Harlyk', + }; }; diff --git a/app/src/routes/peripherals/imu/imu.svelte b/app/src/routes/peripherals/imu/imu.svelte index 63d9318..b633ae4 100644 --- a/app/src/routes/peripherals/imu/imu.svelte +++ b/app/src/routes/peripherals/imu/imu.svelte @@ -1,51 +1,51 @@ {#snippet icon()} - + {/snippet} {#snippet title()} IMU diff --git a/app/src/routes/system/metrics/+page.svelte b/app/src/routes/system/metrics/+page.svelte index 14b7495..464a328 100644 --- a/app/src/routes/system/metrics/+page.svelte +++ b/app/src/routes/system/metrics/+page.svelte @@ -1,15 +1,7 @@
- +
diff --git a/app/src/routes/system/metrics/SystemMetrics.svelte b/app/src/routes/system/metrics/SystemMetrics.svelte index a1e2949..a37cfcb 100644 --- a/app/src/routes/system/metrics/SystemMetrics.svelte +++ b/app/src/routes/system/metrics/SystemMetrics.svelte @@ -1,373 +1,369 @@ - {#snippet icon()} - - {/snippet} - {#snippet title()} - System Metrics - {/snippet} + {#snippet icon()} + + {/snippet} + {#snippet title()} + System Metrics + {/snippet} -
-
- -
-
+
+
+ +
+
-
-
- -
-
-
-
- -
-
-
-
- -
-
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
diff --git a/app/src/routes/system/status/SystemStatus.svelte b/app/src/routes/system/status/SystemStatus.svelte index ff9cdc7..16f9ab0 100644 --- a/app/src/routes/system/status/SystemStatus.svelte +++ b/app/src/routes/system/status/SystemStatus.svelte @@ -1,16 +1,16 @@ @@ -144,89 +149,92 @@
{#await getSystemStatus()} - {:then nothing} -
- + {:then} + {#if systemInformation} +
+ - + - + - + - + - + - - + - - + - + - -
+ +
+ {/if} {/await}
diff --git a/app/src/routes/system/update/GithubFirmwareManager.svelte b/app/src/routes/system/update/GithubFirmwareManager.svelte index dbedd11..1e295be 100644 --- a/app/src/routes/system/update/GithubFirmwareManager.svelte +++ b/app/src/routes/system/update/GithubFirmwareManager.svelte @@ -1,165 +1,154 @@ - {#snippet icon()} - - {/snippet} - {#snippet title()} - Github Firmware Manager - {/snippet} - {#await getGithubAPI()} - - {:then githubReleases} -
-
- - - - - - - - - - - {#each githubReleases as release} - - - - - - - {/each} - -
ReleaseExperimentalInstall
- {release.name} - {#if release.prerelease} - - {/if} - - {#if compareVersions($features.firmware_version, release.tag_name) != 0} - - {/if} -
-
-
- {:catch error} -
- - Please connect to a network with internet access to perform a firmware update. -
- {/await} + {#snippet icon()} + + {/snippet} + {#snippet title()} + Github Firmware Manager + {/snippet} + {#await getGithubAPI()} + + {:then githubReleases} +
+
+ + + + + + + + + + + {#each githubReleases as release} + + + + + + + {/each} + +
ReleaseExperimentalInstall
+ {release.name} + {#if release.prerelease} + + {/if} + + {#if compareVersions($features.firmware_version as string, release.tag_name) != 0} + + {/if} +
+
+
+ {:catch error} +
+ + Please connect to a network with internet access to perform a firmware update. +
+ {/await}
diff --git a/app/src/routes/system/update/UploadFirmware.svelte b/app/src/routes/system/update/UploadFirmware.svelte index 2729dbd..c86ff78 100644 --- a/app/src/routes/system/update/UploadFirmware.svelte +++ b/app/src/routes/system/update/UploadFirmware.svelte @@ -1,57 +1,56 @@ - {#snippet icon()} - - {/snippet} - {#snippet title()} - Upload Firmware - {/snippet} -
- - Uploading a new firmware (.bin) file will replace the existing firmware. You may upload - a (.md5) file first to verify the uploaded firmware. - -
+ {#snippet icon()} + + {/snippet} + {#snippet title()} + Upload Firmware + {/snippet} +
+ + Uploading a new firmware (.bin) file will replace the existing firmware. You may upload a + (.md5) file first to verify the uploaded firmware. + +
- +
diff --git a/app/src/routes/wifi/ap/Accesspoint.svelte b/app/src/routes/wifi/ap/Accesspoint.svelte index 040d749..2317fbe 100644 --- a/app/src/routes/wifi/ap/Accesspoint.svelte +++ b/app/src/routes/wifi/ap/Accesspoint.svelte @@ -1,74 +1,71 @@ @@ -164,22 +162,24 @@
{#await getAPStatus()} - {:then nothing} -
- + {:then} + {#if apStatus} +
+ - + - + - -
+ +
+ {/if} {/await}
@@ -190,175 +190,176 @@
{#await getAPSettings()} - {:then nothing} -
-
-
- - -
-
- - - -
+ {:then} + {#if apSettings} +
+ +
+ + +
+
+ + + +
-
- - -
-
- - - -
+
+ + +
+
+ + + +
-
- - - -
+
+ + + +
-
- - - -
+
+ + + +
-
- - - -
-
- - - -
+
+ + + +
+
+ + + +
- + -
- -
- -
+
+ +
+ +
+ {/if} {/await} diff --git a/app/src/routes/wifi/sta/Scan.svelte b/app/src/routes/wifi/sta/Scan.svelte index 867dcfb..5eac41c 100644 --- a/app/src/routes/wifi/sta/Scan.svelte +++ b/app/src/routes/wifi/sta/Scan.svelte @@ -1,147 +1,131 @@ {#if isOpen} + {#await getWifiSettings()} - {:then nothing} -
- - + {:then} + {#if wifiSettings} +
+ + -
- - {#snippet children({ index })} - -
- - -
-
- {/snippet} -
-
-
- -
-
-
-
-
- - - -
- +
+ + {#snippet children({ index }: { index: number })} + +
+ + +
+
+ {/snippet} +
+
- {#if showNetworkEditor} -
-
+
+
+ +
-
-
- - -
-
- {#if static_ip_config} + + {#if showNetworkEditor} +
-
- -
- - -
- - -
-
- +
-
- - - -
+ type="checkbox" + bind:checked={static_ip_config} + class="checkbox checkbox-primary sm:-mb-5" /> + Static IP Config? +
- {/if} - {/if} + {#if static_ip_config} +
+
+ + + +
-
-
- - -
- -
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ {/if} + {/if} + +
+
+ + +
+ +
+ {/if} {/await}