From 99b9c4ca6763f205523c1010ac6c5c4fb5c8739e Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 15 Nov 2025 17:50:21 +0530 Subject: [PATCH] refactor(layout): convert to client component and optimize metadata handling Remove server-side metadata generation and Geist font in favor of client-side rendering. Disable AIProvider on specific dashboard routes to improve performance. --- app/layout.tsx | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 05983ec3..ff3b2a08 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,11 +1,11 @@ -import type { Metadata } from "next"; -import { Geist } from "next/font/google"; +'use client' import { ThemeProvider } from "next-themes"; import { Toaster } from "sonner"; import { ErrorBoundary } from "@/components/ErrorBoundary"; import { GlobalErrorHandler } from "@/components/GlobalErrorHandler"; import AIProvider from "@/components/ai/AIProvider"; -import { getPageMetadata, getPageStructuredData } from "@/lib/seo/metadata"; +import { getPageStructuredData } from "@/lib/seo/metadata"; +import { usePathname } from "next/navigation"; // Only load dev tools in development const ReactDevTools = () => null; @@ -16,26 +16,13 @@ import "./globals.css"; // ? `https://${process.env.VERCEL_URL}` // : "http://localhost:3000"; -export const metadata: Metadata = getPageMetadata('home', { - title: "Codeunia – Empowering Coders Globally", - description: "Join the global coding community. Participate in hackathons, compete on leaderboards, and advance your coding skills with Codeunia.", - keywords: ['coding', 'hackathons', 'programming', 'developer', 'competition', 'leaderboard', 'coding community'], - url: '/', - type: 'website' -}); - -const geistSans = Geist({ - variable: "--font-geist-sans", - display: "swap", - subsets: ["latin"], -}); - export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { const structuredData = getPageStructuredData('home'); + const pathname = usePathname(); return ( @@ -84,7 +71,7 @@ export default function RootLayout({ {/* Viewport for mobile optimization */} - + {children} - + {!pathname.startsWith('/dashboard/company') && }