Overhaul of the highlight system

This commit is contained in:
iv_vuytsik
2026-01-21 03:16:52 +03:00
parent ce7e39debf
commit 87a1a628d3
13 changed files with 481 additions and 259 deletions

View File

@@ -4,6 +4,7 @@ import React from 'react'
import { useRouter } from 'next/navigation'
import useNavigationStore from '@/app/store/navigationStore'
import AreaChart from '../dashboard/AreaChart'
import * as statusColors from '../../lib/statusColors'
interface AlertType {
id: number
@@ -18,7 +19,7 @@ interface AlertType {
acknowledged: boolean
priority: string
}
interface AlertMenuProps {
alert: AlertType
isOpen: boolean
@@ -27,7 +28,7 @@ interface AlertMenuProps {
compact?: boolean
anchor?: { left: number; top: number } | null
}
const AlertMenu: React.FC<AlertMenuProps> = ({ alert, isOpen, onClose, getStatusText, compact = false, anchor = null }) => {
const router = useRouter()
const { setSelectedDetector, currentObject } = useNavigationStore()
@@ -56,17 +57,19 @@ const AlertMenu: React.FC<AlertMenuProps> = ({ alert, isOpen, onClose, getStatus
}
const getStatusColorCircle = (status: string) => {
// Use hex colors from Alerts submenu system
if (status === '#b3261e') return 'bg-red-500'
if (status === '#fd7c22') return 'bg-orange-500'
if (status === '#00ff00') return 'bg-green-500'
if (status === statusColors.STATUS_COLOR_CRITICAL) return 'bg-red-500'
if (status === statusColors.STATUS_COLOR_WARNING) return 'bg-orange-500'
if (status === statusColors.STATUS_COLOR_NORMAL) return 'bg-green-500'
// Fallback for text-based status
switch (status?.toLowerCase()) {
case 'critical': return 'bg-red-500'
case 'warning': return 'bg-orange-500'
case 'normal': return 'bg-green-500'
default: return 'bg-gray-500'
case 'critical':
return 'bg-red-500'
case 'warning':
return 'bg-orange-500'
case 'normal':
return 'bg-green-500'
default:
return 'bg-gray-500'
}
}
@@ -339,4 +342,4 @@ const AlertMenu: React.FC<AlertMenuProps> = ({ alert, isOpen, onClose, getStatus
)
}
export default AlertMenu
export default AlertMenu