fix: homepage entry lightweight mode exiting Macos tray icon

fix: lightweight mode better handling and logging logic
This commit is contained in:
Tunglies
2025-03-20 23:17:37 +08:00
parent 11b8c8be45
commit 2e38404434
5 changed files with 34 additions and 21 deletions

View File

@@ -66,9 +66,9 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
sx={{
cursor: "pointer",
color: "primary.main",
"&:hover": { textDecoration: "underline" }
"&:hover": { textDecoration: "underline" },
}}
onClick={() => entry_lightweight_mode()}
onClick={async () => await entry_lightweight_mode()}
>
{t("Enable")}
</Typography>
@@ -115,17 +115,25 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
slotProps={{
input: {
endAdornment: (
<InputAdornment position="end">{t("mins")}</InputAdornment>
)
}
<InputAdornment position="end">
{t("mins")}
</InputAdornment>
),
},
}}
/>
</ListItem>
<ListItem sx={{ padding: "5px 2px" }}>
<Typography variant="body2" color="text.secondary" sx={{ fontStyle: "italic" }}>
{t("When closing the window, LightWeight Mode will be automatically activated after _n minutes",
{ n: values.autoEnterLiteModeDelay })}
<Typography
variant="body2"
color="text.secondary"
sx={{ fontStyle: "italic" }}
>
{t(
"When closing the window, LightWeight Mode will be automatically activated after _n minutes",
{ n: values.autoEnterLiteModeDelay },
)}
</Typography>
</ListItem>
</>
@@ -133,4 +141,4 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
</List>
</BaseDialog>
);
});
});

View File

@@ -37,7 +37,11 @@ import { BasePage } from "@/components/base";
import { ClashInfoCard } from "@/components/home/clash-info-card";
import { SystemInfoCard } from "@/components/home/system-info-card";
import { useLockFn } from "ahooks";
import { entry_lightweight_mode, openWebUrl, patchVergeConfig } from "@/services/cmds";
import {
entry_lightweight_mode,
openWebUrl,
patchVergeConfig,
} from "@/services/cmds";
import { TestCard } from "@/components/home/test-card";
import { IpInfoCard } from "@/components/home/ip-info-card";
@@ -260,7 +264,11 @@ const HomePage = () => {
header={
<Box sx={{ display: "flex", alignItems: "center" }}>
<Tooltip title={t("LightWeight Mode")} arrow>
<IconButton onClick={() => entry_lightweight_mode()} size="small" color="inherit">
<IconButton
onClick={async () => await entry_lightweight_mode()}
size="small"
color="inherit"
>
<HistoryEduOutlined />
</IconButton>
</Tooltip>