import { useEffect, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; import { ROUTES } from '../config/routes'; import { eventBus, Events } from '../lib/event-bus'; import { useAppStore } from '../store/app-store'; import { animateCardsStagger, animateFadeInUp } from '../lib/anime-utils'; import { Shield, FileText, Lock, CheckCircle2, ArrowRight, Sparkles } from 'lucide-react'; export function Dashboard() { const headerRef = useRef(null); const cardsRef = useRef(null); const navigate = useNavigate(); const systemStatus = useAppStore((s) => s.systemStatus); const addAuditEvent = useAppStore((s) => s.addAuditEvent); const handleCardClick = (path: string) => { try { eventBus.emit(Events.NAVIGATE, { path }); addAuditEvent({ id: `nav-${Date.now()}`, event: 'navigation', timestamp: new Date().toISOString(), actor: 'user' }); } catch (_) {} navigate(path); }; useEffect(() => { if (headerRef.current) animateFadeInUp(headerRef.current, { duration: 600 }); }, []); useEffect(() => { if (cardsRef.current) animateCardsStagger(cardsRef.current.querySelectorAll('.card-item-anime')); }, []); const cards = [ { path: ROUTES.POLICY_ENGINE.path, title: 'Движок политик', description: systemStatus.policyEngine === 'active' ? 'Активен и применяет политики безопасности' : 'Неактивен', icon: Shield, status: systemStatus.policyEngine, gradient: 'from-blue-500/10 to-blue-600/5', iconColor: 'text-blue-600', borderColor: 'border-blue-200/50', }, { path: ROUTES.AUDIT_LOGGER.path, title: 'Журнал аудита', description: systemStatus.auditLogger === 'active' ? 'Все действия логируются' : 'Логирование неактивно', icon: FileText, status: systemStatus.auditLogger, gradient: 'from-purple-500/10 to-purple-600/5', iconColor: 'text-purple-600', borderColor: 'border-purple-200/50', }, { path: ROUTES.SECRETS_GUARD.path, title: 'Защита секретов', description: systemStatus.secretsGuard === 'active' ? 'Мониторинг утечек секретов' : 'Мониторинг неактивен', icon: Lock, status: systemStatus.secretsGuard, gradient: 'from-emerald-500/10 to-emerald-600/5', iconColor: 'text-emerald-600', borderColor: 'border-emerald-200/50', }, ]; return (

Панель управления

Управление системой безопасности и политиками

{cards.map((card) => { const Icon = card.icon; const isActive = card.status === 'active'; return (
handleCardClick(card.path)} onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && handleCardClick(card.path)} className={`card-item-anime group relative bg-card/80 backdrop-blur-sm p-8 rounded-2xl border-2 cursor-pointer hover-lift transition-all-smooth ${card.borderColor} hover:border-primary/50 hover:shadow-primary-lg focus:outline-none focus:ring-2 focus:ring-primary`} >
{isActive && (
Активен
)}

{card.title}

{card.description}

Открыть
); })}

Система безопасности

Все модули работают в режиме реального времени. Изменения применяются немедленно и логируются в журнале аудита.

); }