From 5902664658a36e4afc81327eea9f8eef05561bcb Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Mon, 30 Dec 2024 12:15:35 +0000 Subject: refactor: Refactor sidebar into a shared component --- .../web/components/admin/sidebar/MobileSidebar.tsx | 21 ------------- apps/web/components/admin/sidebar/Sidebar.tsx | 36 ---------------------- apps/web/components/admin/sidebar/items.tsx | 31 ------------------- 3 files changed, 88 deletions(-) delete mode 100644 apps/web/components/admin/sidebar/MobileSidebar.tsx delete mode 100644 apps/web/components/admin/sidebar/Sidebar.tsx delete mode 100644 apps/web/components/admin/sidebar/items.tsx (limited to 'apps/web/components/admin') 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 ( - - ); -} 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 ( - - ); -} 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: , - path: "/dashboard/bookmarks", - }, - { - name: t("admin.server_stats.server_stats"), - icon: , - path: "/admin/overview", - }, - { - name: t("admin.users_list.users_list"), - icon: , - path: "/admin/users", - }, - { - name: t("common.actions"), - icon: , - path: "/admin/actions", - }, -]; -- cgit v1.2.3-70-g09d2