Add MVP version
This commit is contained in:
42
apps/web/src/app/(dashboard)/layout.tsx
Normal file
42
apps/web/src/app/(dashboard)/layout.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
import { NextAuthProvider } from "~/providers/next-auth";
|
||||
import { getServerAuthSession } from "~/server/auth";
|
||||
|
||||
export const metadata = {
|
||||
title: "Unsend",
|
||||
description: "Generated by create-t3-app",
|
||||
icons: [{ rel: "icon", url: "/favicon.ico" }],
|
||||
};
|
||||
|
||||
export default async function AuthenticatedDashboardLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const session = await getServerAuthSession();
|
||||
|
||||
if (!session?.user) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
return (
|
||||
<NextAuthProvider session={session}>
|
||||
<div className="h-screen flex">
|
||||
<nav className="w-[200px] border border-r p-4">
|
||||
<div className=" font-semibold text-xl">Unsend</div>
|
||||
|
||||
<div className="flex flex-col gap-3 mt-10">
|
||||
<Link href="/dashboard">Dashboard</Link>
|
||||
<Link href="/domains">Domains</Link>
|
||||
<Link href="/emails">Emails</Link>
|
||||
<Link href="/api-keys">API Keys</Link>
|
||||
</div>
|
||||
</nav>
|
||||
<div className="flex-1">
|
||||
<div className=" max-w-4xl mx-auto py-4">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
</NextAuthProvider>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user