diff --git a/frontend/src/pages/LoginPage.js b/frontend/src/pages/LoginPage.js index 9cf067a..4cf2aa2 100644 --- a/frontend/src/pages/LoginPage.js +++ b/frontend/src/pages/LoginPage.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; -import { Form, Input, Button, Typography, Alert, message } from 'antd'; -import { LockOutlined, UserOutlined } from '@ant-design/icons'; +import { Form, Input, Button, Typography, Alert, message, Switch } from 'antd'; +import { LockOutlined, UserOutlined, SettingOutlined, SunOutlined, MoonOutlined } from '@ant-design/icons'; import { preserveFullUrl } from '../utils/urlUtils'; const { Title } = Typography; @@ -9,7 +9,30 @@ const { Title } = Typography; export default function LoginPage({ onLogin }) { const [loading, setLoading] = useState(false); const [error, setError] = useState(null); - const darkMode = typeof window !== 'undefined' && localStorage.getItem('darkMode') === 'true'; + const [isAdminMode, setIsAdminMode] = useState(false); + const [darkMode, setDarkMode] = useState( + typeof window !== 'undefined' && localStorage.getItem('darkMode') === 'true' + ); + + const toggleDarkMode = () => { + const newDarkMode = !darkMode; + setDarkMode(newDarkMode); + localStorage.setItem('darkMode', newDarkMode.toString()); + + // Update HTML class for immediate visual feedback + const htmlElement = document.documentElement; + const bodyElement = document.body; + + if (newDarkMode) { + htmlElement.classList.add('dark-mode'); + htmlElement.style.backgroundColor = '#181818'; + bodyElement.style.backgroundColor = '#181818'; + } else { + htmlElement.classList.remove('dark-mode'); + htmlElement.style.backgroundColor = '#f5f5f5'; + bodyElement.style.backgroundColor = '#f5f5f5'; + } + }; const onFinish = async (values) => { setLoading(true); @@ -53,8 +76,27 @@ export default function LoginPage({ onLogin }) { display: 'flex', alignItems: 'center', justifyContent: 'center', + position: 'relative' }} > + {/* Dark Mode Toggle in der oberen rechten Ecke */} +