diff --git a/.env.example b/.env.example index 71b4bec..766678b 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,7 @@ NEXT_PUBLIC_DisableCartoon=false NEXT_PUBLIC_ShowTag=true NEXT_PUBLIC_ShowNetTransfer=false NEXT_PUBLIC_ForceUseSvgFlag=false +NEXT_PUBLIC_FixedTopServerName=false NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png NEXT_PUBLIC_CustomTitle=NezhaDash NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha. diff --git a/bun.lockb b/bun.lockb index 3bb921e..eb22a69 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/ServerCard.tsx b/components/ServerCard.tsx index ede838e..fb08cfa 100644 --- a/components/ServerCard.tsx +++ b/components/ServerCard.tsx @@ -3,18 +3,11 @@ import ServerFlag from "@/components/ServerFlag"; import ServerUsageBar from "@/components/ServerUsageBar"; import { Badge } from "@/components/ui/badge"; import { Card } from "@/components/ui/card"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip"; import getEnv from "@/lib/env-entry"; import { cn, formatBytes, formatNezhaInfo } from "@/lib/utils"; import { useTranslations } from "next-intl"; import Link from "next/link"; import { useRouter } from "next/navigation"; -import { useEffect, useRef, useState } from "react"; export default function ServerCard({ serverInfo, @@ -28,27 +21,24 @@ export default function ServerCard({ const showFlag = getEnv("NEXT_PUBLIC_ShowFlag") === "true"; const showNetTransfer = getEnv("NEXT_PUBLIC_ShowNetTransfer") === "true"; - - const nameRef = useRef(null); - const [isNameOverflow, setIsNameOverflow] = useState(false); - - useEffect(() => { - if (nameRef.current) { - setIsNameOverflow( - nameRef.current.scrollWidth > nameRef.current.clientWidth, - ); - } - }, [name]); + const fixedTopServerName = + getEnv("NEXT_PUBLIC_FixedTopServerName") === "true"; return online ? (
@@ -60,30 +50,16 @@ export default function ServerCard({ > {showFlag ? : null} - - - - -
-

- {name} -

- {isNameOverflow && ( -
- )} -
- - -

{name}

-
- - +
+

+ {name} +

+
@@ -152,14 +128,20 @@ export default function ServerCard({ ) : (
@@ -171,28 +153,16 @@ export default function ServerCard({ > {showFlag ? : null}
- - - -
-

- {name} -

- {isNameOverflow && ( -
- )} -
- - -

{name}

-
- - +
+

+ {name} +

+
); diff --git a/docker/.env.example b/docker/.env.example index 358cedf..21de401 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -8,6 +8,7 @@ NEXT_PUBLIC_DisableCartoon=false NEXT_PUBLIC_ShowTag=true NEXT_PUBLIC_ShowNetTransfer=false NEXT_PUBLIC_ForceUseSvgFlag=false +NEXT_PUBLIC_FixedTopServerName=false NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png NEXT_PUBLIC_CustomTitle=NezhaDash NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha. \ No newline at end of file diff --git a/package.json b/package.json index fe7c236..9f8f57f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nezha-dash", - "version": "1.2.1", + "version": "1.2.2", "private": true, "scripts": { "dev": "next dev -p 3020", @@ -32,7 +32,7 @@ "framer-motion": "^12.0.0-alpha.1", "lucide-react": "^0.454.0", "luxon": "^3.5.0", - "next": "^15.0.3-canary.4", + "next": "^15.0.3-canary.5", "next-auth": "^5.0.0-beta.25", "next-intl": "^3.24.0", "next-runtime-env": "^3.2.2",