diff --git a/src/components/ProxyPreviewBar.tsx b/src/components/ProxyPreviewBar.tsx index a482ade..b2dcd34 100644 --- a/src/components/ProxyPreviewBar.tsx +++ b/src/components/ProxyPreviewBar.tsx @@ -10,6 +10,7 @@ export const ProxyPreviewBar = (props: { const latencyList = createMemo(() => props.proxyNameList.map((name) => latencyMap()[name]), ) + const all = createMemo(() => latencyList().length) const good = createMemo( () => @@ -35,9 +36,7 @@ export const ProxyPreviewBar = (props: { const notConnected = createMemo( () => latencyList().filter( - (latency) => - latency === latencyQualityMap().NOT_CONNECTED || - typeof latency !== 'number', + (latency) => latency === latencyQualityMap().NOT_CONNECTED, ).length, ) @@ -47,27 +46,27 @@ export const ProxyPreviewBar = (props: {
+ />
+ />
+ />
+ /> diff --git a/src/components/ProxyPreviewDots.tsx b/src/components/ProxyPreviewDots.tsx index 5b2a5fc..7cf939d 100644 --- a/src/components/ProxyPreviewDots.tsx +++ b/src/components/ProxyPreviewDots.tsx @@ -2,22 +2,27 @@ import { For } from 'solid-js' import { twMerge } from 'tailwind-merge' import { latencyQualityMap, useProxies } from '~/signals' -const LatencyDots = (p: { latency: number | undefined; selected: boolean }) => { - let dotClassName = p.selected +const LatencyDots = (props: { + latency: number | undefined + selected: boolean +}) => { + let dotClassName = props.selected ? 'bg-white border-4 border-success' : 'bg-success' if ( - typeof p.latency !== 'number' || - p.latency === latencyQualityMap().NOT_CONNECTED + typeof props.latency !== 'number' || + props.latency === latencyQualityMap().NOT_CONNECTED ) { - dotClassName = p.selected + dotClassName = props.selected ? 'bg-white border-4 border-neutral' : 'bg-neutral' - } else if (p.latency > latencyQualityMap().HIGH) { - dotClassName = p.selected ? 'bg-white border-4 border-error' : 'bg-error' - } else if (p.latency > latencyQualityMap().MEDIUM) { - dotClassName = p.selected + } else if (props.latency > latencyQualityMap().HIGH) { + dotClassName = props.selected + ? 'bg-white border-4 border-error' + : 'bg-error' + } else if (props.latency > latencyQualityMap().MEDIUM) { + dotClassName = props.selected ? 'bg-white border-4 border-warning' : 'bg-warning' } diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 1a9fd83..21482c2 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -133,7 +133,7 @@ const ConfigForm = () => { }) const [updatingGEODatabases, setUpdatingGEODatabases] = createSignal(false) - const [upgraging, setUpgraging] = createSignal(false) + const [upgrading, setUpgrading] = createSignal(false) const [restarting, setRestarting] = createSignal(false) const onUpdateGEODatabases = async () => { @@ -145,11 +145,11 @@ const ConfigForm = () => { } const onUpgrade = async () => { - setUpgraging(true) + setUpgrading(true) try { await request.post('upgrade') } catch {} - setUpgraging(false) + setUpgrading(false) } const onRestart = async () => { @@ -190,7 +190,7 @@ const ConfigForm = () => { {t('restartCore')} - diff --git a/src/pages/Overview.tsx b/src/pages/Overview.tsx index 6892288..94df132 100644 --- a/src/pages/Overview.tsx +++ b/src/pages/Overview.tsx @@ -36,7 +36,7 @@ export default () => { const [memories, setMemories] = createSignal([]) // https://github.com/apexcharts/apexcharts.js/blob/main/samples/source/line/realtime.xml - // TODO: need a better way + // TODO: needs a better way makeTimer( () => { setTraffics((traffics) => traffics.slice(-CHART_MAX_XAXIS)) @@ -152,7 +152,7 @@ export default () => { -
+
{ const [maxRuleRender, setMaxRuleRender] = createSignal(100) const renderRules = createMemo(() => rules().slice(0, maxRuleRender())) - onMount(async () => { - updateRules() - }) + onMount(updateRules) const onUpdateProviderClick = async (e: MouseEvent, name: string) => { const el = getBtnElFromClickEvent(e) diff --git a/src/pages/Setup.tsx b/src/pages/Setup.tsx index 3dff91d..84aea4c 100644 --- a/src/pages/Setup.tsx +++ b/src/pages/Setup.tsx @@ -78,7 +78,7 @@ export default () => { const { form } = createForm>({ extend: validator({ schema }), - onSubmit: onSubmit, + onSubmit, }) const onRemove = (id: string) => @@ -88,14 +88,14 @@ export default () => { const query = new URLSearchParams(window.location.search) if (query.has('hostname')) { - onSubmit({ + void onSubmit({ url: `http://${query.get('hostname')}${ query.get('port') && ':' + query.get('port') }`, secret: query.get('secret') ?? '', }) } else { - onSubmit({ + void onSubmit({ url: 'http://127.0.0.1:9090', secret: '', })