import { Suspense, lazy, type ReactNode } from 'react'; import { Skeleton } from '@/components/ui/skeleton'; import { AdmiralGate } from '../AdmiralGate'; import { CapabilityGate } from '../CapabilityGate'; import { HubOnlyGate } from '../HubOnlyGate'; import LazyBoundary from '../LazyBoundary'; import { SettingsPage } from '../settings/SettingsPage'; import type { SectionId } from '../settings/types'; import { AppStoreView } from '../AppStoreView'; import ResourcesView from '../ResourcesView'; import HomeDashboard from '../HomeDashboard'; import type { NotificationItem } from '../dashboard/types'; import type { ScheduleTaskPrefill } from '../ScheduledOperationsView'; import type { ActiveView } from './hooks/useViewNavigationState'; // Paid-tier views and the security-history overlay are loaded on demand. // Their internal PaidGate / AdmiralGate / CapabilityGate wrappers render // the upsell or capability-missing card with blurred children rather than // short-circuiting, so a tier-locked or capability-missing operator // opening one of these tabs still triggers the chunk fetch to render the // blurred preview. What this lazy split closes is the much larger // initial-bundle leak: every Community user used to download the full // FleetView, AuditLogView, etc. on first page load even if they never // clicked those tabs. After this change, the chunks fetch only on tab // open. // // GlobalObservabilityView is a free-tier feature with no internal gate; // it is split here purely for the bundle-size win, not for IP protection. const HostConsole = lazy(() => import('../HostConsole')); const GlobalObservabilityView = lazy(() => import('../GlobalObservabilityView').then(m => ({ default: m.GlobalObservabilityView })), ); const FleetView = lazy(() => import('../FleetView').then(m => ({ default: m.FleetView })), ); const AuditLogView = lazy(() => import('../AuditLogView').then(m => ({ default: m.AuditLogView })), ); const ScheduledOperationsView = lazy(() => import('../ScheduledOperationsView')); const AutoUpdateReadinessView = lazy(() => import('../AutoUpdateReadinessView')); // Sized for the main workspace area (flex-1 with p-6 padding). Visible // only during the brief window between an unlocked view's chunk request // and its first render. function ViewSkeleton() { return (