'use client' import React from 'react' interface DetectorInfoType { detector_id: number name: string object: string status: string type: string detector_type: string location: string floor: number checked: boolean notifications: Array<{ id: number type: string message: string timestamp: string acknowledged: boolean priority: string }> } interface NotificationDetectorInfoProps { detectorData: DetectorInfoType onClose: () => void } const NotificationDetectorInfo: React.FC = ({ detectorData, onClose }) => { const detectorInfo = detectorData if (!detectorInfo) { return (

Информация о детекторе

Детектор не найден

) } const getStatusColor = (status: string) => { if (status === '#b3261e') return 'text-red-400' if (status === '#fd7c22') return 'text-orange-400' if (status === '#4caf50') return 'text-green-400' return 'text-gray-400' } 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 } } const latestNotification = detectorInfo.notifications && detectorInfo.notifications.length > 0 ? detectorInfo.notifications.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime())[0] : 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' }) } return (

{detectorInfo.name}

{/* Табличка */}
Маркировка по проекту
{detectorInfo.name}
Тип детектора
{detectorInfo.type}
Местоположение
{detectorInfo.location}
Статус
{detectorInfo.status === '#b3261e' ? 'Критический' : detectorInfo.status === '#fd7c22' ? 'Предупреждение' : detectorInfo.status === '#4caf50' ? 'Нормальный' : 'Неизвестно'}
{latestNotification && (
Последнее уведомление
{formatDate(latestNotification.timestamp)}
Приоритет
{getPriorityText(latestNotification.priority)}
)} {latestNotification && (
Сообщение
{latestNotification.message}
)}
) } export default NotificationDetectorInfo