import React, { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { Hexagon, Lock, Mail, ArrowRight, Loader2, Info } from 'lucide-react'; import { USERS } from '../constants'; export const Login: React.FC = () => { const navigate = useNavigate(); const [isLoading, setIsLoading] = useState(false); const [email, setEmail] = useState('lidya@fasto.com'); const [password, setPassword] = useState('password'); const [error, setError] = useState(''); const handleLogin = (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); setError(''); // Simulate API call and validation setTimeout(() => { const user = USERS.find(u => u.email.toLowerCase() === email.toLowerCase()); if (user) { // Mock Login: Save to local storage localStorage.setItem('ctms_user_id', user.id); setIsLoading(false); // Redirect based on role if (user.role === 'super_admin') { navigate('/super-admin'); } else { navigate('/'); } } else { setIsLoading(false); setError('Usuário não encontrado. Tente lidya@fasto.com ou root@system.com'); } }, 1000); }; const fillCredentials = (type: 'admin' | 'super') => { if (type === 'admin') { setEmail('lidya@fasto.com'); } else { setEmail('root@system.com'); } setPassword('password'); }; return (