diff --git a/src/components/ProxyNodePreview.tsx b/src/components/ProxyNodePreview.tsx index 0d7df7ba..5d9b2997 100644 --- a/src/components/ProxyNodePreview.tsx +++ b/src/components/ProxyNodePreview.tsx @@ -1,16 +1,35 @@ -import { Show } from 'solid-js' +import { Show, createMemo } from 'solid-js' import { PROXIES_PREVIEW_TYPE } from '~/config/enum' import { proxiesPreviewType } from '~/pages/Config' import ProxyPreviewBar from './ProxyPreviewBar' import ProxyPreviewDots from './ProxyPreviewDots' export default (props: { proxyNameList: string[]; now?: string }) => { + const isSmallGroup = createMemo(() => props.proxyNameList.length <= 30) + const isShowBar = createMemo(() => { + const type = proxiesPreviewType() + + return ( + type === PROXIES_PREVIEW_TYPE.BAR || + (type === PROXIES_PREVIEW_TYPE.Auto && !isSmallGroup()) + ) + }) + + const isShowDots = createMemo(() => { + const type = proxiesPreviewType() + + return ( + type === PROXIES_PREVIEW_TYPE.BAR || + (type === PROXIES_PREVIEW_TYPE.Auto && isSmallGroup()) + ) + }) + return ( <> - + - + diff --git a/src/components/ProxyPreviewBar.tsx b/src/components/ProxyPreviewBar.tsx index d15d8b08..0bcfdb46 100644 --- a/src/components/ProxyPreviewBar.tsx +++ b/src/components/ProxyPreviewBar.tsx @@ -1,5 +1,4 @@ import { createMemo } from 'solid-js' -import { twMerge } from 'tailwind-merge' import Delay from '~/components/Delay' import { DELAY } from '~/config/enum' import { useProxies } from '~/signals/proxies' @@ -32,28 +31,28 @@ export default (props: { proxyNameList: string[]; now?: string }) => { ) return ( -
+
{ + const [t] = useI18n() + return (
@@ -141,31 +143,23 @@ export default () => {
-
Proxies preview type:
- -
- - +
{t('proxiesPreviewType')}
+
+ + {(value) => ( + + )} +