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
5 changes: 4 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const App: React.FC = () => {
const [sessions, setSessions] = useState<ChatSession[]>([]);
const [currentSessionId, setCurrentSessionId] = useState<string | null>(null);
const [isLoading, setIsLoading] = useState(false);
const [isLoggingIn, setIsLoggingIn] = useState(false);
const [isFaqGenerating, setIsFaqGenerating] = useState(false);
const [generatingStatus, setGeneratingStatus] = useState('');
const [isSyncing, setIsSyncing] = useState(false);
Expand Down Expand Up @@ -96,13 +97,15 @@ const App: React.FC = () => {
}, [personas]);

const handleLogin = (email: string) => {
setIsLoggingIn(true);
// If we have users loaded (from NC or Init), check them
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) => {
Expand Down Expand Up @@ -256,7 +259,7 @@ const App: React.FC = () => {
Synchronisiere mit Nextcloud...
</div>
)}
<LoginView onLogin={handleLogin} />
<LoginView onLogin={handleLogin} isLoading={isLoggingIn} />
</>
);
}
Expand Down
15 changes: 12 additions & 3 deletions components/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { User } from '../types';
interface LoginViewProps {
onLogin: (email: string) => void;
error?: string;
isLoading: boolean;
}

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

Expand Down Expand Up @@ -48,9 +49,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"
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-4 border-white/30 border-t-white rounded-full animate-spin" />
<span className="sr-only">Wird geladen...</span>
</>
) : (
'Guide öffnen'
)}
</button>
</form>

Expand Down