import { createMemo } from 'solid-js' import { Latency } from '~/components' import { latencyQualityMap, useProxies } from '~/signals' export const ProxyPreviewBar = (props: { proxyNameList: string[] now?: string }) => { const { latencyMap } = useProxies() const delayList = createMemo(() => props.proxyNameList.map((i) => latencyMap()[i]), ) const all = createMemo(() => delayList().length) const good = createMemo( () => delayList().filter( (delay) => delay > latencyQualityMap().NOT_CONNECTED && delay <= latencyQualityMap().MEDIUM, ).length, ) const middle = createMemo( () => delayList().filter( (delay) => delay > latencyQualityMap().NOT_CONNECTED && delay <= latencyQualityMap().HIGH, ).length, ) const slow = createMemo( () => delayList().filter((delay) => delay > latencyQualityMap().HIGH).length, ) const notConnected = createMemo( () => delayList().filter( (delay) => delay === latencyQualityMap().NOT_CONNECTED || typeof delay !== 'number', ).length, ) return (
) }