Sprint: ll (#207)

* feat(PBI-ll): voeg lib/product-switch-path.ts toe met resolveProductSwitchTarget

Pure helper die doel-URL bij product-wissel bepaalt; unit-tests dekken alle pad-gevallen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(product-switch-path): dek alle pad-categorieën en null-terugval af

* feat(nav-bar): gebruik resolveProductSwitchTarget bij product-wissel

Vervang router.refresh() door gerichte navigatie via resolveProductSwitchTarget,
zodat product/sprint/solo-pagina's direct naar het nieuwe product navigeren.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(nav-bar): voeg navigatie-assertions toe voor product-wissel

Voeg 4 tests toe die verifiëren dat NavBar na product-wissel naar de
juiste URL navigeert: /products/B, /products/B/sprint, /products/B/solo,
en router.refresh() op niet-product-pagina's.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-14 22:06:32 +02:00 committed by GitHub
parent 3ad352c10f
commit 8287509c7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 114 additions and 1 deletions

View file

@ -0,0 +1,14 @@
export function resolveProductSwitchTarget(
pathname: string,
newProductId: string,
): string | null {
const match = pathname.match(/^\/products\/([^/]+)(\/.*)?$/)
if (!match) return null
const rest = match[2] ?? ''
if (!rest || rest === '/') return `/products/${newProductId}`
if (rest.startsWith('/sprint')) return `/products/${newProductId}/sprint`
if (rest.startsWith('/solo')) return `/products/${newProductId}/solo`
return `/products/${newProductId}`
}