From 559815f7a3e611940e7b741eb7cf3b841e4d5b61 Mon Sep 17 00:00:00 2001 From: xarmian Date: Sat, 28 Mar 2026 14:14:32 +0000 Subject: [PATCH] Add burndown chart to phase detail pages Create PhaseChart SVG component showing task completion over time with an ideal burndown line, actual step chart, and today marker. Wire it into PhaseTasks (shown when phase has start_date) and pass phaseFields from the item detail page. --- .../lib/components/phases/PhaseChart.svelte | 251 ++++++++++++++++++ .../lib/components/phases/PhaseTasks.svelte | 8 +- .../[collection]/[slug]/+page.svelte | 2 +- 3 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 web/src/lib/components/phases/PhaseChart.svelte diff --git a/web/src/lib/components/phases/PhaseChart.svelte b/web/src/lib/components/phases/PhaseChart.svelte new file mode 100644 index 00000000..8da0c61d --- /dev/null +++ b/web/src/lib/components/phases/PhaseChart.svelte @@ -0,0 +1,251 @@ + + +{#if chartData} +
+ + + + {#each chartData.yTicks as tick (tick.value)} + + + {tick.value} + + {/each} + + + + + + + + + + + + {#if chartData.showTodayMarker} + + + today + + {/if} + + + + + + + {chartData.startLabel} + + + {chartData.endLabel} + + + +
+{/if} + + diff --git a/web/src/lib/components/phases/PhaseTasks.svelte b/web/src/lib/components/phases/PhaseTasks.svelte index e11edc99..66ffeafc 100644 --- a/web/src/lib/components/phases/PhaseTasks.svelte +++ b/web/src/lib/components/phases/PhaseTasks.svelte @@ -5,14 +5,16 @@ import { parseFields, formatItemRef } from '$lib/types'; import { dndzone, TRIGGERS, SHADOW_ITEM_MARKER_PROPERTY_NAME } from 'svelte-dnd-action'; import type { DndEvent } from 'svelte-dnd-action'; + import PhaseChart from './PhaseChart.svelte'; interface Props { wsSlug: string; itemSlug: string; itemId: string; + phaseFields?: Record; } - let { wsSlug, itemSlug, itemId }: Props = $props(); + let { wsSlug, itemSlug, itemId, phaseFields }: Props = $props(); let tasks = $state([]); let loading = $state(true); @@ -123,6 +125,10 @@
+ {#if !loading && tasks.length > 0 && phaseFields?.start_date} + + {/if} + {#if loading}
diff --git a/web/src/routes/[workspace]/[collection]/[slug]/+page.svelte b/web/src/routes/[workspace]/[collection]/[slug]/+page.svelte index fcf63b3a..80d00448 100644 --- a/web/src/routes/[workspace]/[collection]/[slug]/+page.svelte +++ b/web/src/routes/[workspace]/[collection]/[slug]/+page.svelte @@ -454,7 +454,7 @@ {#if collSlug === 'phases' && item} - + {/if}