From 99660b9a23b342480cfa7c49ebf96838d2e32d89 Mon Sep 17 00:00:00 2001 From: Rune Harlyk Date: Sat, 8 Mar 2025 14:35:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=BC=20Refactors=20wifi=20and=20ap=20to?= =?UTF-8?q?=20use=20StatusItem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/lib/components/StatusItem.svelte | 43 + .../routes/system/status/StatusItem.svelte | 15 - .../routes/system/status/SystemStatus.svelte | 4 +- app/src/routes/wifi/ap/Accesspoint.svelte | 744 +++++----- app/src/routes/wifi/sta/Wifi.svelte | 1310 ++++++++--------- 5 files changed, 955 insertions(+), 1161 deletions(-) create mode 100644 app/src/lib/components/StatusItem.svelte delete mode 100644 app/src/routes/system/status/StatusItem.svelte diff --git a/app/src/lib/components/StatusItem.svelte b/app/src/lib/components/StatusItem.svelte new file mode 100644 index 0000000..5b7f894 --- /dev/null +++ b/app/src/lib/components/StatusItem.svelte @@ -0,0 +1,43 @@ + + +
+
+ +
+
+
{title}
+
{description}
+
+ {@render children?.()} +
diff --git a/app/src/routes/system/status/StatusItem.svelte b/app/src/routes/system/status/StatusItem.svelte deleted file mode 100644 index f3f1f03..0000000 --- a/app/src/routes/system/status/StatusItem.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - -
-
- -
-
-
{title}
-
{description}
-
-
diff --git a/app/src/routes/system/status/SystemStatus.svelte b/app/src/routes/system/status/SystemStatus.svelte index 3c474ba..10dbac2 100644 --- a/app/src/routes/system/status/SystemStatus.svelte +++ b/app/src/routes/system/status/SystemStatus.svelte @@ -6,12 +6,10 @@ import Spinner from '$lib/components/Spinner.svelte' import { slide } from 'svelte/transition' import { cubicOut } from 'svelte/easing' - import type { SystemInformation, Analytics } from '$lib/types/models' import { socket } from '$lib/stores/socket' import { api } from '$lib/api' import { convertSeconds } from '$lib/utilities' - import { useFeatureFlags } from '$lib/stores/featureFlags' import { Cancel, @@ -31,7 +29,7 @@ Temperature, Stopwatch } from '$lib/components/icons' - import StatusItem from './StatusItem.svelte' + import StatusItem from '$lib/components/StatusItem.svelte' import ActionButton from './ActionButton.svelte' const features = useFeatureFlags() diff --git a/app/src/routes/wifi/ap/Accesspoint.svelte b/app/src/routes/wifi/ap/Accesspoint.svelte index d4e213b..040d749 100644 --- a/app/src/routes/wifi/ap/Accesspoint.svelte +++ b/app/src/routes/wifi/ap/Accesspoint.svelte @@ -1,436 +1,364 @@ - {#snippet icon()} - - {/snippet} - {#snippet title()} - Access Point - {/snippet} -
- {#await getAPStatus()} - - {:then nothing} -
-
-
- -
-
-
Status
-
- {apStatusDescription[apStatus.status].description} -
-
-
+ {#snippet icon()} + + {/snippet} + {#snippet title()} + Access Point + {/snippet} +
+ {#await getAPStatus()} + + {:then nothing} +
+ -
-
- -
-
-
IP Address
-
- {apStatus.ip_address} -
-
-
+ -
-
- -
-
-
MAC Address
-
- {apStatus.mac_address} -
-
-
+ -
-
- -
-
-
AP Clients
-
- {apStatus.station_num} -
-
-
-
- {/await} + +
+ {/await} +
+ +
+
+ Change AP Settings
+ {#await getAPSettings()} + + {:then nothing} +
+
+
+ + +
+
+ + + +
-
-
- Change AP Settings -
- {#await getAPSettings()} - - {:then nothing} -
- -
- - -
-
- - - -
+
+ + +
+
+ + + +
-
- - -
-
- - - -
+
+ + + +
-
- - - -
+
+ + + +
-
- - - -
+
+ + + +
+
+ + + +
-
- - - -
-
- - - -
+ - - -
- -
- -
- {/await} -
+
+ +
+ +
+ {/await} +
diff --git a/app/src/routes/wifi/sta/Wifi.svelte b/app/src/routes/wifi/sta/Wifi.svelte index 697aafa..fbd53f9 100644 --- a/app/src/routes/wifi/sta/Wifi.svelte +++ b/app/src/routes/wifi/sta/Wifi.svelte @@ -1,762 +1,602 @@ - {#snippet icon()} - - {/snippet} - {#snippet title()} - WiFi Connection - {/snippet} -
- {#await getWifiStatus()} - - {:then nothing} -
-
-
- -
-
-
Status
-
- {wifiStatus.status === 3 ? 'Connected' : 'Inactive'} -
-
-
- {#if wifiStatus.status === 3} -
-
- -
-
-
SSID
-
- {wifiStatus.ssid} -
-
-
+ {#snippet icon()} + + {/snippet} + {#snippet title()} + WiFi Connection + {/snippet} +
+ {#await getWifiStatus()} + + {:then nothing} +
+ -
-
- -
-
-
IP Address
-
- {wifiStatus.local_ip} -
-
-
+ {#if wifiStatus.status === 3} + -
-
- -
-
-
RSSI
-
- {wifiStatus.rssi} dBm -
-
-
- -
- {/if} -
+ - - {#if showWifiDetails} -
-
-
- -
-
-
MAC Address
-
- {wifiStatus.mac_address} -
-
-
+ + + + {/if} +
-
-
- -
-
-
Channel
-
- {wifiStatus.channel} -
-
-
- -
-
- -
-
-
Gateway IP
-
- {wifiStatus.gateway_ip} -
-
-
- -
-
- -
-
-
Subnet Mask
-
- {wifiStatus.subnet_mask} -
-
-
- -
-
- -
-
-
DNS
-
- {wifiStatus.dns_ip_1} -
-
-
-
- {/if} - {/await} -
- -
+ + {#if showWifiDetails}
- Saved Networks + class="flex w-full flex-col space-y-1 pt-1" + transition:slide|local={{ duration: 300, easing: cubicOut }}> + + + + + + + + +
- {#await getWifiSettings()} - - {:then nothing} -
- - + {/if} + {/await} +
-
- - {#snippet children({ index })} - -
-
- -
-
-
{dndNetworkList[index].ssid}
-
-
-
- - -
-
- {/snippet} -
-
-
- -
-
-
-
-
- - - -
- -
- - {#if showNetworkEditor} -
-
-
- - - -
-
- - -
- -
- {#if static_ip_config} -
-
- - - -
- -
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- {/if} - {/if} - -
-
- - -
-
-
- {/await} +
+
+ Saved Networks
+ {#await getWifiSettings()} + + {:then nothing} +
+ + + +
+ + {#snippet children({ index })} + +
+ + +
+
+ {/snippet} +
+
+
+ +
+
+
+
+
+ + + +
+ +
+ + {#if showNetworkEditor} +
+
+
+ + + +
+
+ + +
+ +
+ {#if static_ip_config} +
+
+ + + +
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ {/if} + {/if} + +
+
+ + +
+
+
+ {/await} +