/** * AddAccountModal.tsx * * @author Descomplicar® Crescimento Digital * @link https://descomplicar.pt * @copyright 2025 Descomplicar® */ import React, { useState } from 'react'; import type { Account } from '../types'; import { GmailIcon } from './icons/GmailIcon'; import { OutlookIcon } from './icons/OutlookIcon'; import { YahooIcon } from './icons/YahooIcon'; import { ImapIcon } from './icons/ImapIcon'; import AddImapAccountForm from './AddImapAccountForm'; interface AddAccountModalProps { isOpen: boolean; onClose: () => void; onAddAccount: (account: Omit) => void; } const AddAccountModal: React.FC = ({ isOpen, onClose, onAddAccount }) => { const [view, setView] = useState<'providers' | 'imapForm'>('providers'); if (!isOpen) return null; const handleProviderClick = (provider: Account['provider']) => { const email = `novo.usuario.${Math.floor(Math.random() * 1000)}@${provider}.com`; onAddAccount({ email, provider }); }; const handleImapConnect = (email: string) => { onAddAccount({ email, provider: 'imap' }); } const providers: { name: Account['provider'], icon: React.ReactNode }[] = [ { name: 'gmail', icon: }, { name: 'outlook', icon: }, { name: 'yahoo', icon: }, ]; return (
e.stopPropagation()} >
{view === 'providers' ? ( <>

Selecione seu provedor de e-mail para conectar sua conta com segurança.

{providers.map(provider => ( ))}
) : ( setView('providers')} /> )}
); }; export default AddAccountModal;