import React, { useState, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { User, Briefcase, Lock, ArrowRight, AlertCircle, Home } from 'lucide-react'; import { SpotlightCard } from '../components/SpotlightCard'; // Rainbow Button Component const RainbowButton = ({ children, onClick, type = "button", className = "" }) => { const btnRef = useRef(null); const [position, setPosition] = useState({ x: 0, y: 0 }); const [opacity, setOpacity] = useState(0); const handleMouseMove = (e) => { if (!btnRef.current) return; const rect = btnRef.current.getBoundingClientRect(); setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top }); }; return ( ); }; const Login = () => { const [isEmployee, setIsEmployee] = useState(false); const [identifier, setIdentifier] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const { login } = useAuth(); const navigate = useNavigate(); const handleLogin = (e) => { e.preventDefault(); setError(''); if (!identifier || !password) { setError('Please fill in all fields'); return; } const type = isEmployee ? 'employee' : 'customer'; const result = login(identifier, password, type); if (result.success) { if (type === 'customer') { navigate('/'); } else { navigate('/emp/fa/dashboard'); // Default for employees } } else { setError(result.message); } }; const fillDemo = (role) => { if (role === 'customer') { setIsEmployee(false); setIdentifier('alice'); setPassword('password'); } else if (role === 'agent') { setIsEmployee(true); setIdentifier('FA001'); setPassword('password'); } else if (role === 'admin') { setIsEmployee(true); setIdentifier('ADM01'); setPassword('password'); } }; return (
{/* Subtle Ambient Background */}

Welcome Back

Sign in to your Plano Realty account

{/* Neo-Toggle */}
{isEmployee ? : }
setIdentifier(e.target.value)} className="w-full bg-zinc-100 dark:bg-black/20 border border-zinc-200 dark:border-white/5 text-zinc-900 dark:text-white rounded-xl py-4 pl-12 pr-4 focus:outline-none focus:ring-1 focus:ring-black/10 dark:focus:ring-white/20 focus:bg-white dark:focus:bg-black/40 transition-all placeholder:text-zinc-400 dark:placeholder:text-zinc-700 font-medium" placeholder={isEmployee ? "e.g., FA001" : "e.g., alice"} />
setPassword(e.target.value)} className="w-full bg-zinc-100 dark:bg-black/20 border border-zinc-200 dark:border-white/5 text-zinc-900 dark:text-white rounded-xl py-4 pl-12 pr-4 focus:outline-none focus:ring-1 focus:ring-black/10 dark:focus:ring-white/20 focus:bg-white dark:focus:bg-black/40 transition-all placeholder:text-zinc-400 dark:placeholder:text-zinc-700 font-medium" placeholder="Enter your password" />
{error && (
{error}
)} Sign In
{/* Demo Quick Links */}

Quick Demo Access

); }; export default Login;