fix: remove "Open Server Dashboard" link from tenant sidebar
The server dashboard link in the sidebar footer is premature — tenant servers may not be provisioned yet and the link target depends on org context that isn't always available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
|||||||
Sidebar,
|
Sidebar,
|
||||||
TopBar,
|
TopBar,
|
||||||
} from '@cameleer/design-system';
|
} from '@cameleer/design-system';
|
||||||
import { LayoutDashboard, ShieldCheck, Server, Users, Settings, Shield, Building, ScrollText } from 'lucide-react';
|
import { LayoutDashboard, ShieldCheck, Users, Settings, Shield, Building, ScrollText } from 'lucide-react';
|
||||||
import { useAuth } from '../auth/useAuth';
|
import { useAuth } from '../auth/useAuth';
|
||||||
import { useScopes } from '../auth/useScopes';
|
import { useScopes } from '../auth/useScopes';
|
||||||
import { useOrgStore } from '../auth/useOrganization';
|
import { useOrgStore } from '../auth/useOrganization';
|
||||||
@@ -31,7 +31,7 @@ export function Layout() {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { logout } = useAuth();
|
const { logout } = useAuth();
|
||||||
const scopes = useScopes();
|
const scopes = useScopes();
|
||||||
const { username, organizations, currentOrgId } = useOrgStore();
|
const { username } = useOrgStore();
|
||||||
|
|
||||||
const isVendor = scopes.has('platform:admin');
|
const isVendor = scopes.has('platform:admin');
|
||||||
const isTenantAdmin = scopes.has('tenant:manage');
|
const isTenantAdmin = scopes.has('tenant:manage');
|
||||||
@@ -39,10 +39,6 @@ export function Layout() {
|
|||||||
// Vendor on vendor routes: show only TENANTS. On tenant routes: show tenant portal too (for debugging).
|
// Vendor on vendor routes: show only TENANTS. On tenant routes: show tenant portal too (for debugging).
|
||||||
const showTenantPortal = isTenantAdmin && (!isVendor || !onVendorRoute);
|
const showTenantPortal = isTenantAdmin && (!isVendor || !onVendorRoute);
|
||||||
|
|
||||||
// Determine current org slug for server dashboard link
|
|
||||||
const currentOrg = organizations.find((o) => o.id === currentOrgId);
|
|
||||||
const serverDashboardHref = currentOrg?.slug ? `/t/${currentOrg.slug}/` : '#';
|
|
||||||
|
|
||||||
// Build breadcrumbs from path
|
// Build breadcrumbs from path
|
||||||
const segments = location.pathname.replace(/^\//, '').split('/').filter(Boolean);
|
const segments = location.pathname.replace(/^\//, '').split('/').filter(Boolean);
|
||||||
const breadcrumb = segments.map((seg) => {
|
const breadcrumb = segments.map((seg) => {
|
||||||
@@ -173,15 +169,6 @@ export function Layout() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showTenantPortal && (
|
|
||||||
<Sidebar.Footer>
|
|
||||||
<Sidebar.FooterLink
|
|
||||||
icon={<Server size={16} />}
|
|
||||||
label="Open Server Dashboard"
|
|
||||||
onClick={() => window.open(serverDashboardHref, '_blank', 'noopener')}
|
|
||||||
/>
|
|
||||||
</Sidebar.Footer>
|
|
||||||
)}
|
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user