aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/admin
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-12-30 12:15:35 +0000
committerMohamed Bassem <me@mbassem.com>2024-12-30 12:15:35 +0000
commit5902664658a36e4afc81327eea9f8eef05561bcb (patch)
treeb72415e988efb5cd95e4a28634b0b53bf125b168 /apps/web/components/admin
parent179f00b15525b024b6823088ef8fb94b7106b4f0 (diff)
downloadkarakeep-5902664658a36e4afc81327eea9f8eef05561bcb.tar.zst
refactor: Refactor sidebar into a shared component
Diffstat (limited to 'apps/web/components/admin')
-rw-r--r--apps/web/components/admin/sidebar/MobileSidebar.tsx21
-rw-r--r--apps/web/components/admin/sidebar/Sidebar.tsx36
-rw-r--r--apps/web/components/admin/sidebar/items.tsx31
3 files changed, 0 insertions, 88 deletions
diff --git a/apps/web/components/admin/sidebar/MobileSidebar.tsx b/apps/web/components/admin/sidebar/MobileSidebar.tsx
deleted file mode 100644
index 416b944c..00000000
--- a/apps/web/components/admin/sidebar/MobileSidebar.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import MobileSidebarItem from "@/components/shared/sidebar/ModileSidebarItem";
-import { useTranslation } from "@/lib/i18n/server";
-
-import { adminSidebarItems } from "./items";
-
-export default async function MobileSidebar() {
- const { t } = await useTranslation();
- return (
- <aside className="w-full">
- <ul className="flex justify-between space-x-2 border-b-black px-5 py-2 pt-5">
- {adminSidebarItems(t).map((item) => (
- <MobileSidebarItem
- key={item.name}
- logo={item.icon}
- path={item.path}
- />
- ))}
- </ul>
- </aside>
- );
-}
diff --git a/apps/web/components/admin/sidebar/Sidebar.tsx b/apps/web/components/admin/sidebar/Sidebar.tsx
deleted file mode 100644
index 8a5d615a..00000000
--- a/apps/web/components/admin/sidebar/Sidebar.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-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>
- );
-}
diff --git a/apps/web/components/admin/sidebar/items.tsx b/apps/web/components/admin/sidebar/items.tsx
deleted file mode 100644
index 78dfee34..00000000
--- a/apps/web/components/admin/sidebar/items.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { TFunction } from "i18next";
-import { Activity, ArrowLeft, Settings, Users } from "lucide-react";
-
-export const adminSidebarItems = (
- t: TFunction,
-): {
- name: string;
- icon: JSX.Element;
- path: string;
-}[] => [
- {
- name: t("settings.back_to_app"),
- icon: <ArrowLeft size={18} />,
- path: "/dashboard/bookmarks",
- },
- {
- name: t("admin.server_stats.server_stats"),
- icon: <Activity size={18} />,
- path: "/admin/overview",
- },
- {
- name: t("admin.users_list.users_list"),
- icon: <Users size={18} />,
- path: "/admin/users",
- },
- {
- name: t("common.actions"),
- icon: <Settings size={18} />,
- path: "/admin/actions",
- },
-];