From f5be5f52ec3961ef69d2ebc420248a0f5a5515c9 Mon Sep 17 00:00:00 2001 From: Hsueh Date: Tue, 14 Oct 2025 19:50:06 +1100 Subject: [PATCH] fix: fix login button logic and adjust dropdown z-index in usermenu to avoid overlap with main content --- app/components/UserMenu.tsx | 2 +- app/docs/layout.tsx | 6 +++--- auth.ts | 1 - lib/layout.shared.tsx | 16 ++++++++++++++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/components/UserMenu.tsx b/app/components/UserMenu.tsx index 658d104..7e78040 100644 --- a/app/components/UserMenu.tsx +++ b/app/components/UserMenu.tsx @@ -32,7 +32,7 @@ export function UserMenu({ user, provider }: UserMenuProps) { -
+

{user.name ?? "Signed in"} diff --git a/app/docs/layout.tsx b/app/docs/layout.tsx index 10560fb..8e0d46a 100644 --- a/app/docs/layout.tsx +++ b/app/docs/layout.tsx @@ -62,16 +62,16 @@ function pruneEmptyFolders(root: PageTree.Root): PageTree.Root { return transformRoot(root); } -export default function Layout({ children }: { children: ReactNode }) { +export default async function Layout({ children }: { children: ReactNode }) { const tree = pruneEmptyFolders(source.pageTree); - + const options = await baseOptions(); return ( <> {/* Add a class on while in docs to adjust global backgrounds */} { if (!databaseUrl) { console.warn("[auth] DATABASE_URL missing – running without Neon adapter"); } - return { ...authConfig, providers: [ diff --git a/lib/layout.shared.tsx b/lib/layout.shared.tsx index 5dde77b..17a04b8 100644 --- a/lib/layout.shared.tsx +++ b/lib/layout.shared.tsx @@ -1,12 +1,24 @@ import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared"; import { SignInButton } from "@/app/components/SignInButton"; -export function baseOptions(): BaseLayoutProps { +import { UserMenu } from "@/app/components/UserMenu"; +import { auth } from "@/auth"; +export async function baseOptions(): Promise { + const session = await auth(); + const user = session?.user; + const provider = + session && "provider" in session + ? (session.provider as string | undefined) + : undefined; return { nav: { title: "内卷地狱", children: (

- + {user ? ( + + ) : ( + + )}
), },