Compare commits

...

6 Commits

Author SHA1 Message Date
hamster1963
f28f559a0b fix(ServerList): refreshInterval 2024-12-11 21:55:55 +08:00
hamster1963
7a31071c3d 1.7.6 2024-12-11 16:12:13 +08:00
hamster1963
7200c3ecd1 fix: dynamic import disable ssr 2024-12-11 16:10:32 +08:00
hamster1963
452b045e14 fix(overview): image opacity 2024-12-11 15:58:09 +08:00
hamster1963
50a98911ce fix: nextjs version 2024-12-11 15:57:51 +08:00
hamster1963
4bf4b62ed0 chore: deps 2024-12-11 15:43:25 +08:00
5 changed files with 26 additions and 24 deletions

View File

@ -2,7 +2,7 @@
import { ServerApi } from "@/app/types/nezha-api"; import { ServerApi } from "@/app/types/nezha-api";
import { nezhaFetcher } from "@/lib/utils"; import { nezhaFetcher } from "@/lib/utils";
import useSWR from "swr"; import useSWRImmutable from "swr/immutable";
import { geoJsonString } from "../../../lib/geo-json-string"; import { geoJsonString } from "../../../lib/geo-json-string";
import GlobalInfo from "./GlobalInfo"; import GlobalInfo from "./GlobalInfo";
@ -11,7 +11,7 @@ import { InteractiveMap } from "./InteractiveMap";
import { TooltipProvider } from "./TooltipContext"; import { TooltipProvider } from "./TooltipContext";
export default function ServerGlobal() { export default function ServerGlobal() {
const { data: nezhaServerList, error } = useSWR<ServerApi>( const { data: nezhaServerList, error } = useSWRImmutable<ServerApi>(
"/api/server", "/api/server",
nezhaFetcher, nezhaFetcher,
); );

View File

@ -17,6 +17,7 @@ import useSWR from "swr";
import GlobalLoading from "./GlobalLoading"; import GlobalLoading from "./GlobalLoading";
const ServerGlobal = dynamic(() => import("./Global"), { const ServerGlobal = dynamic(() => import("./Global"), {
ssr: false,
loading: () => <GlobalLoading />, loading: () => <GlobalLoading />,
}); });
@ -74,6 +75,7 @@ export default function ServerListClient() {
const { data, error } = useSWR<ServerApi>("/api/server", nezhaFetcher, { const { data, error } = useSWR<ServerApi>("/api/server", nezhaFetcher, {
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 2000, refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 2000,
dedupingInterval: 1000,
}); });
if (error) if (error)

View File

@ -14,18 +14,16 @@ import {
} from "@heroicons/react/20/solid"; } from "@heroicons/react/20/solid";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import Image from "next/image"; import Image from "next/image";
import useSWR from "swr"; import useSWRImmutable from "swr/immutable";
export default function ServerOverviewClient() { export default function ServerOverviewClient() {
const { status, setStatus } = useStatus(); const { status, setStatus } = useStatus();
const { filter, setFilter } = useFilter(); const { filter, setFilter } = useFilter();
const t = useTranslations("ServerOverviewClient"); const t = useTranslations("ServerOverviewClient");
const { data, error, isLoading } = useSWR<ServerApi>(
const { data, error, isLoading } = useSWRImmutable<ServerApi>(
"/api/server", "/api/server",
nezhaFetcher, nezhaFetcher,
{
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 2000,
},
); );
const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true"; const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true";
@ -48,7 +46,9 @@ export default function ServerOverviewClient() {
setFilter(false); setFilter(false);
setStatus("all"); setStatus("all");
}} }}
className={cn("cursor-pointer hover:border-blue-500 transition-all")} className={cn(
"cursor-pointer hover:border-blue-500 transition-all group",
)}
> >
<CardContent className="flex h-full items-center px-6 py-3"> <CardContent className="flex h-full items-center px-6 py-3">
<section className="flex flex-col gap-1"> <section className="flex flex-col gap-1">
@ -148,7 +148,7 @@ export default function ServerOverviewClient() {
setFilter(true); setFilter(true);
}} }}
className={cn( className={cn(
"cursor-pointer hover:ring-purple-500 ring-1 ring-transparent transition-all", "cursor-pointer hover:ring-purple-500 ring-1 ring-transparent transition-all group",
{ {
"ring-purple-500 ring-2 border-transparent": filter === true, "ring-purple-500 ring-2 border-transparent": filter === true,
}, },
@ -190,7 +190,7 @@ export default function ServerOverviewClient() {
</section> </section>
{!disableCartoon && ( {!disableCartoon && (
<Image <Image
className="pointer-events-none absolute right-3 top-[-85px] z-10 w-20 scale-90 md:scale-100" className="absolute right-3 top-[-85px] z-10 w-20 scale-90 group-hover:opacity-50 md:scale-100 transition-all"
alt={"Hamster1963"} alt={"Hamster1963"}
src={blogMan} src={blogMan}
priority priority

BIN
bun.lockb

Binary file not shown.

View File

@ -1,9 +1,9 @@
{ {
"name": "nezha-dash", "name": "nezha-dash",
"version": "1.7.5", "version": "1.7.6",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev --turbopack -p 3040", "dev": "next dev -p 3040",
"start": "node .next/standalone/server.js", "start": "node .next/standalone/server.js",
"lint": "next lint", "lint": "next lint",
"build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/", "build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/",
@ -27,7 +27,7 @@
"@turf/turf": "^7.1.0", "@turf/turf": "^7.1.0",
"@types/d3-geo": "^3.1.0", "@types/d3-geo": "^3.1.0",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@typescript-eslint/eslint-plugin": "^8.17.0", "@typescript-eslint/eslint-plugin": "^8.18.0",
"caniuse-lite": "^1.0.30001687", "caniuse-lite": "^1.0.30001687",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
@ -39,31 +39,31 @@
"framer-motion": "^12.0.0-alpha.2", "framer-motion": "^12.0.0-alpha.2",
"lucide-react": "^0.454.0", "lucide-react": "^0.454.0",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"next": "15.0.4-canary.48", "next": "^15.1.0",
"next-auth": "^5.0.0-beta.25", "next-auth": "^5.0.0-beta.25",
"next-intl": "^3.26.0", "next-intl": "^3.26.0",
"next-runtime-env": "^3.2.2", "next-runtime-env": "^3.2.2",
"next-themes": "^0.4.4", "next-themes": "^0.4.4",
"react": "19.0.0-rc-02c0e824-20241028", "react": "^19.0.0",
"react-device-detect": "^2.2.3", "react-device-detect": "^2.2.3",
"react-dom": "19.0.0-rc-02c0e824-20241028", "react-dom": "^19.0.0",
"react-intersection-observer": "^9.13.1", "react-intersection-observer": "^9.13.1",
"react-wrap-balancer": "^1.1.1", "react-wrap-balancer": "^1.1.1",
"recharts": "^2.14.1", "recharts": "^2.14.1",
"sharp": "^0.33.5", "sharp": "^0.33.5",
"swr": "^2.2.6-beta.4", "swr": "^2.2.6-beta.5",
"tailwind-merge": "^2.5.5", "tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",
"typescript-eslint": "^8.17.0" "typescript-eslint": "^8.18.0"
}, },
"devDependencies": { "devDependencies": {
"@next/bundle-analyzer": "^15.0.4", "@next/bundle-analyzer": "^15.1.0",
"@tailwindcss/postcss": "^4.0.0-beta.6", "@tailwindcss/postcss": "^4.0.0-beta.6",
"@types/node": "^22.10.1", "@types/node": "^22.10.1",
"@types/react": "npm:types-react@19.0.0-rc.1", "@types/react": "^19.0.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1", "@types/react-dom": "^19.0.2",
"eslint": "^9.16.0", "eslint": "^9.16.0",
"eslint-config-next": "^15.0.4", "eslint-config-next": "^15.1.0",
"eslint-plugin-turbo": "^2.3.3", "eslint-plugin-turbo": "^2.3.3",
"eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-unused-imports": "^4.1.4",
"postcss": "^8.4.49", "postcss": "^8.4.49",
@ -74,8 +74,8 @@
"vercel": "39.1.1" "vercel": "39.1.1"
}, },
"overrides": { "overrides": {
"@types/react": "npm:types-react@19.0.0-rc.1", "@types/react": "^npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1", "@types/react-dom": "^npm:types-react-dom@19.0.0-rc.1",
"react-is": "^19.0.0-rc-69d4b800-20241021", "react-is": "^19.0.0-rc-69d4b800-20241021",
"vercel": "$vercel" "vercel": "$vercel"
}, },