src/routes/(auth)/+page.svelte (view raw)
1<script lang="ts">
2 import { db } from '$lib/db';
3 import { liveQuery } from 'dexie';
4 import NewTask from './NewTask.svelte';
5 import Task from './Task.svelte';
6 import type { PageData } from './$types';
7
8 let { data }: { data: PageData } = $props();
9 let tasks = liveQuery(() => db.tasks.toArray());
10</script>
11
12<div class="flex flex-col gap-4 py-4">
13 {#each $tasks as task (task.id)}
14 <Task {task} />
15 {:else}
16 <p class="text-center">Aucune tâche actuellement</p>
17 {/each}
18</div>
19
20<ul>
21 {#each data.tasks as task}
22 <li>{task.name} {task.done} {task.datetime}</li>
23 {/each}
24</ul>
25
26<NewTask />