'use client' import Link from 'next/link' import { usePathname, useRouter } from 'next/navigation' import { useState } from 'react' import { cn } from '@/lib/utils' import { signOut } from '@/lib/auth-actions' import type { SpaceMember, Space } from '@/lib/types' interface NavItem { label: string href: string icon: React.ReactNode badge?: number section: 'workspace' | 'people' | 'admin' } function navIcon(path: string) { const icons: Record = { dashboard: ( ), tasks: ( ), projects: ( ), ops: ( ), comms: ( ), members: ( ), payments: ( ), contacts: ( ), import: ( ), settings: ( ), } return icons[path] ?? null } interface AppSidebarProps { member: SpaceMember & { spaces: Space } taskBadge?: number commsBadge?: number paymentBadge?: number } export function AppSidebar({ member, taskBadge = 0, commsBadge = 0, paymentBadge = 0 }: AppSidebarProps) { const pathname = usePathname() const router = useRouter() const space = member.spaces const initials = member.display_name.split(' ').map(n => n[0]).join('').toUpperCase().slice(0, 2) const isAdmin = member.role === 'admin' || member.role === 'board' function isActive(href: string) { return pathname === href || pathname.startsWith(href + '/') } async function handleSignOut() { await signOut() } return ( ) }