Add toast feedback and linter
This commit is contained in:
parent
c5ee4bfd06
commit
5197847e1e
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -63,6 +63,8 @@ jobs:
|
|||||||
run: yarn && yarn postinstall
|
run: yarn && yarn postinstall
|
||||||
- name: Build WebUI
|
- name: Build WebUI
|
||||||
run: yarn build
|
run: yarn build
|
||||||
|
- name: Run linter
|
||||||
|
run: yarn lint
|
||||||
- name: Get current block
|
- name: Get current block
|
||||||
id: getBlockHeight
|
id: getBlockHeight
|
||||||
run: echo "blockHeight=$(curl -s https://mempool.space/api/blocks/tip/height)" >> $GITHUB_OUTPUT
|
run: echo "blockHeight=$(curl -s https://mempool.space/api/blocks/tip/height)" >> $GITHUB_OUTPUT
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
"tzOffsetHelpText": "A restart is required to apply TZ offset.",
|
"tzOffsetHelpText": "A restart is required to apply TZ offset.",
|
||||||
"screens": "Screens",
|
"screens": "Screens",
|
||||||
"wifiTxPowerText": "In most cases this does not need to be set.",
|
"wifiTxPowerText": "In most cases this does not need to be set.",
|
||||||
"wifiTxPower": "WiFi TX power"
|
"wifiTxPower": "WiFi TX power",
|
||||||
|
"settingsSaved": "Settings saved",
|
||||||
|
"errorSavingSettings": "Error saving settings"
|
||||||
},
|
},
|
||||||
"control": {
|
"control": {
|
||||||
"systemInfo": "System info",
|
"systemInfo": "System info",
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
"hostnamePrefix": "Prefijo de nombre de host",
|
"hostnamePrefix": "Prefijo de nombre de host",
|
||||||
"mempoolnstance": "Instancia de Mempool",
|
"mempoolnstance": "Instancia de Mempool",
|
||||||
"otaUpdates": "Actualización por aire",
|
"otaUpdates": "Actualización por aire",
|
||||||
"wifiTxPowerText": "En la mayoría de los casos no es necesario configurar esto."
|
"wifiTxPowerText": "En la mayoría de los casos no es necesario configurar esto.",
|
||||||
|
"settingsSaved": "Configuración guardada",
|
||||||
|
"errorSavingSettings": "Error al guardar la configuración"
|
||||||
},
|
},
|
||||||
"control": {
|
"control": {
|
||||||
"turnOff": "Apagar",
|
"turnOff": "Apagar",
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
"mempoolnstance": "Mempool instantie",
|
"mempoolnstance": "Mempool instantie",
|
||||||
"otaUpdates": "OTA updates",
|
"otaUpdates": "OTA updates",
|
||||||
"wifiTxPower": "WiFi TX power",
|
"wifiTxPower": "WiFi TX power",
|
||||||
"wifiTxPowerText": "Meestal hoeft dit niet aangepast te worden."
|
"wifiTxPowerText": "Meestal hoeft dit niet aangepast te worden.",
|
||||||
|
"settingsSaved": "Instellingen opgeslagen",
|
||||||
|
"errorSavingSettings": "Fout bij opslaan instellingen"
|
||||||
},
|
},
|
||||||
"control": {
|
"control": {
|
||||||
"systemInfo": "Systeeminformatie",
|
"systemInfo": "Systeeminformatie",
|
||||||
|
@ -39,6 +39,7 @@ $input-font-size-sm: $font-size-base * 0.875;
|
|||||||
@import '../node_modules/bootstrap/scss/card';
|
@import '../node_modules/bootstrap/scss/card';
|
||||||
@import '../node_modules/bootstrap/scss/progress';
|
@import '../node_modules/bootstrap/scss/progress';
|
||||||
@import '../node_modules/bootstrap/scss/tooltip';
|
@import '../node_modules/bootstrap/scss/tooltip';
|
||||||
|
@import '../node_modules/bootstrap/scss/toasts';
|
||||||
|
|
||||||
@import '../node_modules/bootstrap/scss/helpers';
|
@import '../node_modules/bootstrap/scss/helpers';
|
||||||
@import '../node_modules/bootstrap/scss/utilities/api';
|
@import '../node_modules/bootstrap/scss/utilities/api';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PUBLIC_BASE_URL } from '$env/static/public';
|
import { PUBLIC_BASE_URL } from '$env/static/public';
|
||||||
|
|
||||||
import { Container, Row } from 'sveltestrap';
|
import { Container, Row, Toast, ToastBody } from 'sveltestrap';
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
@ -55,6 +55,16 @@
|
|||||||
status.set(dataObj);
|
status.set(dataObj);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let toastIsOpen = false;
|
||||||
|
let toastColor = 'success';
|
||||||
|
let toastBody = '';
|
||||||
|
|
||||||
|
export const showToast = (event) => {
|
||||||
|
toastIsOpen = true;
|
||||||
|
toastColor = event.detail.color;
|
||||||
|
toastBody = event.detail.text;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@ -65,6 +75,20 @@
|
|||||||
<Row>
|
<Row>
|
||||||
<Control bind:settings bind:status></Control>
|
<Control bind:settings bind:status></Control>
|
||||||
<Status bind:settings bind:status></Status>
|
<Status bind:settings bind:status></Status>
|
||||||
<Settings bind:settings></Settings>
|
<Settings bind:settings on:showToast={showToast}></Settings>
|
||||||
</Row>
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
|
<div class="position-fixed bottom-0 end-0 p-2">
|
||||||
|
<div class="">
|
||||||
|
<Toast
|
||||||
|
isOpen={toastIsOpen}
|
||||||
|
class="me-1 bg-{toastColor}"
|
||||||
|
autohide
|
||||||
|
on:close={() => (toastIsOpen = false)}
|
||||||
|
>
|
||||||
|
<ToastBody>
|
||||||
|
{toastBody}
|
||||||
|
</ToastBody>
|
||||||
|
</Toast>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PUBLIC_BASE_URL } from '$env/static/public';
|
import { PUBLIC_BASE_URL } from '$env/static/public';
|
||||||
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
import { _ } from 'svelte-i18n';
|
import { _ } from 'svelte-i18n';
|
||||||
import {
|
import {
|
||||||
@ -34,6 +35,8 @@
|
|||||||
['5dBm', 20] // 5dBm
|
['5dBm', 20] // 5dBm
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
const onSave = async (e: Event) => {
|
const onSave = async (e: Event) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let formSettings = $settings;
|
let formSettings = $settings;
|
||||||
@ -48,7 +51,19 @@
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify(formSettings)
|
body: JSON.stringify(formSettings)
|
||||||
});
|
})
|
||||||
|
.then(() => {
|
||||||
|
dispatch('showToast', {
|
||||||
|
color: 'success',
|
||||||
|
text: $_('section.settings.settingsSaved')
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
dispatch('showToast', {
|
||||||
|
color: 'danger',
|
||||||
|
text: $_('section.settings.errorSavingSettings')
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user