import { useI18n } from '@solid-primitives/i18n' import { IconBrandSpeedtest } from '@tabler/icons-solidjs' import { Show } from 'solid-js' import { twMerge } from 'tailwind-merge' import { Button, Collapse, ForTwoColumns, ProxyCardGroups, ProxyNodePreview, } from '~/components' import { sortProxiesByOrderingType, useStringBooleanMap } from '~/helpers' import { proxiesOrderingType, renderProxiesInSamePage, useProxies, } from '~/signals' import type { Proxy } from '~/types' import ProxyProvider from './ProxyProvider' export default () => { const [t] = useI18n() const { proxies, setProxyGroupByProxyName, latencyTestByProxyGroupName, latencyMap, } = useProxies() const { map: collapsedMap, set: setCollapsedMap } = useStringBooleanMap() const { map: speedTestingMap, setWithCallback: setSpeedTestingMap } = useStringBooleanMap() const onProxyNodeClick = async (proxy: Proxy, proxyName: string) => { void setProxyGroupByProxyName(proxy, proxyName) } const onSpeedTestClick = async (e: MouseEvent, name: string) => { e.stopPropagation() setSpeedTestingMap( name, async () => await latencyTestByProxyGroupName(name), ) } return ( <>