Improved authentication; added fallbacks to 3D; cleaner dashboard charts
This commit is contained in:
@@ -11,6 +11,7 @@ interface FloorNavigationProps {
|
||||
detectorsData: DetectorsDataType
|
||||
onDetectorMenuClick: (detector: DetectorType) => void
|
||||
onClose?: () => void
|
||||
is3DReady?: boolean
|
||||
}
|
||||
|
||||
interface DetectorType {
|
||||
@@ -33,7 +34,7 @@ interface DetectorType {
|
||||
}>
|
||||
}
|
||||
|
||||
const FloorNavigation: React.FC<FloorNavigationProps> = ({ objectId, detectorsData, onDetectorMenuClick, onClose }) => {
|
||||
const FloorNavigation: React.FC<FloorNavigationProps> = ({ objectId, detectorsData, onDetectorMenuClick, onClose, is3DReady = true }) => {
|
||||
const [expandedFloors, setExpandedFloors] = useState<Set<number>>(new Set())
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
|
||||
@@ -95,6 +96,12 @@ const FloorNavigation: React.FC<FloorNavigationProps> = ({ objectId, detectorsDa
|
||||
}
|
||||
|
||||
const handleDetectorMenuClick = (detector: DetectorType) => {
|
||||
// Проверяем валидность данных детектора перед передачей
|
||||
if (!detector || !detector.detector_id || !detector.serial_number) {
|
||||
console.warn('[FloorNavigation] Invalid detector data, skipping menu click:', detector)
|
||||
return
|
||||
}
|
||||
|
||||
onDetectorMenuClick(detector)
|
||||
}
|
||||
|
||||
@@ -184,10 +191,20 @@ const FloorNavigation: React.FC<FloorNavigationProps> = ({ objectId, detectorsDa
|
||||
</svg>
|
||||
)}
|
||||
<button
|
||||
onClick={() => handleDetectorMenuClick(detector)}
|
||||
onClick={() => {
|
||||
if (is3DReady) {
|
||||
handleDetectorMenuClick(detector)
|
||||
} else {
|
||||
console.warn('[FloorNavigation] 3D model not ready, skipping detector focus')
|
||||
}
|
||||
}}
|
||||
className="w-6 h-6 bg-[rgb(27,29,41)] hover:bg-[rgb(37,39,51)] rounded-full flex items-center justify-center transition-colors relative"
|
||||
title={is3DReady ? "Показать детектор на 3D модели" : "3D модель недоступна"}
|
||||
>
|
||||
<div className="w-2 h-2 bg-white rounded-full"></div>
|
||||
{!is3DReady && (
|
||||
<div className="absolute -top-1 -right-1 w-3 h-3 bg-amber-500 rounded-full text-[8px] flex items-center justify-center text-black font-bold">!</div>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user