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 latencyList = createMemo(() => props.proxyNameList.map((name) => latencyMap()[name]), ) const all = createMemo(() => latencyList().length) const good = createMemo( () => latencyList().filter( (latency) => latency > latencyQualityMap().NOT_CONNECTED && latency <= latencyQualityMap().MEDIUM, ).length, ) const middle = createMemo( () => latencyList().filter( (latency) => latency > latencyQualityMap().MEDIUM && latency <= latencyQualityMap().HIGH, ).length, ) const slow = createMemo( () => latencyList().filter((latency) => latency > latencyQualityMap().HIGH) .length, ) const notConnected = createMemo( () => latencyList().filter( (latency) => latency === latencyQualityMap().NOT_CONNECTED || typeof latency !== 'number', ).length, ) return (