summaryrefslogtreecommitdiffstats
path: root/src/app/(protected)/(tabs)
diff options
context:
space:
mode:
authorAlberto Duarte Delgado <alberto@albertoduarte.com>2026-04-01 13:03:25 +0100
committerAlberto Duarte Delgado <alberto@albertoduarte.com>2026-04-01 13:03:25 +0100
commit08ce78dbd97ad792e163482f454f285557c7cdd0 (patch)
tree998ce8d7d48f8344d9ec34691809f2482cde5136 /src/app/(protected)/(tabs)
parentc927739f8f221feabb6e19af2c2667eda905a2eb (diff)
Mejoras de UX y feedback de errores; y, manejo de status de reserva
Diffstat (limited to 'src/app/(protected)/(tabs)')
-rw-r--r--src/app/(protected)/(tabs)/profile/index.tsx11
-rw-r--r--src/app/(protected)/(tabs)/reservations/index.tsx125
2 files changed, 88 insertions, 48 deletions
diff --git a/src/app/(protected)/(tabs)/profile/index.tsx b/src/app/(protected)/(tabs)/profile/index.tsx
index 1e87f21..760b352 100644
--- a/src/app/(protected)/(tabs)/profile/index.tsx
+++ b/src/app/(protected)/(tabs)/profile/index.tsx
@@ -12,6 +12,7 @@ import { useAuthSession } from '@/providers/AuthProvider';
import { useProfile } from '@/features/profile/hooks/useProfile';
import { useUpdateProfile } from '@/features/profile/hooks/useUpdateProfile';
import { router } from 'expo-router';
+import { StatusMessage } from '@/shared/ui/StatusMessage';
export default function ProfileScreen() {
const { logout } = useAuthSession();
@@ -96,8 +97,8 @@ export default function ProfileScreen() {
autoCorrect={false}
/>
- {updateError ? <Text style={styles.error}>{updateError}</Text> : null}
- {successMessage ? <Text style={styles.success}>{successMessage}</Text> : null}
+ {updateError ? <StatusMessage message={updateError} /> : null}
+ {successMessage ? <StatusMessage message={successMessage} tone="success" /> : null}
<Pressable style={styles.button} onPress={submit} disabled={isSubmitting}>
<Text style={styles.buttonText}>
@@ -191,9 +192,7 @@ const styles = StyleSheet.create({
fontWeight: '600',
},
error: {
- color: 'red',
- },
- success: {
- color: 'green',
+ color: '#9f1d35',
+ textAlign: 'center',
},
});
diff --git a/src/app/(protected)/(tabs)/reservations/index.tsx b/src/app/(protected)/(tabs)/reservations/index.tsx
index a2a0d9d..ccec7e9 100644
--- a/src/app/(protected)/(tabs)/reservations/index.tsx
+++ b/src/app/(protected)/(tabs)/reservations/index.tsx
@@ -1,8 +1,8 @@
import {
ActivityIndicator,
Alert,
- FlatList,
Pressable,
+ ScrollView,
StyleSheet,
Text,
View,
@@ -11,7 +11,8 @@ import { useReservations } from '@/features/reservations/hooks/useReservations';
export default function ReservationsScreen() {
const {
- reservations,
+ activeReservations,
+ historyReservations,
loading,
error,
reload,
@@ -59,48 +60,77 @@ export default function ReservationsScreen() {
<View style={styles.container}>
<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}>
- <View style={styles.cardHeader}>
- <Text style={styles.cardTitle}>{item.officeName}</Text>
- <View
- style={[
- styles.statusBadge,
- item.status === 'active' ? styles.statusActive : styles.statusCancelled,
- ]}
- >
- <Text style={styles.statusText}>
- {item.status === 'active' ? 'Activa' : 'Cancelada'}
- </Text>
+ <ScrollView contentContainerStyle={styles.list}>
+ <View style={styles.section}>
+ <Text style={styles.sectionTitle}>Activas</Text>
+
+ {activeReservations.length === 0 ? (
+ <Text style={styles.empty}>No tienes reservas activas</Text>
+ ) : (
+ activeReservations.map((item) => (
+ <View key={item.id} style={styles.card}>
+ <View style={styles.cardHeader}>
+ <Text style={styles.cardTitle}>{item.officeName}</Text>
+ <View
+ style={[
+ styles.statusBadge,
+ styles.statusActive,
+ ]}
+ >
+ <Text style={styles.statusText}>Activa</Text>
+ </View>
+ </View>
+ <Text>Fecha: {item.date}</Text>
+ <Text>Inicio: {item.startTime}</Text>
+ <Text>Fin: {item.endTime}</Text>
+
+ <Pressable
+ style={styles.cancelButton}
+ onPress={() => handleCancelReservation(item.id)}
+ disabled={cancelingReservationId === item.id}
+ >
+ <Text style={styles.buttonText}>
+ {cancelingReservationId === item.id
+ ? 'Cancelando...'
+ : 'Cancelar reserva'}
+ </Text>
+ </Pressable>
</View>
- </View>
- <Text>Fecha: {item.date}</Text>
- <Text>Inicio: {item.startTime}</Text>
- <Text>Fin: {item.endTime}</Text>
+ ))
+ )}
+ </View>
+
+ <View style={styles.section}>
+ <Text style={styles.sectionTitle}>Historial</Text>
- {item.status === 'active' ? (
- <Pressable
- style={styles.cancelButton}
- onPress={() => handleCancelReservation(item.id)}
- disabled={cancelingReservationId === item.id}
- >
- <Text style={styles.buttonText}>
- {cancelingReservationId === item.id
- ? 'Cancelando...'
- : 'Cancelar reserva'}
- </Text>
- </Pressable>
- ) : null}
- </View>
- )}
- />
+ {historyReservations.length === 0 ? (
+ <Text style={styles.empty}>No tienes reservas en el historial</Text>
+ ) : (
+ historyReservations.map((item) => (
+ <View key={item.id} style={styles.card}>
+ <View style={styles.cardHeader}>
+ <Text style={styles.cardTitle}>{item.officeName}</Text>
+ <View
+ style={[
+ styles.statusBadge,
+ item.status === 'completed'
+ ? styles.statusCompleted
+ : styles.statusCancelled,
+ ]}
+ >
+ <Text style={styles.statusText}>
+ {item.status === 'completed' ? 'Completada' : 'Cancelada'}
+ </Text>
+ </View>
+ </View>
+ <Text>Fecha: {item.date}</Text>
+ <Text>Inicio: {item.startTime}</Text>
+ <Text>Fin: {item.endTime}</Text>
+ </View>
+ ))
+ )}
+ </View>
+ </ScrollView>
</View>
);
}
@@ -123,6 +153,14 @@ const styles = StyleSheet.create({
},
list: {
gap: 12,
+ paddingBottom: 24,
+ },
+ section: {
+ gap: 12,
+ },
+ sectionTitle: {
+ fontSize: 20,
+ fontWeight: '700',
},
card: {
borderWidth: 1,
@@ -153,6 +191,9 @@ const styles = StyleSheet.create({
statusCancelled: {
backgroundColor: '#f3d8d8',
},
+ statusCompleted: {
+ backgroundColor: '#dce8f8',
+ },
statusText: {
fontSize: 12,
fontWeight: '700',