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)/reservations/create.tsx | 167 +++++++++++++++++++++------- 1 file changed, 124 insertions(+), 43 deletions(-) (limited to 'src/app/(protected)/reservations') diff --git a/src/app/(protected)/reservations/create.tsx b/src/app/(protected)/reservations/create.tsx index 138f0ee..65a16f5 100644 --- a/src/app/(protected)/reservations/create.tsx +++ b/src/app/(protected)/reservations/create.tsx @@ -1,6 +1,16 @@ import { useLocalSearchParams } from 'expo-router'; -import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native'; +import { + KeyboardAvoidingView, + Platform, + Pressable, + ScrollView, + StyleSheet, + Text, + TextInput, + View, +} from 'react-native'; import { useCreateReservation } from '@/features/reservations/hooks/useCreateReservation'; +import { StatusMessage } from '@/shared/ui/StatusMessage'; export default function CreateReservationScreen() { const params = useLocalSearchParams<{ @@ -17,6 +27,7 @@ export default function CreateReservationScreen() { date, startTime, endTime, + isFormComplete, isSubmitting, error, successMessage, @@ -27,60 +38,101 @@ export default function CreateReservationScreen() { } = useCreateReservation({ officeId, officeName }); return ( - - Crear reserva + + + Crear reserva + + Completa la fecha y el horario en formato 24h. + - - Espacio - {officeName ?? 'No indicado'} + + Espacio + {officeName ?? 'No indicado'} + - ID oficina - {officeId ?? 'No indicado'} - + + Condiciones de reserva + Horario permitido: de 08:00 a 20:00 + Duración mínima: 30 minutos + Duración máxima: 8 horas + - + + Fecha + + Formato: YYYY-MM-DD + - + + + Hora de inicio + + Formato 24h + - + + Hora de fin + + Debe ser posterior + + - {error ? {error} : null} - {successMessage ? {successMessage} : null} + {error ? : null} + {successMessage ? : null} - - - {isSubmitting ? 'Guardando...' : 'Guardar reserva'} - - - + + + {isSubmitting ? 'Guardando...' : 'Guardar reserva'} + + + + ); } const styles = StyleSheet.create({ container: { flex: 1, + }, + content: { padding: 16, - gap: 12, + gap: 14, }, title: { fontSize: 28, fontWeight: '700', - marginBottom: 8, + }, + subtitle: { + color: '#555', + marginBottom: 4, }, infoBox: { borderWidth: 1, @@ -90,6 +142,34 @@ const styles = StyleSheet.create({ gap: 6, marginBottom: 8, }, + rulesBox: { + borderWidth: 1, + borderColor: '#d7e3f7', + backgroundColor: '#f4f8ff', + borderRadius: 12, + padding: 12, + gap: 4, + }, + rulesTitle: { + fontSize: 14, + fontWeight: '700', + color: '#1d4f91', + marginBottom: 2, + }, + rulesText: { + color: '#365b86', + fontSize: 13, + }, + field: { + gap: 6, + }, + row: { + flexDirection: 'row', + gap: 12, + }, + rowField: { + flex: 1, + }, label: { fontSize: 14, fontWeight: '700', @@ -106,6 +186,10 @@ const styles = StyleSheet.create({ paddingHorizontal: 14, paddingVertical: 12, }, + helper: { + color: '#666', + fontSize: 12, + }, button: { backgroundColor: '#1f6feb', paddingVertical: 14, @@ -113,14 +197,11 @@ const styles = StyleSheet.create({ alignItems: 'center', marginTop: 8, }, + buttonDisabled: { + backgroundColor: '#8fb5ec', + }, buttonText: { color: '#fff', fontWeight: '600', }, - error: { - color: 'red', - }, - success: { - color: 'green', - }, }); -- cgit v1.2.3-54-g00ecf