feat: add api implementation

This commit is contained in:
Diego Mireles
2026-05-23 00:07:00 -06:00
parent 3297f3d9fa
commit 39bd572955
12 changed files with 799 additions and 45 deletions

View File

@@ -1,15 +1,67 @@
import { View, Text } from "react-native";
import { View, Text, StyleSheet } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { useRouter } from "expo-router";
import { COLORS } from "../constants/colors";
import PrimaryButton from "../components/PrimaryButton";
import { useApp } from "../context/AppContext";
export default function ProfileScreen() {
const { user, logout } = useApp();
const router = useRouter();
if (!user) {
return (
<SafeAreaView style={styles.container}>
<View style={styles.content}>
<Text style={styles.title}>No has iniciado sesión</Text>
<PrimaryButton
title="Iniciar sesión"
onPress={() => router.push("/login")}
/>
</View>
</SafeAreaView>
);
}
const handleLogout = () => {
logout();
router.replace("/login");
};
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<Text>Perfil</Text>
</View>
<SafeAreaView style={styles.container}>
<View style={styles.content}>
<Text style={styles.title}>Hola, {user.name}</Text>
<Text style={styles.email}>{user.email}</Text>
<View style={{ height: 24 }} />
<PrimaryButton title="Cerrar sesión" onPress={handleLogout} />
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: COLORS.background,
},
content: {
flex: 1,
padding: 24,
justifyContent: "center",
},
title: {
fontSize: 22,
fontWeight: "bold",
textAlign: "center",
marginBottom: 6,
},
email: {
fontSize: 14,
color: "#6B7280",
textAlign: "center",
marginBottom: 16,
},
});