'use client' import Link from 'next/link' import { usePathname, useSearchParams } from 'next/navigation' import { cn } from '@/lib/utils' import { Lightbulb, Bell, Archive, Trash2, Plus, Sparkles, } from 'lucide-react' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' import { useLanguage } from '@/lib/i18n' import { NotebooksList } from './notebooks-list' import { useHomeViewOptional } from '@/context/home-view-context' export function Sidebar({ className, user }: { className?: string, user?: any }) { const pathname = usePathname() const searchParams = useSearchParams() const { t } = useLanguage() const homeBridge = useHomeViewOptional() // Helper to determine if a link is active const isActive = (href: string, exact = false) => { if (href === '/') { // Home is active only if no special filters are applied return pathname === '/' && !searchParams.get('label') && !searchParams.get('archived') && !searchParams.get('trashed') } // For labels if (href.startsWith('/?label=')) { const labelParam = searchParams.get('label') // Extract label from href const labelFromHref = href.split('=')[1] return labelParam === labelFromHref } // For other routes return pathname === href } const NavItem = ({ href, icon: Icon, label, active }: any) => ( {label} ) return ( ) }