import { Show, createEffect, createMemo, createSignal } from 'solid-js' import { DELAY } from '~/config/enum' import { useProxies } from '~/signals/proxies' const Delay = (props: { name?: string }) => { const { proxyNodeMap } = useProxies() const [textClassName, setTextClassName] = createSignal('') const delay = createMemo(() => { return proxyNodeMap()[props.name!]?.delay! }) createEffect(() => { setTextClassName('text-success') if (delay() > DELAY.HIGH) { setTextClassName('text-error') } else if (delay() > DELAY.MEDIUM) { setTextClassName('text-warning') } }) return ( <> {delay()}ms ) } export default Delay