Replace all inline session management with the shared useAssistantSession hook. Keep cockpit-specific state (triageMeta, workZonePct, steps, onboarding) and handlers. Wire onSessionLoadedRef/onTriageUpdateRef callbacks. Add feature flag redirect for flowpilot_cockpit. Update router and prefetch references. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { prefetchRoute } from '@/lib/prefetch'
|
|
|
|
/** Map of base route paths to their lazy import functions for hover-prefetching */
|
|
const PREFETCH_MAP: Record<string, () => Promise<unknown>> = {
|
|
'/': () => import('@/pages/QuickStartPage'),
|
|
'/trees': () => import('@/pages/TreeLibraryPage'),
|
|
'/my-trees': () => import('@/pages/MyTreesPage'),
|
|
'/sessions': () => import('@/pages/SessionHistoryPage'),
|
|
'/shares': () => import('@/pages/MySharesPage'),
|
|
'/analytics': () => import('@/pages/TeamAnalyticsPage'),
|
|
'/analytics/me': () => import('@/pages/MyAnalyticsPage'),
|
|
'/assistant': () => import('@/pages/CockpitPage'),
|
|
'/step-library': () => import('@/pages/StepLibraryPage'),
|
|
'/guides': () => import('@/pages/GuidesHubPage'),
|
|
'/feedback': () => import('@/pages/FeedbackPage'),
|
|
'/account': () => import('@/pages/AccountSettingsPage'),
|
|
}
|
|
|
|
/** Prefetch the chunk for a route on hover/focus */
|
|
export function prefetchForRoute(path: string) {
|
|
// Strip query params for lookup
|
|
const basePath = path.split('?')[0]
|
|
const importFn = PREFETCH_MAP[basePath]
|
|
if (importFn) {
|
|
prefetchRoute(importFn)
|
|
}
|
|
}
|