import React, { useState } from 'react'; interface AuthFormProps { type: 'signup' | 'login'; onSubmit: (data: { email: string; password: string }) => void; isLoading: boolean; error?: string; } const AuthForm: React.FC = ({ type, onSubmit, isLoading, error }) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); console.log('📝 AuthForm handleSubmit called with:', { email, password }); console.log('📝 onSubmit function is:', typeof onSubmit); if (typeof onSubmit === 'function') { console.log('🚀 Calling onSubmit function...'); onSubmit({ email, password }); } else { console.error('❌ onSubmit is not a function!', onSubmit); } }; return (

{type === 'signup' ? 'Create your account' : 'Sign in to your account'}

{type === 'signup' ? 'Join us today and organize your week' : 'Welcome back! Please enter your details'}

{error && (
{error}
)}
setEmail(e.target.value)} className="appearance-none rounded-lg relative block w-full pl-14 px-4 py-4 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 sm:text-base font-medium" placeholder="Email address" />
setPassword(e.target.value)} className="appearance-none rounded-lg relative block w-full pl-14 px-4 py-4 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 sm:text-base font-medium" placeholder="Password" />

Password must be at least 8 characters

{type === 'signup' ? (

Already have an account?{' '}

) : (

Don't have an account?{' '}

)}
); }; export default AuthForm;