feat(proxy): finish proxy page ui and api support

This commit is contained in:
GyDi
2021-12-11 21:28:19 +08:00
parent 0a3c59450b
commit 5b3f63ef02
5 changed files with 221 additions and 1 deletions

View File

@@ -1,5 +1,33 @@
import { useEffect, useState } from "react";
import { Box, List, Typography } from "@mui/material";
import services from "../services";
import ProxyGroup from "../components/proxy-group";
import type { ProxyGroupItem } from "../services/proxy";
const ProxyPage = () => {
return <h1>Proxy</h1>;
const [groups, setGroups] = useState<ProxyGroupItem[]>([]);
useEffect(() => {
// Todo
// result cache
services.getProxyInfo().then((res) => {
setGroups(res.groups);
});
}, []);
return (
<Box sx={{ width: 0.9, maxWidth: "850px", mx: "auto", mb: 2 }}>
<Typography variant="h4" component="h1" sx={{ py: 2 }}>
Proxy Groups
</Typography>
<List sx={{ borderRadius: 1, boxShadow: 2 }}>
{groups.map((group) => (
<ProxyGroup key={group.name} group={group} />
))}
</List>
</Box>
);
};
export default ProxyPage;