added live clock widget

ref #1
This commit is contained in:
Philipp Dormann 2021-03-15 14:55:59 +01:00
parent 84a2ca60b7
commit 22671156a9

View File

@ -1,4 +1,6 @@
<div>
<h1 class="font-semibold w-full text-center text-gray-900">Lauf Für Kaya! Scan 📷</h1>
<h1 class="mr-6 text-6xl font-semibold text-center text-gray-900">{hours}:{minutes}:{seconds}</h1>
<h1 class="mr-6 text-lg font-semibold text-right text-gray-900">configured lap: 400m</h1>
<h1 class="mr-6 text-lg font-semibold text-right text-gray-900">minimum lap time: 10s</h1>
<div class="w-full p-3 text-right">
@ -34,4 +36,12 @@
<script>
import {apikey} from './store.js';
import {lang} from './store.js';
// live clock at the top
let time = new Date();
$: hours = (time.getHours()+"").padStart(2,"0");
$: minutes = (time.getMinutes()+"").padStart(2,"0");
$: seconds = (time.getSeconds()+"").padStart(2,"0");
const interval = setInterval(() => {
time = new Date();
}, 1000);
</script>