import { lazy, Suspense } from 'react' import { Navigate, createBrowserRouter } from 'react-router-dom' import { Spin } from 'antd' const AgentLayout = lazy(() => import('@/components/layout/AgentLayout')) const AdminLayout = lazy(() => import('@/components/layout/AdminLayout')) const Dashboard = lazy(() => import('@/pages/agent/Dashboard')) const ChatHistory = lazy(() => import('@/pages/agent/ChatHistory')) const Customers = lazy(() => import('@/pages/agent/Customers')) const Knowledge = lazy(() => import('@/pages/agent/Knowledge')) const Statistics = lazy(() => import('@/pages/agent/Statistics')) const Settings = lazy(() => import('@/pages/agent/Settings')) const AdminDashboard = lazy(() => import('@/pages/admin/Dashboard')) const Tenants = lazy(() => import('@/pages/admin/Tenants')) const Plans = lazy(() => import('@/pages/admin/Plans')) const Ops = lazy(() => import('@/pages/admin/Ops')) const WidgetPreview = lazy(() => import('@/pages/WidgetPreview')) const loading = (
) function Lazy({ children }: { children: React.ReactNode }) { return {children} } export const router = createBrowserRouter([ { path: '/widget/preview', element: , }, { path: '/admin', element: , children: [ { index: true, element: }, { path: 'dashboard', element: }, { path: 'tenants', element: }, { path: 'plans', element: }, { path: 'ops', element: }, ], }, { path: '/', element: , children: [ { index: true, element: }, { path: 'agent', children: [ { index: true, element: }, { path: 'dashboard', element: }, { path: 'chat-history', element: }, { path: 'customers', element: }, { path: 'knowledge', element: }, { path: 'statistics', element: }, { path: 'settings', element: }, ], }, ], }, ])