-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathlayout.tsx
More file actions
85 lines (79 loc) · 2.27 KB
/
layout.tsx
File metadata and controls
85 lines (79 loc) · 2.27 KB
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
80
81
82
83
84
85
import c from "config";
import Image from "next/image";
import { currentUser } from "@clerk/nextjs/server";
import Link from "next/link";
import { Button } from "ui/components/button";
import DashNavItem from "@/components/dash/shared/DashNavItem";
import { redirect } from "next/navigation";
import ProfileButton from "@/components/shared/ProfileButton";
import ClientToast from "@/components/shared/ClientToast";
import { getUser } from "db/functions";
import { getCurrentUser } from "@/lib/utils/server/user";
interface DashLayoutProps {
children: React.ReactNode;
}
export default async function DashLayout({ children }: DashLayoutProps) {
const user = await getCurrentUser();
if (!user) return redirect("/register");
if (
(c.featureFlags.core.requireUsersApproval as boolean) === true &&
user.isApproved === false
) {
return redirect("/i/approval");
}
return (
<>
<ClientToast />
<div className="grid h-16 w-full grid-cols-2 bg-nav px-5">
<div className="flex items-center gap-x-4">
<Link href="/">
<Image
src={c.icon.svg}
alt={c.hackathonName + " Logo"}
width={32}
height={32}
/>
</Link>
<div className="h-[45%] w-[2px] rotate-[25deg] bg-muted-foreground" />
<h2 className="font-bold tracking-tight">Dashboard</h2>
</div>
<div className="hidden items-center justify-end gap-x-4 md:flex">
<Link href={"/"}>
<Button
variant={"outline"}
className="bg-nav hover:bg-background"
>
Home
</Button>
</Link>
<Link href={c.links.guide} target="_blank">
<Button
variant={"outline"}
className="bg-nav hover:bg-background"
>
Survival Guide
</Button>
</Link>
<Link href={c.links.discord} target="_blank">
<Button
variant={"outline"}
className="bg-nav hover:bg-background"
>
Discord
</Button>
</Link>
<ProfileButton />
</div>
<div className="flex items-center justify-end gap-x-4 md:hidden">
<ProfileButton />
</div>
</div>
<div className="flex h-12 w-full border-b border-b-border bg-nav px-5">
{Object.entries(c.dashPaths.dash).map(([name, path]) => (
<DashNavItem key={name} name={name} path={path} />
))}
</div>
{children}
</>
);
}