'use client' import React from 'react' interface AlertType { id: number detector_id: number detector_name: string type: string status: string message: string timestamp: string location: string object: string acknowledged: boolean priority: string } interface AlertMenuProps { alert: AlertType isOpen: boolean onClose: () => void getStatusText: (status: string) => string compact?: boolean anchor?: { left: number; top: number } | null } const AlertMenu: React.FC = ({ alert, isOpen, onClose, getStatusText, compact = false, anchor = null }) => { if (!isOpen) return null const formatDate = (dateString: string) => { const date = new Date(dateString) return date.toLocaleString('ru-RU', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' }) } const getPriorityColor = (priority: string) => { switch (priority.toLowerCase()) { case 'high': return 'text-red-400' case 'medium': return 'text-orange-400' case 'low': return 'text-green-400' default: return 'text-gray-400' } } const getPriorityText = (priority: string) => { switch (priority.toLowerCase()) { case 'high': return 'Высокий' case 'medium': return 'Средний' case 'low': return 'Низкий' default: return priority } } if (compact && anchor) { return (
Датч.{alert.detector_name}
{getStatusText(alert.status)}
Приоритет
{getPriorityText(alert.priority)}
Время
{formatDate(alert.timestamp)}
Сообщение
{alert.message}
Местоположение
{alert.location}
) } return (

Датч.{alert.detector_name}

{/* Табличка с информацией об алерте */}
Маркировка по проекту
{alert.detector_name}
Приоритет
{getPriorityText(alert.priority)}
Местоположение
{alert.location}
Статус
{getStatusText(alert.status)}
Время события
{formatDate(alert.timestamp)}
Тип алерта
{alert.type}
Сообщение
{alert.message}
) } export default AlertMenu