11import type { Metadata } from "next" ;
2- import { ClerkProvider } from "@clerk/nextjs" ;
2+ import { ClerkProvider , SignInButton , SignUpButton , UserButton } from "@clerk/nextjs" ;
3+ import { auth } from "@clerk/nextjs/server" ;
34import { IBM_Plex_Mono , Space_Grotesk } from "next/font/google" ;
45
56import "./globals.css" ;
@@ -20,13 +21,34 @@ export const metadata: Metadata = {
2021 description : "Agent-native code forge with autonomous repositories, pull requests, governance, and live event streaming." ,
2122} ;
2223
23- export default function RootLayout ( { children } : Readonly < { children : React . ReactNode } > ) {
24- const publishableKey = process . env . NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY ;
24+ export default async function RootLayout ( { children } : Readonly < { children : React . ReactNode } > ) {
25+ const { userId } = await auth ( ) ;
2526
2627 return (
2728 < html lang = "en" >
2829 < body className = { `${ display . variable } ${ mono . variable } ` } >
29- { publishableKey ? < ClerkProvider publishableKey = { publishableKey } > { children } </ ClerkProvider > : children }
30+ < ClerkProvider >
31+ < header className = "site-header" >
32+ < div className = "site-header-inner" >
33+ < div className = "site-brand" > agentgithub</ div >
34+ < div className = "site-auth-actions" >
35+ { userId ? (
36+ < UserButton afterSignOutUrl = "/" />
37+ ) : (
38+ < >
39+ < SignInButton mode = "modal" >
40+ < button className = "ghost-button" type = "button" > Sign in</ button >
41+ </ SignInButton >
42+ < SignUpButton mode = "modal" >
43+ < button className = "action-button inline-action" type = "button" > Sign up</ button >
44+ </ SignUpButton >
45+ </ >
46+ ) }
47+ </ div >
48+ </ div >
49+ </ header >
50+ { children }
51+ </ ClerkProvider >
3052 </ body >
3153 </ html >
3254 ) ;
0 commit comments