diff --git a/components/app-sidebar.tsx b/components/app-sidebar.tsx index eede001..a663213 100644 --- a/components/app-sidebar.tsx +++ b/components/app-sidebar.tsx @@ -1,7 +1,7 @@ 'use client' import Link from 'next/link' -import { usePathname, useRouter } from 'next/navigation' +import { usePathname } from 'next/navigation' import { useState } from 'react' import { cn } from '@/lib/utils' import { signOut } from '@/lib/auth-actions' @@ -11,16 +11,16 @@ import { MessageSquare, Users, CreditCard, BookUser, Download, LogOut, } from 'lucide-react' -function NavLink({ - href, label, icon: Icon, badge, active, onClick, -}: { +interface NavLinkProps { href: string label: string icon: React.ElementType badge?: number active: boolean onClick?: () => void -}) { +} + +function NavLink({ href, label, icon: Icon, badge, active, onClick }: NavLinkProps) { return ( n[0]).join('').toUpperCase().slice(0, 2) + const initials = (member.display_name || 'U').split(' ').map(n => n[0]).join('').toUpperCase().slice(0, 2) const isAdmin = member.role === 'admin' || member.role === 'board' const [drawerOpen, setDrawerOpen] = useState(false) - function isActive(href: string) { - return pathname === href || pathname.startsWith(href + '/') - } + const isActive = (href: string) => pathname === href || pathname.startsWith(href + '/') - async function handleSignOut() { + const handleSignOut = async () => { await signOut() } - const SidebarContent = ({ onNav }: { onNav?: () => void }) => ( + const closeDrawer = () => setDrawerOpen(false) + + const renderNav = (onNav?: () => void) => ( <> {/* Logo */}
Workspace
People
Admin