41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { getServerSession } from "next-auth";
|
|
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
|
import { FormLayoutClient } from "./client";
|
|
import LoginDialog from "@/components/login-dialog";
|
|
import { Metadata } from "next";
|
|
|
|
export const metadata: Metadata = {
|
|
title: {
|
|
default: "Erika! - กรอกแบบฟอร์ม",
|
|
template: "%s | Erika!",
|
|
},
|
|
}
|
|
|
|
export default async function FormLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const session = await getServerSession(authOptions);
|
|
|
|
return (
|
|
<div className="flex min-h-screen flex-col flex-1 w-full bg-background text-foreground dark">
|
|
<header className="border-b border-border px-6 py-3 flex items-center justify-between shrink-0">
|
|
<span className="font-semibold text-sm">
|
|
ฟอร์ม
|
|
</span>
|
|
{session?.user && (
|
|
<FormLayoutClient
|
|
userName={session.user.name ?? ""}
|
|
userImage={session.user.image ?? ""}
|
|
/>
|
|
)}
|
|
</header>
|
|
<main className="flex-1 p-6 md:p-8 overflow-y-auto max-w-6xl mx-auto w-full">
|
|
{children}
|
|
</main>
|
|
{!session && <LoginDialog />}
|
|
</div>
|
|
);
|
|
}
|