clash-verge/src/pages/proxy.tsx

36 lines
924 B
TypeScript
Raw Normal View History

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";
2021-12-08 18:36:34 +03:00
const ProxyPage = () => {
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>
2021-12-11 20:02:14 +03:00
{groups.length > 0 && (
<List sx={{ borderRadius: 1, boxShadow: 2 }}>
{groups.map((group) => (
<ProxyGroup key={group.name} group={group} />
))}
</List>
)}
</Box>
);
2021-12-08 18:36:34 +03:00
};
export default ProxyPage;