feat(proxies): show latency result only when possible

This commit is contained in:
kunish 2024-10-13 02:30:05 +08:00
parent dfcc750a12
commit 4314e64785
No known key found for this signature in database
GPG Key ID: 67D3ACD788F3A7CD
2 changed files with 14 additions and 14 deletions

View File

@ -68,7 +68,9 @@ export const ProxyPreviewBar = (props: {
/>
</div>
<Latency proxyName={props.now} />
<Show when={props.now}>
<Latency proxyName={props.now!} />
</Show>
</div>
)
}

View File

@ -2,7 +2,7 @@ import { twMerge } from 'tailwind-merge'
import { Latency } from '~/components'
import { latencyQualityMap, useProxies } from '~/signals'
const LatencyDots = (props: {
const LatencyDot = (props: {
name: string
latency?: number
selected: boolean
@ -51,21 +51,19 @@ export const ProxyPreviewDots = (props: {
getLatencyByName(name),
])}
>
{([name, latency]) => {
const isSelected = props.now === name
return (
<LatencyDots
name={name}
latency={latency}
selected={isSelected}
/>
)
}}
{([name, latency]) => (
<LatencyDot
name={name}
latency={latency}
selected={props.now === name}
/>
)}
</For>
</div>
<Latency proxyName={props.now} />
<Show when={props.now}>
<Latency proxyName={props.now!} />
</Show>
</div>
)
}