Skip to content

Commit

Permalink
fix: warn users if no device is connected
Browse files Browse the repository at this point in the history
fix: can't backup without a device
  • Loading branch information
Theaninova committed Dec 8, 2023
1 parent af01426 commit f9a63a8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
29 changes: 24 additions & 5 deletions src/routes/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import {loadLocaleAsync} from "../i18n/i18n-util.async"
import {tick} from "svelte"
import SyncOverlay from "./SyncOverlay.svelte"
import {serialPort} from "$lib/serial/connection"
let locale = (browser && (localStorage.getItem("locale") as Locales)) || detectLocale()
$: if (browser)
Expand Down Expand Up @@ -46,9 +47,14 @@
>
</li>
</ul>

<SyncOverlay />

<div>
{#if !$serialPort}
<div class="warning">
<span class="icon">warning</span>{$LL.deviceManager.NO_DEVICE()}
</div>
{/if}
<SyncOverlay />
</div>
<ul>
<li>
<input use:action={{title: $LL.profile.theme.COLOR_SCHEME()}} type="color" bind:value={$theme.color} />
Expand Down Expand Up @@ -87,6 +93,14 @@
opacity: 0;
}
.warning {
color: var(--md-sys-color-error);
gap: 8px;
display: flex;
align-items: center;
justify-content: center;
}
input[type="color"] {
cursor: pointer;
Expand Down Expand Up @@ -116,9 +130,10 @@
}
footer {
display: flex;
display: grid;
align-items: center;
justify-content: space-between;
justify-content: center;
grid-template-columns: 1fr auto 1fr;
width: 100%;
padding: 8px;
Expand All @@ -137,6 +152,10 @@
padding: 0;
list-style: none;
&:last-child {
justify-content: flex-end;
}
}
ul:last-child {
Expand Down
16 changes: 7 additions & 9 deletions src/routes/Navigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@
<PwaStatus />
{/await}
{/if}
{#if $serialPort}
<button use:action={{title: $LL.backup.TITLE()}} use:popup={BackupPopup} class="icon {$syncStatus}">
{#if $userPreferences.backup}
history
{:else}
history_toggle_off
{/if}
</button>
{/if}
<button use:action={{title: $LL.backup.TITLE()}} use:popup={BackupPopup} class="icon {$syncStatus}">
{#if $userPreferences.backup}
history
{:else}
history_toggle_off
{/if}
</button>
<button
bind:this={connectButton}
use:action={{title: $LL.deviceManager.TITLE()}}
Expand Down
17 changes: 0 additions & 17 deletions src/routes/config/+layout.svelte

This file was deleted.

2 changes: 1 addition & 1 deletion src/routes/config/layout/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
onHidden(instance) {
instance.destroy()
},
onDestroy(instance) {
onDestroy() {
shareComponent.$destroy()
},
}).show()
Expand Down

0 comments on commit f9a63a8

Please sign in to comment.