mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
feat: make some changes in response to community suggestions
- make the size of the menu items in header larger - move switch language button to config page
This commit is contained in:
parent
90ecb86603
commit
cc78d4e2b1
@ -5,7 +5,6 @@ import {
|
|||||||
IconGlobe,
|
IconGlobe,
|
||||||
IconGlobeFilled,
|
IconGlobeFilled,
|
||||||
IconHome,
|
IconHome,
|
||||||
IconLanguage,
|
|
||||||
IconMenu,
|
IconMenu,
|
||||||
IconNetwork,
|
IconNetwork,
|
||||||
IconPalette,
|
IconPalette,
|
||||||
@ -14,8 +13,7 @@ import {
|
|||||||
} from '@tabler/icons-solidjs'
|
} from '@tabler/icons-solidjs'
|
||||||
import { For, ParentComponent, Show, createMemo, createSignal } from 'solid-js'
|
import { For, ParentComponent, Show, createMemo, createSignal } from 'solid-js'
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
import { Button } from '~/components'
|
import { ROUTES, themes } from '~/constants'
|
||||||
import { LANG, ROUTES, themes } from '~/constants'
|
|
||||||
import { renderProxiesInSamePage, setCurTheme, useProxies } from '~/signals'
|
import { renderProxiesInSamePage, setCurTheme, useProxies } from '~/signals'
|
||||||
|
|
||||||
const Nav: ParentComponent<{ href: string; tooltip: string }> = ({
|
const Nav: ParentComponent<{ href: string; tooltip: string }> = ({
|
||||||
@ -63,8 +61,19 @@ const ThemeSwitcher = () => (
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const LogoText = () => (
|
||||||
|
<a
|
||||||
|
class="flex gap-2 whitespace-nowrap text-xl font-bold uppercase"
|
||||||
|
href="https://github.com/metacubex/metacubexd"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<span>metacube, </span>
|
||||||
|
<div class="transition-transform hover:rotate-90 hover:scale-125">xd</div>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
|
||||||
export const Header = () => {
|
export const Header = () => {
|
||||||
const [t, { locale }] = useI18n()
|
const [t] = useI18n()
|
||||||
const { proxyProviders } = useProxies()
|
const { proxyProviders } = useProxies()
|
||||||
const navs = createMemo(() => {
|
const navs = createMemo(() => {
|
||||||
const list = [
|
const list = [
|
||||||
@ -148,21 +157,12 @@ export const Header = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a
|
<LogoText />
|
||||||
class="flex whitespace-nowrap text-xl font-bold uppercase"
|
|
||||||
href="https://github.com/metacubex/metacubexd"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
<span class="mr-2">metacube, </span>
|
|
||||||
<div class="transition-transform hover:rotate-90 hover:scale-125">
|
|
||||||
xd
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Show when={location.pathname !== ROUTES.Setup}>
|
<Show when={location.pathname !== ROUTES.Setup}>
|
||||||
<div class="navbar-center hidden lg:flex">
|
<div class="navbar-center hidden lg:flex">
|
||||||
<ul class="menu menu-horizontal gap-2">
|
<ul class="menu menu-horizontal menu-lg gap-2">
|
||||||
<For each={navs()}>
|
<For each={navs()}>
|
||||||
{({ href, name, icon }) => (
|
{({ href, name, icon }) => (
|
||||||
<Nav href={href} tooltip={name}>
|
<Nav href={href} tooltip={name}>
|
||||||
@ -176,17 +176,6 @@ export const Header = () => {
|
|||||||
|
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<Button
|
|
||||||
class="btn-circle btn-sm"
|
|
||||||
onClick={() => {
|
|
||||||
const curLocale = locale()
|
|
||||||
|
|
||||||
locale(curLocale === LANG.EN ? LANG.ZH : LANG.EN)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconLanguage />
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<ThemeSwitcher />
|
<ThemeSwitcher />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,4 +65,5 @@ export default {
|
|||||||
md: 'Normal size',
|
md: 'Normal size',
|
||||||
lg: 'Large size',
|
lg: 'Large size',
|
||||||
switchEndpoint: 'Switch Endpoint',
|
switchEndpoint: 'Switch Endpoint',
|
||||||
|
switchLanguage: 'Switch Language',
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,5 @@ export default {
|
|||||||
md: '正常尺寸',
|
md: '正常尺寸',
|
||||||
lg: '超大尺寸',
|
lg: '超大尺寸',
|
||||||
switchEndpoint: '切换后端',
|
switchEndpoint: '切换后端',
|
||||||
|
switchLanguage: '切换语言',
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import { For, Show, createSignal, onMount } from 'solid-js'
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { Button } from '~/components'
|
import { Button } from '~/components'
|
||||||
import {
|
import {
|
||||||
|
LANG,
|
||||||
PROXIES_ORDERING_TYPE,
|
PROXIES_ORDERING_TYPE,
|
||||||
PROXIES_PREVIEW_TYPE,
|
PROXIES_PREVIEW_TYPE,
|
||||||
ROUTES,
|
ROUTES,
|
||||||
@ -230,7 +231,7 @@ const ConfigForm = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ConfigForXd = () => {
|
const ConfigForXd = () => {
|
||||||
const [t] = useI18n()
|
const [t, { locale }] = useI18n()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const onSwitchEndpointClick = () => {
|
const onSwitchEndpointClick = () => {
|
||||||
@ -377,6 +378,18 @@ const ConfigForXd = () => {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
const curLocale = locale()
|
||||||
|
|
||||||
|
locale(curLocale === LANG.EN ? LANG.ZH : LANG.EN)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('switchLanguage')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Button onClick={onSwitchEndpointClick}>{t('switchEndpoint')}</Button>
|
<Button onClick={onSwitchEndpointClick}>{t('switchEndpoint')}</Button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user