Fix jwt-token
This commit is contained in:
@@ -132,16 +132,22 @@ const MapView = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (recentDetections.length > 0) {
|
if (recentDetections.length > 0) {
|
||||||
const latestDetection = recentDetections[0];
|
const latestDetection = recentDetections[0];
|
||||||
|
console.log('MapView: Processing new detection:', latestDetection);
|
||||||
|
|
||||||
// Add to history with timestamp for fade-out
|
// Add to history with timestamp for fade-out
|
||||||
setDroneDetectionHistory(prev => [
|
const newDetection = {
|
||||||
{
|
|
||||||
...latestDetection,
|
...latestDetection,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
id: `${latestDetection.device_id}-${latestDetection.drone_id}-${latestDetection.device_timestamp}`
|
id: `${latestDetection.device_id}-${latestDetection.drone_id}-${latestDetection.device_timestamp}`
|
||||||
},
|
};
|
||||||
...prev.slice(0, 19) // Keep last 20 detections
|
|
||||||
]);
|
console.log('MapView: Adding to history:', newDetection);
|
||||||
|
|
||||||
|
setDroneDetectionHistory(prev => {
|
||||||
|
const newHistory = [newDetection, ...prev.slice(0, 19)];
|
||||||
|
console.log('MapView: Detection history updated, length:', newHistory.length);
|
||||||
|
return newHistory;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [recentDetections]);
|
}, [recentDetections]);
|
||||||
|
|
||||||
@@ -305,10 +311,16 @@ const MapView = () => {
|
|||||||
|
|
||||||
{/* RSSI-based Detection Rings around Detectors */}
|
{/* RSSI-based Detection Rings around Detectors */}
|
||||||
{showDroneDetections && droneDetectionHistory
|
{showDroneDetections && droneDetectionHistory
|
||||||
.filter(detection => detection.geo_lat && detection.geo_lon)
|
.filter(detection => {
|
||||||
|
const hasCoords = detection.geo_lat && detection.geo_lon;
|
||||||
|
console.log('MapView: Filtering detection:', detection, 'hasCoords:', hasCoords);
|
||||||
|
return hasCoords;
|
||||||
|
})
|
||||||
.map(detection => {
|
.map(detection => {
|
||||||
|
console.log('MapView: Rendering ring for detection:', detection);
|
||||||
const opacity = getDetectionOpacity(detection);
|
const opacity = getDetectionOpacity(detection);
|
||||||
const age = getDetectionAge(detection);
|
const age = getDetectionAge(detection);
|
||||||
|
console.log('MapView: Detection age:', age, 'opacity:', opacity);
|
||||||
|
|
||||||
// Calculate ring radius based on RSSI (rough distance estimation)
|
// Calculate ring radius based on RSSI (rough distance estimation)
|
||||||
const getRssiRadius = (rssi) => {
|
const getRssiRadius = (rssi) => {
|
||||||
@@ -321,6 +333,7 @@ const MapView = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const radius = getRssiRadius(detection.rssi);
|
const radius = getRssiRadius(detection.rssi);
|
||||||
|
console.log('MapView: Ring radius:', radius, 'for RSSI:', detection.rssi);
|
||||||
|
|
||||||
// Color based on threat level and RSSI strength
|
// Color based on threat level and RSSI strength
|
||||||
const getRingColor = (rssi, droneType) => {
|
const getRingColor = (rssi, droneType) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user