import { useState } from "react"; import { useRecoilState } from "recoil"; import { Box, List, ListItem, ListItemText, ListSubheader, Typography, TextField, styled, Switch, Select, MenuItem, } from "@mui/material"; import { atomPaletteMode } from "../states/setting"; import PaletteSwitch from "../components/palette-switch"; import { setSysProxy } from "../services/command"; const MiniListItem = styled(ListItem)(({ theme }) => ({ paddingTop: 5, paddingBottom: 5, })); const SettingPage = () => { const [mode, setMode] = useRecoilState(atomPaletteMode); const [proxy, setProxy] = useState(false); const onSysproxy = (enable: boolean) => { const value = proxy; setProxy(enable); setSysProxy(enable) .then(() => { console.log("success"); }) .catch((err) => { setProxy(value); // recover console.log(err); }); }; return ( Setting 通用设置 setMode(c ? "dark" : "light")} /> onSysproxy(c)} /> ); }; export default SettingPage;