fix: keep vendor sidebar active on account settings page
All checks were successful
CI / build (push) Successful in 1m54s
CI / docker (push) Successful in 1m26s

Vendor sidebar collapsed and tenant sidebar appeared when navigating to
/settings/account because onVendorRoute was false for non-/vendor paths.
Now vendor users stay on vendor sidebar for all routes except /tenant/*.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-27 17:18:09 +02:00
parent 687598952f
commit e7952dd9de

View File

@@ -44,9 +44,11 @@ export function Layout() {
refetchInterval: 30_000,
});
const isTenantAdmin = scopes.has('tenant:manage');
const onVendorRoute = location.pathname.startsWith('/vendor');
// Vendor on vendor routes: show only TENANTS. On tenant routes: show tenant portal too (for debugging).
const showTenantPortal = isTenantAdmin && (!isVendor || !onVendorRoute);
const onTenantRoute = location.pathname.startsWith('/tenant');
const onVendorRoute = location.pathname.startsWith('/vendor') || (isVendor && !onTenantRoute);
// Vendor on vendor routes (or neutral pages like account settings): show only vendor sidebar.
// On tenant routes: show tenant portal too (for debugging).
const showTenantPortal = isTenantAdmin && (!isVendor || onTenantRoute);
// Build breadcrumbs from path
const segments = location.pathname.replace(/^\//, '').split('/').filter(Boolean);