Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function UserMenu({ user, provider }: UserMenuProps) {
</Avatar>
</summary>

<div className="absolute right-0 mt-2 w-60 overflow-hidden rounded-md border border-border bg-popover shadow-lg">
<div className="absolute right-0 mt-2 w-60 overflow-hidden rounded-md border border-border bg-popover shadow-lg z-50">
<div className="border-b border-border bg-muted/40 px-4 py-3">
<p className="text-sm font-medium text-foreground">
{user.name ?? "Signed in"}
Expand Down
6 changes: 3 additions & 3 deletions app/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <html> while in docs to adjust global backgrounds */}
<DocsRouteFlag />
<DocsLayout
tree={tree}
{...baseOptions()}
{...options}
sidebar={{
// Only show top-level items on first load
defaultOpenLevel: 0,
Expand Down
1 change: 0 additions & 1 deletion auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const { handlers, auth, signIn, signOut } = NextAuth(() => {
if (!databaseUrl) {
console.warn("[auth] DATABASE_URL missing – running without Neon adapter");
}

return {
...authConfig,
providers: [
Expand Down
16 changes: 14 additions & 2 deletions lib/layout.shared.tsx
Original file line number Diff line number Diff line change
@@ -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<BaseLayoutProps> {
const session = await auth();
const user = session?.user;
const provider =
session && "provider" in session
? (session.provider as string | undefined)
: undefined;
return {
nav: {
title: "内卷地狱",
children: (
<div className="ms-auto flex justify-end">
<SignInButton />
{user ? (
<UserMenu user={user} provider={provider} />
) : (
<SignInButton />
)}
</div>
),
},
Expand Down