From 08ce78dbd97ad792e163482f454f285557c7cdd0 Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Wed, 1 Apr 2026 13:03:25 +0100 Subject: Mejoras de UX y feedback de errores; y, manejo de status de reserva --- src/app/(protected)/(tabs)/profile/index.tsx | 11 +- src/app/(protected)/(tabs)/reservations/index.tsx | 125 ++++++++++++++-------- 2 files changed, 88 insertions(+), 48 deletions(-) (limited to 'src/app/(protected)/(tabs)') 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 ? {updateError} : null} - {successMessage ? {successMessage} : null} + {updateError ? : null} + {successMessage ? : null} @@ -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() { Mis reservas - item.id} - contentContainerStyle={styles.list} - ListEmptyComponent={ - No tienes reservas todavĂ­a - } - renderItem={({ item }) => ( - - - {item.officeName} - - - {item.status === 'active' ? 'Activa' : 'Cancelada'} - + + + Activas + + {activeReservations.length === 0 ? ( + No tienes reservas activas + ) : ( + activeReservations.map((item) => ( + + + {item.officeName} + + Activa + + + Fecha: {item.date} + Inicio: {item.startTime} + Fin: {item.endTime} + + handleCancelReservation(item.id)} + disabled={cancelingReservationId === item.id} + > + + {cancelingReservationId === item.id + ? 'Cancelando...' + : 'Cancelar reserva'} + + - - Fecha: {item.date} - Inicio: {item.startTime} - Fin: {item.endTime} + )) + )} + + + + Historial - {item.status === 'active' ? ( - handleCancelReservation(item.id)} - disabled={cancelingReservationId === item.id} - > - - {cancelingReservationId === item.id - ? 'Cancelando...' - : 'Cancelar reserva'} - - - ) : null} - - )} - /> + {historyReservations.length === 0 ? ( + No tienes reservas en el historial + ) : ( + historyReservations.map((item) => ( + + + {item.officeName} + + + {item.status === 'completed' ? 'Completada' : 'Cancelada'} + + + + Fecha: {item.date} + Inicio: {item.startTime} + Fin: {item.endTime} + + )) + )} + + ); } @@ -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', -- cgit v1.2.3-54-g00ecf