metacubexd/src/main.tsx

43 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-08-24 04:20:53 +08:00
/* @refresh reload */
2023-08-30 10:41:40 +08:00
import '~/index.css'
2023-08-24 04:20:53 +08:00
import dayjs from 'dayjs'
2023-09-04 18:48:39 +08:00
import 'dayjs/locale/zh-cn'
import relativeTime from 'dayjs/plugin/relativeTime'
2024-03-20 16:12:33 +08:00
import { lazy } from 'solid-js'
2024-04-23 13:56:12 +08:00
import { render } from 'solid-js/web'
2024-03-20 16:12:33 +08:00
import { Toaster } from 'solid-toast'
2023-09-01 23:25:37 +08:00
import { App } from '~/App'
2024-03-20 16:12:33 +08:00
import { ROUTES } from '~/constants'
import { I18nProvider, locale } from '~/i18n'
const Setup = lazy(() => import('~/pages/Setup'))
const Overview = lazy(() => import('~/pages/Overview'))
const Connections = lazy(() => import('~/pages/Connections'))
const Logs = lazy(() => import('~/pages/Logs'))
const Proxies = lazy(() => import('~/pages/Proxies'))
const Rules = lazy(() => import('~/pages/Rules'))
const Config = lazy(() => import('~/pages/Config'))
2023-08-24 04:20:53 +08:00
dayjs.extend(relativeTime)
2023-08-24 04:20:53 +08:00
render(
() => (
2024-03-20 16:12:33 +08:00
<I18nProvider locale={locale()}>
<HashRouter root={App}>
<Route path={ROUTES.Setup} component={Setup} />
<Route path="*" component={Overview} />
2024-03-20 16:12:33 +08:00
<Route path={ROUTES.Overview} component={Overview} />
<Route path={ROUTES.Proxies} component={Proxies} />
<Route path={ROUTES.Rules} component={Rules} />
<Route path={ROUTES.Conns} component={Connections} />
<Route path={ROUTES.Log} component={Logs} />
<Route path={ROUTES.Config} component={Config} />
</HashRouter>
<Toaster position="bottom-center" />
</I18nProvider>
2023-08-24 04:20:53 +08:00
),
2024-03-20 16:12:33 +08:00
document.querySelector('#root')!,
2023-08-24 04:20:53 +08:00
)