import { IconBrandSpeedtest, IconReload, IconSettings, } from '@tabler/icons-solidjs' import { For, Show, createMemo, createSignal, onMount } from 'solid-js' import { twMerge } from 'tailwind-merge' import { Button, Collapse, ProxiesSettingsModal, ProxyNodeCard, ProxyNodePreview, RenderInTwoColumns, SubscriptionInfo, } from '~/components' import { filterProxiesByAvailability, sortProxiesByOrderingType, } from '~/helpers' import { useI18n } from '~/i18n' import { formatTimeFromNow, hideUnAvailableProxies, proxiesOrderingType, useProxies, } from '~/signals' enum ActiveTab { proxyProviders = 'proxyProviders', proxies = 'proxies', } export default () => { let proxiesSettingsModalRef: HTMLDialogElement | undefined const [t] = useI18n() const { fetchProxies, proxies, selectProxyInGroup, latencyMap, proxyProviders, updateProviderByProviderName, updateAllProvider, proxyGroupLatencyTest, proxyProviderLatencyTest, collapsedMap, setCollapsedMap, proxyGroupLatencyTestingMap, proxyProviderLatencyTestingMap, isAllProviderUpdating, updatingMap, } = useProxies() onMount(fetchProxies) const onProxyGroupLatencyTestClick = async ( e: MouseEvent, groupName: string, ) => { e.stopPropagation() void proxyGroupLatencyTest(groupName) } const onProxyProviderLatencyTestClick = ( e: MouseEvent, providerName: string, ) => { e.stopPropagation() void proxyProviderLatencyTest(providerName) } const onUpdateProxyProviderClick = (e: MouseEvent, providerName: string) => { e.stopPropagation() void updateProviderByProviderName(providerName) } const onUpdateAllProviderClick = async (e: MouseEvent) => { e.stopPropagation() void updateAllProvider() } const [activeTab, setActiveTab] = createSignal(ActiveTab.proxies) const tabs = () => [ { type: ActiveTab.proxies, name: t('proxies'), count: proxies().length, }, { type: ActiveTab.proxyProviders, name: t('proxyProviders'), count: proxyProviders().length, }, ] return (