-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathlayout.tsx
28 lines (26 loc) · 1012 Bytes
/
layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {type ReactNode, Suspense} from 'react';
import {GET} from 'app/api/auth/[...nextauth]/route';
import {getServerSession} from 'next-auth/next';
import LoginButton from 'sentry-docs/components/changelog/loginButton';
import NextAuthSessionProvider from 'sentry-docs/components/nextAuthSessionProvider';
export default async function Layout({children}: {children: ReactNode}) {
const session = await getServerSession(GET);
let content = (
<div className="relative min-h-[calc(100vh-8rem)] w-full mx-auto bg-gray-200 pt-16 grid grid-cols-12">
{children}
<div className="fixed top-3 right-4 z-50">
<Suspense fallback={null}>
<LoginButton />
</Suspense>
</div>
</div>
);
if (!session) {
content = (
<div className="relative min-h-[calc(100vh-8rem)] w-full mx-auto bg-gray-200 pt-16 flex items-center justify-center">
<LoginButton />
</div>
);
}
return <NextAuthSessionProvider>{content}</NextAuthSessionProvider>;
}