metacubexd/src/App.tsx

52 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-08-27 22:25:41 +08:00
import { Route, Routes, useNavigate } from '@solidjs/router'
import { Show, onMount } from 'solid-js'
2023-08-24 04:20:53 +08:00
import { Header } from '~/components/Header'
import { Config } from '~/pages/Config'
import { Connections } from '~/pages/Connections'
import { Logs } from '~/pages/Logs'
import { Overview } from '~/pages/Overview'
import { Proxies } from '~/pages/Proxies'
import { Rules } from '~/pages/Rules'
import { Setup } from '~/pages/Setup'
2023-08-27 22:25:41 +08:00
import { curTheme, selectedEndpoint } from '~/signals'
2023-08-24 04:20:53 +08:00
export const App = () => {
const navigate = useNavigate()
onMount(() => {
if (!selectedEndpoint()) {
navigate('/setup')
}
})
return (
<div
2023-08-28 23:23:19 +08:00
class="relative flex h-screen flex-col p-2 subpixel-antialiased"
data-theme={curTheme()}
>
2023-08-27 22:25:41 +08:00
<Header />
2023-08-24 04:20:53 +08:00
2023-08-28 23:23:19 +08:00
<div class="flex-1 overflow-y-auto py-4">
2023-08-24 04:20:53 +08:00
<Routes>
<Show when={selectedEndpoint()}>
<Route path="/" component={Overview} />
<Route path="/proxies" component={Proxies} />
<Route path="/rules" component={Rules} />
<Route path="/conns" component={Connections} />
<Route path="/logs" component={Logs} />
<Route path="/config" component={Config} />
</Show>
<Route path="/setup" component={Setup} />
</Routes>
</div>
2023-08-28 23:23:19 +08:00
<footer class="footer footer-center rounded-box hidden bg-base-200 p-2 text-base-content sm:block">
<a href="https://github.com/metacubex/metacubexd" target="_blank">
metacubexd
</a>
</footer>
2023-08-24 04:20:53 +08:00
</div>
)
}