mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45:35 +08:00
refactor: specialType
This commit is contained in:
parent
a12fb8a6a9
commit
c53d9624ca
@ -1,7 +1,7 @@
|
|||||||
import { createMemo } from 'solid-js'
|
import { createMemo, Show } from 'solid-js'
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
import { Latency } from '~/components'
|
import { Latency } from '~/components'
|
||||||
import { filterGroupType, formatProxyType } from '~/helpers'
|
import { filterSpecialProxyType, formatProxyType } from '~/helpers'
|
||||||
import { useProxies } from '~/signals'
|
import { useProxies } from '~/signals'
|
||||||
|
|
||||||
export const ProxyNodeCard = (props: {
|
export const ProxyNodeCard = (props: {
|
||||||
@ -12,6 +12,14 @@ export const ProxyNodeCard = (props: {
|
|||||||
const { proxyName, isSelected, onClick } = props
|
const { proxyName, isSelected, onClick } = props
|
||||||
const { proxyNodeMap } = useProxies()
|
const { proxyNodeMap } = useProxies()
|
||||||
const proxyNode = createMemo(() => proxyNodeMap()[proxyName])
|
const proxyNode = createMemo(() => proxyNodeMap()[proxyName])
|
||||||
|
const specialType = () =>
|
||||||
|
filterSpecialProxyType(proxyNode()?.type)
|
||||||
|
? proxyNode()?.xudp
|
||||||
|
? 'xudp'
|
||||||
|
: proxyNode()?.udp
|
||||||
|
? 'udp'
|
||||||
|
: null
|
||||||
|
: null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -32,15 +40,7 @@ export const ProxyNodeCard = (props: {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{formatProxyType(proxyNode()?.type)}
|
{formatProxyType(proxyNode()?.type)}
|
||||||
{filterGroupType(proxyNode()?.type) ? (
|
<Show when={specialType()}>{` :: ${specialType()}`}</Show>
|
||||||
<span>
|
|
||||||
{' :: '}
|
|
||||||
{proxyNode()?.xudp && 'x'}
|
|
||||||
{proxyNode()?.udp && 'udp'}
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span>{proxyNode()?.now}</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs">
|
<div class="text-xs">
|
||||||
<Latency name={props.proxyName} />
|
<Latency name={props.proxyName} />
|
||||||
|
@ -34,7 +34,7 @@ export const formatProxyType = (type = '') => {
|
|||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
export const filterGroupType = (type = '') => {
|
export const filterSpecialProxyType = (type = '') => {
|
||||||
const t = type.toLowerCase()
|
const t = type.toLowerCase()
|
||||||
const conditions = [
|
const conditions = [
|
||||||
'selector',
|
'selector',
|
||||||
|
Loading…
Reference in New Issue
Block a user