feat: support proxy provider update

This commit is contained in:
GyDi
2023-08-05 21:38:44 +08:00
parent 94757f0f0c
commit f1770711cb
4 changed files with 110 additions and 13 deletions

View File

@@ -48,6 +48,7 @@ const Layout = () => {
mutate("getProxies");
mutate("getVersion");
mutate("getClashConfig");
mutate("getProviders");
});
// update the verge config

View File

@@ -2,7 +2,7 @@ import useSWR from "swr";
import { useEffect, useMemo } from "react";
import { useLockFn } from "ahooks";
import { useTranslation } from "react-i18next";
import { Button, ButtonGroup, Paper } from "@mui/material";
import { Box, Button, ButtonGroup, Paper } from "@mui/material";
import {
closeAllConnections,
getClashConfig,
@@ -12,6 +12,7 @@ import { patchClashConfig } from "@/services/cmds";
import { useVerge } from "@/hooks/use-verge";
import { BasePage } from "@/components/base";
import { ProxyGroups } from "@/components/proxy/proxy-groups";
import { ProviderButton } from "@/components/proxy/provider-button";
const ProxyPage = () => {
const { t } = useTranslation();
@@ -53,18 +54,22 @@ const ProxyPage = () => {
contentStyle={{ height: "100%" }}
title={t("Proxy Groups")}
header={
<ButtonGroup size="small">
{modeList.map((mode) => (
<Button
key={mode}
variant={mode === curMode ? "contained" : "outlined"}
onClick={() => onChangeMode(mode)}
sx={{ textTransform: "capitalize" }}
>
{t(mode)}
</Button>
))}
</ButtonGroup>
<Box display="flex" alignItems="center" gap={1}>
<ProviderButton />
<ButtonGroup size="small">
{modeList.map((mode) => (
<Button
key={mode}
variant={mode === curMode ? "contained" : "outlined"}
onClick={() => onChangeMode(mode)}
sx={{ textTransform: "capitalize" }}
>
{t(mode)}
</Button>
))}
</ButtonGroup>
</Box>
}
>
<Paper