Fix workflow, UI settings as store

This commit is contained in:
Djuri Baars 2024-06-09 00:23:39 +02:00
parent e53b487236
commit 6a71f80718
5 changed files with 19 additions and 16 deletions

View file

@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- uses: actions/setup-node@v3 - uses: actions/setup-node@v4
with: with:
node-version: lts/* node-version: lts/*
cache: yarn cache: yarn
@ -47,7 +47,7 @@ jobs:
~/.cache/pip ~/.cache/pip
~/node_modules ~/node_modules
key: ${{ runner.os }}-pio key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4 - uses: actions/setup-python@v5
with: with:
python-version: '3.9' python-version: '3.9'
- name: Get current date - name: Get current date

7
src/lib/uiSettings.ts Normal file
View file

@ -0,0 +1,7 @@
import { writable } from 'svelte/store';
export const uiSettings = writable({
inputSize: 'sm',
selectClass: '',
btnSize: 'lg'
});

View file

@ -9,16 +9,17 @@
import Control from './Control.svelte'; import Control from './Control.svelte';
import Settings from './Settings.svelte'; import Settings from './Settings.svelte';
import Status from './Status.svelte'; import Status from './Status.svelte';
import { uiSettings } from '$lib/uiSettings';
let settings = writable({ let settings = writable({
fgColor: '0' fgColor: '0'
}); });
let uiSettings = writable({ // let uiSettings = writable({
inputSize: 'sm', // inputSize: 'sm',
selectClass: '', // selectClass: '',
btnSize: 'lg' // btnSize: 'lg'
}); // });
let status = writable({ let status = writable({
data: ['L', 'O', 'A', 'D', 'I', 'N', 'G'], data: ['L', 'O', 'A', 'D', 'I', 'N', 'G'],
@ -122,14 +123,9 @@
<Container fluid> <Container fluid>
<Row cols={{ lg: 3, sm: 1 }}> <Row cols={{ lg: 3, sm: 1 }}>
<Control bind:settings bind:uiSettings bind:status></Control> <Control bind:settings bind:status></Control>
<Status bind:settings bind:status></Status> <Status bind:settings bind:status></Status>
<Settings <Settings bind:settings on:showToast={showToast} on:formReset={fetchSettingsData}></Settings>
bind:settings
bind:uiSettings
on:showToast={showToast}
on:formReset={fetchSettingsData}
></Settings>
</Row> </Row>
</Container> </Container>
<div class="position-fixed bottom-0 end-0 p-2"> <div class="position-fixed bottom-0 end-0 p-2">

View file

@ -16,9 +16,9 @@
Row Row
} from 'sveltestrap'; } from 'sveltestrap';
import FirmwareUpdater from './FirmwareUpdater.svelte'; import FirmwareUpdater from './FirmwareUpdater.svelte';
import { uiSettings } from '$lib/uiSettings';
export let settings = {}; export let settings = {};
export let uiSettings;
export let customText: string; export let customText: string;
export let status: Writable<{ leds: [] }>; export let status: Writable<{ leds: [] }>;

View file

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { PUBLIC_BASE_URL } from '$lib/config'; import { PUBLIC_BASE_URL } from '$lib/config';
import { uiSettings } from '$lib/uiSettings';
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import { _ } from 'svelte-i18n'; import { _ } from 'svelte-i18n';
@ -20,7 +21,6 @@
} from 'sveltestrap'; } from 'sveltestrap';
export let settings; export let settings;
export let uiSettings;
const wifiTxPowerMap = new Map<string, number>([ const wifiTxPowerMap = new Map<string, number>([
['Default', 80], ['Default', 80],