From 83b0de831a6d6eedc1c2b8ad74de1416752dd835 Mon Sep 17 00:00:00 2001 From: kunish Date: Thu, 31 Aug 2023 00:00:50 +0800 Subject: [PATCH] feat: update proxy layout --- src/components/Collpase.tsx | 4 ++-- src/components/ProxyNodeCard.tsx | 26 +++++++++++++++++++------- src/pages/Proxies.tsx | 7 ++++--- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/components/Collpase.tsx b/src/components/Collpase.tsx index c41a889..d4cf264 100644 --- a/src/components/Collpase.tsx +++ b/src/components/Collpase.tsx @@ -27,7 +27,7 @@ const Collapse: ParentComponent = (props) => {
= (props) => {
{content} diff --git a/src/components/ProxyNodeCard.tsx b/src/components/ProxyNodeCard.tsx index 7cb26aa..1b0bea8 100644 --- a/src/components/ProxyNodeCard.tsx +++ b/src/components/ProxyNodeCard.tsx @@ -10,14 +10,16 @@ export default (props: { const { proxyName, isSelected, onClick } = props const { delayMap, proxyNodeMap } = useProxies() const proxyNode = createMemo(() => proxyNodeMap()[proxyName]) + const Delay = (proxyname: string) => { const delay = delayMap()[proxyname] - let textClassName = 'text-green-500' if (typeof delay !== 'number' || delay === 0) { return '' } + let textClassName = 'text-green-500' + if (delay > 500) { textClassName = 'text-red-500' } else if (delay > 200) { @@ -27,25 +29,35 @@ export default (props: { return {delay}ms } + const formatProxyType = (type: string) => { + const t = type.toLowerCase() + + if (t === 'shadowsocks') { + return 'SS' + } + + return t + } + return (
onClick?.()} data-tip={proxyName} > -
{proxyName}
-
-
- {proxyNode().type} +
{proxyName}
+
+
+ {formatProxyType(proxyNode().type)} {proxyNode().udp ? ' :: udp' : ''}
-
{Delay(proxyName)}
+
{Delay(proxyName)}
) diff --git a/src/pages/Proxies.tsx b/src/pages/Proxies.tsx index 7a07d51..6b62da8 100644 --- a/src/pages/Proxies.tsx +++ b/src/pages/Proxies.tsx @@ -36,7 +36,7 @@ export default () => {

Proxies

-
+
{(proxy) => { const title = ( @@ -54,6 +54,7 @@ export default () => {
) + const content = ( {(proxyName) => ( @@ -77,7 +78,7 @@ export default () => { [`group-${proxy.name}`]: val, }) } - > + /> ) }} @@ -87,7 +88,7 @@ export default () => {

Proxy Providers

-
+
{(proxyProvider) => { const title = <>{proxyProvider.name}