From 40cc6cea25d048c2e77e11bbfea0cd1e5eb784f6 Mon Sep 17 00:00:00 2001 From: Enrique Pérez Pérez Date: Sun, 19 Apr 2026 19:32:09 +0200 Subject: Completado cambios pantalla oficinas y detalle de oficina #12 y #13 --- src/app/(protected)/offices/[officeId].tsx | 408 ++++++++++++++++------------- 1 file changed, 230 insertions(+), 178 deletions(-) (limited to 'src/app/(protected)/offices') diff --git a/src/app/(protected)/offices/[officeId].tsx b/src/app/(protected)/offices/[officeId].tsx index c632490..fbcd9f8 100644 --- a/src/app/(protected)/offices/[officeId].tsx +++ b/src/app/(protected)/offices/[officeId].tsx @@ -5,37 +5,31 @@ import { ScrollView, StyleSheet, Text, - TextInput, View, } from 'react-native'; + import { useOffice } from '@/features/offices/hooks/useOffice'; import { useFavoriteOffices } from '@/features/offices/hooks/useFavoriteOffices'; -import { StatusMessage } from '@/shared/ui/StatusMessage'; -import { useOfficeAvailability } from '@/features/reservations/hooks/useOfficeAvailability'; + +import theme from '@/theme'; +import { Feather, MaterialIcons } from '@expo/vector-icons'; export default function OfficeDetailScreen() { const params = useLocalSearchParams<{ officeId: string }>(); - const officeId = typeof params.officeId === 'string' ? params.officeId : undefined; + const officeId = + typeof params.officeId === 'string' ? params.officeId : undefined; const { office, loading, error, reload } = useOffice(officeId); const { favoriteOfficeIdsSet, - favoritesError, pendingOfficeId, toggleFavorite, } = useFavoriteOffices(); - const { - selectedDate, - reservations, - loading: loadingAvailability, - error: availabilityError, - setSelectedDate, - } = useOfficeAvailability(officeId); if (loading) { return ( - + ); } @@ -43,230 +37,288 @@ export default function OfficeDetailScreen() { if (error || !office) { return ( - {error ?? 'No se pudo cargar la oficina'} + + {error ?? 'No se pudo cargar el espacio'} + - - Reintentar + + Reintentar - Volver a espacios + Volver ); } + const isFav = favoriteOfficeIdsSet.has(office.id); + return ( - - {office.name} + + {/* HEADER */} + + + ← Volver a espacios + + + + {/* IMAGE */} + {/* + 🏢 + */} + + + + + {/* TITLE */} + + + {office.name} + + {office.location ?? 'Sin ubicación'} + + + + + + {office.available ? 'Disponible' : 'Ocupado'} + + + + + {/* CAPACITY + PRICE */} + + + {office.capacity} personas + + + {/* + {office.price ?? '—'} + */} + + + {/* DESCRIPTION */} + {office.description && ( + + Descripción + {office.description} + + )} + + {/* FAVORITE */} { - void toggleFavorite(office.id); - }} + onPress={() => toggleFavorite(office.id)} disabled={pendingOfficeId === office.id} > - + {pendingOfficeId === office.id ? '...' - : favoriteOfficeIdsSet.has(office.id) - ? '★' - : '☆'} + : isFav + ? '★ Guardado' + : '☆ Guardar como favorito'} - - - {favoritesError ? : null} - {availabilityError ? : null} - - - Ubicación - {office.location} - Capacidad - {office.capacity} personas - - {office.description ? ( - <> - Descripción - {office.description} - - ) : null} - - - - Disponibilidad - - Fecha - - - Consulta los horarios ocupados para esa fecha - - {loadingAvailability ? ( - - ) : availabilityError ? null : reservations.length === 0 ? ( - No hay bloques ocupados para esta fecha - ) : ( - - {reservations.map((reservation) => ( - - - {reservation.startTime} - {reservation.endTime} - - Ocupado - - ))} - - )} + {/* RESERVE BUTTON */} + + + + Reservar ahora + + + - - - - Reservar este espacio - - - ); } const styles = StyleSheet.create({ container: { - flex: 1, - padding: 16, - gap: 16, + paddingVertical: theme.spacing.xl, + }, + + content: { + width: '100%', + maxWidth: theme.layout.contentWidth, + alignSelf: 'center', + paddingHorizontal: theme.spacing.xl, + gap: theme.spacing.xl, }, + center: { flex: 1, - alignItems: 'center', justifyContent: 'center', - padding: 24, - gap: 12, + alignItems: 'center', + padding: theme.spacing.xl, + gap: theme.spacing.md, }, - title: { - fontSize: 28, - fontWeight: '700', - flex: 1, + + back: { + color: theme.colors.textSecondary, + fontSize: theme.typography.md, }, - header: { - flexDirection: 'row', + + imageBox: { + width: '100%', + height: 180, + borderRadius: theme.radius.xl, + backgroundColor: theme.colors.primarySoft, alignItems: 'center', - gap: 12, - }, - card: { - borderWidth: 1, - borderColor: '#ddd', - borderRadius: 12, - padding: 16, - gap: 10, + justifyContent: 'center', }, - label: { - fontSize: 14, - fontWeight: '700', - color: '#444', + + imageIcon: { + fontSize: 48, }, - sectionTitle: { - fontSize: 20, - fontWeight: '700', - marginBottom: 4, + + titleRow: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'flex-start', + gap: theme.spacing.md, }, - value: { - fontSize: 16, - color: '#111', + + title: { + fontSize: theme.typography.xxxl, + fontWeight: theme.fontWeight.semibold, + color: theme.colors.text, }, - input: { - borderWidth: 1, - borderColor: '#ccc', - borderRadius: 10, - paddingHorizontal: 14, - paddingVertical: 12, + + subtitle: { + color: theme.colors.textSecondary, marginTop: 4, }, - helper: { - color: '#666', - fontSize: 12, + + metaRow: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', }, - availabilityList: { - gap: 10, - marginTop: 8, + + meta: { + color: theme.colors.textSecondary, + }, + + price: { + color: theme.colors.primary, + fontSize: theme.typography.xxl, + fontWeight: theme.fontWeight.semibold, }, - availabilityItem: { + + card: { + backgroundColor: theme.colors.surface, + borderRadius: theme.radius.lg, + padding: theme.spacing.lg, borderWidth: 1, - borderColor: '#d9e5d4', - backgroundColor: '#f3faf1', - borderRadius: 10, - padding: 12, - gap: 4, + borderColor: theme.colors.border, + ...theme.shadows.card, }, - availabilityTime: { - fontSize: 16, - fontWeight: '600', - color: '#1f3a1a', + + sectionTitle: { + fontSize: theme.typography.lg, + fontWeight: theme.fontWeight.semibold, + marginBottom: theme.spacing.sm, + color: theme.colors.text, }, - availabilityStatus: { - color: '#336b2f', - fontSize: 13, + + text: { + color: theme.colors.textSecondary, }, - availableText: { - color: '#2e7d32', - marginTop: 8, + + badge: { + backgroundColor: theme.colors.divider, + paddingHorizontal: theme.spacing.md, + paddingVertical: theme.spacing.xs, + borderRadius: theme.radius.sm, }, - button: { - backgroundColor: '#1f6feb', - paddingVertical: 14, - borderRadius: 10, - alignItems: 'center', + + badgeActive: { + backgroundColor: theme.colors.successBg, }, - secondaryButton: { - backgroundColor: '#555', - paddingVertical: 14, - paddingHorizontal: 16, - borderRadius: 10, - alignItems: 'center', + + badgeText: { + color: theme.colors.textSecondary, + fontSize: theme.typography.sm, }, + + badgeTextActive: { + color: theme.colors.successText, + }, + favoriteButton: { - width: 44, - height: 44, - borderRadius: 22, + padding: theme.spacing.md, + borderRadius: theme.radius.md, + backgroundColor: theme.colors.divider, alignItems: 'center', - justifyContent: 'center', - backgroundColor: '#eef2f6', }, + favoriteButtonActive: { backgroundColor: '#ffe8a3', }, - favoriteButtonText: { - fontSize: 22, - color: '#8a6700', + + favoriteText: { + fontWeight: theme.fontWeight.medium, + color: theme.colors.text, + }, + + reserveButton: { + backgroundColor: theme.colors.primary, + paddingVertical: theme.spacing.lg, + borderRadius: theme.radius.lg, + alignItems: 'center', }, - buttonText: { - color: '#fff', - fontWeight: '600', + + reserveText: { + color: theme.colors.white, + fontWeight: theme.fontWeight.semibold, + fontSize: theme.typography.lg, }, - error: { - color: 'red', - textAlign: 'center', + + primaryButton: { + backgroundColor: theme.colors.primary, + padding: theme.spacing.md, + borderRadius: theme.radius.md, + }, + + primaryButtonText: { + color: theme.colors.white, + fontWeight: theme.fontWeight.semibold, + }, + + secondaryButton: { + backgroundColor: theme.colors.muted, + padding: theme.spacing.md, + borderRadius: theme.radius.md, }, -}); +}); \ No newline at end of file -- cgit v1.2.3-54-g00ecf