1- import { redirect } from "next/navigation"
21import { cache } from "react"
2+ import { redirect } from "next/navigation"
3+ import { User } from "@prisma/client"
34
5+ import { authOptions } from "@/lib/auth"
46import { db } from "@/lib/db"
57import { getCurrentUser } from "@/lib/session"
6- import { User } from "@prisma/client"
7- import { authOptions } from "@/lib/auth"
8- import { DashboardHeader } from "@/components/dashboard/header"
9- import { PostCreateButton } from "@/components/dashboard/post-create-button"
10- import { DashboardShell } from "@/components/dashboard/shell"
11- import { PostItem } from "@/components/dashboard/post-item"
12- import { EmptyPlaceholder } from "@/components/dashboard/empty-placeholder"
8+ import { cn } from "@/lib/utils"
9+ import { EmptyPlaceholder } from "@/components/empty-placeholder"
10+ import { DashboardHeader } from "@/components/header"
11+ import { PostCreateButton } from "@/components/post-create-button"
12+ import { PostItem } from "@/components/post-item"
13+ import { DashboardShell } from "@/components/shell"
14+ import { buttonVariants } from "@/components/ui/button"
15+
16+ export const metadata = {
17+ title : "Dashboard" ,
18+ }
1319
1420const getPostsForUser = cache ( async ( userId : User [ "id" ] ) => {
1521 return await db . post . findMany ( {
@@ -32,7 +38,7 @@ export default async function DashboardPage() {
3238 const user = await getCurrentUser ( )
3339
3440 if ( ! user ) {
35- redirect ( authOptions . pages . signIn )
41+ redirect ( authOptions ? .pages ? .signIn || "/login" )
3642 }
3743
3844 const posts = await getPostsForUser ( user . id )
@@ -56,7 +62,12 @@ export default async function DashboardPage() {
5662 < EmptyPlaceholder . Description >
5763 You don't have any posts yet. Start creating content.
5864 </ EmptyPlaceholder . Description >
59- < PostCreateButton className = "border-slate-200 bg-white text-brand-900 hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2" />
65+ < PostCreateButton
66+ className = { cn (
67+ buttonVariants ( { variant : "outline" } ) ,
68+ "text-slate-900"
69+ ) }
70+ />
6071 </ EmptyPlaceholder >
6172 ) }
6273 </ div >
0 commit comments