Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
pnpm-lock.yaml
3 changes: 1 addition & 2 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ const App: React.FC = () => {
localStorage.setItem(PERSONA_STORAGE_KEY, JSON.stringify(personas));
}, [personas]);

const handleLogin = (email: string) => {
// If we have users loaded (from NC or Init), check them
const handleLogin = async (email: string): Promise<void> => {
const user = users.find(u => u.email.toLowerCase() === email.toLowerCase() && u.status === 'aktiv');
if (user) {
setCurrentUser(user);
Expand Down
24 changes: 19 additions & 5 deletions components/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@ import React, { useState } from 'react';
import { User } from '../types';

interface LoginViewProps {
onLogin: (email: string) => void;
onLogin: (email: string) => Promise<void>;
error?: string;
}

const LoginView: React.FC<LoginViewProps> = ({ onLogin, error: externalError }) => {
const [email, setEmail] = useState('');
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(externalError || '');

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

return (
Expand Down Expand Up @@ -48,9 +54,17 @@ 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"
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:bg-gray-800 disabled:cursor-not-allowed flex items-center justify-center"
disabled={isLoading}
>
Guide öffnen
{isLoading ? (
<>
<div className="w-5 h-5 border-2 border-white/20 border-t-white rounded-full animate-spin mr-3" />
<span className="animate-pulse">Wird geladen...</span>
</>
) : (
'Guide öffnen'
)}
</button>
</form>

Expand Down