Skip to content

Commit e2d3ab2

Browse files
authored
Merge pull request #330 from codeunia-dev/feat/company-team-roles-and-invite-flow
refactor(layout): convert to client component and optimize metadata handling
2 parents d5d4b01 + 99b9c4c commit e2d3ab2

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

app/layout.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { Metadata } from "next";
2-
import { Geist } from "next/font/google";
1+
'use client'
32
import { ThemeProvider } from "next-themes";
43
import { Toaster } from "sonner";
54
import { ErrorBoundary } from "@/components/ErrorBoundary";
65
import { GlobalErrorHandler } from "@/components/GlobalErrorHandler";
76
import AIProvider from "@/components/ai/AIProvider";
8-
import { getPageMetadata, getPageStructuredData } from "@/lib/seo/metadata";
7+
import { getPageStructuredData } from "@/lib/seo/metadata";
8+
import { usePathname } from "next/navigation";
99

1010
// Only load dev tools in development
1111
const ReactDevTools = () => null;
@@ -16,26 +16,13 @@ import "./globals.css";
1616
// ? `https://${process.env.VERCEL_URL}`
1717
// : "http://localhost:3000";
1818

19-
export const metadata: Metadata = getPageMetadata('home', {
20-
title: "Codeunia – Empowering Coders Globally",
21-
description: "Join the global coding community. Participate in hackathons, compete on leaderboards, and advance your coding skills with Codeunia.",
22-
keywords: ['coding', 'hackathons', 'programming', 'developer', 'competition', 'leaderboard', 'coding community'],
23-
url: '/',
24-
type: 'website'
25-
});
26-
27-
const geistSans = Geist({
28-
variable: "--font-geist-sans",
29-
display: "swap",
30-
subsets: ["latin"],
31-
});
32-
3319
export default function RootLayout({
3420
children,
3521
}: Readonly<{
3622
children: React.ReactNode;
3723
}>) {
3824
const structuredData = getPageStructuredData('home');
25+
const pathname = usePathname();
3926

4027
return (
4128
<html lang="en" suppressHydrationWarning>
@@ -84,7 +71,7 @@ export default function RootLayout({
8471
{/* Viewport for mobile optimization */}
8572
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
8673
</head>
87-
<body className={`${geistSans.className} antialiased`} suppressHydrationWarning>
74+
<body className={`antialiased`} suppressHydrationWarning>
8875
<ErrorBoundary>
8976
<ThemeProvider
9077
attribute="class"
@@ -95,7 +82,7 @@ export default function RootLayout({
9582
<GlobalErrorHandler />
9683
{children}
9784
<Toaster richColors position="top-center" />
98-
<AIProvider />
85+
{!pathname.startsWith('/dashboard/company') && <AIProvider />}
9986

10087
<ReactDevTools />
10188
<AuthDebug />

0 commit comments

Comments
 (0)