From 2b4a7bf09eea93834f5a2b04e66fcd96038d5c4d Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Fri, 19 Sep 2025 15:11:42 +0200 Subject: [PATCH] Fix jwt-token --- client/src/pages/MapView.jsx | 62 +++++++++++++------------- client/src/utils/tempTranslations.js | 66 +++++++++++++++++++++++++++- 2 files changed, 96 insertions(+), 32 deletions(-) diff --git a/client/src/pages/MapView.jsx b/client/src/pages/MapView.jsx index 6f73c78..3853ecf 100644 --- a/client/src/pages/MapView.jsx +++ b/client/src/pages/MapView.jsx @@ -148,7 +148,7 @@ const MapView = () => { 10: "DJI Mavic", 11: "DJI Phantom", 20: "DJI Mini", - 99: "Unknown" + 99: t('map.unknown') }); } }; @@ -788,14 +788,14 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory

🚨 - Drone Detection Details + {t('map.droneDetectionDetails')}

- {age < 1 ? 'LIVE' : `${Math.round(age)}m ago`} + { age < 1 ? t('map.live') : `${Math.round(age)}m ago`}
@@ -804,11 +804,11 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory
- Drone ID: + {t('map.droneId')}:
{detection.drone_id}
- Type: + {t('map.type')}:
{droneTypes[detection.drone_type] || `Type ${detection.drone_type}`}
@@ -822,7 +822,7 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory
- RSSI: + {t('map.rssi')}:
-50 ? 'text-red-600' : detection.rssi > -70 ? 'text-orange-600' : @@ -832,7 +832,7 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory
- Frequency: + {t('map.frequency')}:
{detection.freq}MHz
@@ -840,10 +840,10 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory {/* Detection Timeline */}
- Detection Timeline: + {t('map.detectionTimeline')}:
- First detected: + {t('map.firstDetected')}: {(() => { const timestamp = firstDetection.device_timestamp || firstDetection.timestamp || firstDetection.server_timestamp; @@ -854,12 +854,12 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory } catch (e) { console.warn('Invalid firstDetection timestamp:', timestamp, e); } - return 'Unknown'; + return t('map.unknown'); })()}
- Latest detection: + {t('map.latestDetection')}: {(() => { const timestamp = detection.device_timestamp || detection.timestamp || detection.server_timestamp; @@ -870,13 +870,13 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory } catch (e) { console.warn('Invalid detection timestamp:', timestamp, e); } - return 'Unknown'; + return t('map.unknown'); })()}
{droneHistory.length > 1 && (
- Total detections: + {t('map.totalDetections')}: {droneHistory.length}
)} @@ -886,7 +886,7 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory {/* Movement Analysis */} {movementTrend && (
- Movement Analysis: + {t('map.movementAnalysis')}:
- {movementTrend.trend === 'APPROACHING' ? '⚠️ APPROACHING' : - movementTrend.trend === 'RETREATING' ? '✅ RETREATING' : - '➡️ STABLE POSITION'} + {movementTrend.trend === 'APPROACHING' ? `⚠️ ${t('map.approaching')}` : + movementTrend.trend === 'RETREATING' ? `✅ ${t('map.retreating')}` : + `➡️ ${t('map.stablePosition')}`}
- RSSI change: {movementTrend.change > 0 ? '+' : ''}{typeof movementTrend.change === 'number' ? movementTrend.change.toFixed(1) : 'N/A'}dB - over {typeof movementTrend.duration === 'number' ? movementTrend.duration.toFixed(1) : 'N/A'} minutes + {t('map.rssiChange')}: {movementTrend.change > 0 ? '+' : ''}{typeof movementTrend.change === 'number' ? movementTrend.change.toFixed(1) : 'N/A'}dB + {t('map.over')} {typeof movementTrend.duration === 'number' ? movementTrend.duration.toFixed(1) : 'N/A'} {t('map.minutes')}
{/* Signal Strength History Graph (simplified) */}
-
Signal Strength Trend:
+
{t('map.signalStrengthTrend')}:
{droneHistory.slice(0, 8).reverse().map((hist, idx) => { const height = Math.max(10, Math.min(32, (hist.rssi + 100) / 2)); // Scale -100 to 0 dBm to 10-32px @@ -934,7 +934,7 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory ); })}
-
Last 8 detections (oldest to newest)
+
{t('map.lastDetections')}
@@ -942,26 +942,26 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory {/* Current Detection Details */}
- Current Detection: + {t('map.currentDetection')}:
- Confidence: + {t('map.confidence')}:
{typeof detection.confidence_level === 'number' ? (detection.confidence_level * 100).toFixed(0) : 'N/A'}%
- Duration: + {t('map.duration')}:
{typeof detection.signal_duration === 'number' ? (detection.signal_duration / 1000).toFixed(1) : 'N/A'}s
- Detector: -
Device {detection.device_id}
+ {t('map.detector')}: +
{t('map.deviceName')} {detection.device_id}
- Location: + {t('map.location')}:
{typeof detection.geo_lat === 'number' ? detection.geo_lat.toFixed(4) : 'N/A'}, {typeof detection.geo_lon === 'number' ? detection.geo_lon.toFixed(4) : 'N/A'}
@@ -972,7 +972,7 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory {/* Legacy movement analysis from detection */} {detection.movement_analysis && (
- Real-time Analysis: + {t('map.realTimeAnalysis')}:
= 3 ? 'bg-red-100 text-red-800' : @@ -985,13 +985,15 @@ const DroneDetectionPopup = ({ detection, age, droneTypes, droneDetectionHistory {detection.movement_analysis.rssiTrend && (
- Instant trend: + {t('map.instantTrend')}: - {detection.movement_analysis.rssiTrend.trend} + {detection.movement_analysis.rssiTrend.trend === 'STRENGTHENING' ? t('map.strengthening') : + detection.movement_analysis.rssiTrend.trend === 'WEAKENING' ? t('map.weakening') : + detection.movement_analysis.rssiTrend.trend} {detection.movement_analysis.rssiTrend.change !== 0 && ( ({detection.movement_analysis.rssiTrend.change > 0 ? '+' : ''}{typeof detection.movement_analysis.rssiTrend.change === 'number' ? detection.movement_analysis.rssiTrend.change.toFixed(1) : 'N/A'}dB) diff --git a/client/src/utils/tempTranslations.js b/client/src/utils/tempTranslations.js index 91a401b..6182228 100644 --- a/client/src/utils/tempTranslations.js +++ b/client/src/utils/tempTranslations.js @@ -314,7 +314,38 @@ const translations = { droneLabels: 'Drone ID labels shown', positionOffsets: 'Slight position offsets for visibility', ringSize: 'Ring size = estimated distance from detector', - showDroneDetections: 'Show Drone Detections' + showDroneDetections: 'Show Drone Detections', + droneDetectionDetails: 'Drone Detection Details', + live: 'LIVE', + droneId: 'Drone ID', + type: 'Type', + rssi: 'RSSI', + frequency: 'Frequency', + detectionTimeline: 'Detection Timeline', + firstDetected: 'First detected', + latestDetection: 'Latest detection', + currentDetection: 'Current Detection', + confidence: 'Confidence', + duration: 'Duration', + detector: 'Detector', + location: 'Location', + realTimeAnalysis: 'Real-time Analysis', + firstDetection: 'First detection', + movementAnalysis: 'Movement Analysis', + totalDetections: 'Total detections', + signalStrengthTrend: 'Signal Strength Trend', + lastDetections: 'Last 8 detections (oldest to newest)', + approaching: 'APPROACHING', + retreating: 'RETREATING', + stablePosition: 'STABLE POSITION', + rssiChange: 'RSSI change', + over: 'over', + minutes: 'minutes', + instantTrend: 'Instant trend', + strengthening: 'STRENGTHENING', + weakening: 'WEAKENING', + deviceName: 'Device', + unknown: 'Unknown' }, movementAlerts: { title: 'Movement Alerts', @@ -713,7 +744,38 @@ const translations = { droneLabels: 'Drönar-ID-etiketter visas', positionOffsets: 'Lätta positionsförskjutningar för synlighet', ringSize: 'Ringstorlek = uppskattad distans från detektor', - showDroneDetections: 'Visa drönardetekteringar' + showDroneDetections: 'Visa drönardetekteringar', + droneDetectionDetails: 'Drönardetekteringsdetaljer', + live: 'LIVE', + droneId: 'Drönar-ID', + type: 'Typ', + rssi: 'RSSI', + frequency: 'Frekvens', + detectionTimeline: 'Detekteringstidslinje', + firstDetected: 'Först detekterad', + latestDetection: 'Senaste detektion', + currentDetection: 'Aktuell detektion', + confidence: 'Konfidensgrad', + duration: 'Varaktighet', + detector: 'Detektor', + location: 'Plats', + realTimeAnalysis: 'Realtidsanalys', + firstDetection: 'Första detektion', + movementAnalysis: 'Rörelseanalys', + totalDetections: 'Totalt antal detektioner', + signalStrengthTrend: 'Signalstyrketrend', + lastDetections: 'Senaste 8 detektioner (äldsta till nyaste)', + approaching: 'NÄRMAR SIG', + retreating: 'DRAR SIG TILLBAKA', + stablePosition: 'STABIL POSITION', + rssiChange: 'RSSI-förändring', + over: 'över', + minutes: 'minuter', + instantTrend: 'Omedelbar trend', + strengthening: 'FÖRSTÄRKNING', + weakening: 'FÖRSVAGNING', + deviceName: 'Enhet', + unknown: 'Okänd' }, movementAlerts: { title: 'Rörelselarm',