|
@@ -1,18 +1,16 @@
|
|
import useSWR, { useSWRConfig } from "swr";
|
|
import useSWR, { useSWRConfig } from "swr";
|
|
import {
|
|
import {
|
|
- List,
|
|
|
|
ListItemText,
|
|
ListItemText,
|
|
- ListSubheader,
|
|
|
|
TextField,
|
|
TextField,
|
|
Switch,
|
|
Switch,
|
|
Select,
|
|
Select,
|
|
MenuItem,
|
|
MenuItem,
|
|
} from "@mui/material";
|
|
} from "@mui/material";
|
|
-import { getClashConfig, updateConfigs } from "../services/api";
|
|
|
|
-import { patchClashConfig } from "../services/cmds";
|
|
|
|
-import { ApiType } from "../services/types";
|
|
|
|
-import GuardState from "./guard-state";
|
|
|
|
-import SettingItem from "./setting-item";
|
|
|
|
|
|
+import { getClashConfig, updateConfigs } from "../../services/api";
|
|
|
|
+import { SettingList, SettingItem } from "./setting";
|
|
|
|
+import { patchClashConfig } from "../../services/cmds";
|
|
|
|
+import { ApiType } from "../../services/types";
|
|
|
|
+import GuardState from "../guard-state";
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
onError?: (err: Error) => void;
|
|
onError?: (err: Error) => void;
|
|
@@ -30,22 +28,16 @@ const SettingClash = ({ onError }: Props) => {
|
|
} = clashConfig ?? {};
|
|
} = clashConfig ?? {};
|
|
|
|
|
|
const onSwitchFormat = (_e: any, value: boolean) => value;
|
|
const onSwitchFormat = (_e: any, value: boolean) => value;
|
|
-
|
|
|
|
const onChangeData = (patch: Partial<ApiType.ConfigData>) => {
|
|
const onChangeData = (patch: Partial<ApiType.ConfigData>) => {
|
|
mutate("getClashConfig", { ...clashConfig, ...patch }, false);
|
|
mutate("getClashConfig", { ...clashConfig, ...patch }, false);
|
|
};
|
|
};
|
|
-
|
|
|
|
const onUpdateData = async (patch: Partial<ApiType.ConfigData>) => {
|
|
const onUpdateData = async (patch: Partial<ApiType.ConfigData>) => {
|
|
await updateConfigs(patch);
|
|
await updateConfigs(patch);
|
|
await patchClashConfig(patch);
|
|
await patchClashConfig(patch);
|
|
};
|
|
};
|
|
|
|
|
|
return (
|
|
return (
|
|
- <List>
|
|
|
|
- <ListSubheader sx={{ background: "transparent" }}>
|
|
|
|
- Clash Setting
|
|
|
|
- </ListSubheader>
|
|
|
|
-
|
|
|
|
|
|
+ <SettingList title="Clash Setting">
|
|
<SettingItem>
|
|
<SettingItem>
|
|
<ListItemText primary="Allow Lan" />
|
|
<ListItemText primary="Allow Lan" />
|
|
<GuardState
|
|
<GuardState
|
|
@@ -102,7 +94,7 @@ const SettingClash = ({ onError }: Props) => {
|
|
disabled
|
|
disabled
|
|
/>
|
|
/>
|
|
</SettingItem>
|
|
</SettingItem>
|
|
- </List>
|
|
|
|
|
|
+ </SettingList>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
|