初始化工程
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
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: <Verify /> },
|
||||
{ path: '/onboarding', element: <Onboarding /> },
|
||||
{ path: '/admin/uuids', element: <AdminGuard><AdminUuids /></AdminGuard> },
|
||||
{
|
||||
path: '/',
|
||||
element: (
|
||||
<AccessGuard>
|
||||
<OnboardingGuard>
|
||||
<Layout />
|
||||
</OnboardingGuard>
|
||||
</AccessGuard>
|
||||
),
|
||||
children: [
|
||||
{ index: true, element: <Dashboard /> },
|
||||
{ path: 'overview', element: <Navigate to="/" replace /> },
|
||||
{ path: 'analysis', element: <Navigate to="/settings?tab=ext-pages" replace /> },
|
||||
{ path: 'analysis/:menuId', element: <AnalysisDetail /> },
|
||||
{ path: 'concept-analysis', element: <ConceptAnalysis /> },
|
||||
{ path: 'industry-analysis', element: <IndustryAnalysis /> },
|
||||
{ path: 'stock-analysis', element: <StockAnalysis /> },
|
||||
{ path: 'watchlist', element: <Watchlist /> },
|
||||
{ path: 'screener', element: <Screener /> },
|
||||
{ path: 'backtest', element: <Backtest /> },
|
||||
{ path: 'financials', element: <Financials /> },
|
||||
{ path: 'data', element: <Data /> },
|
||||
{ path: 'monitor', element: <Monitor /> },
|
||||
{ path: 'trading', element: <Trading /> },
|
||||
{ path: 'limit-ladder', element: <LimitUpLadder /> },
|
||||
{ path: 'indices', element: <Indices /> },
|
||||
{ path: 'branding', element: <Branding /> },
|
||||
{ path: 'settings', element: <Settings /> },
|
||||
// 隐藏路由:开发者工具(不暴露在菜单,仅供调试)
|
||||
{ path: 'dev', element: <Dev /> },
|
||||
// 旧路由兼容重定向
|
||||
{ path: 'settings/keys', element: <Navigate to="/settings?tab=account" replace /> },
|
||||
{ path: 'settings/ai', element: <Navigate to="/settings?tab=ai" replace /> },
|
||||
{ path: 'settings/queries', element: <Navigate to="/settings?tab=queries" replace /> },
|
||||
],
|
||||
},
|
||||
])
|
||||
Reference in New Issue
Block a user