import { useI18n } from '@solid-primitives/i18n' import { IconReload } from '@tabler/icons-solidjs' import InfiniteScroll from 'solid-infinite-scroll' import { For, Show, createMemo, createSignal, onMount } from 'solid-js' import { useRules } from '~/signals/rules' import { formatTimeFromNow, getBtnElFromClickEvent } from '~/utils/proxies' export default () => { const [t] = useI18n() const { rules, rulesProviders, updateRules, updateAllRuleProvider, updateRuleProviderByName, } = useRules() const [maxRuleRender, setMaxRuleRender] = createSignal(100) const renderRules = createMemo(() => rules().slice(0, maxRuleRender())) onMount(async () => { updateRules() }) const onUpdateProviderClick = async (e: MouseEvent, name: string) => { const el = getBtnElFromClickEvent(e) el.classList.add('animate-spin') e.stopPropagation() await updateRuleProviderByName(name) el.classList.remove('animate-spin') } const onUpdateAllProviderClick = async (e: MouseEvent) => { const el = getBtnElFromClickEvent(e) el.classList.add('animate-spin') e.stopPropagation() await updateAllRuleProvider() el.classList.remove('animate-spin') } return (

{t('rules')}

setMaxRuleRender(maxRuleRender() + 100)} > {(rule) => (
{rule.payload} {rule.size !== -1 && ` (${rule.size})`}
{rule.type} :: {rule.proxy}
)}
0}>

{t('ruleProviders')}

{(rulesProvider) => (
{rulesProvider.name} ({rulesProvider.ruleCount})
{rulesProvider.vehicleType} / {rulesProvider.behavior} / Updated {formatTimeFromNow(rulesProvider.updatedAt)}
)}
) }