-
Notifications
You must be signed in to change notification settings - Fork 788
/
Copy pathprofile.tsx
36 lines (34 loc) · 1.09 KB
/
profile.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
import { getSession } from "@/lib/auth";
import { redirect } from "next/navigation";
import Link from "next/link";
import Image from "next/image";
import LogoutButton from "./logout-button";
export default async function Profile() {
const session = await getSession();
if (!session?.user) {
redirect("/login");
}
return (
<div className="flex w-full items-center justify-between">
<Link
href="/settings"
className="flex w-full flex-1 items-center space-x-3 rounded-lg px-2 py-1.5 transition-all duration-150 ease-in-out hover:bg-stone-200 active:bg-stone-300 dark:text-white dark:hover:bg-stone-700 dark:active:bg-stone-800"
>
<Image
src={
session.user.image ??
`https://avatar.vercel.sh/${session.user.email}`
}
width={40}
height={40}
alt={session.user.name ?? "User avatar"}
className="h-6 w-6 rounded-full"
/>
<span className="truncate text-sm font-medium">
{session.user.name}
</span>
</Link>
<LogoutButton />
</div>
);
}