import { useState } from 'react'; import { useNavigate } from 'react-router'; import { useAuth } from '@/providers/auth-provider'; import { Button } from '@/components/base/buttons/button'; import { SocialButton } from '@/components/base/buttons/social-button'; import { Input } from '@/components/base/input/input'; const features = [ { title: 'Unified Lead Inbox', description: 'All channels in one workspace', }, { title: 'Campaign Intelligence', description: 'Real-time performance tracking', }, { title: 'Speed to Contact', description: 'Automated assignment and outreach', }, ]; export const LoginPage = () => { const { loginWithUser } = useAuth(); const navigate = useNavigate(); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(null); const [isLoading, setIsLoading] = useState(false); const handleSubmit = async (event: React.FormEvent) => { event.preventDefault(); setError(null); if (!email || !password) { setError('Email and password are required'); return; } setIsLoading(true); try { const { apiClient } = await import('@/lib/api-client'); const response = await apiClient.login(email, password); // Build user from sidecar response const u = response.user; const firstName = u?.firstName ?? ''; const lastName = u?.lastName ?? ''; const name = `${firstName} ${lastName}`.trim() || email; const initials = `${firstName[0] ?? ''}${lastName[0] ?? ''}`.toUpperCase() || email[0].toUpperCase(); loginWithUser({ id: u?.id, name, initials, role: (u?.role ?? 'executive') as 'executive' | 'admin' | 'cc-agent', email: u?.email ?? email, avatarUrl: u?.avatarUrl, platformRoles: u?.platformRoles, }); navigate('/'); } catch (err: any) { setError(err.message); setIsLoading(false); } }; const handleGoogleSignIn = () => { setError('Google sign-in not yet configured'); }; return (
{/* Left panel — 60% — hidden on mobile */}
{/* Abstract corner gradients */}