1- import React , {
2- lazy ,
3- Suspense ,
4- useCallback ,
5- useEffect ,
6- useRef ,
7- useState ,
8- } from 'react'
1+ import React , { useCallback , useEffect , useRef , useState } from 'react'
92import { Toaster , toast } from 'react-hot-toast'
103import { useTranslation } from 'react-i18next'
11- import {
12- Navigate ,
13- Route ,
14- Routes ,
15- useLocation ,
16- useNavigate ,
17- } from 'react-router-dom'
4+ import { Outlet , useLocation , useNavigate } from 'react-router-dom'
185import { SWRConfig } from 'swr'
196
20- import FullLoading from '@/components/FullLoading'
217import NetworkErrorModal from '@/components/NetworkErrorModal'
228import NewVersionAlert from '@/components/NewVersionAlert'
239import PageLayout from '@/components/PageLayout'
2410import RunInSurge from '@/components/RunInSurge'
2511import useTrafficUpdater from '@/hooks/useTrafficUpdater'
26- import HomePage from '@/pages/Home'
27- import { LandingPage } from '@/pages/Landing'
2812import {
2913 usePlatformVersion ,
3014 useAppDispatch ,
@@ -36,17 +20,6 @@ import { profileActions } from '@/store/slices/profile'
3620import { isRunInSurge } from '@/utils'
3721import { httpClient } from '@/utils/fetcher'
3822
39- const PoliciesPage = lazy ( ( ) => import ( '@/pages/Policies' ) )
40- const RequestsPage = lazy ( ( ) => import ( '@/pages/Requests' ) )
41- const TrafficPage = lazy ( ( ) => import ( '@/pages/Traffic' ) )
42- const ModulesPage = lazy ( ( ) => import ( '@/pages/Modules' ) )
43- const ScriptingPage = lazy ( ( ) => import ( '@/pages/Scripting' ) )
44- const EvaluatePage = lazy ( ( ) => import ( '@/pages/Scripting/Evaluate' ) )
45- const DnsPage = lazy ( ( ) => import ( '@/pages/Dns' ) )
46- const DevicesPage = lazy ( ( ) => import ( '@/pages/Devices' ) )
47- const CurrentProfilePage = lazy ( ( ) => import ( '@/pages/Profiles/Current' ) )
48- const ManageProfilesPage = lazy ( ( ) => import ( '@/pages/Profiles/Manage' ) )
49-
5023const App : React . FC = ( ) => {
5124 const { t } = useTranslation ( )
5225 const [ isNetworkModalOpen , setIsNetworkModalOpen ] = useState ( false )
@@ -136,23 +109,7 @@ const App: React.FC = () => {
136109 </ RunInSurge >
137110
138111 < PageLayout >
139- < Suspense fallback = { < FullLoading /> } >
140- < Routes >
141- < Route path = "/" element = { < LandingPage /> } />
142- < Route path = "/home" element = { < HomePage /> } />
143- < Route path = "/policies" element = { < PoliciesPage /> } />
144- < Route path = "/requests" element = { < RequestsPage /> } />
145- < Route path = "/traffic" element = { < TrafficPage /> } />
146- < Route path = "/modules" element = { < ModulesPage /> } />
147- < Route path = "/scripting" element = { < ScriptingPage /> } />
148- < Route path = "/scripting/evaluate" element = { < EvaluatePage /> } />
149- < Route path = "/dns" element = { < DnsPage /> } />
150- < Route path = "/devices" element = { < DevicesPage /> } />
151- < Route path = "/profiles" element = { < ManageProfilesPage /> } />
152- < Route path = "/profiles/current" element = { < CurrentProfilePage /> } />
153- < Route path = "*" element = { < Navigate to = "/" replace /> } />
154- </ Routes >
155- </ Suspense >
112+ < Outlet />
156113 </ PageLayout >
157114 </ SWRConfig >
158115 )
0 commit comments