Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions components/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ interface LoginViewProps {
const LoginView: React.FC<LoginViewProps> = ({ onLogin, error: externalError }) => {
const [email, setEmail] = useState('');
const [error, setError] = useState(externalError || '');
const [isLoading, setIsLoading] = useState(false);

const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!email) {
setError('Bitte gib deine Wohnpro E-Mail Adresse ein.');
return;
}
onLogin(email);
setIsLoading(true);

// Simulate network delay for better UX feedback
setTimeout(() => {
onLogin(email);
// If login fails, we need to re-enable the button.
// If it succeeds, this component unmounts anyway.
setIsLoading(false);
}, 1000);
};

return (
Expand Down Expand Up @@ -48,9 +57,14 @@ const LoginView: React.FC<LoginViewProps> = ({ onLogin, error: externalError })

<button
type="submit"
className="w-full bg-black text-white rounded-2xl py-4 font-semibold text-lg hover:bg-gray-900 active:scale-[0.98] transition-all shadow-lg shadow-black/5"
disabled={isLoading}
className="w-full bg-black text-white rounded-2xl py-4 font-semibold text-lg hover:bg-gray-900 active:scale-[0.98] transition-all shadow-lg shadow-black/5 flex items-center justify-center disabled:bg-gray-800"
>
Guide öffnen
{isLoading ? (
<div className="w-6 h-6 border-2 border-white/30 border-t-white rounded-full animate-spin" />
) : (
'Guide öffnen'
)}
</button>
</form>

Expand Down