From a1074227f15e6423ab2571bb436266f0c18d1801 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Fri, 19 Sep 2025 13:00:48 +0200 Subject: [PATCH] Fix jwt-token --- client/src/main.jsx | 1 + .../components/common/LanguageSelector.jsx | 70 +++++++++++++++++++ management/src/main.jsx | 1 + 3 files changed, 72 insertions(+) create mode 100644 management/src/components/common/LanguageSelector.jsx diff --git a/client/src/main.jsx b/client/src/main.jsx index 4f7f073..82e3060 100644 --- a/client/src/main.jsx +++ b/client/src/main.jsx @@ -2,6 +2,7 @@ import React from 'react' import ReactDOM from 'react-dom/client' import App from './App.jsx' import './index.css' +import './i18n' // Initialize i18n // Suppress browser extension errors in development if (process.env.NODE_ENV === 'development') { diff --git a/management/src/components/common/LanguageSelector.jsx b/management/src/components/common/LanguageSelector.jsx new file mode 100644 index 0000000..6914005 --- /dev/null +++ b/management/src/components/common/LanguageSelector.jsx @@ -0,0 +1,70 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { Menu, Transition } from '@headlessui/react'; +import { Fragment } from 'react'; +import { Globe, ChevronDown, Check } from 'lucide-react'; + +const languages = [ + { code: 'en', name: 'English', flag: 'πŸ‡ΊπŸ‡Έ' }, + { code: 'sv', name: 'Svenska', flag: 'πŸ‡ΈπŸ‡ͺ' } +]; + +export default function LanguageSelector({ className = '' }) { + const { i18n, t } = useTranslation(); + + const currentLanguage = languages.find(lang => lang.code === i18n.language) || languages[0]; + + const changeLanguage = (languageCode) => { + i18n.changeLanguage(languageCode); + }; + + return ( + +
+ + + {currentLanguage.flag} + {currentLanguage.name} + + +
+ + + +
+ {languages.map((language) => ( + + {({ active }) => ( + + )} + + ))} +
+
+
+
+ ); +} \ No newline at end of file diff --git a/management/src/main.jsx b/management/src/main.jsx index 54b39dd..39b83fa 100644 --- a/management/src/main.jsx +++ b/management/src/main.jsx @@ -2,6 +2,7 @@ import React from 'react' import ReactDOM from 'react-dom/client' import App from './App.jsx' import './index.css' +import './i18n' // Initialize i18n ReactDOM.createRoot(document.getElementById('root')).render(