mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
perf: use Link prefetch
This commit is contained in:
parent
3007992af5
commit
606237d57e
@ -12,6 +12,7 @@ import {
|
|||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import { cn, formatBytes, formatNezhaInfo } from "@/lib/utils";
|
import { cn, formatBytes, formatNezhaInfo } from "@/lib/utils";
|
||||||
import { useLocale, useTranslations } from "next-intl";
|
import { useLocale, useTranslations } from "next-intl";
|
||||||
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function ServerCard({
|
export default function ServerCard({
|
||||||
@ -31,13 +32,11 @@ export default function ServerCard({
|
|||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
|
|
||||||
return online ? (
|
return online ? (
|
||||||
|
<Link href={`/${locale}/${id}`} prefetch={true}>
|
||||||
<Card
|
<Card
|
||||||
className={
|
className={
|
||||||
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row cursor-pointer"
|
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row cursor-pointer"
|
||||||
}
|
}
|
||||||
onClick={() => {
|
|
||||||
router.push(`/${locale}/${id}`);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<section
|
<section
|
||||||
className="grid items-center gap-2 lg:w-28 "
|
className="grid items-center gap-2 lg:w-28 "
|
||||||
@ -120,6 +119,7 @@ export default function ServerCard({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<Card
|
<Card
|
||||||
className={cn(
|
className={cn(
|
||||||
|
Loading…
Reference in New Issue
Block a user