summaryrefslogtreecommitdiffstats
path: root/src/app/(protected)/(tabs)/reservations/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/(protected)/(tabs)/reservations/index.tsx')
-rw-r--r--src/app/(protected)/(tabs)/reservations/index.tsx92
1 files changed, 84 insertions, 8 deletions
diff --git a/src/app/(protected)/(tabs)/reservations/index.tsx b/src/app/(protected)/(tabs)/reservations/index.tsx
index 817ec6e..56f7832 100644
--- a/src/app/(protected)/(tabs)/reservations/index.tsx
+++ b/src/app/(protected)/(tabs)/reservations/index.tsx
@@ -1,10 +1,55 @@
-import { StyleSheet, Text, View } from 'react-native';
+import {
+ ActivityIndicator,
+ FlatList,
+ Pressable,
+ StyleSheet,
+ Text,
+ View,
+} from 'react-native';
+import { useReservations } from '@/features/reservations/hooks/useReservations';
export default function ReservationsScreen() {
+ const { reservations, loading, error, reload } = useReservations();
+
+ if (loading) {
+ return (
+ <View style={styles.center}>
+ <ActivityIndicator size="large" />
+ </View>
+ );
+ }
+
+ if (error) {
+ return (
+ <View style={styles.center}>
+ <Text style={styles.error}>{error}</Text>
+ <Pressable style={styles.button} onPress={reload}>
+ <Text style={styles.buttonText}>Reintentar</Text>
+ </Pressable>
+ </View>
+ );
+ }
+
return (
<View style={styles.container}>
- <Text style={styles.title}>Reservas</Text>
- <Text style={styles.text}>Pantalla en construcción.</Text>
+ <Text style={styles.title}>Mis reservas</Text>
+
+ <FlatList
+ data={reservations}
+ keyExtractor={(item) => item.id}
+ contentContainerStyle={styles.list}
+ ListEmptyComponent={
+ <Text style={styles.empty}>No tienes reservas todavía</Text>
+ }
+ renderItem={({ item }) => (
+ <View style={styles.card}>
+ <Text style={styles.cardTitle}>{item.officeName}</Text>
+ <Text>Fecha: {item.date}</Text>
+ <Text>Inicio: {item.startTime}</Text>
+ <Text>Fin: {item.endTime}</Text>
+ </View>
+ )}
+ />
</View>
);
}
@@ -13,16 +58,47 @@ const styles = StyleSheet.create({
container: {
flex: 1,
padding: 16,
- justifyContent: 'center',
+ },
+ center: {
+ flex: 1,
alignItems: 'center',
- gap: 12,
+ justifyContent: 'center',
+ padding: 24,
},
title: {
fontSize: 28,
fontWeight: '700',
+ marginBottom: 16,
+ },
+ list: {
+ gap: 12,
+ },
+ card: {
+ borderWidth: 1,
+ borderColor: '#ddd',
+ borderRadius: 12,
+ padding: 16,
+ gap: 6,
+ },
+ cardTitle: {
+ fontSize: 18,
+ fontWeight: '600',
+ },
+ error: {
+ color: 'red',
+ marginBottom: 12,
+ },
+ button: {
+ backgroundColor: '#1f6feb',
+ paddingHorizontal: 16,
+ paddingVertical: 12,
+ borderRadius: 10,
+ },
+ buttonText: {
+ color: '#fff',
+ fontWeight: '600',
},
- text: {
- fontSize: 16,
- color: '#555',
+ empty: {
+ color: '#666',
},
});