diff --git a/App.tsx b/App.tsx index 28169f5..86249fa 100644 --- a/App.tsx +++ b/App.tsx @@ -21,6 +21,7 @@ const PERSONA_STORAGE_KEY = 'wohnprojekt_persona_cache'; const App: React.FC = () => { const [showLanding, setShowLanding] = useState(true); const [currentUser, setCurrentUser] = useState(null); + const [isLoggingIn, setIsLoggingIn] = useState(false); const [currentView, setCurrentView] = useState('chat'); const [isSidebarOpen, setIsSidebarOpen] = useState(false); @@ -95,14 +96,18 @@ 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) => { + setIsLoggingIn(true); + // Simulate network delay + await new Promise(resolve => setTimeout(resolve, 1000)); + const user = users.find(u => u.email.toLowerCase() === email.toLowerCase() && u.status === 'aktiv'); if (user) { setCurrentUser(user); } else { alert("Zugang verweigert. Nur verifizierte Wohnpro-Bewohner können sich im Wohnpro Guide anmelden."); } + setIsLoggingIn(false); }; const sendMessage = async (text: string) => { @@ -256,7 +261,7 @@ const App: React.FC = () => { Synchronisiere mit Nextcloud... )} - + ); } diff --git a/components/Icons.tsx b/components/Icons.tsx index 6d8f925..e551616 100644 --- a/components/Icons.tsx +++ b/components/Icons.tsx @@ -46,3 +46,26 @@ export const ChevronDownIcon = ({ className = "w-6 h-6" }) => ; export const ThumbsDownIcon = ({ className = "w-6 h-6" }) => ; export const DownloadIcon = ({ className = "w-6 h-6" }) => ; + +export const Spinner = ({ className = "w-6 h-6" }) => ( + + + + +); diff --git a/components/LoginView.tsx b/components/LoginView.tsx index a7c3c0b..abbf9d8 100644 --- a/components/LoginView.tsx +++ b/components/LoginView.tsx @@ -1,13 +1,14 @@ - import React, { useState } from 'react'; import { User } from '../types'; +import { Spinner } from './Icons'; interface LoginViewProps { onLogin: (email: string) => void; error?: string; + isLoading?: boolean; } -const LoginView: React.FC = ({ onLogin, error: externalError }) => { +const LoginView: React.FC = ({ onLogin, error: externalError, isLoading }) => { const [email, setEmail] = useState(''); const [error, setError] = useState(externalError || ''); @@ -42,15 +43,17 @@ const LoginView: React.FC = ({ onLogin, error: externalError }) onChange={(e) => { setEmail(e.target.value); setError(''); }} placeholder="Wohnpro E-Mail Adresse" className={`w-full bg-gray-50 border ${error ? 'border-red-200' : 'border-gray-100'} rounded-2xl px-6 py-4 focus:outline-none focus:ring-2 focus:ring-black/5 transition-all text-lg placeholder:text-gray-300`} + disabled={isLoading} /> {error &&

{error}

}