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)/(tabs)/offices/index.tsx | 107 +++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/app/(protected)/(tabs)/offices/index.tsx (limited to 'src/app/(protected)/(tabs)/offices') diff --git a/src/app/(protected)/(tabs)/offices/index.tsx b/src/app/(protected)/(tabs)/offices/index.tsx new file mode 100644 index 0000000..23445ee --- /dev/null +++ b/src/app/(protected)/(tabs)/offices/index.tsx @@ -0,0 +1,107 @@ +import { Link } from 'expo-router'; +import { + ActivityIndicator, + FlatList, + Pressable, + StyleSheet, + Text, + View, +} from 'react-native'; +import { useOffices } from '@/features/offices/hooks/useOffices'; + +export default function OfficesScreen() { + const { offices, loading, error, reload } = useOffices(); + + if (loading) { + return ( + + + + ); + } + + if (error) { + return ( + + {error} + + Reintentar + + + ); + } + + return ( + + Espacios + + item.id} + contentContainerStyle={styles.list} + ListEmptyComponent={ + No hay espacios disponibles + } + renderItem={({ item }) => ( + + + {item.name} + {item.location} + Capacidad: {item.capacity} + {item.description ? {item.description} : null} + + + )} + /> + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + padding: 16, + }, + center: { + flex: 1, + alignItems: 'center', + justifyContent: 'center', + padding: 24, + }, + title: { + fontSize: 28, + fontWeight: '700', + marginBottom: 16, + }, + list: { + gap: 12, + }, + card: { + borderWidth: 1, + borderColor: '#ddd', + borderRadius: 12, + padding: 16, + gap: 6, + }, + cardTitle: { + fontSize: 18, + fontWeight: '600', + }, + error: { + color: 'red', + marginBottom: 12, + }, + button: { + backgroundColor: '#1f6feb', + paddingHorizontal: 16, + paddingVertical: 12, + borderRadius: 10, + }, + buttonText: { + color: '#fff', + fontWeight: '600', + }, + empty: { + color: '#666', + }, +}); -- cgit v1.2.3-54-g00ecf