import { createMemo } from 'solid-js' import { twMerge } from 'tailwind-merge' import { DELAY } from '~/config/enum' import { useProxies } from '~/signals/proxies' export default (props: { proxyName: string isSelected?: boolean onClick?: () => void }) => { const { proxyName, isSelected, onClick } = props const { proxyNodeMap } = useProxies() const proxyNode = createMemo(() => proxyNodeMap()[proxyName]) const Delay = (delay: number | undefined) => { if (typeof delay !== 'number' || delay === DELAY.NOT_CONNECTED) { return '' } let textClassName = 'text-success' if (delay > DELAY.HIGH) { textClassName = 'text-error' } else if (delay > DELAY.MEDIUM) { textClassName = 'text-warning' } return {delay}ms } const formatProxyType = (type = '') => { const t = type.toLowerCase() if (t.includes('shadowsocks')) { return t.replace('shadowsocks', 'ss') } return t } return (