-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavbar.tsx
79 lines (77 loc) · 2.76 KB
/
Navbar.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import Link from "next/link";
import { MaxWidthWrapper } from "./MaxWidthWrapper";
import { buttonVariants } from "@/components/ui/button";
import { ArrowRight } from "lucide-react";
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export const Navbar = async () => {
const { getUser } = getKindeServerSession();
const user = await getUser();
const isAdmin = user?.email === process.env.ADMIN_EMAIL;
return (
<nav className="sticky z-[100] h-14 inset-x-0 top-0 w-full border-b border-gray-200 bg-white/75 backdrop-blur-sm transition-all">
<MaxWidthWrapper>
<div className="flex h-14 items-center justify-between border-b border-zinc-200">
<Link href="/" className="flex z-40 font-semibold">
case <span className="text-green-600">cobra</span>
</Link>{" "}
<div className="h-full flex items-center space-x-4">
{user ? (
<>
<Link
href="/api/auth/logout"
className={buttonVariants({ size: "sm", variant: "ghost" })}
>
Sign Out
</Link>
{isAdmin ? (
<Link
href="/api/auth/logout"
className={buttonVariants({ size: "sm", variant: "ghost" })}
>
Dashboard ✨
</Link>
) : null}
<Link
href="/configure/upload"
className={buttonVariants({
size: "sm",
className: "hidden sm:flex items-center gap-1",
})}
>
Create case
<ArrowRight className="ml-1.5 h-5 w-5" />
</Link>
</>
) : (
<>
<Link
href="/api/auth/register"
className={buttonVariants({ size: "sm", variant: "ghost" })}
>
Sign Up
</Link>
<Link
href="/api/auth/login"
className={buttonVariants({ size: "sm", variant: "ghost" })}
>
Login
</Link>
<div className="h-8 w-px bg-zinc-200 hidden sm:block" />
<Link
href="/configure/upload"
className={buttonVariants({
size: "sm",
className: "hidden sm:flex items-center gap-1",
})}
>
Create case
<ArrowRight className="ml-1.5 h-5 w-5" />
</Link>
</>
)}
</div>
</div>
</MaxWidthWrapper>
</nav>
);
};