-
-
-
{t(TRANSLATION_KEY.PROXY)}
+
+
+
{`TCP: ${connectionsAmount.tcp}`}
+
{`UDP: ${connectionsAmount.udp}`}
+
+
-
-
-
-
-
-
{t(TRANSLATION_KEY.DIRECT)}
+
+
+
);
diff --git a/src/components/pages/Data/Dashboard/index.tsx b/src/components/pages/Data/Dashboard/index.tsx
index b9c60b8..27bab14 100644
--- a/src/components/pages/Data/Dashboard/index.tsx
+++ b/src/components/pages/Data/Dashboard/index.tsx
@@ -1,13 +1,4 @@
import { type RootState, trafficsSlice } from "@/reducers";
-import {
- CategoryScale,
- Chart,
- LinearScale,
- LineController,
- LineElement,
- PointElement,
- Title,
-} from "chart.js";
import {
subscribeNowTraffic,
subscribeTotalTraffic,
@@ -25,16 +16,17 @@ interface Speed {
direct: TrafficItem[];
}
-Chart.register(
- LineController,
- LineElement,
- PointElement,
- LinearScale,
- Title,
- CategoryScale,
-);
+interface DashboardProps {
+ connectionsAmount: {
+ tcp: number;
+ udp: number;
+ };
+}
-export default function Dashboard(): React.ReactNode {
+export default function Dashboard(
+ props: Readonly
,
+): React.ReactNode {
+ const { connectionsAmount } = props;
const traffics = useSelector((state) => {
return state.traffics.now;
});
@@ -50,8 +42,12 @@ export default function Dashboard(): React.ReactNode {
});
return result;
}, [traffics]);
- const total = useSelector(
- (state) => state.traffics.total,
+ const total = useSelector(
+ (state) =>
+ state.traffics.total || {
+ proxy: { upload: 0, download: 0 },
+ direct: { upload: 0, download: 0 },
+ },
);
const dispatch = useDispatch();
useEffect(() => {
@@ -77,11 +73,13 @@ export default function Dashboard(): React.ReactNode {
};
}, [dispatch]);
- return speed && total ? (
+ return (
-
+
- ) : (
- ""
);
}
diff --git a/src/components/pages/Data/index.tsx b/src/components/pages/Data/index.tsx
index dfc018f..d36e9df 100644
--- a/src/components/pages/Data/index.tsx
+++ b/src/components/pages/Data/index.tsx
@@ -1,35 +1,6 @@
import Connections from "@/components/pages/Data/Connections";
-import Dashboard from "@/components/pages/Data/Dashboard";
-import { TRANSLATION_KEY } from "@/i18n/locales/key";
-import { Tab, TabList } from "@fluentui/react-components";
-import React, { useState } from "react";
-import { useTranslation } from "react-i18next";
-
-enum DATA_TAB {
- Dashboard = "dashboard",
- Connections = "connections",
-}
+import React from "react";
export default function Data() {
- const [selectedValue, setSelectedValue] = useState(DATA_TAB.Dashboard);
- const { t } = useTranslation();
-
- return (
- <>
- {
- setSelectedValue(data.value as DATA_TAB);
- }}
- >
-
- {t(TRANSLATION_KEY.STATISTICS)}
-
-
- {t(TRANSLATION_KEY.NAV_CONNECTION)}
-
-
- {selectedValue === DATA_TAB.Dashboard ? : }
- >
- );
+ return ;
}
diff --git a/src/hooks/index.ts b/src/hooks/index.ts
index df33d56..c1eaf35 100644
--- a/src/hooks/index.ts
+++ b/src/hooks/index.ts
@@ -5,9 +5,7 @@ import checkForUpdate from "@/utils/checkForUpdate";
import { LAST_CHECK_UPDATE_DATE, LATEST_RELEASE_URL } from "@/utils/constants";
import { makeStyles } from "@fluentui/react-components";
import { tokens } from "@fluentui/react-theme";
-import { Chart, type ChartConfiguration } from "chart.js";
import { getProxyDelay } from "lux-js-sdk";
-import type * as React from "react";
import {
useCallback,
useEffect,
@@ -18,25 +16,6 @@ import {
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
-export const useChartJs = (
- initialConfiguration: ChartConfiguration,
-): [React.RefObject, Chart | undefined] => {
- const chartRef = useRef(null);
-
- const chart = useRef();
-
- useEffect(() => {
- if (chartRef.current && !chart.current) {
- const ctx = chartRef.current;
- if (ctx) {
- chart.current = new Chart(ctx, initialConfiguration);
- }
- }
- }, [initialConfiguration]);
-
- return [chartRef, chart.current];
-};
-
export const useTestDelay = () => {
const dispatch = useDispatch();
return useCallback(
diff --git a/yarn.lock b/yarn.lock
index b71c364..0c94911 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1977,11 +1977,6 @@
resolved "https://registry.yarnpkg.com/@jsonjoy.com/util/-/util-1.2.0.tgz#0fe9a92de72308c566ebcebe8b5a3f01d3149df2"
integrity sha512-4B8B+3vFsY4eo33DMKyJPlQ3sBMpPFUZK2dr3O3rXrOGKKbYG44J0XSFkDo1VOQiri5HFEhIeVvItjR2xcazmg==
-"@kurkle/color@^0.3.0":
- version "0.3.2"
- resolved "https://registry.yarnpkg.com/@kurkle/color/-/color-0.3.2.tgz#5acd38242e8bde4f9986e7913c8fdf49d3aa199f"
- integrity sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==
-
"@leichtgewicht/ip-codec@^2.0.1":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b"
@@ -2985,13 +2980,6 @@ chalk@^4.0.0, chalk@^4.1.0:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
-chart.js@^4.4.7:
- version "4.4.7"
- resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-4.4.7.tgz#7a01ee0b4dac3c03f2ab0589af888db296d896fa"
- integrity sha512-pwkcKfdzTMAU/+jNosKhNL2bHtJc/sSmYgVbuGTEDhzkrhmyihmP7vUc/5ZK9WopidMDHNe3Wm7jOd/WhuHWuw==
- dependencies:
- "@kurkle/color" "^0.3.0"
-
"chokidar@>=3.0.0 <4.0.0":
version "3.5.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"