feat(frontend): register, guide, feedback, addresses & status polling
- Add register screen with onboarding redirect to address validation - Add waste separation guide screen with 4 categories and offline tips (organicos, reciclables, sanitarios, especiales) plus preventive messaging banner - Add feedback submission screen with 4 types and 1-5 star rating - Add address screen: list colonias, pick one, validate against backend - Switch from pull-to-refresh GPS hack to periodic polling of /tracking/status (30s) — backend now drives the simulation - Filter notifications by logged-in user.id (tunnel-view on client side) - Add register/logout/address actions to profile screen - Hide login/register/feedback/addresses from tab bar (href: null) - Set API_URL to LAN IP for physical phone testing over hotspot
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { View, Text, StyleSheet } from "react-native";
|
||||
import { View, Text, StyleSheet, Alert } from "react-native";
|
||||
import { SafeAreaView } from "react-native-safe-area-context";
|
||||
import { useRouter } from "expo-router";
|
||||
|
||||
@@ -6,11 +6,25 @@ import { COLORS } from "../constants/colors";
|
||||
import PrimaryButton from "../components/PrimaryButton";
|
||||
|
||||
import { useApp } from "../context/AppContext";
|
||||
import { resetDemo } from "../services/tracking.service";
|
||||
|
||||
export default function ProfileScreen() {
|
||||
const { user, logout } = useApp();
|
||||
const { user, logout, refreshStatus } = useApp();
|
||||
const router = useRouter();
|
||||
|
||||
const handleResetDemo = async () => {
|
||||
try {
|
||||
await resetDemo();
|
||||
await refreshStatus();
|
||||
Alert.alert("Demo reiniciado", "Estado y notificaciones borradas.");
|
||||
} catch (err) {
|
||||
Alert.alert(
|
||||
"Error",
|
||||
err instanceof Error ? err.message : "No se pudo reiniciar",
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
if (!user) {
|
||||
return (
|
||||
<SafeAreaView style={styles.container}>
|
||||
@@ -35,7 +49,30 @@ export default function ProfileScreen() {
|
||||
<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="Mi domicilio"
|
||||
onPress={() => router.push("/addresses")}
|
||||
/>
|
||||
|
||||
<View style={{ height: 12 }} />
|
||||
|
||||
<PrimaryButton
|
||||
title="Buzón de retroalimentación"
|
||||
onPress={() => router.push("/feedback")}
|
||||
/>
|
||||
|
||||
<View style={{ height: 12 }} />
|
||||
|
||||
<PrimaryButton
|
||||
title="Reiniciar demo"
|
||||
onPress={handleResetDemo}
|
||||
/>
|
||||
|
||||
<View style={{ height: 12 }} />
|
||||
|
||||
<PrimaryButton title="Cerrar sesión" onPress={handleLogout} />
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
|
||||
Reference in New Issue
Block a user