feat: add warning tooltip for proxy chain

This commit is contained in:
wonfen
2026-05-18 07:53:29 +08:00
parent ae7915c66f
commit e11b74206d
17 changed files with 60 additions and 19 deletions
+12 -1
View File
@@ -21,6 +21,7 @@ import {
DragIndicator,
Link,
LinkOff,
WarningRounded,
} from '@mui/icons-material'
import {
Alert,
@@ -40,6 +41,7 @@ import {
selectNodeForGroup,
} from 'tauri-plugin-mihomo-api'
import { TooltipIcon } from '@/components/base'
import { useAppRefreshers, useProxiesData } from '@/providers/app-data-context'
import { updateProxyChainConfigInRuntime } from '@/services/cmds'
import { debugLog } from '@/utils/debug'
@@ -251,6 +253,7 @@ export const ProxyChain = ({
}: ProxyChainProps) => {
const theme = useTheme()
const { t } = useTranslation()
const chainWarning = t('proxies.page.chain.warning')
const { proxies } = useProxiesData()
const { refreshProxy } = useAppRefreshers()
const [isConnecting, setIsConnecting] = useState(false)
@@ -499,7 +502,15 @@ export const ProxyChain = ({
mb: 2,
}}
>
<Typography variant="h6">{t('proxies.page.chain.header')}</Typography>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.75 }}>
<Typography variant="h6">{t('proxies.page.chain.header')}</Typography>
<TooltipIcon
title={chainWarning}
icon={WarningRounded}
color="warning"
sx={{ p: 0.25 }}
/>
</Box>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
{proxyChain.length > 0 && (
<IconButton
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "체인 프록시 구성",
"empty": "구성된 프록시 체인이 없습니다",
"warning": "체인 프록시는 네트워크 속도를 크게 저하시킬 수 있습니다. 명확한 업무상 필요가 없거나 이 구성을 이해하지 못한다면 비활성화 상태로 두세요.",
"empty": "체인 프록시는 네트워크 속도를 크게 저하시킬 수 있습니다. 명확한 업무상 필요가 없거나 이 구성을 이해하지 못한다면 비활성화 상태로 두세요.",
"instruction": "프록시 체인에 추가하려면 순서대로 노드를 클릭하세요",
"minimumNodes": "체인 프록시는 최소 2개의 노드가 필요합니다",
"minimumNodesHint": "체인 프록시는 최소 2개의 노드가 필요합니다. 하나 더 추가하세요.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Цепочка прокси",
"empty": "Цепочка прокси не настроена",
"warning": "Цепочка прокси может значительно снизить скорость сети. Если у вас нет явной рабочей необходимости или вы не понимаете эту настройку, оставьте ее отключенной.",
"empty": "Цепочка прокси может значительно снизить скорость сети. Если у вас нет явной рабочей необходимости или вы не понимаете эту настройку, оставьте ее отключенной.",
"instruction": "Нажимайте на узлы по порядку, чтобы добавить их в цепочку",
"minimumNodes": "Для цепочки требуется минимум 2 узла",
"minimumNodesHint": "Для цепочки требуется минимум 2 узла. Добавьте ещё один узел.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "Chain Proxy Config",
"empty": "No proxy chain configured",
"warning": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"empty": "Chain proxy will significantly reduce network speed. If you do not have a clear business need, or do not understand this configuration, keep it disabled.",
"instruction": "Click nodes in order to add to proxy chain",
"minimumNodes": "Chain proxy requires at least 2 nodes",
"minimumNodesHint": "Chain proxy requires at least 2 nodes. Please add one more node.",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "代理链配置",
"empty": "暂无代理链配置",
"warning": "链式代理会显著降低网速。如果您没有明确的业务需求,或不了解此项配置,请保持关闭",
"empty": "链式代理会显著降低网速。如果您没有明确的业务需求,或不了解此项配置,请保持关闭",
"instruction": "顺序点击节点添加到代理链中",
"minimumNodes": "链式代理至少需要 2 个节点",
"minimumNodesHint": "链式代理至少需要 2 个节点,请再添加一个节点。",
+2 -1
View File
@@ -43,7 +43,8 @@
},
"chain": {
"header": "鏈式代理設定",
"empty": "暫無鏈式代理設定",
"warning": "鏈式代理會顯著降低網速。如果您沒有明確的業務需求,或不了解此項設定,請保持關閉",
"empty": "鏈式代理會顯著降低網速。如果您沒有明確的業務需求,或不了解此項設定,請保持關閉",
"instruction": "依序點擊節點新增到鏈式代理中",
"minimumNodes": "鏈式代理至少需要 2 個節點",
"minimumNodesHint": "鏈式代理至少需要 2 個節點,請再新增一個節點。",
+20 -5
View File
@@ -1,11 +1,11 @@
import { LanOutlined, LanRounded } from '@mui/icons-material'
import { LanOutlined, LanRounded, WarningRounded } from '@mui/icons-material'
import { Box, Button, ButtonGroup } from '@mui/material'
import { useLockFn } from 'ahooks'
import { useCallback, useEffect, useReducer, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { closeAllConnections } from 'tauri-plugin-mihomo-api'
import { BasePage } from '@/components/base'
import { BasePage, TooltipIcon } from '@/components/base'
import { ProviderButton } from '@/components/proxy/provider-button'
import { ProxyGroups } from '@/components/proxy/proxy-groups'
import { useVerge } from '@/hooks/use-verge'
@@ -54,6 +54,7 @@ const ProxyPage = () => {
const normalizedMode = clashConfig?.mode?.toLowerCase()
const curMode = isMode(normalizedMode) ? normalizedMode : undefined
const chainWarning = t('proxies.page.chain.warning')
const onChangeMode = useLockFn(async (mode: Mode) => {
// 断开连接
@@ -134,9 +135,23 @@ const ProxyPage = () => {
full
contentStyle={{ height: '101.5%' }}
title={
isChainMode
? t('proxies.page.title.chainMode')
: t('proxies.page.title.default')
isChainMode ? (
<Box
component="span"
data-tauri-drag-region="true"
sx={{ display: 'inline-flex', alignItems: 'center', gap: 0.75 }}
>
{t('proxies.page.title.chainMode')}
<TooltipIcon
title={chainWarning}
icon={WarningRounded}
color="warning"
sx={{ p: 0.25 }}
/>
</Box>
) : (
t('proxies.page.title.default')
)
}
header={
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
+1
View File
@@ -238,6 +238,7 @@ export const translationKeys = [
'proxies.page.tooltips.filter',
'proxies.page.placeholders.delayCheckUrl',
'proxies.page.chain.header',
'proxies.page.chain.warning',
'proxies.page.chain.empty',
'proxies.page.chain.instruction',
'proxies.page.chain.minimumNodes',
+1
View File
@@ -439,6 +439,7 @@ export interface TranslationResources {
instruction: string
minimumNodes: string
minimumNodesHint: string
warning: string
}
labels: {
delayCheckReset: string