From 31584b4e5a3a551e2ceb15281a38677c39c46e12 Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Mon, 30 Mar 2026 15:55:32 +0100 Subject: Offices logic --- src/app/(protected)/offices/[officeId].tsx | 119 +++++++++++++++++++++++++++++ src/app/(protected)/offices/index.tsx | 0 2 files changed, 119 insertions(+) delete mode 100644 src/app/(protected)/offices/index.tsx (limited to 'src/app/(protected)/offices') diff --git a/src/app/(protected)/offices/[officeId].tsx b/src/app/(protected)/offices/[officeId].tsx index e69de29..77fd610 100644 --- a/src/app/(protected)/offices/[officeId].tsx +++ b/src/app/(protected)/offices/[officeId].tsx @@ -0,0 +1,119 @@ +import { Link, useLocalSearchParams } from 'expo-router'; +import { ActivityIndicator, Pressable, StyleSheet, Text, View } from 'react-native'; +import { useOffice } from '@/features/offices/hooks/useOffice'; + +export default function OfficeDetailScreen() { + const params = useLocalSearchParams<{ officeId: string }>(); + const officeId = typeof params.officeId === 'string' ? params.officeId : undefined; + + const { office, loading, error, reload } = useOffice(officeId); + + if (loading) { + return ( + + + + ); + } + + if (error || !office) { + return ( + + {error ?? 'No se pudo cargar la oficina'} + + + Reintentar + + + + + Volver a espacios + + + + ); + } + + return ( + + {office.name} + + + Ubicación + {office.location} + + Capacidad + {office.capacity} personas + + {office.description ? ( + <> + Descripción + {office.description} + + ) : null} + + + + + Reservar este espacio + + + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + padding: 16, + gap: 16, + }, + center: { + flex: 1, + alignItems: 'center', + justifyContent: 'center', + padding: 24, + gap: 12, + }, + title: { + fontSize: 28, + fontWeight: '700', + }, + card: { + borderWidth: 1, + borderColor: '#ddd', + borderRadius: 12, + padding: 16, + gap: 10, + }, + label: { + fontSize: 14, + fontWeight: '700', + color: '#444', + }, + value: { + fontSize: 16, + color: '#111', + }, + button: { + backgroundColor: '#1f6feb', + paddingVertical: 14, + borderRadius: 10, + alignItems: 'center', + }, + secondaryButton: { + backgroundColor: '#555', + paddingVertical: 14, + paddingHorizontal: 16, + borderRadius: 10, + alignItems: 'center', + }, + buttonText: { + color: '#fff', + fontWeight: '600', + }, + error: { + color: 'red', + textAlign: 'center', + }, +}); diff --git a/src/app/(protected)/offices/index.tsx b/src/app/(protected)/offices/index.tsx deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3-54-g00ecf