From 4fae8f04f546d2b3f6053870d93385fa36af4742 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Fri, 9 Feb 2024 15:32:04 +0000 Subject: [ui] Adding the favourites and archive pages --- packages/web/app/dashboard/components/Sidebar.tsx | 39 +++++++++------------- .../web/app/dashboard/components/SidebarItem.tsx | 30 +++++++++++++++++ 2 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 packages/web/app/dashboard/components/SidebarItem.tsx (limited to 'packages/web/app/dashboard/components') diff --git a/packages/web/app/dashboard/components/Sidebar.tsx b/packages/web/app/dashboard/components/Sidebar.tsx index c2abe1e1..3b4e1649 100644 --- a/packages/web/app/dashboard/components/Sidebar.tsx +++ b/packages/web/app/dashboard/components/Sidebar.tsx @@ -2,27 +2,8 @@ import { Button } from "@/components/ui/button"; import { authOptions } from "@/lib/auth"; import { Archive, MoreHorizontal, Star, Tag, Home, Brain } from "lucide-react"; import { getServerSession } from "next-auth"; -import Link from "next/link"; import { redirect } from "next/navigation"; - -function SidebarItem({ - name, - logo, - path, -}: { - name: string; - logo: React.ReactNode; - path: string; -}) { - return ( -
  • - - {logo} - {name} - -
  • - ); -} +import SidebarItem from "./SidebarItem"; export default async function Sidebar() { const session = await getServerSession(authOptions); @@ -39,9 +20,21 @@ export default async function Sidebar() {
    diff --git a/packages/web/app/dashboard/components/SidebarItem.tsx b/packages/web/app/dashboard/components/SidebarItem.tsx new file mode 100644 index 00000000..e6a00d72 --- /dev/null +++ b/packages/web/app/dashboard/components/SidebarItem.tsx @@ -0,0 +1,30 @@ +"use client"; + +import { cn } from "@/lib/utils"; +import Link from "next/link"; +import { usePathname } from "next/navigation"; + +export default function SidebarItem({ + name, + logo, + path, +}: { + name: string; + logo: React.ReactNode; + path: string; +}) { + const currentPath = usePathname(); + return ( +
  • + + {logo} + {name} + +
  • + ); +} -- cgit v1.2.3-70-g09d2