import { useState } from 'react' import { authRepository } from '../repositories/authRepository.js' import { BrandLogo } from '../components/Brand.jsx' import { FeatureBadge, FeatureCallout } from '../components/FeatureState.jsx' import loginClinicImage from '../assets/figma/login-clinic.png' const mockCredentials = [ { label: 'Admin', email: 'hugo@popcode.com.br', password: 'hdoria' }, { label: 'Médico', email: 'leticia.lacerda@souunit.com.br', password: 'Senha@123' }, { label: 'Secretária', email: 'recepcao@mediconnect.com', password: 'demo12345' }, { label: 'Gestor', email: 'gestao@mediconnect.com', password: '12345678' }, ] export function LoginPage({ navigate }) { const [form, setForm] = useState({ email: '', password: '', }) const [showPassword, setShowPassword] = useState(false) const [credentialsOpen, setCredentialsOpen] = useState(false) const [loading, setLoading] = useState(false) const [error, setError] = useState('') function updateField(field, value) { setForm((current) => ({ ...current, [field]: value })) } async function handleSubmit(event) { event.preventDefault() setLoading(true) setError('') try { await authRepository.login(form) navigate('/inicio') } catch (err) { setError(err.message || 'Erro de autenticação') } finally { setLoading(false) } } return (

Entrar

Bem-vindo(a) de volta! Acesse sua conta.

{error && (
{error}
)}
updateField('email', event.target.value)} placeholder="seu@email.com" type="email" value={form.email} /> navigate('/recuperar-senha')} type="button" > Esqueceu a senha? } htmlFor="login-password" label="Senha" >
updateField('password', event.target.value)} placeholder="••••••••" type={showPassword ? 'text' : 'password'} value={form.password} />
{credentialsOpen ? (

Credenciais mockadas

{mockCredentials.map((credential) => ( ))}
) : null}
) } export function RegisterPage({ navigate }) { const [role, setRole] = useState('Clínica') return (
{ event.preventDefault() navigate('/inicio') }} >
{['Clínica', 'Profissional'].map((option) => ( ))}
) } export function ForgotPasswordPage({ navigate }) { const [sent, setSent] = useState(false) const [email, setEmail] = useState('recepcao@mediconnect.com') const [error, setError] = useState('') const [loading, setLoading] = useState(false) async function handleSubmit(event) { event.preventDefault() setLoading(true) setError('') try { await authRepository.requestPasswordReset(email) setSent(true) } catch (err) { setError(err.message || 'Erro ao comunicar com o servidor.') } finally { setLoading(false) } } return ( {sent ? (
Link de recuperação enviado para o e-mail informado. Siga as instruções do link!
) : (
{error && (
{error}
)} setEmail(e.target.value)} value={email} type="email" />
)}
) } function AuthLayout({ children, description, title }) { return (

{title}

{description}

{children}
) } const authInputClass = 'h-11 w-full rounded-[6px] border border-white/10 bg-white/[0.05] px-4 text-sm text-white outline-none transition placeholder:text-white/30 focus:border-[#3b82f6] focus:ring-2 focus:ring-[#3b82f6]/20' function AuthField({ children, label }) { return ( ) } function LoginField({ action, children, htmlFor, label }) { return (
{action} {children}
) } function LoginLogo() { return ( ) } function LoginMetric({ label, value }) { return (
{value}
{label}
) } function EyeIcon() { return ( ) }