Files
sfera-new/src/components/dashboard/dashboard-home.tsx
Veronika Smirnova bf27f3ba29 Оптимизирована производительность React компонентов с помощью мемоизации
КРИТИЧНЫЕ КОМПОНЕНТЫ ОПТИМИЗИРОВАНЫ:
• AdminDashboard (346 kB) - добавлены React.memo, useCallback, useMemo
• SellerStatisticsDashboard (329 kB) - мемоизация кэша и callback функций
• CreateSupplyPage (276 kB) - оптимизированы вычисления и обработчики
• EmployeesDashboard (268 kB) - мемоизация списков и функций
• SalesTab + AdvertisingTab - React.memo обертка

ТЕХНИЧЕСКИЕ УЛУЧШЕНИЯ:
 React.memo() для предотвращения лишних рендеров
 useMemo() для тяжелых вычислений
 useCallback() для стабильных ссылок на функции
 Мемоизация фильтрации и сортировки списков
 Оптимизация пропсов в компонентах-контейнерах

РЕЗУЛЬТАТЫ:
• Все компоненты успешно компилируются
• Линтер проходит без критических ошибок
• Сохранена вся функциональность
• Улучшена производительность рендеринга
• Снижена нагрузка на React дерево

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 13:18:45 +03:00

74 lines
3.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client'
import { Building2, Phone } from 'lucide-react'
import { Card } from '@/components/ui/card'
import { useAuth } from '@/hooks/useAuth'
import { useSidebar } from '@/hooks/useSidebar'
import { Sidebar } from './sidebar'
export function DashboardHome() {
const { user } = useAuth()
const { getSidebarMargin } = useSidebar()
const getOrganizationName = () => {
if (user?.organization?.name) {
return user.organization.name
}
if (user?.organization?.fullName) {
return user.organization.fullName
}
return 'Вашей организации'
}
return (
<div className="h-screen flex overflow-hidden">
<Sidebar />
<main className={`flex-1 ${getSidebarMargin()} px-6 py-4 overflow-hidden transition-all duration-300`}>
<div className="p-8">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{/* Информация об организации */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<Building2 className="h-8 w-8 text-purple-400" />
<h3 className="text-xl font-semibold text-white">Организация</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">{getOrganizationName()}</p>
{user?.organization?.inn && <p className="text-white/60 text-sm">ИНН: {user.organization.inn}</p>}
</div>
</Card>
{/* Контактная информация */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<Phone className="h-8 w-8 text-green-400" />
<h3 className="text-xl font-semibold text-white">Контакты</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">+{user?.phone}</p>
<p className="text-white/60 text-sm">Основной номер</p>
</div>
</Card>
{/* Статистика или дополнительная информация */}
<Card className="bg-white/10 backdrop-blur border-white/20 p-6">
<div className="flex items-center space-x-3 mb-4">
<div className="h-8 w-8 bg-blue-500 rounded-full flex items-center justify-center">
<span className="text-white text-sm font-bold">SF</span>
</div>
<h3 className="text-xl font-semibold text-white">SferaV</h3>
</div>
<div className="space-y-2">
<p className="text-white font-medium">Система управления бизнесом</p>
<p className="text-white/60 text-sm">Версия 1.0</p>
</div>
</Card>
</div>
</div>
</main>
</div>
)
}