aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/admin/sidebar/Sidebar.tsx
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-12-30 11:27:32 +0000
committerMohamed Bassem <me@mbassem.com>2024-12-30 11:31:35 +0000
commit179f00b15525b024b6823088ef8fb94b7106b4f0 (patch)
treed64257778930965ed076ff9a081411470343fb3c /apps/web/components/admin/sidebar/Sidebar.tsx
parentaff4e60952321d06dc4cf517ff3b15206aaaebba (diff)
downloadkarakeep-179f00b15525b024b6823088ef8fb94b7106b4f0.tar.zst
feat: Change the admin page to be tabbed similar to that of the settings page
Diffstat (limited to 'apps/web/components/admin/sidebar/Sidebar.tsx')
-rw-r--r--apps/web/components/admin/sidebar/Sidebar.tsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/web/components/admin/sidebar/Sidebar.tsx b/apps/web/components/admin/sidebar/Sidebar.tsx
new file mode 100644
index 00000000..8a5d615a
--- /dev/null
+++ b/apps/web/components/admin/sidebar/Sidebar.tsx
@@ -0,0 +1,36 @@
+import { redirect } from "next/navigation";
+import SidebarItem from "@/components/shared/sidebar/SidebarItem";
+import { useTranslation } from "@/lib/i18n/server";
+import { getServerAuthSession } from "@/server/auth";
+
+import serverConfig from "@hoarder/shared/config";
+
+import { adminSidebarItems } from "./items";
+
+export default async function Sidebar() {
+ const { t } = await useTranslation();
+ const session = await getServerAuthSession();
+ if (!session) {
+ redirect("/");
+ }
+
+ return (
+ <aside className="flex h-[calc(100vh-64px)] w-60 flex-col gap-5 border-r p-4 ">
+ <div>
+ <ul className="space-y-2 text-sm font-medium">
+ {adminSidebarItems(t).map((item) => (
+ <SidebarItem
+ key={item.name}
+ logo={item.icon}
+ name={item.name}
+ path={item.path}
+ />
+ ))}
+ </ul>
+ </div>
+ <div className="mt-auto flex items-center border-t pt-2 text-sm text-gray-400">
+ Hoarder v{serverConfig.serverVersion}
+ </div>
+ </aside>
+ );
+}