From e55a60c12e37db62d7562e95865bff4ed0a84066 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Thu, 13 Feb 2025 11:50:25 +0800 Subject: [PATCH] fix: resolve server-side rendering issue with Mac detection in Footer --- app/(main)/footer.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/(main)/footer.tsx b/app/(main)/footer.tsx index 99f5b99..7b4be04 100644 --- a/app/(main)/footer.tsx +++ b/app/(main)/footer.tsx @@ -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,7 +29,11 @@ export default function Footer() { const t = useTranslations("Footer") const version = pack.version const currentYear = new Date().getFullYear() - const isMac = /macintosh|mac os x/i.test(navigator.userAgent) + const [isMac, setIsMac] = useState(true) + + useEffect(() => { + setIsMac(/macintosh|mac os x/i.test(navigator.userAgent)) + }, []) return (