добавил изменение цвета toggle

This commit is contained in:
Dmitry Borisenko
2022-08-16 14:07:10 +02:00
parent 3a03ae323d
commit 3aa38fb256
3 changed files with 8 additions and 6 deletions

View File

@@ -29,7 +29,6 @@
//****************************************************constants section*********************************************************/
//******************************************************************************************************************************/
let version = 410;
let debug = true;
let LOG_MAX_MESSAGES = 100;
let reconnectTimeout = 20000;
@@ -37,11 +36,12 @@
let updatingTimeout = 80000;
let opened = false;
let preventMove = false;
let devMode = true;
//****************************************************variable section**********************************************************/
//******************************************************************************************************************************/
let myip = document.location.hostname;
//let myip = "192.168.88.228";
if (devMode) myip = "192.168.88.228";
//Flags
let firstDevListRequest = true;
@@ -1122,7 +1122,9 @@
<Route path="/">
<DashboardPage show={dashReady} layoutJson={layoutJson} pages={pages} wsPush={(ws, topic, status) => wsPush(ws, topic, status)} />
<!--<button class="btn-lg" on:click={() => createFinalLayout()}>{"Test"}</button>-->
<!--<textarea value={JSON.stringify(layoutJson)} class="ipt-big h-40 w-full" />-->
{#if devMode}
<textarea value={JSON.stringify(layoutJson)} class="ipt-big h-40 w-full" />
{/if}
</Route>
<Route path="/config">
<ConfigPage show={configReady} configJson={configJson} widgetsJson={widgetsJson} itemsJson={itemsJson} bind:scenarioTxt saveConfig={() => saveConfig()} rebootEsp={() => rebootEsp()} />

View File

@@ -10,7 +10,7 @@
</div>
<div class="flex justify-end w-1/3">
{#if widget.type == "number"}
<input class={widget.sent ? "ipt-rnd text-right border-red-500" : "ipt-rnd text-right focus:border-indigo-500"} on:change={() => ((widget.sent = true), wsPush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} step="0.01" type="number" />
<input class={widget.sent ? "ipt-rnd text-right border-red-500" : "ipt-rnd text-right focus:border-indigo-500"} on:change={() => ((widget.sent = true), wsPush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} step="0.1" type="number" />
{/if}
{#if widget.type == "text"}
<input class={widget.sent ? "ipt-rnd text-right border-red-500" : "ipt-rnd text-right focus:border-indigo-500"} on:change={() => ((widget.sent = true), wsPush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} type="text" />

View File

@@ -33,8 +33,8 @@
<label for={widget.topic} class="items-center cursor-pointer">
<div class="relative">
<input bind:checked={toggleState} on:change={() => (changeValue(), wsPush(widget.ws, widget.topic, widget.status))} id={widget.topic} type="checkbox" class="sr-only" />
<div class="block bg-gray-600 w-10 h-6 rounded-full" />
<div class="dot {widget.sent ? 'bg-red-400' : 'bg-white'} absolute left-1 top-1 w-4 h-4 rounded-full transition" />
<div class="block {toggleState ? 'bg-blue-600' : 'bg-gray-600'} w-10 h-6 rounded-full shadow-lg" />
<div class="dot {widget.sent ? 'bg-red-300' : 'bg-gray-100'} absolute left-1 top-1 w-4 h-4 rounded-full transition shadow-lg" />
</div>
</label>
</div>