style: simplify and improve proxy settings UI

This commit is contained in:
wonfen
2025-09-01 13:57:04 +08:00
parent 0ea875f7f7
commit 45fdebeaca
2 changed files with 104 additions and 146 deletions

View File

@@ -1,6 +1,19 @@
## v2.4.2 ## v2.4.2
To be done ### ✨ 新增功能
- 增加托盘节点选择
### 🐞 修复问题
- 修复首页节点切换失效的问题
- 修复和优化服务检查流程
- 修复2.4.1引入的订阅地址重定向报错问题
- 修复 rpm/deb 包名称问题
### 👙 界面样式
- 简化和改进代理设置样式
## v2.4.1 ## v2.4.1

View File

@@ -8,15 +8,9 @@ import {
DeleteForeverRounded, DeleteForeverRounded,
WarningRounded, WarningRounded,
} from "@mui/icons-material"; } from "@mui/icons-material";
import { import { Box, Typography, alpha, useTheme } from "@mui/material";
Box,
Button,
Tooltip,
Typography,
alpha,
useTheme,
} from "@mui/material";
import { DialogRef, Switch } from "@/components/base"; import { DialogRef, Switch } from "@/components/base";
import { TooltipIcon } from "@/components/base/base-tooltip-icon";
import { GuardState } from "@/components/setting/mods/guard-state"; import { GuardState } from "@/components/setting/mods/guard-state";
import { SysproxyViewer } from "@/components/setting/mods/sysproxy-viewer"; import { SysproxyViewer } from "@/components/setting/mods/sysproxy-viewer";
import { TunViewer } from "@/components/setting/mods/tun-viewer"; import { TunViewer } from "@/components/setting/mods/tun-viewer";
@@ -100,19 +94,6 @@ const ProxyControlSwitches = ({
return ( return (
<Box sx={{ width: "100%" }}> <Box sx={{ width: "100%" }}>
{label && (
<Box
sx={{
fontSize: "15px",
fontWeight: "500",
mb: 0.5,
display: "none",
}}
>
{label}
</Box>
)}
{/* 仅显示当前选中的开关 */} {/* 仅显示当前选中的开关 */}
{isSystemProxyMode && ( {isSystemProxyMode && (
<Box <Box
@@ -131,39 +112,26 @@ const ProxyControlSwitches = ({
> >
<Box sx={{ display: "flex", alignItems: "center" }}> <Box sx={{ display: "flex", alignItems: "center" }}>
{systemProxyActualState ? ( {systemProxyActualState ? (
<PlayCircleOutlineRounded <PlayCircleOutlineRounded sx={{ color: "success.main", mr: 1 }} />
sx={{ color: "success.main", mr: 1.5, fontSize: 28 }}
/>
) : ( ) : (
<PauseCircleOutlineRounded <PauseCircleOutlineRounded
sx={{ color: "text.disabled", mr: 1.5, fontSize: 28 }} sx={{ color: "text.disabled", mr: 1 }}
/> />
)} )}
<Box>
<Typography <Typography
variant="subtitle1" variant="subtitle1"
sx={{ fontWeight: 500, fontSize: "15px" }} sx={{ fontWeight: 500, fontSize: "15px" }}
> >
{t("System Proxy")} {t("System Proxy")}
</Typography> </Typography>
</Box> <TooltipIcon
</Box> title={t("System Proxy Info")}
icon={SettingsRounded}
<Box sx={{ display: "flex", alignItems: "center" }}>
<Tooltip title={t("System Proxy Info")} arrow>
<Box
sx={{
mr: 1,
color: "text.secondary",
"&:hover": { color: "primary.main" },
cursor: "pointer",
}}
onClick={() => sysproxyRef.current?.open()} onClick={() => sysproxyRef.current?.open()}
> sx={{ ml: 1 }}
<SettingsRounded fontSize="small" /> />
</Box> </Box>
</Tooltip>
<GuardState <GuardState
value={systemProxyActualState} value={systemProxyActualState}
@@ -175,7 +143,6 @@ const ProxyControlSwitches = ({
<Switch edge="end" /> <Switch edge="end" />
</GuardState> </GuardState>
</Box> </Box>
</Box>
)} )}
{isTunMode && ( {isTunMode && (
@@ -196,75 +163,54 @@ const ProxyControlSwitches = ({
> >
<Box sx={{ display: "flex", alignItems: "center" }}> <Box sx={{ display: "flex", alignItems: "center" }}>
{enable_tun_mode ? ( {enable_tun_mode ? (
<PlayCircleOutlineRounded <PlayCircleOutlineRounded sx={{ color: "success.main", mr: 1 }} />
sx={{ color: "success.main", mr: 1.5, fontSize: 28 }}
/>
) : ( ) : (
<PauseCircleOutlineRounded <PauseCircleOutlineRounded
sx={{ color: "text.disabled", mr: 1.5, fontSize: 28 }} sx={{ color: "text.disabled", mr: 1 }}
/> />
)} )}
<Box>
<Typography <Typography
variant="subtitle1" variant="subtitle1"
sx={{ fontWeight: 500, fontSize: "15px" }} sx={{ fontWeight: 500, fontSize: "15px" }}
> >
{t("Tun Mode")} {t("Tun Mode")}
</Typography> </Typography>
</Box> <TooltipIcon
title={t("Tun Mode Info")}
icon={SettingsRounded}
onClick={() => tunRef.current?.open()}
sx={{ ml: 1 }}
/>
{!isTunAvailable && ( {!isTunAvailable && (
<Tooltip <TooltipIcon
title={t("TUN requires Service Mode or Admin Mode")} title={t("TUN requires Service Mode or Admin Mode")}
arrow icon={WarningRounded}
> sx={{ color: "warning.main", ml: 1 }}
<WarningRounded sx={{ color: "warning.main", ml: 1 }} /> />
</Tooltip>
)} )}
</Box>
<Box sx={{ display: "flex", alignItems: "center" }}>
{!isTunAvailable && ( {!isTunAvailable && (
<Tooltip title={t("Install Service")} arrow> <TooltipIcon
<Button title={t("Install Service")}
variant="outlined" icon={BuildRounded}
color="primary" color="primary"
size="small"
onClick={onInstallService} onClick={onInstallService}
sx={{ mr: 1, minWidth: "32px", p: "4px" }} sx={{ ml: 1 }}
> />
<BuildRounded fontSize="small" />
</Button>
</Tooltip>
)} )}
{isServiceMode && ( {isServiceMode && (
<Tooltip title={t("Uninstall Service")} arrow> <TooltipIcon
<Button title={t("Uninstall Service")}
icon={DeleteForeverRounded}
color="secondary" color="secondary"
size="small"
onClick={onUninstallService} onClick={onUninstallService}
sx={{ mr: 1, minWidth: "32px", p: "4px" }} sx={{ ml: 1 }}
> />
<DeleteForeverRounded fontSize="small" />
</Button>
</Tooltip>
)} )}
<Tooltip title={t("Tun Mode Info")} arrow>
<Box
sx={{
mr: 1,
color: "text.secondary",
"&:hover": { color: "primary.main" },
cursor: "pointer",
}}
onClick={() => tunRef.current?.open()}
>
<SettingsRounded fontSize="small" />
</Box> </Box>
</Tooltip>
<GuardState <GuardState
value={enable_tun_mode ?? false} value={enable_tun_mode ?? false}
@@ -299,7 +245,6 @@ const ProxyControlSwitches = ({
<Switch edge="end" disabled={!isTunAvailable} /> <Switch edge="end" disabled={!isTunAvailable} />
</GuardState> </GuardState>
</Box> </Box>
</Box>
)} )}
{/* 引用对话框组件 */} {/* 引用对话框组件 */}