import React, { useState } from 'react'; import { KeyboardAvoidingView, Platform, Pressable, StyleSheet, Text, TextInput, View, } from 'react-native'; import { useAuth } from '../lib/api'; import { C } from '../lib/theme'; export function LoginScreen() { const { login } = useAuth(); const [user, setUser] = useState('admin'); const [pass, setPass] = useState(''); const [err, setErr] = useState(''); const [busy, setBusy] = useState(false); const go = async () => { setBusy(true); setErr(''); try { const ok = await login(user.trim(), pass); if (!ok) setErr('Wrong password.'); else setPass(''); } catch { setErr('Network error — are you online?'); } finally { setBusy(false); } }; return ( ⚕️ Health Dashboard health.rehbock.xyz — private USER PASSWORD Unlock {err} ); } const s = StyleSheet.create({ wrap: { flex: 1, backgroundColor: C.bg, alignItems: 'center', justifyContent: 'center', padding: 24, }, card: { width: '100%', maxWidth: 340, backgroundColor: C.surface, borderWidth: 1, borderColor: C.border, borderRadius: 16, paddingVertical: 28, paddingHorizontal: 24, }, h1: { fontSize: 18, fontWeight: '600', color: C.text, marginBottom: 4 }, sub: { fontSize: 12, color: C.muted, marginBottom: 20 }, lbl: { fontSize: 11, color: C.muted, letterSpacing: 0.5, marginTop: 12, marginBottom: 5 }, input: { paddingVertical: 11, paddingHorizontal: 12, borderRadius: 10, borderWidth: 1, borderColor: C.border, backgroundColor: C.surface2, color: C.text, fontSize: 15, }, go: { marginTop: 20, padding: 12, borderRadius: 10, backgroundColor: C.accent, alignItems: 'center', }, err: { marginTop: 12, fontSize: 12.5, color: C.red, minHeight: 18 }, });