diff --git a/src/components/setting/mods/setting-comp.tsx b/src/components/setting/mods/setting-comp.tsx index 167b5a3..a2dbdf6 100644 --- a/src/components/setting/mods/setting-comp.tsx +++ b/src/components/setting/mods/setting-comp.tsx @@ -3,32 +3,39 @@ import { Box, List, ListItem, + ListItemButton, ListItemText, ListSubheader, } from "@mui/material"; +import { ChevronRightRounded } from "@mui/icons-material"; interface ItemProps { label: ReactNode; extra?: ReactNode; children?: ReactNode; secondary?: ReactNode; + onClick?: () => void; } export const SettingItem: React.FC = (props) => { - const { label, extra, children, secondary } = props; + const { label, extra, children, secondary, onClick } = props; + const clickable = !!onClick; - const primary = !extra ? ( + const primary = ( {label} - - ) : ( - - {label} - {extra} + {extra ? extra : null} ); - return ( + return clickable ? ( + + + + + + + ) : ( {children} diff --git a/src/components/setting/setting-clash.tsx b/src/components/setting/setting-clash.tsx index 035403b..651982d 100644 --- a/src/components/setting/setting-clash.tsx +++ b/src/components/setting/setting-clash.tsx @@ -9,7 +9,7 @@ import { IconButton, Tooltip, } from "@mui/material"; -import { ArrowForward, Settings, Shuffle } from "@mui/icons-material"; +import { Settings, Shuffle } from "@mui/icons-material"; import { DialogRef, Notice, Switch } from "@/components/base"; import { useClash } from "@/hooks/use-clash"; import { GuardState } from "./mods/guard-state"; @@ -120,7 +120,10 @@ const SettingClash = ({ onError }: Props) => { color={enable_random_port ? "primary" : "inherit"} size="small" onClick={() => { - Notice.success(t("Restart Application to Apply Modifications"), 1000); + Notice.success( + t("Restart Application to Apply Modifications"), + 1000 + ); onChangeVerge({ enable_random_port: !enable_random_port }); patchVerge({ enable_random_port: !enable_random_port }); }} @@ -146,27 +149,12 @@ const SettingClash = ({ onError }: Props) => { /> - - ctrlRef.current?.open()} - > - - - + ctrlRef.current?.open()} + label={t("External")} + /> - - webRef.current?.open()} - > - - - + webRef.current?.open()} label={t("Web UI")} /> { {isWIN && ( - - - - - + )} - - - - - + ); }; diff --git a/src/components/setting/setting-verge.tsx b/src/components/setting/setting-verge.tsx index 53c3014..2b2bc9f 100644 --- a/src/components/setting/setting-verge.tsx +++ b/src/components/setting/setting-verge.tsx @@ -2,14 +2,7 @@ import { useRef } from "react"; import { useLockFn } from "ahooks"; import { useTranslation } from "react-i18next"; import { open } from "@tauri-apps/api/dialog"; -import { - Button, - IconButton, - MenuItem, - Select, - Input, - Typography, -} from "@mui/material"; +import { Button, MenuItem, Select, Input, Typography } from "@mui/material"; import { exitApp, openAppDir, @@ -17,7 +10,6 @@ import { openLogsDir, openDevTools, } from "@/services/cmds"; -import { ArrowForward } from "@mui/icons-material"; import { checkUpdate } from "@tauri-apps/api/updater"; import { useVerge } from "@/hooks/use-verge"; import { version } from "@root/package.json"; @@ -213,128 +205,48 @@ const SettingVerge = ({ onError }: Props) => { > - - themeRef.current?.open()} - > - - - - - layoutRef.current?.open()} - > - - - + themeRef.current?.open()} + label={t("Theme Setting")} + /> - - miscRef.current?.open()} - > - - - + layoutRef.current?.open()} + label={t("Layout Setting")} + /> - - hotkeyRef.current?.open()} - > - - - + miscRef.current?.open()} + label={t("Miscellaneous")} + /> - - configRef.current?.open()} - > - - - + hotkeyRef.current?.open()} + label={t("Hotkey Setting")} + /> - - - - - + configRef.current?.open()} + label={t("Runtime Config")} + /> - - - - - + - - - - - + - - - - - + - - - - - + - - { - exitApp(); - }} - > - - - + + + { + exitApp(); + }} + label={t("Exit")} + /> v{version}