webui/src/routes/+page.svelte

44 lines
1.1 KiB
Svelte
Raw Normal View History

2023-11-17 00:05:35 +00:00
<script lang="ts">
import { PUBLIC_BASE_URL } from '$env/static/public';
import { _ } from 'svelte-i18n';
import { Col, Container, Row } from 'sveltestrap';
import Control from './Control.svelte';
import Status from './Status.svelte';
import Settings from './Settings.svelte';
import { writable } from 'svelte/store';
import { onMount } from 'svelte';
2023-11-17 02:15:23 +00:00
let settings = writable({
fgColor: "0"
});
2023-11-17 00:05:35 +00:00
onMount(() => {
fetch( PUBLIC_BASE_URL + `/api/settings`)
.then((res) => res.json())
.then((data) => {
data.fgColor = String(data.fgColor);
data.bgColor = String(data.bgColor);
2023-11-17 02:15:23 +00:00
data.timePerScreen = data.timerSeconds / 60;
if (data.fgColor> 65535) {
data.fgColor = "65535";
}
2023-11-17 12:12:22 +00:00
if (data.bgColor> 65535) {
data.bgColor = "65535";
}
2023-11-17 00:05:35 +00:00
settings.set(data);
});
});
</script>
<Container fluid>
<Row>
<Control bind:settings></Control>
<Status bind:settings></Status>
<Settings bind:settings></Settings>
</Row>
</Container>