mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45:35 +08:00
feat: update proxy layout
This commit is contained in:
parent
4a03662bbd
commit
83b0de831a
@ -27,7 +27,7 @@ const Collapse: ParentComponent<Props> = (props) => {
|
|||||||
<div
|
<div
|
||||||
class={twMerge(
|
class={twMerge(
|
||||||
getCollapseClassName(),
|
getCollapseClassName(),
|
||||||
'collapse collapse-arrow overflow-visible border-secondary bg-base-200 p-1',
|
'collapse collapse-arrow overflow-visible border-secondary bg-base-200',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -39,7 +39,7 @@ const Collapse: ParentComponent<Props> = (props) => {
|
|||||||
<div
|
<div
|
||||||
class={twMerge(
|
class={twMerge(
|
||||||
getCollapseContentClassName(),
|
getCollapseContentClassName(),
|
||||||
'collapse-content grid grid-cols-1 gap-2 overflow-hidden transition-opacity duration-1000 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5',
|
'collapse-content grid auto-rows-min grid-cols-2 gap-2 transition-opacity duration-1000 lg:grid-cols-3 xl:grid-cols-4',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
|
@ -10,14 +10,16 @@ export default (props: {
|
|||||||
const { proxyName, isSelected, onClick } = props
|
const { proxyName, isSelected, onClick } = props
|
||||||
const { delayMap, proxyNodeMap } = useProxies()
|
const { delayMap, proxyNodeMap } = useProxies()
|
||||||
const proxyNode = createMemo(() => proxyNodeMap()[proxyName])
|
const proxyNode = createMemo(() => proxyNodeMap()[proxyName])
|
||||||
|
|
||||||
const Delay = (proxyname: string) => {
|
const Delay = (proxyname: string) => {
|
||||||
const delay = delayMap()[proxyname]
|
const delay = delayMap()[proxyname]
|
||||||
let textClassName = 'text-green-500'
|
|
||||||
|
|
||||||
if (typeof delay !== 'number' || delay === 0) {
|
if (typeof delay !== 'number' || delay === 0) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let textClassName = 'text-green-500'
|
||||||
|
|
||||||
if (delay > 500) {
|
if (delay > 500) {
|
||||||
textClassName = 'text-red-500'
|
textClassName = 'text-red-500'
|
||||||
} else if (delay > 200) {
|
} else if (delay > 200) {
|
||||||
@ -27,25 +29,35 @@ export default (props: {
|
|||||||
return <span class={textClassName}>{delay}ms</span>
|
return <span class={textClassName}>{delay}ms</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatProxyType = (type: string) => {
|
||||||
|
const t = type.toLowerCase()
|
||||||
|
|
||||||
|
if (t === 'shadowsocks') {
|
||||||
|
return 'SS'
|
||||||
|
}
|
||||||
|
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={twMerge(
|
class={twMerge(
|
||||||
|
'card card-bordered tooltip tooltip-bottom card-compact flex gap-1 p-4',
|
||||||
isSelected
|
isSelected
|
||||||
? 'border-primary bg-success-content text-success'
|
? 'border-primary bg-success-content text-success'
|
||||||
: 'border-secondary',
|
: 'border-secondary',
|
||||||
onClick && 'cursor-pointer',
|
onClick && 'cursor-pointer',
|
||||||
'card card-bordered tooltip tooltip-bottom card-compact gap-2 p-4',
|
|
||||||
)}
|
)}
|
||||||
onClick={() => onClick?.()}
|
onClick={() => onClick?.()}
|
||||||
data-tip={proxyName}
|
data-tip={proxyName}
|
||||||
>
|
>
|
||||||
<div class="flex truncate">{proxyName}</div>
|
<div class="truncate text-left">{proxyName}</div>
|
||||||
<div class="flex flex-row">
|
<div class="flex items-center justify-between gap-1">
|
||||||
<div class="flex flex-1 truncate text-sm text-slate-500">
|
<div class="truncate text-xs text-slate-500">
|
||||||
{proxyNode().type}
|
{formatProxyType(proxyNode().type)}
|
||||||
{proxyNode().udp ? ' :: udp' : ''}
|
{proxyNode().udp ? ' :: udp' : ''}
|
||||||
</div>
|
</div>
|
||||||
<div>{Delay(proxyName)}</div>
|
<div class="text-xs">{Delay(proxyName)}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -36,7 +36,7 @@ export default () => {
|
|||||||
<div>
|
<div>
|
||||||
<h1 class="pb-4 text-lg font-semibold">Proxies</h1>
|
<h1 class="pb-4 text-lg font-semibold">Proxies</h1>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-1">
|
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||||
<For each={proxies()}>
|
<For each={proxies()}>
|
||||||
{(proxy) => {
|
{(proxy) => {
|
||||||
const title = (
|
const title = (
|
||||||
@ -54,6 +54,7 @@ export default () => {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<For each={proxy.all}>
|
<For each={proxy.all}>
|
||||||
{(proxyName) => (
|
{(proxyName) => (
|
||||||
@ -77,7 +78,7 @@ export default () => {
|
|||||||
[`group-${proxy.name}`]: val,
|
[`group-${proxy.name}`]: val,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
></Collapse>
|
/>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</For>
|
</For>
|
||||||
@ -87,7 +88,7 @@ export default () => {
|
|||||||
<div>
|
<div>
|
||||||
<h1 class="pb-4 text-lg font-semibold">Proxy Providers</h1>
|
<h1 class="pb-4 text-lg font-semibold">Proxy Providers</h1>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-1">
|
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||||
<For each={proxyProviders()}>
|
<For each={proxyProviders()}>
|
||||||
{(proxyProvider) => {
|
{(proxyProvider) => {
|
||||||
const title = <>{proxyProvider.name}</>
|
const title = <>{proxyProvider.name}</>
|
||||||
|
Loading…
Reference in New Issue
Block a user