import React, { useState } from 'react'; import { Calendar, Loader2, Server, User } from 'lucide-react'; import { atprotoService } from '../services/atproto'; import { useModalFocus } from '../hooks/useModalFocus'; interface AuthModalProps { isOpen: boolean; onSuccess: () => void; } export const AuthModal: React.FC = ({ isOpen, onSuccess }) => { const dialogRef = useModalFocus(isOpen, () => {}); const [identifier, setIdentifier] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(() => atprotoService.getAuthenticationError()); if (!isOpen) return null; const handleSubmit = async (event: React.FormEvent) => { event.preventDefault(); setError(null); setLoading(true); try { await atprotoService.startOAuthLogin(identifier); onSuccess(); } catch (reason) { setError(reason instanceof Error ? reason.message : 'Could not start OAuth sign-in.'); setLoading(false); } }; return (

CalendAT

Sign in through your AT Protocol provider

{error && (
{error}
)}
{identifier.startsWith('http') ? : } setIdentifier(event.target.value)} required autoComplete="username" placeholder="you.example.com or https://your-pds.example" className="w-full pl-9 pr-3 py-2 text-xs rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-primary-500 focus:border-transparent outline-none transition" />

You will continue securely with your provider. CalendAT never receives your password.

); };