import { Navigate, Route, Routes, useNavigate } from '@solidjs/router' import { Show, createEffect, lazy, onMount } from 'solid-js' import { Header } from '~/components/Header' import { curTheme, endpoint, selectedEndpoint } from '~/signals' import { ROUTE } from './config/enum' import { useAutoSwitchTheme } from './signals/config' import { useProxies } from './signals/proxies' 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 ProxyProvider = lazy(() => import('~/pages/ProxyProvider')) const Rules = lazy(() => import('~/pages/Rules')) const Config = lazy(() => import('~/pages/Config')) export const App = () => { const navigate = useNavigate() useAutoSwitchTheme() createEffect(() => { if (selectedEndpoint() && endpoint()) { useProxies().updateProxy() } }) onMount(async () => { if (!selectedEndpoint()) { navigate('/setup') } }) return (
} />
) }