From 7f4f8d142ac294376d7643e18fa1dd6e16dec7fe Mon Sep 17 00:00:00 2001
From: hamster1963 <1410514192@qq.com>
Date: Thu, 24 Oct 2024 21:51:42 +0800
Subject: [PATCH 1/3] fix: tab switch
---
app/(main)/[id]/page.tsx | 5 +----
components/TabSwitch.tsx | 6 ++++--
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/app/(main)/[id]/page.tsx b/app/(main)/[id]/page.tsx
index 3646322..ac10cc9 100644
--- a/app/(main)/[id]/page.tsx
+++ b/app/(main)/[id]/page.tsx
@@ -5,13 +5,10 @@ import ServerDetailChartClient from "@/app/(main)/ClientComponents/ServerDetailC
import ServerDetailClient from "@/app/(main)/ClientComponents/ServerDetailClient";
import TabSwitch from "@/components/TabSwitch";
import { Separator } from "@/components/ui/separator";
-import { useTranslations } from "next-intl";
import { useState } from "react";
export default function Page({ params }: { params: { id: string } }) {
- const t = useTranslations("TabSwitch");
-
- const tabs = [t("Detail"), t("Network")];
+ const tabs = ["Detail", "Network"];
const [currentTab, setCurrentTab] = useState(tabs[0]);
return (
diff --git a/components/TabSwitch.tsx b/components/TabSwitch.tsx
index 7701815..7bae3e0 100644
--- a/components/TabSwitch.tsx
+++ b/components/TabSwitch.tsx
@@ -2,7 +2,8 @@
import { cn } from "@/lib/utils";
import { motion } from "framer-motion";
-import React, { useState } from "react";
+import { useTranslations } from "next-intl";
+import React from "react";
export default function TabSwitch({
tabs,
@@ -13,6 +14,7 @@ export default function TabSwitch({
currentTab: string;
setCurrentTab: (tab: string) => void;
}) {
+ const t = useTranslations("TabSwitch");
return (
@@ -38,7 +40,7 @@ export default function TabSwitch({
/>
)}
))}
From d41db008f522b443c7425fad94b82feeefc00d80 Mon Sep 17 00:00:00 2001
From: hamster1963 <1410514192@qq.com>
Date: Thu, 24 Oct 2024 22:00:22 +0800
Subject: [PATCH 2/3] fix: release note
---
.github/workflows/Deploy.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/Deploy.yml b/.github/workflows/Deploy.yml
index 9d58d2b..0a6fb6e 100644
--- a/.github/workflows/Deploy.yml
+++ b/.github/workflows/Deploy.yml
@@ -58,6 +58,7 @@ jobs:
release:
runs-on: ubuntu-latest
+ needs: build-and-push
steps:
- uses: actions/checkout@v4
with:
From ea51c7d5f3236df9062328f9120e9f303627a461 Mon Sep 17 00:00:00 2001
From: hamster1963 <1410514192@qq.com>
Date: Fri, 25 Oct 2024 15:24:20 +0800
Subject: [PATCH 3/3] fix: G/s compatible
---
app/(main)/header.tsx | 2 +-
components/ServerCard.tsx | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/app/(main)/header.tsx b/app/(main)/header.tsx
index 015a4dc..38b5fac 100644
--- a/app/(main)/header.tsx
+++ b/app/(main)/header.tsx
@@ -62,7 +62,7 @@ function Header() {
// https://github.com/streamich/react-use/blob/master/src/useInterval.ts
const useInterval = (callback: Function, delay?: number | null) => {
- const savedCallback = useRef
(() => { });
+ const savedCallback = useRef(() => {});
useEffect(() => {
savedCallback.current = callback;
});
diff --git a/components/ServerCard.tsx b/components/ServerCard.tsx
index 8772e22..a54b008 100644
--- a/components/ServerCard.tsx
+++ b/components/ServerCard.tsx
@@ -83,13 +83,17 @@ export default function ServerCard({
{t("Upload")}
- {up.toFixed(2)}M/s
+ {up >= 1024
+ ? `${(up / 1024).toFixed(2)}G/s`
+ : `${up.toFixed(2)}M/s`}
{t("Download")}
- {down.toFixed(2)}M/s
+ {down >= 1024
+ ? `${(down / 1024).toFixed(2)}G/s`
+ : `${down.toFixed(2)}M/s`}