File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 11import type { Metadata } from "next" ;
22import { Geist , Geist_Mono } from "next/font/google" ;
3+ import { headers } from "next/headers" ;
34import { Toaster } from "sonner" ;
45import { Navbar } from "@/components/navbar" ;
6+ import { auth } from "@/lib/auth/auth" ;
57import "@/lib/api-client" ;
68import "./globals.css" ;
79
@@ -20,17 +22,21 @@ export const metadata: Metadata = {
2022 description : "Generated by create next app" ,
2123} ;
2224
23- export default function RootLayout ( {
25+ export default async function RootLayout ( {
2426 children,
2527} : Readonly < {
2628 children : React . ReactNode ;
2729} > ) {
30+ const session = await auth . api . getSession ( {
31+ headers : await headers ( ) ,
32+ } ) ;
33+
2834 return (
2935 < html lang = "en" >
3036 < body
3137 className = { `${ geistSans . variable } ${ geistMono . variable } antialiased` }
3238 >
33- < Navbar />
39+ { session && < Navbar /> }
3440 { children }
3541 < Toaster
3642 richColors
Original file line number Diff line number Diff line change 1+ import Image from "next/image" ;
2+
3+ export function NavbarLogo ( ) {
4+ return (
5+ < div className = "flex items-center gap-2" >
6+ < Image
7+ src = "/toolhive-icon.svg"
8+ alt = "Toolhive"
9+ width = { 17 }
10+ height = { 19 }
11+ className = "shrink-0"
12+ />
13+ < span className = "text-[28px] font-bold leading-[37px] tracking-[-0.025em] text-foreground" >
14+ Toolhive
15+ </ span >
16+ </ div >
17+ ) ;
18+ }
Original file line number Diff line number Diff line change 11import { headers } from "next/headers" ;
2+ import { NavbarLogo } from "@/components/navbar-logo" ;
23import { UserMenu } from "@/components/user-menu" ;
34import { auth } from "@/lib/auth/auth" ;
45
@@ -10,7 +11,7 @@ export async function Navbar() {
1011 return (
1112 < header className = "w-full border-b bg-muted/50" >
1213 < div className = "container mx-auto flex items-center justify-between px-4 py-4" >
13- < div />
14+ < NavbarLogo />
1415 { session ?. user ?. name && < UserMenu userName = { session . user . name } /> }
1516 </ div >
1617 </ header >
You can’t perform that action at this time.
0 commit comments