aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/ScoreBadge.svelte
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-09-08 08:57:08 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-09-08 08:57:08 +0200
commit4b2b964283075712de98743720ff3e31370ddc8e (patch)
tree7200e83869dbd42d5f20318a07a6ca328e5ac59f /src/lib/components/ScoreBadge.svelte
parent992e40835af1600a0961ec2454fb78ff43aec3c6 (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/lib/components/ScoreBadge.svelte')
-rw-r--r--src/lib/components/ScoreBadge.svelte13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/components/ScoreBadge.svelte b/src/lib/components/ScoreBadge.svelte
new file mode 100644
index 0000000..6384667
--- /dev/null
+++ b/src/lib/components/ScoreBadge.svelte
@@ -0,0 +1,13 @@
+<script lang="ts">
+ let { score }: { score: number } = $props();
+
+ const className = $derived(
+ score >= 80
+ ? 'score bg-success'
+ : score >= 50
+ ? 'score bg-accent'
+ : 'score bg-danger',
+ );
+</script>
+
+<span class={className}>{score}</span>