Added first working stats to the dashboard

This commit is contained in:
Nicolai Ort 2021-08-18 15:28:21 +02:00
parent 0df9a52043
commit d13d6aa260
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
1 changed files with 11 additions and 2 deletions

View File

@ -1,10 +1,19 @@
<script>
import Apiclient from '$lib/Apiclient';
import Statscard from '$lib/Statscard.svelte';
$: stats = {
urls: 0,
visits: 99
};
Apiclient.getStats().then((res) => {
stats = res;
});
</script>
<h2 class="text-3xl font-bold text-gray-800 dark:text-gray-100 pb-6">Home</h2>
<div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
<Statscard title="Links created">
<Statscard title="Links created" bind:count={stats.urls}>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
@ -20,7 +29,7 @@
/>
</svg>
</Statscard>
<Statscard title="Visits">
<Statscard title="Visits" bind:count={stats.visits}>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"