Compare commits

...

5 Commits

Author SHA1 Message Date
hamster1963
23a3261251 chore: bump version to 2.7.1 2025-02-13 14:59:00 +08:00
hamster1963
a6aa91d35a fix: add locale dependency to component rendering effects 2025-02-13 14:56:56 +08:00
hamster1963
e55a60c12e fix: resolve server-side rendering issue with Mac detection in Footer 2025-02-13 11:50:25 +08:00
hamster1963
2164321e72 chore: update project dependencies to latest versions 2025-02-13 11:35:09 +08:00
hamster1963
b5658d81ab feat: add platform-specific keyboard shortcut display in Footer 2025-02-13 11:34:52 +08:00
5 changed files with 23 additions and 14 deletions

View File

@ -1,6 +1,8 @@
"use client"
import pack from "@/package.json"
import { useTranslations } from "next-intl"
import { useEffect, useState } from "react"
const GITHUB_URL = "https://github.com/hamster1963/nezha-dash"
const PERSONAL_URL = "https://buycoffee.top"
@ -27,6 +29,11 @@ export default function Footer() {
const t = useTranslations("Footer")
const version = pack.version
const currentYear = new Date().getFullYear()
const [isMac, setIsMac] = useState(true)
useEffect(() => {
setIsMac(/macintosh|mac os x/i.test(navigator.userAgent))
}, [])
return (
<footer className="mx-auto w-full max-w-5xl flex items-center justify-between">
@ -43,7 +50,7 @@ export default function Footer() {
</section>
<p className={`mt-1 ${baseTextStyles}`}>
<kbd className="pointer-events-none mx-1 inline-flex h-4 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100">
<span className="text-xs"></span>K
{isMac ? <span className="text-xs"></span> : "Ctrl "}K
</kbd>
</p>
</footer>

BIN
bun.lockb

Binary file not shown.

View File

@ -2,7 +2,7 @@
import getEnv from "@/lib/env-entry"
import { cn } from "@/lib/utils"
import { useTranslations } from "next-intl"
import { useLocale, useTranslations } from "next-intl"
import { createRef, useEffect, useRef, useState } from "react"
export default function Switch({
@ -19,6 +19,7 @@ export default function Switch({
const scrollRef = useRef<HTMLDivElement>(null)
const tagRefs = useRef(allTag.map(() => createRef<HTMLDivElement>()))
const t = useTranslations("ServerListClient")
const locale = useLocale()
const [indicator, setIndicator] = useState<{ x: number; w: number }>({
x: 0,
w: 0,
@ -58,7 +59,7 @@ export default function Switch({
w: currentTagElement.offsetWidth,
})
}
}, [nowTag])
}, [nowTag, locale])
useEffect(() => {
const currentTagElement = tagRefs.current[allTag.indexOf(nowTag)]?.current
@ -75,7 +76,7 @@ export default function Switch({
behavior: "smooth",
})
}
}, [nowTag])
}, [nowTag, locale])
return (
<div

View File

@ -1,7 +1,7 @@
"use client"
import { cn } from "@/lib/utils"
import { useTranslations } from "next-intl"
import { useLocale, useTranslations } from "next-intl"
import { useEffect, useRef, useState } from "react"
export default function TabSwitch({
@ -19,6 +19,7 @@ export default function TabSwitch({
w: 0,
})
const tabRefs = useRef<(HTMLDivElement | null)[]>([])
const locale = useLocale()
useEffect(() => {
const currentTabElement = tabRefs.current[tabs.indexOf(currentTab)]
@ -32,7 +33,7 @@ export default function TabSwitch({
w: currentTabElement.offsetWidth,
})
}
}, [currentTab, tabs])
}, [currentTab, tabs, locale])
return (
<div className="z-50 flex flex-col items-start rounded-[50px]">

View File

@ -1,6 +1,6 @@
{
"name": "nezha-dash",
"version": "2.7.0",
"version": "2.7.1",
"private": true,
"scripts": {
"dev": "next dev -p 3040",
@ -31,7 +31,7 @@
"@types/d3-geo": "^3.1.0",
"@types/luxon": "^3.4.2",
"babel-plugin-react-compiler": "^19.0.0-beta-e552027-20250112",
"caniuse-lite": "^1.0.30001698",
"caniuse-lite": "^1.0.30001699",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.0.4",
@ -44,7 +44,7 @@
"lucide-react": "^0.474.0",
"luxon": "^3.5.0",
"maxmind": "^4.3.24",
"next": "^15.1.6",
"next": "^15.1.7",
"next-auth": "^5.0.0-beta.25",
"next-intl": "^3.26.3",
"next-runtime-env": "^3.2.2",
@ -62,13 +62,13 @@
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@next/bundle-analyzer": "^15.1.6",
"@tailwindcss/postcss": "^4.0.4",
"@next/bundle-analyzer": "^15.1.7",
"@tailwindcss/postcss": "^4.0.6",
"@types/node": "^22.13.1",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"postcss": "^8.5.1",
"tailwindcss": "^4.0.4",
"postcss": "^8.5.2",
"tailwindcss": "^4.0.6",
"typescript": "^5.7.3",
"vercel": "^39.4.2"
},