import React, { useState, FormEvent } from "react"; import { useNavigate } from "react-router-dom"; import { LogoIconLarge } from "../components/icons/Logo"; import { EyeIcon } from "../components/icons/ExportCommonIcons"; // import LoadingPage from "../components/templates/LoadingPage"; const UserAuth: React.FC = () => { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [error, setError] = useState(""); const [isSignIn, setIsSignIn] = useState(true); // Toggle between login and register const [userName, setUserName] = useState(""); // Username for registration const navigate = useNavigate(); const handleLogin = (e: FormEvent) => { e.preventDefault(); // Dummy validation for "account not found" if (email !== "user@example.com") { setError("Account not found"); } else { setError(""); console.log("Login Successful!"); console.log("Email:", email); console.log("Password:", password); } }; const handleRegister = (e: FormEvent) => { e.preventDefault(); // Dummy validation for registration if (email && password && userName) { setError(""); console.log("Registration Successful!"); console.log("Username:", userName); console.log("Email:", email); console.log("Password:", password); setIsSignIn(true); } else { setError("Please fill all the fields!"); } }; return ( <> {/* */}

Welcome to Dwinzo

{isSignIn ? ( <> Don’t have an account?{" "} setIsSignIn(false)} style={{ cursor: "pointer" }} > Register here! ) : ( <> Already have an account?{" "} setIsSignIn(true)} style={{ cursor: "pointer" }} > Login here! )}

{error &&
🛈 {error}
}
{!isSignIn && ( setUserName(e.target.value)} required /> )} setEmail(e.target.value)} required />
setPassword(e.target.value)} required />
{!isSignIn && (
I have read and agree to the terms of service
)}

By signing up for, or logging into, an account, you agree to our{" "} navigate("/privacy")} style={{ cursor: "pointer" }} > privacy policy {" "} &{" "} navigate("/terms")} style={{ cursor: "pointer" }} > terms of service {" "} whether you read them or not. You can also find these terms on our website.

); }; export default UserAuth;