mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 09:23:00 +00:00
feat: editing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import {serialPort, syncStatus, unsavedChanges} from "$lib/serial/connection"
|
||||
import {serialPort, syncStatus} from "$lib/serial/connection"
|
||||
import {slide, fly} from "svelte/transition"
|
||||
import {canShare, triggerShare} from "$lib/share"
|
||||
import {popup} from "$lib/popup"
|
||||
@@ -13,24 +13,6 @@
|
||||
import ConfigTabs from "./ConfigTabs.svelte"
|
||||
import EditActions from "./EditActions.svelte"
|
||||
|
||||
async function flashChanges() {
|
||||
$syncStatus = "uploading"
|
||||
// Yes, this is a completely arbitrary and unnecessary delay.
|
||||
// The only purpose of it is to create a sense of weight,
|
||||
// aka make it more "energy intensive" to click.
|
||||
// The only conceivable way users could reach the commit limit in this case
|
||||
// would be if they click it every time they change a setting.
|
||||
// Because of that, we don't need to show a fearmongering message such as
|
||||
// "Your device will break after you click this 10,000 times!"
|
||||
await new Promise(resolve => setTimeout(resolve, 6000))
|
||||
$serialPort.commit()
|
||||
unsavedChanges.update(it => {
|
||||
it.clear()
|
||||
return it
|
||||
})
|
||||
$syncStatus = "done"
|
||||
}
|
||||
|
||||
$: if (browser && !canAutoConnect()) {
|
||||
connectButton?.click()
|
||||
}
|
||||
@@ -55,17 +37,6 @@
|
||||
<PwaStatus />
|
||||
{/await}
|
||||
{/if}
|
||||
{#if $unsavedChanges.size > 0}
|
||||
<button
|
||||
disabled={$syncStatus === "uploading"}
|
||||
on:click={flashChanges}
|
||||
transition:fly={{x: -8}}
|
||||
title={$LL.deviceManager.APPLY_SETTINGS()}
|
||||
class="icon"
|
||||
>save
|
||||
</button>
|
||||
<div transition:slide class="separator" />
|
||||
{/if}
|
||||
{#if $serialPort}
|
||||
<button title={$LL.backup.TITLE()} use:popup={BackupPopup} class="icon {$syncStatus}">
|
||||
{#if $syncStatus === "downloading"}
|
||||
|
||||
Reference in New Issue
Block a user