Skip to content

feat(site/src/pages/TemplateBuilder): make sidebar steps navigable - #28153

Open
aqandrew wants to merge 2 commits into
mainfrom
feat/navigable-sidebar-steps
Open

feat(site/src/pages/TemplateBuilder): make sidebar steps navigable#28153
aqandrew wants to merge 2 commits into
mainfrom
feat/navigable-sidebar-steps

Conversation

@aqandrew

Copy link
Copy Markdown
Contributor

What

Makes the remaining SelectionSummary sidebar elements clickable jump targets on /templates/new/builder, continuing the work from #27351 (which made module rows navigable).

Clickable now:

Sidebar element Jumps to
Base Template label base-infra
Selected base-template row base-parameters (falls back to base-infra when that step is skipped)
Modules label module-select
Each module row module-settings + scroll (already shipped in #27351)
Customizations label customizations

Back-stack behavior

The sidebar previously colored groups purely from the current step, so jumping backward would grey out and disable steps you had already reached. This adds a maxReachedGroup that never shrinks on backward navigation:

  • Groups at or below the furthest-reached group stay complete (green) and clickable, like a browser back-stack.
  • Groups strictly above render as upcoming and inert (no button, no hover, not focusable).
  • The connecting divider color keys off maxReachedGroup, not the current step, so it stays green after navigating backward.

Clickability is gated on maxReachedGroup (you can only jump to steps you have already reached).

Changes

  • SelectionSummary.tsx: new required maxReachedStep and onNavigateStep props. Split the single variant() into indicatorVariant (label circle), dividerVariant (connecting line), and a reachable() gate. StepIndicator and BaseTemplateSelection render as <button> (hover + focus ring, aria-label) when a reachable handler is supplied, else stay inert.
  • TemplateBuilderPageView.tsx: track maxReachedGroup; add navigateToStepId(stepId) that resolves skipped steps via nearestVisible (so base-parameters falls back to base-infra) and mirrors the existing customizations reset when leaving that step. Wire both new props into SelectionSummary.
  • SelectionSummary.stories.tsx: add onNavigateStep to meta and maxReachedStep to existing stories; add NavigationClicks (asserts each label/base/module callback), BackwardNavigation (dividers stay green), and UpcomingStepsInert (steps above max-reached are not buttons).

Out of scope

Everything else from #27077 stays out: gallery height, sensitive-var banner relocation, trash-icon wiring, and the scroll-past required-field subsystem.

Testing

  • pnpm check (biome) clean
  • pnpm lint:types (tsc) clean
  • pnpm vitest run --project=storybook src/pages/TemplateBuilder — 37 pass
  • pnpm vitest run --project=unit src/pages/TemplateBuilder — 55 pass
Implementation plan / decision log

Origin

This is the remainder of PR #27077's item #2 (navigable selection summary), rebased onto current main after #27351 shipped the module-row navigation.

Why a maxReachedGroup back-stack

furthestAllowedIndex(state) on current main is all-or-nothing (0 without a base selected, otherwise the last step), so it cannot express "how far the user has progressed" for the sidebar coloring. A monotonic maxReachedGroup (bumped when the current group advances, never shrunk) is needed to keep completed steps green and clickable after backward navigation, matching #27077.

Decisions

  • Reachability gating: gate both coloring and clickability on maxReachedGroup (only jump to steps already reached), rather than the looser furthestAllowedIndex (which would let users skip required steps once a base is chosen).
  • Base-template row target: jump to base-parameters and let nearestVisible fall back to base-infra when the base has no parameters/prerequisites.
  • Module rows: keep onNavigateModule passed directly (not re-gated on reachability), since a module can only be selected after reaching group 2, so reachable(2) is always true when module rows render. This preserves the earlier decision to keep the module row's handler required with no inert branch.

Coder Agents generated, on behalf of @aqandrew.

Make the SelectionSummary step labels and the selected base-template row
clickable jump targets, matching the already-navigable module rows.

Add a maxReachedGroup back-stack so completed steps stay green and
clickable after navigating backward, and gate clickability on it.
The base-template row jumps to base-parameters, falling back to
base-infra when that step is skipped.
@aqandrew
aqandrew marked this pull request as ready for review August 13, 2026 20:43
@aqandrew
aqandrew requested a review from jeremyruppel August 13, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant