From 625596b9e717592f9b52e5d719eece8a435a3d27 Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 6 May 2024 11:55:32 +0800 Subject: [PATCH] fix: uwu detection Signed-off-by: Innei --- app/UWUHandler.tsx | 20 -------------------- app/[locale]/layout.tsx | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 22 deletions(-) delete mode 100644 app/UWUHandler.tsx diff --git a/app/UWUHandler.tsx b/app/UWUHandler.tsx deleted file mode 100644 index b11dd42..0000000 --- a/app/UWUHandler.tsx +++ /dev/null @@ -1,20 +0,0 @@ -'use client' - -import { redirect, useSearchParams } from 'next/navigation' -import { useEffect } from 'react' - -export function UWUHandler() { - const query = useSearchParams() - - useEffect(() => { - if (query?.has('uwu')) { - if (query.get('uwu') === '0') { - localStorage.removeItem('uwu') - } else { - localStorage.setItem('uwu', '1') - } - redirect('/') - } - }, [query]) - return null -} diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index d964ba3..9a2896a 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -18,7 +18,6 @@ import { PostHogPageview, PHProvider as PostHogProvider, } from '../PostHogProvider' -import { UWUHandler } from '../UWUHandler' const fontSansEn = Manrope({ weight: ['400', '500', '700'], @@ -106,10 +105,17 @@ export default async function RootLayout({ suppressHydrationWarning className={`font-sans ${fontSansEn.variable}`} > + +