feat: add lite mode toggle to home page

This commit is contained in:
Tunglies 2025-03-19 02:18:20 +08:00
parent 772ecdd3b0
commit 74e441df5b

View File

@ -23,6 +23,7 @@ import {
DnsOutlined, DnsOutlined,
SpeedOutlined, SpeedOutlined,
HelpOutlineRounded, HelpOutlineRounded,
HistoryEduOutlined,
} from "@mui/icons-material"; } from "@mui/icons-material";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { ProxyTunCard } from "@/components/home/proxy-tun-card"; import { ProxyTunCard } from "@/components/home/proxy-tun-card";
@ -36,7 +37,7 @@ import { BasePage } from "@/components/base";
import { ClashInfoCard } from "@/components/home/clash-info-card"; import { ClashInfoCard } from "@/components/home/clash-info-card";
import { SystemInfoCard } from "@/components/home/system-info-card"; import { SystemInfoCard } from "@/components/home/system-info-card";
import { useLockFn } from "ahooks"; import { useLockFn } from "ahooks";
import { openWebUrl } from "@/services/cmds"; import { openWebUrl, patchVergeConfig } from "@/services/cmds";
import { TestCard } from "@/components/home/test-card"; import { TestCard } from "@/components/home/test-card";
import { IpInfoCard } from "@/components/home/ip-info-card"; import { IpInfoCard } from "@/components/home/ip-info-card";
@ -258,6 +259,11 @@ const HomePage = () => {
contentStyle={{ padding: 2 }} contentStyle={{ padding: 2 }}
header={ header={
<Box sx={{ display: "flex", alignItems: "center" }}> <Box sx={{ display: "flex", alignItems: "center" }}>
<Tooltip title={t("Lite Mode")} arrow>
<IconButton onClick={() => patchVergeConfig({ enable_lite_mode: true })} size="small" color="inherit">
<HistoryEduOutlined />
</IconButton>
</Tooltip>
<Tooltip title={t("Manual")} arrow> <Tooltip title={t("Manual")} arrow>
<IconButton onClick={toGithubDoc} size="small" color="inherit"> <IconButton onClick={toGithubDoc} size="small" color="inherit">
<HelpOutlineRounded /> <HelpOutlineRounded />
@ -275,9 +281,9 @@ const HomePage = () => {
{/* 订阅和当前节点部分 */} {/* 订阅和当前节点部分 */}
{homeCards.profile && ( {homeCards.profile && (
<Grid size={6}> <Grid size={6}>
<HomeProfileCard <HomeProfileCard
current={current} current={current}
onProfileUpdated={mutateProfiles} onProfileUpdated={mutateProfiles}
/> />
</Grid> </Grid>
)} )}