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:
parent
3ad352c10f
commit
8287509c7c
4 changed files with 114 additions and 1 deletions
14
lib/product-switch-path.ts
Normal file
14
lib/product-switch-path.ts
Normal 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}`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue