diff --git a/frontend_admin/other/App copy.tsx b/frontend_admin/other/App copy.tsx deleted file mode 100644 index ba1e50e..0000000 --- a/frontend_admin/other/App copy.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import React, { useState } from "react"; -import "./App.css"; -import Header from "./Header"; - -function App() { - const [username, setUsername] = useState(""); - const [password, setPassword] = useState(""); - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - - try { - const response = await fetch("http://localhost:5002/api/login", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - username, - password, - }), - }); - - if (response.ok) { - console.log("Login successful"); - // Handle successful login here - } else { - console.log("Login failed"); - // Handle login error here - } - } catch (error) { - console.error("Login error:", error); - } - }; - - return ( - <> -
-
- - setUsername(e.target.value)} - required - /> -
-
- - setPassword(e.target.value)} - required - /> -
- -
- - ); -} - -export default App; diff --git a/frontend_admin/other/App.tsx b/frontend_admin/other/App.tsx deleted file mode 100644 index d1d4475..0000000 --- a/frontend_admin/other/App.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React, { useState } from "react"; -import Header from "./components/Header"; -import LoginCard from "./components/LoginCard"; - -function App() { - const [showLogin, setShowLogin] = useState(false); - - const handleLoginClick = () => setShowLogin(true); - const handleCloseLogin = () => setShowLogin(false); - - const handleLoginSubmit = (username: string, password: string) => { - // Hier kannst du fetch einbauen - alert(`Login: ${username} / ${password}`); - setShowLogin(false); - }; - - return ( -
-
-
- {/* Hier kommt später der Seiteninhalt */} - {showLogin && ( - - )} -
-
- ); -} - -export default App; diff --git a/frontend_admin/other/components/Header.tsx b/frontend_admin/other/components/Header.tsx deleted file mode 100644 index fa0fbb4..0000000 --- a/frontend_admin/other/components/Header.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from "react"; -import bike from "../../src/assets/bicycle-solid.svg"; -import user from "../../src/assets/circle-user-solid.svg"; - -type HeaderProps = { - onLoginClick: () => void; -}; - -const Header: React.FC = ({ onLoginClick }) => ( -
-
- Bike Logo - - Bikelane Web - -
-
- User Icon - -
-
-); - -export default Header; \ No newline at end of file diff --git a/frontend_admin/other/components/LoginCard.tsx b/frontend_admin/other/components/LoginCard.tsx deleted file mode 100644 index a59bf63..0000000 --- a/frontend_admin/other/components/LoginCard.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React, { useRef, useEffect } from "react"; - -type LoginCardProps = { - onClose: () => void; - onSubmit: (username: string, password: string) => void; -}; - -const LoginCard: React.FC = ({ onClose, onSubmit }) => { - const [username, setUsername] = React.useState(""); - const [password, setPassword] = React.useState(""); - const cardRef = useRef(null); - - useEffect(() => { - const handler = (e: MouseEvent) => { - if (cardRef.current && !cardRef.current.contains(e.target as Node)) { - onClose(); - } - }; - document.addEventListener("mousedown", handler); - return () => document.removeEventListener("mousedown", handler); - }, [onClose]); - - return ( -
-
-
- Login -
-
{ - e.preventDefault(); - onSubmit(username, password); - }} - > - - - -
-
-
- ); -}; - -export default LoginCard; diff --git a/frontend_admin/src/App.tsx b/frontend_admin/src/App.tsx index 3a41560..e9512e5 100644 --- a/frontend_admin/src/App.tsx +++ b/frontend_admin/src/App.tsx @@ -16,7 +16,7 @@ function App() { const [isAuthenticated, setIsAuthenticated] = useState( !!Cookies.get("token") ); - const [showLogin, setShowLogin] = useState(false); + const [, setShowLogin] = useState(false); return (