Skip to content

Commit

Permalink
fixes WiFi settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
theelims committed Apr 24, 2024
1 parent 4476ee1 commit c93db7a
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file.

### Fixed

- Fixes to WiFi.svelte and models.ts to fix type errors and visibility rights.

### Removed

- Removed duplicate in ESP32SvelteKit.cpp [#47](https://github.com/theelims/ESP32-sveltekit/pull/47) and WiFi.svelte [#50](https://github.com/theelims/ESP32-sveltekit/pull/50)
Expand Down
2 changes: 1 addition & 1 deletion interface/src/lib/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type WifiStatus = {
export type WifiSettings = {
hostname: string;
priority_RSSI: boolean;
wifi_networks: NetworkItem[];
wifi_networks: KnownNetworkItem[];
};

export type KnownNetworkItem = {
Expand Down
114 changes: 56 additions & 58 deletions interface/src/routes/wifi/sta/Wifi.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,17 @@
{/await}
</div>

<div class="bg-base-200 shadow-lg relative grid w-full max-w-2xl self-center overflow-hidden">
<div
class="min-h-16 flex w-full items-center justify-between space-x-3 p-0 text-xl font-medium"
>
Saved Networks
</div>
{#await getWifiSettings()}
<Spinner />
{:then nothing}
<div class="relative w-full overflow-visible">
{#if !$page.data.features.security || $user.admin}
{#if !$page.data.features.security || $user.admin}
<div class="bg-base-200 shadow-lg relative grid w-full max-w-2xl self-center overflow-hidden">
<div
class="min-h-16 flex w-full items-center justify-between space-x-3 p-0 text-xl font-medium"
>
Saved Networks
</div>
{#await getWifiSettings()}
<Spinner />
{:then nothing}
<div class="relative w-full overflow-visible">
<button
class="btn btn-primary text-primary-content btn-md absolute -top-14 right-16"
on:click={() => {
Expand All @@ -487,55 +487,53 @@
>
<Scan class="h-6 w-6" /></button
>
{/if}

<div
class="overflow-x-auto space-y-1"
transition:slide|local={{ duration: 300, easing: cubicOut }}
>
<DragDropList
id="networks"
type={VerticalDropZone}
itemSize={60}
itemCount={dndNetworkList.length}
on:drop={onDrop}
let:index
<div
class="overflow-x-auto space-y-1"
transition:slide|local={{ duration: 300, easing: cubicOut }}
>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="rounded-box bg-base-100 flex items-center space-x-3 px-4 py-2">
<div class="mask mask-hexagon bg-primary h-auto w-10 shrink-0">
<Router class="text-primary-content h-auto w-full scale-75" />
</div>
<div>
<div class="font-bold">{dndNetworkList[index].ssid}</div>
</div>
{#if !$page.data.features.security || $user.admin}
<div class="flex-grow" />
<div class="space-x-0 px-0 mx-0">
<button
class="btn btn-ghost btn-sm"
on:click={() => {
handleEdit(index);
}}
>
<Edit class="h-6 w-6" /></button
>
<button
class="btn btn-ghost btn-sm"
on:click={() => {
confirmDelete(index);
}}
>
<Delete class="text-error h-6 w-6" />
</button>
<DragDropList
id="networks"
type={VerticalDropZone}
itemSize={60}
itemCount={dndNetworkList.length}
on:drop={onDrop}
let:index
>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="rounded-box bg-base-100 flex items-center space-x-3 px-4 py-2">
<div class="mask mask-hexagon bg-primary h-auto w-10 shrink-0">
<Router class="text-primary-content h-auto w-full scale-75" />
</div>
{/if}
</div>
</DragDropList>
<div>
<div class="font-bold">{dndNetworkList[index].ssid}</div>
</div>
{#if !$page.data.features.security || $user.admin}
<div class="flex-grow" />
<div class="space-x-0 px-0 mx-0">
<button
class="btn btn-ghost btn-sm"
on:click={() => {
handleEdit(index);
}}
>
<Edit class="h-6 w-6" /></button
>
<button
class="btn btn-ghost btn-sm"
on:click={() => {
confirmDelete(index);
}}
>
<Delete class="text-error h-6 w-6" />
</button>
</div>
{/if}
</div>
</DragDropList>
</div>
</div>
</div>

{#if !$page.data.features.security || $user.admin}
<div class="divider mb-0" />
<div
class="flex flex-col gap-2 p-0"
Expand Down Expand Up @@ -756,7 +754,7 @@
</div>
</form>
</div>
{/if}
{/await}
</div>
{/await}
</div>
{/if}
</SettingsCard>

0 comments on commit c93db7a

Please sign in to comment.