import useSWR from "swr"; import { useLockFn } from "ahooks"; import { useTranslation } from "react-i18next"; import { Button, ButtonGroup, Paper } from "@mui/material"; import { getClashConfig, updateConfigs } from "@/services/api"; import { patchClashConfig } from "@/services/cmds"; import { ProxyGroups } from "@/components/proxy/proxy-groups"; import { BasePage } from "@/components/base"; const ProxyPage = () => { const { t } = useTranslation(); const { data: clashConfig, mutate: mutateClash } = useSWR( "getClashConfig", getClashConfig ); const modeList = ["rule", "global", "direct", "script"]; const curMode = clashConfig?.mode.toLowerCase(); const onChangeMode = useLockFn(async (mode: string) => { await updateConfigs({ mode }); await patchClashConfig({ mode }); mutateClash(); }); return ( {modeList.map((mode) => ( ))} } > ); }; export default ProxyPage;