From 6015e616fa2d0a10e4d459b943be4a6575fcd6bf Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Wed, 10 Jun 2026 15:04:00 +0800 Subject: [PATCH] feat: add @numeric-text/react for improved numeric display in Header and ServerOverview components --- package.json | 1 + pnpm-lock.yaml | 18 ++++++++++++++++++ src/components/Header.tsx | 7 ++++++- src/components/ServerOverview.tsx | 22 ++++++++++++---------- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index da8da7f..aed467e 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "dependencies": { "@fontsource/inter": "5.2.8", "@heroicons/react": "2.2.0", + "@numeric-text/react": "^0.1.4", "@radix-ui/react-accordion": "1.2.12", "@radix-ui/react-checkbox": "1.3.3", "@radix-ui/react-dialog": "^1.1.16", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fd3bd07..2ee6669 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@heroicons/react': specifier: 2.2.0 version: 2.2.0(react@19.2.6) + '@numeric-text/react': + specifier: ^0.1.4 + version: 0.1.4(react@19.2.6) '@radix-ui/react-accordion': specifier: 1.2.12 version: 1.2.12(@types/react-dom@19.2.3(@types/react@19.2.15))(@types/react@19.2.15)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) @@ -275,6 +278,14 @@ packages: '@emnapi/core': ^1.7.1 '@emnapi/runtime': ^1.7.1 + '@numeric-text/core@0.1.4': + resolution: {integrity: sha512-tMaH5u/kdpw3AP+XJMnDWyq39zVHoP80NCLTFwzVept64dIAMKBNLlYtUK0+EULiyFg6IiSwswmc9tMukV1tLw==} + + '@numeric-text/react@0.1.4': + resolution: {integrity: sha512-i1t18jSzn168nl9jYrC+W1FlPexjy0dbAa9bofykaL44ogu+puLg2f5roVA3xOUgjL6bSojv+wKUA/ZRRshwEw==} + peerDependencies: + react: ^18 || ^19 + '@oxc-project/types@0.132.0': resolution: {integrity: sha512-FESMOxil5Se014ui/Eq8fT5uHJo6nIRwH0PfJrZJXs6Gek3ZVFOrpUv3YIZT20m+extU98Hg1Ym72U58rlsxUQ==} @@ -1800,6 +1811,13 @@ snapshots: '@tybys/wasm-util': 0.10.2 optional: true + '@numeric-text/core@0.1.4': {} + + '@numeric-text/react@0.1.4(react@19.2.6)': + dependencies: + '@numeric-text/core': 0.1.4 + react: 19.2.6 + '@oxc-project/types@0.132.0': {} '@radix-ui/number@1.1.1': {} diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 95b48f8..b2e7794 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,3 +1,4 @@ +import NumericText from "@numeric-text/react"; import { useQuery } from "@tanstack/react-query"; import { ImageMinus } from "lucide-react"; import { DateTime } from "luxon"; @@ -180,7 +181,11 @@ function Header() { }, )} > - {connected ? onlineCount : } + {connected ? ( + + ) : ( + + )}

{connected ? t("online") : t("offline")}

diff --git a/src/components/ServerOverview.tsx b/src/components/ServerOverview.tsx index 7888a8e..f8e80eb 100644 --- a/src/components/ServerOverview.tsx +++ b/src/components/ServerOverview.tsx @@ -2,6 +2,7 @@ import { ArrowDownCircleIcon, ArrowUpCircleIcon, } from "@heroicons/react/20/solid"; +import NumericText from "@numeric-text/react"; import { useTranslation } from "react-i18next"; import { Card, CardContent } from "@/components/ui/card"; import { useStatus } from "@/hooks/use-status"; @@ -63,7 +64,7 @@ export default function ServerOverview({ -
{total}
+ @@ -93,8 +94,7 @@ export default function ServerOverview({ - -
{online}
+ @@ -124,7 +124,7 @@ export default function ServerOverview({ -
{offline}
+ @@ -145,12 +145,14 @@ export default function ServerOverview({

-

- ↑{formatBytes(up)} -

-

- ↓{formatBytes(down)} -

+ +