mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
perf: remove motion-number
This commit is contained in:
parent
51800e11c1
commit
427a05a6e2
@ -7,7 +7,6 @@ import useSWR from "swr";
|
|||||||
import { formatBytes, nezhaFetcher } from "@/lib/utils";
|
import { formatBytes, nezhaFetcher } from "@/lib/utils";
|
||||||
import { Loader } from "@/components/loading/Loader";
|
import { Loader } from "@/components/loading/Loader";
|
||||||
import { ServerApi } from "@/app/types/nezha-api";
|
import { ServerApi } from "@/app/types/nezha-api";
|
||||||
import MotionNumber from "motion-number";
|
|
||||||
|
|
||||||
export default function ServerOverviewClient() {
|
export default function ServerOverviewClient() {
|
||||||
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher);
|
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher);
|
||||||
@ -26,11 +25,7 @@ export default function ServerOverviewClient() {
|
|||||||
</span>
|
</span>
|
||||||
{data ? (
|
{data ? (
|
||||||
<div className="text-lg font-semibold">
|
<div className="text-lg font-semibold">
|
||||||
<MotionNumber
|
{data?.result.length}
|
||||||
value={data?.result.length}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-7 items-center">
|
<div className="flex h-7 items-center">
|
||||||
@ -52,11 +47,7 @@ export default function ServerOverviewClient() {
|
|||||||
</span>
|
</span>
|
||||||
{data ? (
|
{data ? (
|
||||||
<div className="text-lg font-semibold">
|
<div className="text-lg font-semibold">
|
||||||
<MotionNumber
|
{data?.live_servers}
|
||||||
value={data?.live_servers}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-7 items-center">
|
<div className="flex h-7 items-center">
|
||||||
@ -78,11 +69,7 @@ export default function ServerOverviewClient() {
|
|||||||
</span>
|
</span>
|
||||||
{data ? (
|
{data ? (
|
||||||
<div className="text-lg font-semibold">
|
<div className="text-lg font-semibold">
|
||||||
<MotionNumber
|
{data?.offline_servers}
|
||||||
value={data?.offline_servers}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-7 items-center">
|
<div className="flex h-7 items-center">
|
||||||
|
@ -9,7 +9,6 @@ import {
|
|||||||
import { cn, formatNezhaInfo } from "@/lib/utils";
|
import { cn, formatNezhaInfo } from "@/lib/utils";
|
||||||
import ServerCardPopover from "./ServerCardPopover";
|
import ServerCardPopover from "./ServerCardPopover";
|
||||||
import getUnicodeFlagIcon from "country-flag-icons/unicode";
|
import getUnicodeFlagIcon from "country-flag-icons/unicode";
|
||||||
import MotionNumber from "motion-number";
|
|
||||||
|
|
||||||
export default function ServerCard({
|
export default function ServerCard({
|
||||||
serverInfo,
|
serverInfo,
|
||||||
@ -58,11 +57,7 @@ export default function ServerCard({
|
|||||||
<div className={"flex flex-col"}>
|
<div className={"flex flex-col"}>
|
||||||
<p className="text-xs text-muted-foreground">CPU</p>
|
<p className="text-xs text-muted-foreground">CPU</p>
|
||||||
<div className="text-xs font-semibold flex items-center">
|
<div className="text-xs font-semibold flex items-center">
|
||||||
<MotionNumber
|
{cpu.toFixed(2)}
|
||||||
value={cpu.toFixed(2)}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
%
|
%
|
||||||
</div>
|
</div>
|
||||||
<ServerUsageBar value={cpu} />
|
<ServerUsageBar value={cpu} />
|
||||||
@ -70,11 +65,7 @@ export default function ServerCard({
|
|||||||
<div className={"flex flex-col"}>
|
<div className={"flex flex-col"}>
|
||||||
<p className="text-xs text-muted-foreground">Mem</p>
|
<p className="text-xs text-muted-foreground">Mem</p>
|
||||||
<div className="text-xs font-semibold flex items-center">
|
<div className="text-xs font-semibold flex items-center">
|
||||||
<MotionNumber
|
{mem.toFixed(2)}
|
||||||
value={mem.toFixed(2)}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
%
|
%
|
||||||
</div>
|
</div>
|
||||||
<ServerUsageBar value={mem} />
|
<ServerUsageBar value={mem} />
|
||||||
@ -82,34 +73,22 @@ export default function ServerCard({
|
|||||||
<div className={"flex flex-col"}>
|
<div className={"flex flex-col"}>
|
||||||
<p className="text-xs text-muted-foreground">STG</p>
|
<p className="text-xs text-muted-foreground">STG</p>
|
||||||
<div className="text-xs font-semibold flex items-center">
|
<div className="text-xs font-semibold flex items-center">
|
||||||
<MotionNumber
|
{stg.toFixed(2)}
|
||||||
value={stg.toFixed(2)}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
%
|
%
|
||||||
</div>
|
</div>
|
||||||
<ServerUsageBar value={stg} />
|
<ServerUsageBar value={stg} />
|
||||||
</div>
|
</div>
|
||||||
<div className={"flex flex-col items-end"}>
|
<div className={"flex flex-col"}>
|
||||||
<p className="text-xs text-muted-foreground">Upload</p>
|
<p className="text-xs text-muted-foreground">Upload</p>
|
||||||
<div className="text-xs font-semibold flex items-center justify-end">
|
<div className="text-xs font-semibold flex items-center">
|
||||||
<MotionNumber
|
{up.toFixed(2)}
|
||||||
value={up.toFixed(2)}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
Mb/s
|
Mb/s
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={"flex flex-col"}>
|
<div className={"flex flex-col"}>
|
||||||
<p className="text-xs text-muted-foreground">Download</p>
|
<p className="text-xs text-muted-foreground">Download</p>
|
||||||
<div className="text-xs font-semibold flex items-center justify-end">
|
<div className="text-xs font-semibold flex items-center">
|
||||||
<MotionNumber
|
{down.toFixed(2)}
|
||||||
value={down.toFixed(2)}
|
|
||||||
format={{ notation: "compact" }}
|
|
||||||
locales="en-US"
|
|
||||||
/>
|
|
||||||
Mb/s
|
Mb/s
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
"eslint-plugin-simple-import-sort": "^12.0.0",
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
||||||
"lucide-react": "^0.414.0",
|
"lucide-react": "^0.414.0",
|
||||||
"luxon": "^3.4.4",
|
"luxon": "^3.4.4",
|
||||||
"motion-number": "^0.1.6",
|
|
||||||
"next": "^14.2.3",
|
"next": "^14.2.3",
|
||||||
"next-themes": "^0.3.0",
|
"next-themes": "^0.3.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user