Overhaul of the highlight system
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
'use client'
|
||||
|
||||
|
||||
import React, { useState } from 'react'
|
||||
import * as statusColors from '../../lib/statusColors'
|
||||
|
||||
interface DetectorsDataType {
|
||||
detectors: Record<string, DetectorType>
|
||||
}
|
||||
|
||||
|
||||
interface FloorNavigationProps {
|
||||
objectId?: string
|
||||
detectorsData: DetectorsDataType
|
||||
@@ -13,7 +14,7 @@ interface FloorNavigationProps {
|
||||
onClose?: () => void
|
||||
is3DReady?: boolean
|
||||
}
|
||||
|
||||
|
||||
interface DetectorType {
|
||||
detector_id: number
|
||||
name: string
|
||||
@@ -34,7 +35,7 @@ interface DetectorType {
|
||||
priority: string
|
||||
}>
|
||||
}
|
||||
|
||||
|
||||
const FloorNavigation: React.FC<FloorNavigationProps> = (props) => {
|
||||
const { objectId, detectorsData, onDetectorMenuClick, onClose, is3DReady = true } = props
|
||||
const [expandedFloors, setExpandedFloors] = useState<Set<number>>(new Set())
|
||||
@@ -81,19 +82,27 @@ const FloorNavigation: React.FC<FloorNavigationProps> = (props) => {
|
||||
|
||||
const getStatusColor = (status: string) => {
|
||||
switch (status) {
|
||||
case '#b3261e': return 'bg-red-500'
|
||||
case '#fd7c22': return 'bg-orange-500'
|
||||
case '#00ff00': return 'bg-green-500'
|
||||
default: return 'bg-gray-500'
|
||||
case statusColors.STATUS_COLOR_CRITICAL:
|
||||
return 'bg-red-500'
|
||||
case statusColors.STATUS_COLOR_WARNING:
|
||||
return 'bg-orange-500'
|
||||
case statusColors.STATUS_COLOR_NORMAL:
|
||||
return 'bg-green-500'
|
||||
default:
|
||||
return 'bg-gray-500'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const getStatusText = (status: string) => {
|
||||
switch (status) {
|
||||
case '#b3261e': return 'Критический'
|
||||
case '#fd7c22': return 'Предупреждение'
|
||||
case '#00ff00': return 'Норма'
|
||||
default: return 'Неизвестно'
|
||||
case statusColors.STATUS_COLOR_CRITICAL:
|
||||
return 'Критический'
|
||||
case statusColors.STATUS_COLOR_WARNING:
|
||||
return 'Предупреждение'
|
||||
case statusColors.STATUS_COLOR_NORMAL:
|
||||
return 'Норма'
|
||||
default:
|
||||
return 'Неизвестно'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,4 +232,4 @@ const FloorNavigation: React.FC<FloorNavigationProps> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default FloorNavigation
|
||||
export default FloorNavigation
|
||||
|
||||
Reference in New Issue
Block a user