blob: 1c18e90c6dbb664b4428ee34422835bbc82eec25 (
plain) (
blame)
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
|
import Link from "next/link";
import { redirect } from "next/navigation";
import { Separator } from "@/components/ui/separator";
import { api } from "@/server/api/client";
import { getServerAuthSession } from "@/server/auth";
import { Home, PackageOpen, Search, Settings, Shield, Tag } from "lucide-react";
import serverConfig from "@hoarder/shared/config";
import AllLists from "./AllLists";
import SidebarItem from "./SidebarItem";
import SidebarProfileOptions from "./SidebarProfileOptions";
export default async function Sidebar() {
const session = await getServerAuthSession();
if (!session) {
redirect("/");
}
const lists = await api.lists.list();
return (
<aside className="flex h-screen w-60 flex-col gap-5 border-r p-4">
<Link href={"/dashboard/bookmarks"}>
<div className="flex items-center rounded-lg px-1 text-foreground">
<PackageOpen />
<span className="ml-2 text-base font-semibold">Hoarder</span>
</div>
</Link>
<Separator />
<div>
<ul className="space-y-2 text-sm font-medium">
<SidebarItem
logo={<Home />}
name="Home"
path="/dashboard/bookmarks"
/>
{serverConfig.meilisearch && (
<SidebarItem
logo={<Search />}
name="Search"
path="/dashboard/search"
/>
)}
<SidebarItem logo={<Tag />} name="Tags" path="/dashboard/tags" />
<SidebarItem
logo={<Settings />}
name="Settings"
path="/dashboard/settings"
/>
{session.user.role == "admin" && (
<SidebarItem
logo={<Shield />}
name="Admin"
path="/dashboard/admin"
/>
)}
</ul>
</div>
<Separator />
<AllLists initialData={lists} />
<div className="mt-auto flex justify-between justify-self-end">
<div className="my-auto"> {session.user.name} </div>
<SidebarProfileOptions />
</div>
</aside>
);
}
|