From 32245f113287d05dd396345dd045ec5306ee923a Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Fri, 19 Sep 2025 14:13:24 +0200 Subject: [PATCH] Fix jwt-token --- client/src/components/Layout.jsx | 4 +- client/src/pages/Alerts.jsx | 8 +- client/src/pages/Devices.jsx | 8 +- client/src/pages/Login.jsx | 15 +- client/src/pages/MapView.jsx | 5 +- client/src/pages/Settings.jsx | 4 +- client/src/utils/tempTranslations.js | 302 +++++++++++++++++++++++++-- 7 files changed, 312 insertions(+), 34 deletions(-) diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx index 62ab631..c5f8be3 100644 --- a/client/src/components/Layout.jsx +++ b/client/src/components/Layout.jsx @@ -33,7 +33,7 @@ const Layout = () => { // Build navigation based on user permissions with translations const baseNavigation = [ { name: t('navigation.dashboard'), href: '/', icon: HomeIcon }, - { name: 'Map View', href: '/map', icon: MapIcon }, // TODO: Add to translations + { name: t('navigation.map'), href: '/map', icon: MapIcon }, { name: t('navigation.devices'), href: '/devices', icon: ServerIcon }, { name: t('navigation.detections'), href: '/detections', icon: ExclamationTriangleIcon }, { name: t('navigation.alerts'), href: '/alerts', icon: BellIcon }, @@ -106,7 +106,7 @@ const Layout = () => {

- {navigation?.find(item => item.href === location.pathname)?.name || 'Drone Detection System'} + {navigation?.find(item => item.href === location.pathname)?.name || t('app.title')}

diff --git a/client/src/pages/Alerts.jsx b/client/src/pages/Alerts.jsx index 4e28561..a6c0e8d 100644 --- a/client/src/pages/Alerts.jsx +++ b/client/src/pages/Alerts.jsx @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import api from '../services/api'; import { format } from 'date-fns'; +import { t } from '../utils/tempTranslations'; import { PlusIcon, BellIcon, @@ -106,6 +107,7 @@ const Alerts = () => { return (
+ {t('alerts.loading')}
); } @@ -115,10 +117,10 @@ const Alerts = () => {

- Alert Management + {t('alerts.title')}

- Configure and monitor alert rules for drone detections + {t('alerts.description')}

diff --git a/client/src/pages/Devices.jsx b/client/src/pages/Devices.jsx index 2e903c0..a6289e3 100644 --- a/client/src/pages/Devices.jsx +++ b/client/src/pages/Devices.jsx @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import api from '../services/api'; import { format } from 'date-fns'; +import { t } from '../utils/tempTranslations'; import { PlusIcon, PencilIcon, @@ -145,6 +146,7 @@ const Devices = () => { return (
+ {t('devices.loading')}
); } @@ -154,10 +156,10 @@ const Devices = () => {

- Devices + {t('devices.title')}

- Manage your drone detection devices + {t('devices.description')} {pendingCount > 0 && ( {pendingCount} pending approval @@ -170,7 +172,7 @@ const Devices = () => { className="btn btn-primary flex items-center space-x-2" > - Add Device + {t('devices.addDevice')}

diff --git a/client/src/pages/Login.jsx b/client/src/pages/Login.jsx index ff55df9..e4ad987 100644 --- a/client/src/pages/Login.jsx +++ b/client/src/pages/Login.jsx @@ -4,6 +4,7 @@ import { useAuth } from '../contexts/AuthContext'; import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'; import toast from 'react-hot-toast'; import api from '../services/api'; +import { t } from '../utils/tempTranslations'; const Login = () => { const [credentials, setCredentials] = useState({ @@ -42,7 +43,7 @@ const Login = () => {
-

Loading...

+

{t('common.loading')}

); @@ -100,7 +101,7 @@ const Login = () => { {tenantConfig?.tenant_name || 'Drone Detection System'}

- Sign in to your account + {t('auth.signIn')}

{tenantConfig?.auth_provider && (

@@ -115,7 +116,7 @@ const Login = () => {

{ type="text" required className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-primary-500 focus:border-primary-500 focus:z-10 sm:text-sm" - placeholder="Username or Email" + placeholder={t('auth.username')} value={credentials.username} onChange={handleChange} disabled={loading} @@ -131,7 +132,7 @@ const Login = () => {
{ type={showPassword ? 'text' : 'password'} required className="appearance-none rounded-none relative block w-full px-3 py-2 pr-10 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-primary-500 focus:border-primary-500 focus:z-10 sm:text-sm" - placeholder="Password" + placeholder={t('auth.password')} value={credentials.password} onChange={handleChange} disabled={loading} @@ -167,7 +168,7 @@ const Login = () => { {loading ? (
) : ( - 'Sign in' + t('auth.signIn') )}
diff --git a/client/src/pages/MapView.jsx b/client/src/pages/MapView.jsx index 329f4b2..f5ddff8 100644 --- a/client/src/pages/MapView.jsx +++ b/client/src/pages/MapView.jsx @@ -6,6 +6,7 @@ import L from 'leaflet'; // For divIcon and other Leaflet utilities import { useSocket } from '../contexts/SocketContext'; import api from '../services/api'; import { format } from 'date-fns'; +import { t } from '../utils/tempTranslations'; import { ServerIcon, ExclamationTriangleIcon, @@ -324,10 +325,10 @@ const MapView = () => {

- Device Map + {t('map.title')}

- Real-time view of all devices and drone detections + {t('map.description')}

diff --git a/client/src/pages/Settings.jsx b/client/src/pages/Settings.jsx index 6e4fd33..f37ecab 100644 --- a/client/src/pages/Settings.jsx +++ b/client/src/pages/Settings.jsx @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'; import { useAuth } from '../contexts/AuthContext'; import api from '../services/api'; import toast from 'react-hot-toast'; +import { t } from '../utils/tempTranslations'; import { CogIcon, ShieldCheckIcon, @@ -90,6 +91,7 @@ const Settings = () => { return (
+ {t('settings.loading')}
); } @@ -115,7 +117,7 @@ const Settings = () => {

- Tenant Settings + {t('settings.title')}