From d49882b3f986b49c908a3e1c6e41b98e4ff34309 Mon Sep 17 00:00:00 2001 From: Jonathan Hvid Date: Tue, 12 May 2026 11:43:07 +0200 Subject: [PATCH] =?UTF-8?q?feat(route):=20nav=20script=20=E2=80=94=20arrow?= =?UTF-8?q?s,=20fades,=20progress=20dots,=20initial=20scroll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vanilla TS script at the bottom of RoadmapRoute.astro. No library. - Arrows scrollBy ±72% of the scroll-container's clientWidth, smooth behaviour. Disabled at scroll start/end. - Edge fades (.rr-fade-left / -right) flip opacity 0↔1 at scroll start / end so the affordance disappears when there's nowhere further to go. - Progress dots track scrollLeft/(scrollWidth-clientWidth) percentage, bucketing into dots.length slots. Active dot gets .active (themed in CSS as --on-surface). - On mount, the script reads section.data-initial-x — the SVG x position of the most recent shipping milestone (computed server-side from the layout helper) — and scrolls so that x sits ~25% from the left edge of the viewport. Clamped to [0, scrollWidth-clientWidth]. Member opens /roadmap and immediately sees one shipped item + several ahead-of-them items, not the very start of history. - setTimeout(update, 50) re-measures after first paint settles (especially relevant when SVG fonts or other late-arriving assets shift the trackWidth by a couple of px). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/RoadmapRoute.astro | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/components/RoadmapRoute.astro b/src/components/RoadmapRoute.astro index 5a8ecb8..182991c 100644 --- a/src/components/RoadmapRoute.astro +++ b/src/components/RoadmapRoute.astro @@ -159,6 +159,58 @@ const initialShippingX = lastShippingIndex >= 0 ? itemXByIndex[lastShippingIndex + +