-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpage.tsx
61 lines (56 loc) · 2.04 KB
/
page.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Button } from '@/components/ui/button'
import { UserButton, auth } from '@clerk/nextjs'
import { ArrowRight, LogIn } from 'lucide-react'
import Link from 'next/link'
import FileUpload from './FileUpload'
import SubscriptionButton from './SubscriptionButton'
import { checkProSubscription } from '@/lib/subscription'
import { getFirstChat } from '@/lib/serverUtils'
export default async function Home() {
const { userId } = await auth()
const isAuth = !!userId
const isPro = await checkProSubscription()
const firstChat = await getFirstChat()
return (
<div className="w-screen min-h-screen bg-gradient-to-r from-indigo-200 via-red-200 to-yellow-100">
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
<div className="flex flex-col items-center text-center">
<div className="flex items-center">
<h1 className="mr-3 text-5xl font-semibold">Chat with your PDF</h1>
<UserButton afterSignOutUrl="/" />
</div>
{isAuth && (
<div className="flex mt-2">
{firstChat && (
<Link href={`/chat/${firstChat.id}`}>
<Button>
Go to Chats <ArrowRight className="w-4 h-4 ml-2" />
</Button>
</Link>
)}
<div className="ml-3">
<SubscriptionButton isPro={isPro} />
</div>
</div>
)}
<p className="max-w-xl mt-1 text-md text-slate-600">
Join millions of students, researchers and professionals to
instantly answer questions and understand research with AI.
</p>
<div className="w-full mt-4">
{isAuth ? (
<FileUpload />
) : (
<Link href="/auth/sign-in">
<Button>
<LogIn className="w-4 h-4 mr-2" />
Login to Get Started!
</Button>
</Link>
)}
</div>
</div>
</div>
</div>
)
}