blob: 66b3259fc2f329091907f357f5004c97abb55369 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<script lang="ts">
import { enhance } from '$app/forms';
import ScoreBadge from '$lib/components/ScoreBadge.svelte';
import Button from '$lib/components/Button.svelte';
import Row from '$lib/components/Row.svelte';
let { data, form } = $props();
let name = $state('');
</script>
<main>
<header class="page-header">
<h1>Projets</h1>
<ScoreBadge score={data.globalScore} />
</header>
<form class="add-bar" method="POST" action="?/addProject" use:enhance>
<input
class="form-input"
type="text"
name="name"
bind:value={name}
placeholder="Nouveau projet..."
autocomplete="off"
/>
<Button variant="accent" ariaLabel="Ajouter">+</Button>
</form>
{#if form?.error}
<p class="error">{form.error}</p>
{/if}
<ul class="item-list">
{#each data.projects as entry (entry.project.id)}
<Row style="padding: 0.875rem 1rem;">
<a class="project-link" href="/projects/{entry.project.id}"
>{entry.project.name}</a
>
<ScoreBadge score={entry.healthScore} />
</Row>
{/each}
</ul>
{#if data.projects.length === 0}
<p class="empty">Aucun projet</p>
{/if}
</main>
<style>
.project-link {
flex-grow: 1;
font-weight: 500;
color: var(--text);
text-decoration: none;
}
.project-link:hover {
color: var(--accent);
}
</style>
|