import { useI18n } from '@solid-primitives/i18n'
import { A, useLocation, useNavigate } from '@solidjs/router'
import {
IconArrowsExchange,
IconFileStack,
IconGlobe,
IconGlobeFilled,
IconHome,
IconLanguage,
IconMenu,
IconNetwork,
IconPalette,
IconRuler,
IconSettings,
} from '@tabler/icons-solidjs'
import { For, ParentComponent, Show, createMemo, createSignal } from 'solid-js'
import { twMerge } from 'tailwind-merge'
import { Button } from '~/components'
import { LANG, ROUTES, themes } from '~/constants'
import { setCurTheme, setSelectedEndpoint, useProxies } from '~/signals'
const Nav: ParentComponent<{ href: string; tooltip: string }> = ({
href,
tooltip,
children,
}) => (
{children}
)
const ThemeSwitcher = () => (
)
export const Header = () => {
const [t, { locale }] = useI18n()
const { proxyProviders } = useProxies()
const navs = createMemo(() => {
const list = [
{
href: ROUTES.Overview,
name: t('overview'),
icon: ,
},
{
href: ROUTES.Proxies,
name: t('proxies'),
icon: ,
},
{
href: ROUTES.Rules,
name: t('rules'),
icon: ,
},
{
href: ROUTES.Conns,
name: t('connections'),
icon: ,
},
{
href: ROUTES.Log,
name: t('logs'),
icon: ,
},
{
href: ROUTES.Config,
name: t('config'),
icon: ,
},
]
if (proxyProviders().length > 0) {
list.splice(2, 0, {
href: ROUTES.Proxyprovider,
name: t('proxyProviders'),
icon: ,
})
}
return list
})
const location = useLocation()
const navigate = useNavigate()
const [openedDrawer, setOpenedDrawer] = createSignal(false)
const onSwitchEndpointClick = () => {
setSelectedEndpoint('')
navigate('/setup')
}
return (
)
}