Fix jwt-token
This commit is contained in:
@@ -613,7 +613,16 @@ const DevicePopup = ({ device, status, detections }) => (
|
||||
<div>Coordinates: {device.geo_lat}, {device.geo_lon}</div>
|
||||
{device.last_heartbeat && (
|
||||
<div>
|
||||
Last seen: {format(new Date(device.last_heartbeat), 'MMM dd, HH:mm')}
|
||||
Last seen: {(() => {
|
||||
try {
|
||||
if (device.last_heartbeat && !isNaN(new Date(device.last_heartbeat).getTime())) {
|
||||
return format(new Date(device.last_heartbeat), 'MMM dd, HH:mm');
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Invalid last_heartbeat timestamp:', device.last_heartbeat, e);
|
||||
}
|
||||
return 'Invalid time';
|
||||
})()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -722,19 +731,33 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory
|
||||
<div className="flex justify-between">
|
||||
<span className="text-gray-600">First detected:</span>
|
||||
<span className="font-mono text-gray-900">
|
||||
{firstDetection.device_timestamp ?
|
||||
format(new Date(firstDetection.device_timestamp), 'MMM dd, HH:mm:ss') :
|
||||
'Unknown'
|
||||
{(() => {
|
||||
const timestamp = firstDetection.device_timestamp || firstDetection.timestamp || firstDetection.server_timestamp;
|
||||
try {
|
||||
if (timestamp && !isNaN(new Date(timestamp).getTime())) {
|
||||
return format(new Date(timestamp), 'MMM dd, HH:mm:ss');
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Invalid firstDetection timestamp:', timestamp, e);
|
||||
}
|
||||
return 'Unknown';
|
||||
})()}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-gray-600">Latest detection:</span>
|
||||
<span className="font-mono text-gray-900">
|
||||
{detection.device_timestamp ?
|
||||
format(new Date(detection.device_timestamp), 'MMM dd, HH:mm:ss') :
|
||||
'Unknown'
|
||||
{(() => {
|
||||
const timestamp = detection.device_timestamp || detection.timestamp || detection.server_timestamp;
|
||||
try {
|
||||
if (timestamp && !isNaN(new Date(timestamp).getTime())) {
|
||||
return format(new Date(timestamp), 'MMM dd, HH:mm:ss');
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Invalid detection timestamp:', timestamp, e);
|
||||
}
|
||||
return 'Unknown';
|
||||
})()}
|
||||
</span>
|
||||
</div>
|
||||
{droneHistory.length > 1 && (
|
||||
@@ -782,7 +805,17 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory
|
||||
'bg-green-400'
|
||||
}`}
|
||||
style={{ height: `${height}px` }}
|
||||
title={`${hist.rssi}dBm at ${format(new Date(hist.device_timestamp), 'HH:mm:ss')}`}
|
||||
title={`${hist.rssi}dBm at ${(() => {
|
||||
const timestamp = hist.device_timestamp || hist.timestamp || hist.server_timestamp;
|
||||
try {
|
||||
if (timestamp && !isNaN(new Date(timestamp).getTime())) {
|
||||
return format(new Date(timestamp), 'HH:mm:ss');
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Invalid timestamp:', timestamp, e);
|
||||
}
|
||||
return 'Invalid time';
|
||||
})()}`}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user