|
@@ -3,24 +3,16 @@ import { useLockFn } from "ahooks";
|
|
import {
|
|
import {
|
|
Box,
|
|
Box,
|
|
Button,
|
|
Button,
|
|
- Grid,
|
|
|
|
IconButton,
|
|
IconButton,
|
|
MenuItem,
|
|
MenuItem,
|
|
Paper,
|
|
Paper,
|
|
Select,
|
|
Select,
|
|
TextField,
|
|
TextField,
|
|
- Typography,
|
|
|
|
} from "@mui/material";
|
|
} from "@mui/material";
|
|
import { useRecoilState } from "recoil";
|
|
import { useRecoilState } from "recoil";
|
|
import { Virtuoso } from "react-virtuoso";
|
|
import { Virtuoso } from "react-virtuoso";
|
|
import { useTranslation } from "react-i18next";
|
|
import { useTranslation } from "react-i18next";
|
|
-import {
|
|
|
|
- ArrowDownward,
|
|
|
|
- ArrowUpward,
|
|
|
|
- Link,
|
|
|
|
- TableChartRounded,
|
|
|
|
- TableRowsRounded,
|
|
|
|
-} from "@mui/icons-material";
|
|
|
|
|
|
+import { TableChartRounded, TableRowsRounded } from "@mui/icons-material";
|
|
import { closeAllConnections } from "@/services/api";
|
|
import { closeAllConnections } from "@/services/api";
|
|
import { atomConnectionSetting } from "@/services/states";
|
|
import { atomConnectionSetting } from "@/services/states";
|
|
import { useClashInfo } from "@/hooks/use-clash";
|
|
import { useClashInfo } from "@/hooks/use-clash";
|
|
@@ -32,7 +24,6 @@ import {
|
|
ConnectionDetail,
|
|
ConnectionDetail,
|
|
ConnectionDetailRef,
|
|
ConnectionDetailRef,
|
|
} from "@/components/connection/connection-detail";
|
|
} from "@/components/connection/connection-detail";
|
|
-import parseTraffic from "@/utils/parse-traffic";
|
|
|
|
|
|
|
|
const initConn = { uploadTotal: 0, downloadTotal: 0, connections: [] };
|
|
const initConn = { uploadTotal: 0, downloadTotal: 0, connections: [] };
|
|
|
|
|
|
@@ -57,10 +48,6 @@ const ConnectionsPage = () => {
|
|
list.sort((a, b) => b.curDownload! - a.curDownload!),
|
|
list.sort((a, b) => b.curDownload! - a.curDownload!),
|
|
};
|
|
};
|
|
|
|
|
|
- const uploadTotal = connData.uploadTotal;
|
|
|
|
-
|
|
|
|
- const downloadTotal = connData.downloadTotal;
|
|
|
|
-
|
|
|
|
const filterConn = useMemo(() => {
|
|
const filterConn = useMemo(() => {
|
|
const orderFunc = orderOpts[curOrderOpt];
|
|
const orderFunc = orderOpts[curOrderOpt];
|
|
const connections = connData.connections.filter((conn) =>
|
|
const connections = connData.connections.filter((conn) =>
|
|
@@ -125,24 +112,6 @@ const ConnectionsPage = () => {
|
|
|
|
|
|
const detailRef = useRef<ConnectionDetailRef>(null!);
|
|
const detailRef = useRef<ConnectionDetailRef>(null!);
|
|
|
|
|
|
- const connectionItems = [
|
|
|
|
- {
|
|
|
|
- icon: <ArrowUpward />,
|
|
|
|
- label: t("Upload Total"),
|
|
|
|
- value: parseTraffic(uploadTotal).join(" "),
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- icon: <ArrowDownward />,
|
|
|
|
- label: t("Download Total"),
|
|
|
|
- value: parseTraffic(downloadTotal).join(" "),
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- icon: <Link />,
|
|
|
|
- label: t("Active Connections"),
|
|
|
|
- value: filterConn.length,
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
-
|
|
|
|
return (
|
|
return (
|
|
<BasePage
|
|
<BasePage
|
|
title={t("Connections")}
|
|
title={t("Connections")}
|
|
@@ -173,21 +142,7 @@ const ConnectionsPage = () => {
|
|
</Box>
|
|
</Box>
|
|
}
|
|
}
|
|
>
|
|
>
|
|
- <Paper sx={{ padding: 2, mb: 2 }}>
|
|
|
|
- <Grid container>
|
|
|
|
- {connectionItems.map((item, index) => (
|
|
|
|
- <Grid item xs={4} key={index}>
|
|
|
|
- <Box display="flex" alignItems="center" whiteSpace="nowrap">
|
|
|
|
- {item.icon}
|
|
|
|
- <Typography sx={{ ml: 1, mr: 1 }}>{item.label}</Typography>
|
|
|
|
- <Typography>{item.value}</Typography>
|
|
|
|
- </Box>
|
|
|
|
- </Grid>
|
|
|
|
- ))}
|
|
|
|
- </Grid>
|
|
|
|
- </Paper>
|
|
|
|
-
|
|
|
|
- <Paper sx={{ boxShadow: 2, height: "calc(100% - 56px - 16px)" }}>
|
|
|
|
|
|
+ <Paper sx={{ boxShadow: 0, height: "100%" }}>
|
|
<Box
|
|
<Box
|
|
sx={{
|
|
sx={{
|
|
pt: 1,
|
|
pt: 1,
|