2025-03-28 10:52:01 -04:00
|
|
|
import {
|
|
|
|
|
ClerkProvider,
|
|
|
|
|
SignedIn,
|
|
|
|
|
SignedOut,
|
2025-03-28 14:21:51 -04:00
|
|
|
SignInButton,
|
|
|
|
|
SignUpButton,
|
2025-03-28 10:52:01 -04:00
|
|
|
UserButton,
|
|
|
|
|
} from "@clerk/nextjs";
|
2025-03-28 14:21:51 -04:00
|
|
|
import type { Metadata } from "next";
|
2025-03-28 10:52:01 -04:00
|
|
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
|
|
|
import "../styles/tailwind.css";
|
2023-11-25 23:30:41 +01:00
|
|
|
|
2025-03-28 10:52:01 -04:00
|
|
|
const geistSans = Geist({
|
|
|
|
|
variable: "--font-geist-sans",
|
|
|
|
|
subsets: ["latin"],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const geistMono = Geist_Mono({
|
|
|
|
|
variable: "--font-geist-mono",
|
|
|
|
|
subsets: ["latin"],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const metadata: Metadata = {
|
|
|
|
|
title: "Create Next App",
|
|
|
|
|
description: "Generated by create next app",
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-28 14:21:51 -04:00
|
|
|
// Check if Clerk is enabled
|
|
|
|
|
const isClerkEnabled =
|
|
|
|
|
process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY &&
|
|
|
|
|
process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY !== 'pk_test_YOUR_PUBLISHABLE_KEY';
|
|
|
|
|
|
2025-03-28 10:52:01 -04:00
|
|
|
export default function RootLayout({
|
|
|
|
|
children,
|
|
|
|
|
}: Readonly<{
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
}>) {
|
2025-03-28 14:21:51 -04:00
|
|
|
// Render the layout without Clerk if it's not enabled
|
|
|
|
|
if (!isClerkEnabled) {
|
|
|
|
|
return (
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<body
|
|
|
|
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
|
|
|
>
|
|
|
|
|
<header className="flex justify-end items-center p-4 gap-4 h-16">
|
|
|
|
|
{/* Placeholder for auth buttons when Clerk is disabled */}
|
|
|
|
|
<div className="flex gap-4">
|
|
|
|
|
<button className="text-sm font-medium">Sign In</button>
|
|
|
|
|
<button className="text-sm font-medium">Sign Up</button>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
{children}
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Render with Clerk if it's enabled
|
2023-11-25 23:30:41 +01:00
|
|
|
return (
|
2025-03-28 10:52:01 -04:00
|
|
|
<ClerkProvider>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<body
|
|
|
|
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
|
|
|
>
|
|
|
|
|
<header className="flex justify-end items-center p-4 gap-4 h-16">
|
|
|
|
|
<SignedOut>
|
|
|
|
|
<SignInButton />
|
|
|
|
|
<SignUpButton />
|
|
|
|
|
</SignedOut>
|
|
|
|
|
<SignedIn>
|
|
|
|
|
<UserButton />
|
|
|
|
|
</SignedIn>
|
|
|
|
|
</header>
|
|
|
|
|
{children}
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
</ClerkProvider>
|
|
|
|
|
);
|
|
|
|
|
}
|