import { Navigate, Route, Routes, useNavigate } from '@solidjs/router' import { Show, createEffect, lazy, onMount } from 'solid-js' import { Toaster } from 'solid-toast' import { twMerge } from 'tailwind-merge' import { Header } from '~/components' import { ROUTES } from '~/constants' import { WsMsg, curTheme, endpoint, selectedEndpoint, setAllConnections, setLatestConnectionMsg, useAutoSwitchTheme, useProxies, useTwemoji, useWsRequest, } from '~/signals' 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')) export const App = () => { const navigate = useNavigate() useAutoSwitchTheme() createEffect(() => { if (selectedEndpoint() && endpoint()) { void useProxies().updateProxies() setAllConnections([]) setLatestConnectionMsg(useWsRequest('connections')) } }) onMount(() => { if (!selectedEndpoint()) { navigate(ROUTES.Setup) } }) return (
} />
) }