Fix jwt-token

This commit is contained in:
2025-09-19 14:39:00 +02:00
parent 348b489b0e
commit 9145a9f4d9
2 changed files with 79 additions and 19 deletions

View File

@@ -426,7 +426,7 @@ const Devices = () => {
<div className="mt-3">
<div className="flex items-center justify-between mb-4">
<h3 className="text-lg font-medium text-gray-900">
Device Details
{t('devices.deviceDetails')}
</h3>
<button
onClick={() => setShowDetailsModal(false)}
@@ -438,64 +438,64 @@ const Devices = () => {
<div className="space-y-3 text-sm">
<div className="flex justify-between">
<span className="font-medium text-gray-700">Device ID:</span>
<span className="font-medium text-gray-700">{t('devices.deviceId')}:</span>
<span className="text-gray-900">{selectedDevice.id}</span>
</div>
<div className="flex justify-between">
<span className="font-medium text-gray-700">Name:</span>
<span className="text-gray-900">{selectedDevice.name || 'Unnamed'}</span>
<span className="font-medium text-gray-700">{t('devices.name')}:</span>
<span className="text-gray-900">{selectedDevice.name || t('devices.unnamed')}</span>
</div>
<div className="flex justify-between">
<span className="font-medium text-gray-700">Status:</span>
<span className="font-medium text-gray-700">{t('devices.status')}:</span>
<span className={`px-2 py-1 rounded-full text-xs font-medium ${
getStatusColor(selectedDevice.stats?.status)
}`}>
{selectedDevice.stats?.status || 'Unknown'}
{selectedDevice.stats?.status ? t(`devices.${selectedDevice.stats.status}`) : t('devices.unknown')}
</span>
</div>
<div className="flex justify-between">
<span className="font-medium text-gray-700">Approved:</span>
<span className="font-medium text-gray-700">{t('devices.approved')}:</span>
<span className={`px-2 py-1 rounded-full text-xs font-medium ${
selectedDevice.is_approved ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800'
}`}>
{selectedDevice.is_approved ? 'Yes' : 'Pending'}
{selectedDevice.is_approved ? t('devices.yes') : t('devices.pending')}
</span>
</div>
{selectedDevice.location_description && (
<div className="flex justify-between">
<span className="font-medium text-gray-700">Location:</span>
<span className="font-medium text-gray-700">{t('devices.location')}:</span>
<span className="text-gray-900 text-right">{selectedDevice.location_description}</span>
</div>
)}
{(selectedDevice.geo_lat && selectedDevice.geo_lon) && (
<div className="flex justify-between">
<span className="font-medium text-gray-700">Coordinates:</span>
<span className="font-medium text-gray-700">{t('devices.coordinates')}:</span>
<span className="text-gray-900">{selectedDevice.geo_lat}, {selectedDevice.geo_lon}</span>
</div>
)}
{selectedDevice.last_heartbeat && (
<div className="flex justify-between">
<span className="font-medium text-gray-700">Last Heartbeat:</span>
<span className="font-medium text-gray-700">{t('devices.lastHeartbeat')}:</span>
<span className="text-gray-900">{format(new Date(selectedDevice.last_heartbeat), 'MMM dd, yyyy HH:mm')}</span>
</div>
)}
{selectedDevice.firmware_version && (
<div className="flex justify-between">
<span className="font-medium text-gray-700">Firmware:</span>
<span className="font-medium text-gray-700">{t('devices.firmware')}:</span>
<span className="text-gray-900">{selectedDevice.firmware_version}</span>
</div>
)}
{selectedDevice.stats && (
<div className="flex justify-between">
<span className="font-medium text-gray-700">Detections (24h):</span>
<span className="font-medium text-gray-700">{t('devices.detections24h')}:</span>
<span className={`font-medium ${
selectedDevice.stats.detections_24h > 0 ? 'text-red-600' : 'text-green-600'
}`}>
@@ -506,7 +506,7 @@ const Devices = () => {
{selectedDevice.created_at && (
<div className="flex justify-between">
<span className="font-medium text-gray-700">Created:</span>
<span className="font-medium text-gray-700">{t('alerts.created')}:</span>
<span className="text-gray-900">{format(new Date(selectedDevice.created_at), 'MMM dd, yyyy HH:mm')}</span>
</div>
)}
@@ -521,7 +521,7 @@ const Devices = () => {
}}
className="flex-1 bg-green-100 text-green-700 py-2 px-3 rounded hover:bg-green-200 transition-colors text-sm font-medium"
>
Approve
{t('devices.approve')}
</button>
)}