import React, { useState } from 'react'; import { supabase } from '../services/supabase'; import { LogIn, Mail, Lock, UserPlus, ArrowLeft, RefreshCw, CheckCircle2 } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; import AubixIcon from './AubixIcon'; const Login: React.FC = () => { const [isSignUp, setIsSignUp] = useState(false); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [fullName, setFullName] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [success, setSuccess] = useState(null); const handleLogin = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(null); const { error } = await supabase.auth.signInWithPassword({ email, password }); if (error) setError(error.message); setLoading(false); }; const handleSignUp = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(null); setSuccess(null); const { error } = await supabase.auth.signUp({ email, password, options: { data: { full_name: fullName, } } }); if (error) { setError(error.message); } else { setSuccess('Account created! You can now sign in.'); setIsSignUp(false); setFullName(''); } setLoading(false); }; return (

{isSignUp ? 'Join Aubm' : 'Welcome'}

{isSignUp ? 'Create your agent operator profile' : 'Access the Aubm Orchestrator'}

{success && ( {success} )}
{isSignUp && (
setFullName(e.target.value)} required={isSignUp} style={{ width: '100%', padding: '0.8rem 1rem 0.8rem 2.5rem', background: 'rgba(255,255,255,0.05)', border: '1px solid var(--glass-border)', borderRadius: 'var(--radius-md)', color: 'white', outline: 'none' }} />
)}
setEmail(e.target.value)} required style={{ width: '100%', padding: '0.8rem 1rem 0.8rem 2.5rem', background: 'rgba(255,255,255,0.05)', border: '1px solid var(--glass-border)', borderRadius: 'var(--radius-md)', color: 'white', outline: 'none' }} />
setPassword(e.target.value)} required style={{ width: '100%', padding: '0.8rem 1rem 0.8rem 2.5rem', background: 'rgba(255,255,255,0.05)', border: '1px solid var(--glass-border)', borderRadius: 'var(--radius-md)', color: 'white', outline: 'none' }} />
{error &&
{error}
}
); }; export default Login;