'use client' import { LogOut } from 'lucide-react' import { usePathname, useRouter } from 'next/navigation' import { useAuth } from '@/hooks/useAuth' import { useSidebar } from '@/hooks/useSidebar' import { NavigationButton } from './core/NavigationButton' import { NotificationBadge } from './core/NotificationBadge' import { SidebarLayout } from './core/SidebarLayout' import { UserProfile } from './core/UserProfile' import { useSidebarData } from './hooks/useSidebarData' import { fulfillmentNavigation } from './navigations/fulfillment' // Компонент уведомлений для поставок фулфилмента function FulfillmentSuppliesNotification({ count }: { count: number }) { if (count === 0) return null return (
{count > 99 ? '99+' : count}
) } export function FulfillmentSidebar({ user: propUser }: { user?: any } = {}) { const { user: hookUser, logout } = useAuth() // Приоритет: переданный user через props, затем из хука const user = propUser || hookUser const router = useRouter() const pathname = usePathname() const { isCollapsed, toggleSidebar } = useSidebar() const { totalUnreadCount, incomingRequestsCount, supplyOrdersCount } = useSidebarData() if (!user) return null const handleNavigationClick = (path: string) => { router.push(path) } return ( {/* Информация о пользователе */} {/* Навигация */}
{fulfillmentNavigation.map((item) => ( handleNavigationClick(item.path)} notification={ item.id === 'messenger' ? ( ) : item.id === 'partners' ? ( ) : item.id === 'supplies' ? ( ) : null } /> ))}
{/* Кнопка выхода */}
) }