From 54ddd412654b48eee8cc979cc711c2a973ca878a Mon Sep 17 00:00:00 2001 From: Jake Date: Fri, 24 Apr 2026 20:41:51 +0100 Subject: [PATCH] feat(gamification): CompletionSparkline component Tiny inline SVG. Seven bars, zero-days render as 1 px baseline stubs. fill=currentColor so the parent's text colour (tertiary ink on the Tasks header) drives it. Self-hides if all 7 days are zero. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/lib/components/CompletionSparkline.svelte | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/lib/components/CompletionSparkline.svelte diff --git a/src/lib/components/CompletionSparkline.svelte b/src/lib/components/CompletionSparkline.svelte new file mode 100644 index 0000000..ca72bdc --- /dev/null +++ b/src/lib/components/CompletionSparkline.svelte @@ -0,0 +1,59 @@ + + +{#if hasAnyCompletion} + + {#each data as d, i} + {@const x = i * (barWidth + BAR_GAP)} + {@const proportion = d.count / maxCount} + {@const barHeight = Math.max(1, Math.round(proportion * height))} + {@const y = height - barHeight} + + {/each} + +{/if}