import { For, createSignal, onMount } from 'solid-js' import { twMerge } from 'tailwind-merge' import { useProxies } from '~/signals/proxies' import type { Proxy } from '~/types' export default () => { const { proxies, proxyProviders, delayMap, updateProxy, setProxiesByProxyName, } = useProxies() const [collapseMap, setCollapseMap] = createSignal>( {}, ) const renderDelay = (proxyname: string) => { const delay = delayMap()[proxyname] if (typeof delay !== 'number' || delay === 0) { return '' } return {delay}ms } onMount(async () => { await updateProxy() }) const onProxyNodeClick = async (proxy: Proxy, proxyName: string) => { setProxiesByProxyName(proxy, proxyName) } const onCollapseTitleClick = (name: string) => { const cMap = collapseMap() cMap[name] = !cMap[name] setCollapseMap({ ...cMap }) } const getCollapseClassName = (name: string) => { return collapseMap()[name] ? 'collapse-open' : 'collapse-close' } return (

Proxies

{(proxy) => (
onCollapseTitleClick(proxy.name)} > {proxy.name} {proxy.type}
{(proxyName) => (
onProxyNodeClick(proxy, proxyName)} > {proxyName} {renderDelay(proxyName)}
)}
)}

Proxy Providers

{(proxy) => (
onCollapseTitleClick(proxy.name)} > {proxy.name}
{(proxyNode) => (
{proxyNode.name} {renderDelay(proxyNode.name)}
)}
)}
) }