settings.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { Grid, IconButton, Paper } from "@mui/material";
  2. import { useLockFn } from "ahooks";
  3. import { useTranslation } from "react-i18next";
  4. import { BasePage, Notice } from "@/components/base";
  5. import { GitHub } from "@mui/icons-material";
  6. import { openWebUrl } from "@/services/cmds";
  7. import SettingVerge from "@/components/setting/setting-verge";
  8. import SettingClash from "@/components/setting/setting-clash";
  9. import SettingSystem from "@/components/setting/setting-system";
  10. const SettingPage = () => {
  11. const { t } = useTranslation();
  12. const onError = (err: any) => {
  13. Notice.error(err?.message || err.toString());
  14. };
  15. const toGithubRepo = useLockFn(() => {
  16. return openWebUrl("https://github.com/wonfen/clash-verge-rev");
  17. });
  18. return (
  19. <BasePage
  20. title={t("Settings")}
  21. header={
  22. <IconButton
  23. size="small"
  24. color="inherit"
  25. title="@wonfen/clash-verge-rev"
  26. onClick={toGithubRepo}
  27. >
  28. <GitHub fontSize="inherit" />
  29. </IconButton>
  30. }
  31. >
  32. <Grid container spacing={{ xs: 2, lg: 3 }}>
  33. <Grid item xs={12} md={6}>
  34. <Paper sx={{ borderRadius: 1, boxShadow: 2, marginBottom: 2 }}>
  35. <SettingSystem onError={onError} />
  36. </Paper>
  37. <Paper sx={{ borderRadius: 1, boxShadow: 2 }}>
  38. <SettingClash onError={onError} />
  39. </Paper>
  40. </Grid>
  41. <Grid item xs={12} md={6}>
  42. <Paper sx={{ borderRadius: 1, boxShadow: 2 }}>
  43. <SettingVerge onError={onError} />
  44. </Paper>
  45. </Grid>
  46. </Grid>
  47. </BasePage>
  48. );
  49. };
  50. export default SettingPage;