2023-11-28 07:49:44 +08:00
|
|
|
import { Box, Grid, IconButton, Paper } from "@mui/material";
|
2023-08-05 19:54:59 +08:00
|
|
|
import { useLockFn } from "ahooks";
|
2022-03-12 23:07:45 +08:00
|
|
|
import { useTranslation } from "react-i18next";
|
2022-11-20 22:03:55 +08:00
|
|
|
import { BasePage, Notice } from "@/components/base";
|
2023-08-05 19:54:59 +08:00
|
|
|
import { GitHub } from "@mui/icons-material";
|
|
|
|
|
import { openWebUrl } from "@/services/cmds";
|
2022-08-06 02:35:11 +08:00
|
|
|
import SettingVerge from "@/components/setting/setting-verge";
|
|
|
|
|
import SettingClash from "@/components/setting/setting-clash";
|
|
|
|
|
import SettingSystem from "@/components/setting/setting-system";
|
2024-03-09 21:37:21 +08:00
|
|
|
import { atomThemeMode } from "@/services/states";
|
|
|
|
|
import { useRecoilState } from "recoil";
|
|
|
|
|
import { useCustomTheme } from "@/components/layout/use-custom-theme";
|
2021-12-12 01:13:08 +08:00
|
|
|
|
2021-12-08 23:36:34 +08:00
|
|
|
const SettingPage = () => {
|
2022-03-12 23:07:45 +08:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
|
|
const onError = (err: any) => {
|
|
|
|
|
Notice.error(err?.message || err.toString());
|
2022-01-17 02:42:52 +08:00
|
|
|
};
|
|
|
|
|
|
2023-08-05 19:54:59 +08:00
|
|
|
const toGithubRepo = useLockFn(() => {
|
2023-12-02 23:04:04 +08:00
|
|
|
return openWebUrl("https://github.com/clash-verge-rev/clash-verge-rev");
|
2023-08-05 19:54:59 +08:00
|
|
|
});
|
|
|
|
|
|
2024-03-09 21:37:21 +08:00
|
|
|
const [mode] = useRecoilState(atomThemeMode);
|
|
|
|
|
const isDark = mode === "light" ? false : true;
|
|
|
|
|
const { theme } = useCustomTheme();
|
|
|
|
|
|
2021-12-09 23:28:57 +08:00
|
|
|
return (
|
2023-08-05 19:54:59 +08:00
|
|
|
<BasePage
|
|
|
|
|
title={t("Settings")}
|
|
|
|
|
header={
|
|
|
|
|
<IconButton
|
2024-03-09 21:37:21 +08:00
|
|
|
size="medium"
|
2023-08-05 19:54:59 +08:00
|
|
|
color="inherit"
|
2023-12-02 23:04:04 +08:00
|
|
|
title="@clash-verge-rev/clash-verge-rev"
|
2023-08-05 19:54:59 +08:00
|
|
|
onClick={toGithubRepo}
|
|
|
|
|
>
|
|
|
|
|
<GitHub fontSize="inherit" />
|
|
|
|
|
</IconButton>
|
|
|
|
|
}
|
|
|
|
|
>
|
2024-03-09 21:37:21 +08:00
|
|
|
<Grid container spacing={{ xs: 1.5, lg: 1.5 }}>
|
2023-10-20 10:05:03 +08:00
|
|
|
<Grid item xs={12} md={6}>
|
2024-03-09 21:37:21 +08:00
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
borderRadius: 2,
|
|
|
|
|
marginBottom: 1.5,
|
|
|
|
|
backgroundColor: isDark ? "#282a36" : "#ffffff",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-11-22 14:52:14 +08:00
|
|
|
<SettingSystem onError={onError} />
|
2023-11-28 07:49:44 +08:00
|
|
|
</Box>
|
2024-03-09 21:37:21 +08:00
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
borderRadius: 2,
|
|
|
|
|
backgroundColor: isDark ? "#282a36" : "#ffffff",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-11-22 14:52:14 +08:00
|
|
|
<SettingClash onError={onError} />
|
2023-11-28 07:49:44 +08:00
|
|
|
</Box>
|
2023-10-20 10:05:03 +08:00
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} md={6}>
|
2024-03-09 21:37:21 +08:00
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
borderRadius: 2,
|
|
|
|
|
backgroundColor: isDark ? "#282a36" : "#ffffff",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-10-20 10:05:03 +08:00
|
|
|
<SettingVerge onError={onError} />
|
2023-11-28 07:49:44 +08:00
|
|
|
</Box>
|
2023-10-20 10:05:03 +08:00
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
2022-01-16 03:11:07 +08:00
|
|
|
</BasePage>
|
2021-12-09 23:28:57 +08:00
|
|
|
);
|
2021-12-08 23:36:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default SettingPage;
|