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

@ -20,6 +20,7 @@ import { NotificationsBell } from '@/components/shared/notifications-bell'
import { SoloNavStatusIndicators } from '@/components/solo/nav-status-indicators'
import { cn } from '@/lib/utils'
import { setActiveProductAction } from '@/actions/active-product'
import { resolveProductSwitchTarget } from '@/lib/product-switch-path'
import { debugProps } from '@/lib/debug'
interface NavBarProps {
@ -70,7 +71,8 @@ export function NavBar({
}
const next = products.find(p => p.id === productId)
toast.success(`Actief product: ${next?.name ?? 'gewijzigd'}`)
router.refresh()
const target = resolveProductSwitchTarget(pathname, productId)
if (target) router.push(target); else router.refresh()
})
}