This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpage.tsx
50 lines (43 loc) · 1.48 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
import type { NextPage } from "next";
import SignInButtons from "~/components/sign-in-options";
import { rsc } from "../../shared/server-rsc/trpc";
export const runtime = "edge";
export const metadata = {
title: "Profile",
description: "Your profile.",
};
/* @ts-expect-error Async Server Component */
const Home: NextPage = async () => {
const user = await rsc.whoami.fetch();
return (
<>
<div className="h-12" />
<div className="flex w-full max-w-[600px] flex-col items-center gap-4">
{!user && <SignInButtons />}
{!!user ? (
<div className="flex w-full max-w-[500px] flex-col gap-4">
<div id="account-info">
<h2 className="pb-2 text-3xl font-semibold tracking-tight transition-colors first:mt-0">
Account Information
</h2>
<div className="h-2"></div>
<div className="flex flex-col rounded border border-slate-600 bg-slate-900">
<div className="flex justify-between border-b-2 border-b-slate-800 p-4">
<div>Username</div>
<div>{user.name}</div>
</div>
<div className="flex justify-between p-4">
<div>Email</div>
<div>{user.email}</div>
</div>
</div>
</div>
</div>
) : (
<div>You must sign in to view your profile.</div>
)}
</div>
</>
);
};
export default Home;