From a309aba988419cd6d453dc5c99f29fca3836d510 Mon Sep 17 00:00:00 2001 From: 22 <60903333+nini22P@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:27:37 +0800 Subject: [PATCH 1/2] feat: add a feature that only works on March 32nd --- .../components/AprilFools/AprilFools.tsx | 30 +++++++++++++++++++ app/[locale]/layout.tsx | 2 ++ package-lock.json | 24 --------------- 3 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 app/[locale]/components/AprilFools/AprilFools.tsx diff --git a/app/[locale]/components/AprilFools/AprilFools.tsx b/app/[locale]/components/AprilFools/AprilFools.tsx new file mode 100644 index 0000000..39e6f80 --- /dev/null +++ b/app/[locale]/components/AprilFools/AprilFools.tsx @@ -0,0 +1,30 @@ +'use client' + +import { useEffect } from 'react' +import { usePathname } from 'next/navigation' + +const AprilFools = () => { + const pathname = usePathname() + + useEffect(() => { + const now = new Date() + if (now.getMonth() !== 3 || now.getDate() !== 1) return + + if (document.title.includes('WebGAL')) + document.title = document.title.replace(/WebGAL/g, 'WebG@L') + + const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT) + const textNodes: Text[] = [] + let node: Node | null + while ((node = walker.nextNode())) textNodes.push(node as Text) + textNodes.forEach(node => { + if (node.textContent?.includes('WebGAL')) + node.textContent = node.textContent.replace(/WebGAL/g, 'WebG@L') + }) + }, [pathname]) + + return null +} + +export default AprilFools + diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index e9aeab1..a93d777 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -5,6 +5,7 @@ import { i18n } from '../../i18n' import Footer from './components/Footer/Footer' import Navbar from './components/Navbar/Navbar' import { GoogleAnalytics } from '@next/third-parties/google' +import AprilFools from './components/AprilFools/AprilFools' const notoSansSC = Noto_Sans_SC({ subsets: ['latin'], @@ -29,6 +30,7 @@ export default async function LangLayout({ children, params: { locale } } + {children}