diff --git a/src/components/dashboard/dashboard-home.tsx b/src/components/dashboard/dashboard-home.tsx index 645d9ba..68916de 100644 --- a/src/components/dashboard/dashboard-home.tsx +++ b/src/components/dashboard/dashboard-home.tsx @@ -4,9 +4,11 @@ import { useAuth } from '@/hooks/useAuth' import { Card } from '@/components/ui/card' import { Building2, Phone } from 'lucide-react' import { Sidebar } from './sidebar' +import { useSidebar } from '@/hooks/useSidebar' export function DashboardHome() { const { user } = useAuth() + const { getSidebarMargin } = useSidebar() const getOrganizationName = () => { if (user?.organization?.name) { @@ -21,9 +23,9 @@ export function DashboardHome() { return ( -
+
-
+
{/* Информация об организации */} diff --git a/src/components/dashboard/dashboard.tsx b/src/components/dashboard/dashboard.tsx index f8708cd..d27ed86 100644 --- a/src/components/dashboard/dashboard.tsx +++ b/src/components/dashboard/dashboard.tsx @@ -4,10 +4,12 @@ import { useState } from 'react' import { Sidebar } from './sidebar' import { UserSettings } from './user-settings' import { DashboardHome } from './dashboard-home' +import { useSidebar } from '@/hooks/useSidebar' export type DashboardSection = 'home' | 'settings' export function Dashboard() { + const { getSidebarMargin } = useSidebar() const [activeSection] = useState('home') const renderContent = () => { @@ -21,9 +23,9 @@ export function Dashboard() { } return ( -
+
-
+
{renderContent()}
diff --git a/src/components/dashboard/sidebar.tsx b/src/components/dashboard/sidebar.tsx index 2ad391e..9b46382 100644 --- a/src/components/dashboard/sidebar.tsx +++ b/src/components/dashboard/sidebar.tsx @@ -107,7 +107,7 @@ export function Sidebar() { const isPartnersActive = pathname.startsWith('/partners') return ( -
+
{/* Кнопка сворачивания */}
diff --git a/src/components/supplies/supplies-dashboard.tsx b/src/components/supplies/supplies-dashboard.tsx index f168d81..463c8cf 100644 --- a/src/components/supplies/supplies-dashboard.tsx +++ b/src/components/supplies/supplies-dashboard.tsx @@ -5,6 +5,7 @@ import { Card } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Sidebar } from '@/components/dashboard/sidebar' +import { useSidebar } from '@/hooks/useSidebar' import { ChevronDown, @@ -232,6 +233,7 @@ const mockSupplies: Supply[] = [ ] export function SuppliesDashboard() { + const { getSidebarMargin } = useSidebar() const [expandedSupplies, setExpandedSupplies] = useState>(new Set()) const [expandedRoutes, setExpandedRoutes] = useState>(new Set()) const [expandedWholesalers, setExpandedWholesalers] = useState>(new Set()) @@ -327,9 +329,9 @@ export function SuppliesDashboard() { } return ( -
+
-
+
{/* Заголовок */}
diff --git a/src/hooks/useSidebar.tsx b/src/hooks/useSidebar.tsx index 80197cc..a597109 100644 --- a/src/hooks/useSidebar.tsx +++ b/src/hooks/useSidebar.tsx @@ -20,7 +20,7 @@ export function SidebarProvider({ children }: { children: ReactNode }) { const getSidebarMargin = () => { // Учитываем отступ слева (left-4) + ширина сайдбара + дополнительный отступ - return isCollapsed ? 'ml-20' : 'ml-80' + return isCollapsed ? 'ml-20' : 'ml-64' } return (