diff options
| author | Alberto Duarte Delgado <alberto@albertoduarte.com> | 2026-04-26 14:01:59 +0100 |
|---|---|---|
| committer | Alberto Duarte Delgado <alberto@albertoduarte.com> | 2026-04-26 14:01:59 +0100 |
| commit | f078507d3c529b61421adbeca14c623f9eb6538c (patch) | |
| tree | 1ca889dbcd3b7175a4e125f42cff088130474166 /src/app/(protected)/(tabs)/offices | |
| parent | 609db5f1744fdd339f04ebed764fd1641ce820d0 (diff) | |
| parent | 4eebbb2ff5df645655813a530b84a6395a44bffd (diff) | |
Merge remote-tracking branch 'origin/feature/anita' into develop
Diffstat (limited to 'src/app/(protected)/(tabs)/offices')
| -rw-r--r-- | src/app/(protected)/(tabs)/offices/index.tsx | 314 |
1 files changed, 164 insertions, 150 deletions
diff --git a/src/app/(protected)/(tabs)/offices/index.tsx b/src/app/(protected)/(tabs)/offices/index.tsx index c84123a..67fcd92 100644 --- a/src/app/(protected)/(tabs)/offices/index.tsx +++ b/src/app/(protected)/(tabs)/offices/index.tsx @@ -44,7 +44,7 @@ export default function OfficesScreen() { if (error) { return ( <View style={styles.center}> - <Text style={{ color: theme.colors.error }}>{error}</Text> + <Text style={styles.errorText}>{error}</Text> <Pressable style={styles.primaryButton} onPress={reload}> <Text style={styles.primaryButtonText}>Reintentar</Text> </Pressable> @@ -53,132 +53,122 @@ export default function OfficesScreen() { } return ( - <View style={styles.container}> - <View style={styles.content}> - {/* HEADER */} - <View style={styles.header}> - <Text style={styles.title}>Espacios disponibles</Text> - - {/* SEARCH */} - <TextInput - style={styles.search} - placeholder="Buscar espacios..." - value={search} - onChangeText={setSearch} - /> + <View style={styles.container}> + {/* cabecera superior de la pantalla */} + <View style={styles.topBar}> + <Text style={styles.topBarTitle}>Espacios</Text> + </View> - <Pressable - style={[ - styles.favoriteFilterButton, - showOnlyFavorites && styles.favoriteFilterButtonActive, - ]} - onPress={() => setShowOnlyFavorites((current) => !current)} - > - <MaterialIcons - name={showOnlyFavorites ? 'star' : 'star-outline'} - size={18} - color={ - showOnlyFavorites - ? theme.colors.white - : theme.colors.primary - } + <View style={styles.content}> + {/* herramientas de filtrado */} + <View style={styles.toolsCard}> + <TextInput + style={styles.search} + placeholder="Buscar espacios..." + placeholderTextColor={theme.colors.textSecondary} + value={search} + onChangeText={setSearch} /> - <Text + + <Pressable style={[ - styles.favoriteFilterText, - showOnlyFavorites && styles.favoriteFilterTextActive, + styles.favoriteFilterButton, + showOnlyFavorites && styles.favoriteFilterButtonActive, ]} + onPress={() => setShowOnlyFavorites((current) => !current)} > - Solo favoritos - </Text> - </Pressable> - </View> + <MaterialIcons + name={showOnlyFavorites ? "star" : "star-outline"} + size={18} + color={ + showOnlyFavorites ? theme.colors.white : theme.colors.primary + } + /> + <Text + style={[ + styles.favoriteFilterText, + showOnlyFavorites && styles.favoriteFilterTextActive, + ]} + > + Solo favoritos + </Text> + </Pressable> + </View> + + {/* contador de resultados */} + <Text style={styles.resultText}> + {filteredOffices.length} espacio + {filteredOffices.length !== 1 ? "s" : ""} encontrados + </Text> + + {/* lista */} + <FlatList + data={filteredOffices} + keyExtractor={(item) => item.id} + contentContainerStyle={styles.list} + renderItem={({ item }) => { + const isFav = favoriteOfficeIdsSet.has(item.id); + + return ( + <Link href={`/(protected)/offices/${item.id}`} asChild> + <Pressable style={styles.card}> + <View style={styles.cardContent}> + <View style={styles.imageBox}> + <MaterialIcons + name="business" + size={40} + color={theme.colors.primary} + /> + </View> + + <View style={styles.info}> + <View style={styles.rowBetween}> + <View style={styles.infoMain}> + <Text style={styles.cardTitle}>{item.name}</Text> + <Text style={styles.cardSubtitle}> + {item.location} + </Text> + </View> - {/* COUNT */} - <Text style={styles.resultText}> - {filteredOffices.length} espacio - {filteredOffices.length !== 1 ? 's' : ''} encontrados - </Text> - - {/* LIST */} - <FlatList - data={filteredOffices} - keyExtractor={(item) => item.id} - contentContainerStyle={styles.list} - renderItem={({ item }) => { - const isFav = favoriteOfficeIdsSet.has(item.id); - - return ( - <Link href={`/(protected)/offices/${item.id}`} asChild> - <Pressable style={styles.card}> - <View style={styles.cardContent}> - {/* IMAGE PLACEHOLDER */} - {/*<View style={styles.imageBox}> - <Text style={styles.imageIcon}>🏢</Text> - </View>*/} -<View style={styles.imageBox}> - <MaterialIcons - name="business" - size={40} - color={theme.colors.primary} - /> -</View> - {/* INFO */} - <View style={styles.info}> - <View style={styles.rowBetween}> - <View style={{ flex: 1 }}> - <Text style={styles.cardTitle}>{item.name}</Text> - <Text style={styles.cardSubtitle}> - {item.location} - </Text> + <Text style={styles.chevron}>›</Text> </View> - <Text style={styles.chevron}>›</Text> - </View> + <Text style={styles.capacity}> + {item.capacity} personas + </Text> - <Text style={styles.capacity}> - {item.capacity} personas - </Text> - - <View style={styles.footer}> - {/*<Text style={styles.price}> - {item.price ?? '—'} - </Text>*/} - - <View - style={[ - styles.badge, - isFav && styles.badgeActive, - ]} - > - <Text - style={[ - styles.badgeText, - isFav && styles.badgeTextActive, - ]} + <View style={styles.footer}> + <View + style={[styles.badge, isFav && styles.badgeActive]} > - {isFav ? 'Favorito' : 'Disponible'} - </Text> + <Text + style={[ + styles.badgeText, + isFav && styles.badgeTextActive, + ]} + > + {isFav ? "Favorito" : "Disponible"} + </Text> + </View> </View> </View> </View> - </View> - </Pressable> - </Link> - ); - }} - ListEmptyComponent={ - <View style={styles.emptyBox}> - <Text style={styles.emptyText}> - {showOnlyFavorites - ? 'No tienes espacios favoritos con estos filtros' - : 'No se encontraron espacios'} - </Text> - </View> - } - /> + </Pressable> + </Link> + ); + }} + ListEmptyComponent={ + <View style={styles.emptyBox}> + <Text style={styles.emptyText}> + {showOnlyFavorites + ? "No tienes espacios favoritos con estos filtros" + : "No se encontraron espacios"} + </Text> + </View> + } + /> + </View> </View> - </View> ); } @@ -188,31 +178,55 @@ const styles = StyleSheet.create({ backgroundColor: theme.colors.background, }, -content: { - flex: 1, - width: '100%', - maxWidth: theme.layout.contentWidth, - alignSelf: 'center', -}, + content: { + flex: 1, + width: "100%", + maxWidth: theme.layout.contentWidth, + alignSelf: "center", + }, center: { flex: 1, - justifyContent: 'center', - alignItems: 'center', + justifyContent: "center", + alignItems: "center", + padding: theme.spacing.xl, + gap: theme.spacing.md, + backgroundColor: theme.colors.background, }, - header: { + // cabecera superior de la pantalla + topBar: { backgroundColor: theme.colors.surface, - padding: theme.spacing.xl, borderBottomWidth: 1, - borderColor: theme.colors.border, + borderBottomColor: theme.colors.border, + paddingHorizontal: theme.spacing.xl, + paddingTop: theme.spacing.xxxl, + paddingBottom: theme.spacing.lg, }, - title: { - fontSize: theme.typography.xxxl, + // titulo principal de la cabecera + topBarTitle: { + fontSize: theme.typography.xxl, fontWeight: theme.fontWeight.semibold, color: theme.colors.text, - marginBottom: theme.spacing.md, + textAlign: "left", + maxWidth: theme.layout.contentWidth, + width: "100%", + alignSelf: "center", + }, + + errorText: { + color: theme.colors.error, + textAlign: "center", + }, + + // bloque de busqueda y filtros + toolsCard: { + backgroundColor: theme.colors.surface, + padding: theme.spacing.xl, + gap: theme.spacing.md, + borderBottomWidth: 1, + borderBottomColor: theme.colors.border, }, search: { @@ -222,18 +236,18 @@ content: { borderRadius: theme.radius.lg, paddingHorizontal: theme.spacing.lg, paddingVertical: theme.spacing.md, + color: theme.colors.text, }, favoriteFilterButton: { - marginTop: theme.spacing.md, borderWidth: 1, borderColor: theme.colors.primary, borderRadius: theme.radius.lg, paddingHorizontal: theme.spacing.lg, paddingVertical: theme.spacing.md, - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'center', + flexDirection: "row", + alignItems: "center", + justifyContent: "center", gap: theme.spacing.sm, }, @@ -272,7 +286,7 @@ content: { }, cardContent: { - flexDirection: 'row', + flexDirection: "row", gap: theme.spacing.lg, }, @@ -281,12 +295,8 @@ content: { height: 80, borderRadius: theme.radius.lg, backgroundColor: theme.colors.primarySoft, - alignItems: 'center', - justifyContent: 'center', - }, - - imageIcon: { - fontSize: 28, + alignItems: "center", + justifyContent: "center", }, info: { @@ -295,9 +305,13 @@ content: { }, rowBetween: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'flex-start', + flexDirection: "row", + justifyContent: "space-between", + alignItems: "flex-start", + }, + + infoMain: { + flex: 1, }, cardTitle: { @@ -322,14 +336,9 @@ content: { }, footer: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - }, - - price: { - color: theme.colors.primary, - fontWeight: theme.fontWeight.medium, + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", }, badge: { @@ -353,7 +362,7 @@ content: { }, emptyBox: { - alignItems: 'center', + alignItems: "center", padding: theme.spacing.xxxl, }, @@ -361,6 +370,11 @@ content: { color: theme.colors.textSecondary, }, + errorText: { + color: theme.colors.error, + textAlign: "center", + }, + primaryButton: { marginTop: theme.spacing.md, backgroundColor: theme.colors.primary, |