import { useState } from 'react'; import { useNavigate } from 'react-router'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faEye, faEyeSlash } from '@fortawesome/pro-duotone-svg-icons'; import { useAuth } from '@/providers/auth-provider'; import { Button } from '@/components/base/buttons/button'; import { SocialButton } from '@/components/base/buttons/social-button'; import { Checkbox } from '@/components/base/checkbox/checkbox'; 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 saved = localStorage.getItem('helix_remember'); const savedCreds = saved ? JSON.parse(saved) : null; const [email, setEmail] = useState(savedCreds?.email ?? ''); const [password, setPassword] = useState(savedCreds?.password ?? ''); const [showPassword, setShowPassword] = useState(false); const [rememberMe, setRememberMe] = useState(!!savedCreds); 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(); if (rememberMe) { localStorage.setItem('helix_remember', JSON.stringify({ email, password })); } else { localStorage.removeItem('helix_remember'); } 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 */}