import { createBrowserRouter, Navigate } from 'react-router-dom' import { AccessGuard } from './components/AccessGuard' import { AdminGuard } from './components/AdminGuard' import { Layout } from './components/Layout' import { Verify } from './pages/Verify' import { AdminUuids } from './pages/AdminUuids' import { Watchlist } from './pages/Watchlist' import { Screener } from './pages/Screener' import { Backtest } from './pages/Backtest' import { Financials } from './pages/Financials' import { Onboarding } from './pages/Onboarding' import { Data } from './pages/Data' import { Monitor } from './pages/Monitor' import { Trading } from './pages/Trading' import { Dashboard } from './pages/Dashboard' import { AnalysisDetail } from './pages/AnalysisDetail' import { ConceptAnalysis } from './pages/ConceptAnalysis' import { IndustryAnalysis } from './pages/IndustryAnalysis' import { StockAnalysis } from './pages/StockAnalysis' import { LimitUpLadder } from './pages/LimitUpLadder' import { Branding } from './pages/Branding' import { Settings } from './pages/Settings' import { Indices } from './pages/Indices' import { Dev } from './pages/Dev' // 首次使用守卫 —— 当前已关闭:数据源 Key 已内置,用户无需首次配置。 // 如需重新启用引导页,恢复下方判定逻辑即可。 function OnboardingGuard({ children }: { children: React.ReactNode }) { return <>{children} } export const router = createBrowserRouter([ { path: '/verify', element: }, { path: '/onboarding', element: }, { path: '/admin/uuids', element: }, { path: '/', element: ( ), children: [ { index: true, element: }, { path: 'overview', element: }, { path: 'analysis', element: }, { path: 'analysis/:menuId', element: }, { path: 'concept-analysis', element: }, { path: 'industry-analysis', element: }, { path: 'stock-analysis', element: }, { path: 'watchlist', element: }, { path: 'screener', element: }, { path: 'backtest', element: }, { path: 'financials', element: }, { path: 'data', element: }, { path: 'monitor', element: }, { path: 'trading', element: }, { path: 'limit-ladder', element: }, { path: 'indices', element: }, { path: 'branding', element: }, { path: 'settings', element: }, // 隐藏路由:开发者工具(不暴露在菜单,仅供调试) { path: 'dev', element: }, // 旧路由兼容重定向 { path: 'settings/keys', element: }, { path: 'settings/ai', element: }, { path: 'settings/queries', element: }, ], }, ])