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