diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-08 08:57:08 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-08 08:57:08 +0200 |
| commit | 4b2b964283075712de98743720ff3e31370ddc8e (patch) | |
| tree | 7200e83869dbd42d5f20318a07a6ca328e5ac59f /src/routes/+page.svelte | |
| parent | 992e40835af1600a0961ec2454fb78ff43aec3c6 (diff) | |
Deduplicate routine actions and badges across project routes
- Share edit/complete/archive form actions in routine-actions.ts; route
servers become thin wrappers (strictest guard semantics in one place)
- Move parseFrequencyDays into validation.ts
- Extract ScoreBadge/StatusBadge components; use on project pages and
the home page instead of duplicated scoreClass/statusClass helpers
- Fix archiveProject calling the routine archive with the project id
Diffstat (limited to 'src/routes/+page.svelte')
| -rw-r--r-- | src/routes/+page.svelte | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index fd987ff..35ff5d7 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,21 +1,16 @@ <script lang="ts"> import { enhance } from '$app/forms'; + import ScoreBadge from '$lib/components/ScoreBadge.svelte'; let { data, form } = $props(); let name = $state(''); - - function scoreClass(score: number): string { - if (score >= 80) return 'score bg-success'; - if (score >= 50) return 'score bg-accent'; - return 'score bg-danger'; - } </script> <main> <header class="page-header"> <h1>Projets</h1> - <span class={scoreClass(data.globalScore)}>{data.globalScore}</span> + <ScoreBadge score={data.globalScore} /> </header> <form class="add-bar" method="POST" action="?/addProject" use:enhance> @@ -40,7 +35,7 @@ <a class="project-link" href="/projects/{entry.project.id}" >{entry.project.name}</a > - <span class={scoreClass(entry.healthScore)}>{entry.healthScore}</span> + <ScoreBadge score={entry.healthScore} /> </li> {/each} </ul> |
