import { useI18n } from '@solid-primitives/i18n'
import { A, useLocation } from '@solidjs/router'
import {
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 { renderProxiesInSamePage, setCurTheme, 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 && !renderProxiesInSamePage()) {
list.splice(2, 0, {
href: ROUTES.ProxyProvider,
name: t('proxyProviders'),
icon: ,
})
}
return list
})
const location = useLocation()
const [openedDrawer, setOpenedDrawer] = createSignal(false)
return (
)
}