From cf8afc1ee12a51251a4795d1be6414f640f9e494 Mon Sep 17 00:00:00 2001 From: Anita Date: Sat, 4 Apr 2026 20:52:35 +0100 Subject: feat: menuBar, perfil y home redise帽ados y sistema de estilos global creado MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(protected)/(tabs)/_layout.tsx | 69 ++- src/app/(protected)/(tabs)/home.tsx | 492 +++++++++++++------ src/app/(protected)/(tabs)/profile/index.tsx | 701 +++++++++++++++++++++++---- src/theme/index.ts | 76 +++ 4 files changed, 1114 insertions(+), 224 deletions(-) create mode 100644 src/theme/index.ts diff --git a/src/app/(protected)/(tabs)/_layout.tsx b/src/app/(protected)/(tabs)/_layout.tsx index 0b71c6d..a4e0445 100644 --- a/src/app/(protected)/(tabs)/_layout.tsx +++ b/src/app/(protected)/(tabs)/_layout.tsx @@ -1,23 +1,76 @@ import { Tabs } from 'expo-router'; +import { Feather } from '@expo/vector-icons'; +import { MaterialIcons } from '@expo/vector-icons'; +import theme from '@/theme'; + +// accesos cortos al theme de estilos +const { colors, typography, fontWeight, layout } = theme; export default function TabsLayout() { return ( - + ( + + ), + }} /> ( + + ), + }} /> ( + + ), + }} /> ( + + ), + }} /> ); diff --git a/src/app/(protected)/(tabs)/home.tsx b/src/app/(protected)/(tabs)/home.tsx index 3ddad57..523283c 100644 --- a/src/app/(protected)/(tabs)/home.tsx +++ b/src/app/(protected)/(tabs)/home.tsx @@ -1,42 +1,51 @@ +import { useReservations } from '@/features/reservations/hooks/useReservations'; +import { useAuthSession } from '@/providers/AuthProvider'; +import theme from '@/theme'; +import { Feather, MaterialIcons } from '@expo/vector-icons'; import { Link } from 'expo-router'; import { useMemo } from 'react'; import { ActivityIndicator, Pressable, StyleSheet, Text, View } from 'react-native'; -import { useAuthSession } from '@/providers/AuthProvider'; -import { useReservations } from '@/features/reservations/hooks/useReservations'; -import { useFavoriteOffices } from '@/features/offices/hooks/useFavoriteOffices'; -function getReservationStart(date: string, startTime: string): Date { - return new Date(`${date}T${startTime}:00`); -} +function formatDate(date: string): string { + const parsedDate = new Date(date); + + return parsedDate.toLocaleDateString('es-ES', { + day: '2-digit', + month: 'short', + year: 'numeric', + }); + } + +// creacion de acceso rapidos al theme de estilos +const { colors, spacing, radius, typography, fontWeight, layout, shadows } = theme; export default function HomeScreen() { const { user } = useAuthSession(); - const { reservations, activeReservations, historyReservations, loading, error } = useReservations(); - const { - favoriteOfficeIds, - isLoadingFavorites, - favoritesError, - } = useFavoriteOffices(); - - const nextReservation = useMemo(() => { - const now = new Date(); + const { reservations, activeReservations, loading, error } = useReservations(); + - return activeReservations.find((reservation) => getReservationStart(reservation.date, reservation.startTime) >= now) - ?? activeReservations[0] - ?? null; - }, [activeReservations]); + // crea el contador de reservas en el mes actual + const currentMonthReservationsCount = useMemo(() => { + const now = new Date(); + const currentMonth = now.getMonth(); + const currentYear = now.getFullYear(); - const completedReservationsCount = useMemo( - () => historyReservations.filter((reservation) => reservation.status === 'completed').length, - [historyReservations] - ); + return reservations.filter((reservation) => { + const reservationDate = new Date(reservation.date); + return ( + reservationDate.getMonth() === currentMonth && + reservationDate.getFullYear() === currentYear + ); + }).length; + }, [reservations]); - const checkedInReservationsCount = useMemo( - () => reservations.filter((reservation) => reservation.checkInAt).length, - [reservations] + // crea una lista con las 2 primeras reservas activas + const previewReservations = useMemo( + () => activeReservations.slice(0, 2), + [activeReservations] ); - if (loading || isLoadingFavorites) { + if (loading) { return ( @@ -44,70 +53,134 @@ export default function HomeScreen() { ); } - if (error || favoritesError) { + if (error) { return ( - {error ?? favoritesError} + {error} ); } return ( + // pantalla inicio - Dashboard + {/* cabecera de bienvenida */} - Bienvenido{user?.displayName ? `, ${user.displayName}` : ''} + Hola{user?.displayName ? `, ${user.displayName}` : ''} 馃憢 - {user?.email} - - - Pr贸xima reserva - {nextReservation ? ( - <> - {nextReservation.officeName} - - {nextReservation.date} 路 {nextReservation.startTime} - {nextReservation.endTime} - - - {nextReservation.checkInAt ? 'Llegada registrada' : 'Pendiente de check-in'} - - - - Ver mis reservas - - - + + + Bienvenido a la App Oficina + + + + {/* seccion de accesos rapidos */} + + Accesos r谩pidos + + + + + + + + + Reservar{"\n"}espacio + + + + + + + + + + + Mis reservas{"\n"}activas + + + + + + + {/* secci贸n de reservas activas */} + + Reservas activas + + + + + Ver todas + {'>'} + + + + + + + {previewReservations.length > 0 ? ( + previewReservations.map((reservation) => ( + + + + + + + + + + + {reservation.officeName} + {'>'} + + + + + + {formatDate(reservation.date)} + + + + + + {reservation.startTime} - {reservation.endTime} + + + + + {reservation.checkInAt ? 'Confirmada' : 'Pendiente'} + + + + + + + + )) ) : ( - <> - No tienes reservas pr贸ximas - - Explora espacios disponibles y reserva cuando lo necesites. + + + No tienes reservas activas en este momento. - - - Buscar espacios - - - + )} + {/* seccion de estadisticas */} {activeReservations.length} Reservas activas + - {favoriteOfficeIds.length} - Favoritos - - - {completedReservationsCount} - Completadas + {currentMonthReservationsCount} + Este mes + - {checkedInReservationsCount} - Check-ins + {reservations.length} + Total @@ -115,96 +188,245 @@ export default function HomeScreen() { } const styles = StyleSheet.create({ + // el ancho del container esta acotado si se toca hacerlo en el menuBar tambien container: { flex: 1, - padding: 16, - gap: 16, + paddingHorizontal: spacing.xl, + paddingTop: spacing.lg, + paddingBottom: spacing.xl, + gap: 18, + maxWidth: layout.contentWidth, + width: '100%', + alignSelf: 'center', + backgroundColor: colors.background, }, center: { flex: 1, alignItems: 'center', justifyContent: 'center', - padding: 24, - }, - eyebrow: { - color: '#5a7188', - fontSize: 13, - fontWeight: '700', - textTransform: 'uppercase', - letterSpacing: 1, + padding: spacing.xxxl, + backgroundColor: colors.background, }, + + // estilos de cabecera title: { - fontSize: 32, - fontWeight: '700', + fontSize: typography.xxxl, + fontWeight: fontWeight.medium, + color: colors.text, + }, + subtitle: { + fontSize: typography.xl, + color: colors.muted, + }, + divider: { + height: 1, + backgroundColor: colors.divider, + marginVertical: spacing.md, + }, + + // estilos de la seccion de accesos rapidos + sectionTitle: { + fontSize: typography.xxl, + fontWeight: fontWeight.semibold, + color: colors.text, + }, + quickAccessSection: { + gap: spacing.lg, + }, + quickAccessRow: { + flexDirection: 'row', + gap: spacing.lg, + }, + quickAccessButton: { + flex: 1, + backgroundColor: colors.primary, + paddingVertical: spacing.xxxl, + borderRadius: radius.xl, + alignItems: 'center', + justifyContent: 'center', + gap: spacing.md, + minHeight: 120, + }, + quickAccessButtonDark: { + flex: 1, + backgroundColor: colors.primaryDark, + paddingVertical: spacing.xxxl, + borderRadius: radius.xl, + alignItems: 'center', + justifyContent: 'center', + gap: spacing.md, + minHeight: 112, + }, + + // --- estilos textos accesos rapidos + quickAccessButtonText: { + color: colors.white, + fontWeight: fontWeight.regular, + fontSize: typography.md, + textAlign: 'center', + lineHeight: 16, + }, + //---------------------------------- + + quickAccessIconContainerLight: { + width: 40, + height: 40, + borderRadius: radius.md, + backgroundColor: '#3b82f6', + alignItems: 'center', + justifyContent: 'center', + }, + quickAccessIconContainerDark: { + width: 40, + height: 40, + borderRadius: radius.md, + backgroundColor: '#334e68', + alignItems: 'center', + justifyContent: 'center', + }, + + // estilos de reservas activas + reservationsHeader: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + }, + linkRow: { + flexDirection: 'row', + alignItems: 'center', + gap: spacing.xs, + }, + chevronSmall: { + fontSize: typography.lg, + color: colors.primary, + fontWeight: fontWeight.semibold, + }, + linkText: { + color: colors.primary, + fontWeight: fontWeight.regular, + }, + reservationsList: { + gap: spacing.xl, + }, + + // estilos tarjetas de reservas activas + reservationCard: { + backgroundColor: colors.surface, + borderRadius: radius.xxl, + padding: spacing.xl, + gap: spacing.md, + minHeight: 100, + ...shadows.card, + }, + reservationContent: { + flexDirection: 'row', + gap: spacing.lg, + }, + reservationIconContainer: { + width: 48, + height: 48, + borderRadius: radius.lg, + backgroundColor: colors.primarySoft, + alignItems: 'center', + justifyContent: 'center', + }, + reservationInfo: { + flex: 1, + gap: spacing.sm, + }, + reservationHeader: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + }, + reservationOffice: { + fontSize: 18, + fontWeight: fontWeight.medium, + color: colors.text, + }, + chevron: { + fontSize: 18, + color: colors.textSecondary, + fontWeight: fontWeight.semibold, + }, + reservationMetaRow: { + flexDirection: 'row', + alignItems: 'center', + gap: spacing.sm, + }, + reservationMeta: { + color: colors.textSecondary, + fontSize: typography.md, + }, + reservationRow: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', }, - email: { - color: '#666', + reservationTime: { + color: colors.text, + fontSize: typography.lg, + flex: 1, + }, + statusBadge: { + alignSelf: 'flex-start', + backgroundColor: colors.successBg, + paddingHorizontal: 10, + paddingVertical: spacing.xs, + borderRadius: radius.sm, }, - heroCard: { - backgroundColor: '#eff6ff', + statusText: { + color: colors.successText, + fontWeight: fontWeight.semibold, + fontSize: typography.sm, + }, + emptyReservationCard: { borderWidth: 1, - borderColor: '#c8daf7', - borderRadius: 18, - padding: 18, - gap: 10, - }, - cardLabel: { - color: '#2b5ea8', - fontSize: 13, - fontWeight: '700', - textTransform: 'uppercase', - letterSpacing: 0.8, - }, - heroTitle: { - fontSize: 24, - fontWeight: '700', - color: '#102a43', - }, - heroMeta: { - color: '#365b86', - fontSize: 15, - }, - heroStatus: { - color: '#1d4f91', - fontWeight: '600', + borderColor: colors.border, + borderRadius: radius.xxl, + padding: spacing.xl, + backgroundColor: colors.surface, }, + emptyReservationText: { + color: colors.textSecondary, + textAlign: 'center', + }, + + //estilos estadisticas statsGrid: { flexDirection: 'row', - flexWrap: 'wrap', - gap: 12, + gap: spacing.lg, }, statCard: { - width: '47%', - minWidth: 150, + flex: 1, borderWidth: 1, - borderColor: '#dde3ea', - borderRadius: 16, - padding: 16, - backgroundColor: '#fff', - gap: 4, + borderColor: colors.border, + borderRadius: radius.xxl, + paddingVertical: 18, + paddingHorizontal: spacing.lg, + minHeight: 115, + backgroundColor: colors.surface, + gap: spacing.sm, + alignItems: 'center', + justifyContent: 'space-between', }, + + // --- estilos textos estadisticas statValue: { - fontSize: 28, - fontWeight: '700', - color: '#13293d', + fontSize: typography.xxxl, + fontWeight: fontWeight.regular, + color: colors.text, }, statLabel: { - color: '#66788a', - fontSize: 13, - fontWeight: '600', - }, - button: { - backgroundColor: '#1f6feb', - paddingVertical: 14, - borderRadius: 10, - alignItems: 'center', + color: colors.textSecondary, + fontSize: typography.sm, + fontWeight: fontWeight.regular, + textAlign: 'center', }, + //-------------------------------- + error: { - color: '#9f1d35', + color: colors.error, textAlign: 'center', }, - buttonText: { - color: '#fff', - fontWeight: '600', - }, -}); +}); \ No newline at end of file diff --git a/src/app/(protected)/(tabs)/profile/index.tsx b/src/app/(protected)/(tabs)/profile/index.tsx index 760b352..660d113 100644 --- a/src/app/(protected)/(tabs)/profile/index.tsx +++ b/src/app/(protected)/(tabs)/profile/index.tsx @@ -1,22 +1,34 @@ -import { useEffect } from 'react'; +import { useEffect, useMemo, useState } from 'react'; +import theme from '@/theme'; import { ActivityIndicator, Pressable, + ScrollView, StyleSheet, Text, TextInput, View, } from 'react-native'; +import { Feather } from '@expo/vector-icons'; import { Image } from 'expo-image'; import { useAuthSession } from '@/providers/AuthProvider'; import { useProfile } from '@/features/profile/hooks/useProfile'; import { useUpdateProfile } from '@/features/profile/hooks/useUpdateProfile'; import { router } from 'expo-router'; import { StatusMessage } from '@/shared/ui/StatusMessage'; +import { useOffices } from '@/features/offices/hooks/useOffices'; +import { useFavoriteOffices } from '@/features/offices/hooks/useFavoriteOffices'; + +const { colors, spacing, radius, typography, fontWeight, layout, shadows } = theme; export default function ProfileScreen() { + // hook de autenticacion const { logout } = useAuthSession(); + + // hook para cargar datos del perfil const { profile, loading, error, reload } = useProfile(); + + // hook para actualizar nombre y foto del perfil const { displayName, photoURL, @@ -28,18 +40,62 @@ export default function ProfileScreen() { submit, } = useUpdateProfile(profile?.displayName ?? '', profile?.photoURL ?? ''); + // hook de favoritos del usuario + const { + favoriteOfficeIds, + isLoadingFavorites, + favoritesError, + } = useFavoriteOffices(); + + // hook con el listado completo de oficinas + const { + offices, + loading: officesLoading, + error: officesError, + } = useOffices(); + + // estado local para alternar entre modo vista y modo edicion + const [isEditing, setIsEditing] = useState(false); + + // cruce entre ids favoritos y lista completa de oficinas + // para obtener los datos reales de las oficinas favoritas + const favoriteOffices = useMemo(() => { + return offices.filter((office) => favoriteOfficeIds.includes(office.id)); + }, [offices, favoriteOfficeIds]); + + // sincroniza el formulario con los datos cargados del perfil useEffect(() => { if (profile?.displayName) { setDisplayName(profile.displayName); } + setPhotoURL(profile?.photoURL ?? ''); }, [profile?.displayName, profile?.photoURL, setDisplayName, setPhotoURL]); + // cerrar sesion y redirigir a pantalla de bienvenida const handleLogout = async () => { await logout(); router.replace('/(auth)/welcome'); }; + // cambia entre modo vista y modo edicion + const handleToggleEditing = () => { + // si se pulsa cancelar, restauramos los valores actuales del perfil + if (isEditing) { + setDisplayName(profile?.displayName ?? ''); + setPhotoURL(profile?.photoURL ?? ''); + } + + setIsEditing((current) => !current); + }; + + // guardar cambios del perfil + const handleSaveProfile = async () => { + await submit(); + setIsEditing(false); + }; + + // estado de carga inicial del perfil if (loading) { return ( @@ -48,10 +104,12 @@ export default function ProfileScreen() { ); } + // estado de error general del perfil if (error || !profile) { return ( {error ?? 'No se pudo cargar el perfil'} + Reintentar @@ -60,11 +118,19 @@ export default function ProfileScreen() { } return ( - - Perfil - - - + + {/* cabecera superior visual dentro del scroll */} + + Perfil + + {/* tarjeta cabecera del perfil */} + {/* avatar, nombre, correo y boton editar / cancelar */} + + {photoURL ? ( ) : ( @@ -74,125 +140,598 @@ export default function ProfileScreen() { )} + + + {/* nombre del usuario */} + {displayName || 'Usuario'} + + {/* correo del usuario */} + {profile.email} + + {/* boton editar perfil / cancelar */} + + + {isEditing ? 'Cancelar' : 'Editar perfil'} + + + + + + {/* seccion sobre mi */} + {/* solo visual por ahora, FALTA CONEXION CON FIREBASE PARA GUARDAR INFO */} + + Sobre m铆 - Correo - {profile.email} - - Nombre - - - URL de la foto - - - {updateError ? : null} - {successMessage ? : null} - - - - {isSubmitting ? 'Guardando...' : 'Guardar cambios'} + + + Espacio personal del usuario para mostrar una breve descripci贸n o + presentaci贸n dentro de la aplicaci贸n. - + + + + {/* seccion informacion personal */} + {/* en modo vista muestra datos */} + {/* en modo edicion muestra formulario */} + + Informaci贸n personal + + + {isEditing ? ( + <> + {/* formulario de edicion: nombre */} + Nombre + + + {/* formulario de edicion: url de la foto */} + URL de la foto + + + {/* mensajes de error o exito al guardar */} + {updateError ? : null} + {successMessage ? ( + + ) : null} + + {/* boton guardar cambios */} + + + {isSubmitting ? 'Guardando...' : 'Guardar cambios'} + + + + ) : ( + <> + {/* fila de nombre completo */} + + + + Nombre completo + {displayName || 'Usuario'} + + + + {/* fila de correo electronico */} + + + + Correo electr贸nico + {profile.email} + + + + {/* fila de telefono */} + {/* por ahora es solo visual, FALTA CONEXION CON FIREBASE */} + + + + Tel茅fono + +34 600 123 456 + + + + {/* fila de empresa */} + {/* por ahora es solo visual, FALTA CONEXION CON FIREBASE */} + + + + Empresa + Empresa Innovadora S.L. + + + + )} + + + + {/* seccion favoritos */} + + Favoritos + + + {isLoadingFavorites || officesLoading ? ( + Cargando favoritos... + ) : favoritesError || officesError ? ( + + {favoritesError ?? officesError} + + ) : favoriteOffices.length === 0 ? ( + + Todav铆a no has marcado oficinas como favoritas. + + ) : ( + <> + {/* cabecera resumida de favoritos */} + + {favoriteOffices.length} + oficinas guardadas + + + {/* lista corta de favoritos, limitada a 3 */} + + {favoriteOffices.slice(0, 3).map((office) => ( + + + + + + + {office.name} + Espacio favorito + + + ))} + + + {/* enlace visual para ver todos los favoritos + solo aparece si hay mas de 3 favoritos */} + {favoriteOffices.length > 3 ? ( + + Ver todos + + ) : null} + + )} + + + + {/* seccion enlaces secundarios */} + + + + + + Notificaciones + + {'>'} + + + + + + Privacidad y seguridad + + {'>'} + + + + + + Ayuda y soporte + + {'>'} + + + {/* boton cerrar sesion */} - Cerrar sesi贸n + + + Cerrar sesi贸n + - + + {/* texto inferior de version */} + App Oficina v1.0.0 + ); } const styles = StyleSheet.create({ + // contenedor principal de la pantalla container: { flex: 1, - padding: 16, - gap: 16, + backgroundColor: colors.background, + }, + + // contenido interno del scroll + // padding general, separacion entre bloques y el ancho maximo + // para mantener consistencia con otras pantallas + content: { + padding: spacing.xl, + paddingTop: spacing.lg, + gap: spacing.lg, + maxWidth: layout.contentWidth, + width: '100%', + alignSelf: 'center', + paddingBottom: spacing.xxxl, }, + + // estado de carga y error general center: { flex: 1, alignItems: 'center', justifyContent: 'center', - padding: 24, - gap: 12, + padding: spacing.xxxl, + gap: spacing.md, + backgroundColor: colors.background, }, - title: { - fontSize: 28, - fontWeight: '700', + + // titulo superior de la pantalla + topBar: { + backgroundColor: colors.surface, + borderBottomWidth: 1, + borderBottomColor: colors.border, + paddingHorizontal: spacing.xl, + paddingTop: spacing.lg, + paddingBottom: spacing.lg, + marginHorizontal: -spacing.xl, + marginTop: -spacing.lg, }, - card: { + topBarTitle: { + fontSize: typography.xxl, + fontWeight: fontWeight.semibold, + color: colors.text, + textAlign: 'left', + maxWidth: layout.contentWidth, + width: '100%', + alignSelf: 'center', + paddingHorizontal: spacing.xl, + }, + + // tarjeta superior de cabecera + headerCard: { + backgroundColor: colors.surface, + borderRadius: radius.xxl, + padding: spacing.lg, borderWidth: 1, - borderColor: '#ddd', - borderRadius: 12, - padding: 16, - gap: 10, + borderColor: colors.border, + ...shadows.card, }, - avatarSection: { + + // fila interna de la cabecera + // coloca avatar a la izquierda y datos a la derecha + headerRow: { + flexDirection: 'row', alignItems: 'center', - gap: 12, - marginBottom: 8, + gap: spacing.lg, + }, + + // bloque de informacion de la cabecera + headerInfo: { + flex: 1, + gap: spacing.xs, }, + + // avatar del usuario avatar: { - width: 112, - height: 112, - borderRadius: 56, - backgroundColor: '#ddd', + width: 64, + height: 64, + borderRadius: 32, }, + + // avatar alternativo cuando no hay foto avatarPlaceholder: { + backgroundColor: colors.primary, alignItems: 'center', justifyContent: 'center', - backgroundColor: '#1f6feb', }, + + // letra dentro del avatar alternativo avatarPlaceholderText: { - color: '#fff', - fontSize: 36, - fontWeight: '700', + color: colors.white, + fontSize: 28, + fontWeight: fontWeight.semibold, }, - label: { - fontSize: 14, - fontWeight: '700', - color: '#444', + + // nombre principal del usuario + profileName: { + fontSize: typography.xl, + fontWeight: fontWeight.semibold, + color: colors.text, + }, + + // correo mostrado en cabecera + profileEmail: { + fontSize: typography.md, + color: colors.textSecondary, + }, + + // boton pequeno de editar / cancelar + editButton: { + marginTop: spacing.xs, + borderWidth: 1, + borderColor: colors.primary, + paddingVertical: spacing.xs, + paddingHorizontal: spacing.md, + borderRadius: radius.md, + alignSelf: 'flex-start', + }, + + // texto del boton editar / cancelar + editButtonText: { + color: colors.primary, + fontSize: typography.sm, + fontWeight: fontWeight.medium, + }, + + // separacion entre titulo de seccion y tarjeta + section: { + gap: spacing.sm, + }, + + // titulo de cada seccion + sectionTitle: { + fontSize: typography.xl, + fontWeight: fontWeight.semibold, + color: colors.text, + }, + + // tarjeta base reutilizable + card: { + backgroundColor: colors.surface, + borderRadius: radius.xxl, + padding: spacing.lg, + borderWidth: 1, + borderColor: colors.border, + ...shadows.card, + gap: spacing.md, + }, + + // fila de informacion personal con icono a la izquierda + infoRow: { + flexDirection: 'row', + alignItems: 'flex-start', + gap: spacing.md, + }, + + // contenido de texto dentro de cada fila de informacion + infoContent: { + flex: 1, + gap: spacing.xs, + }, + + // bloque antiguo de informacion personal + // se mantienen por si se reutiliza sino ELIMINAR + infoBlock: { + gap: spacing.xs, + }, + + // etiqueta pequena de informacion personal + infoLabel: { + fontSize: typography.sm, + color: colors.textSecondary, + fontWeight: fontWeight.regular, + }, + + // valor mostrado en informacion personal + infoValue: { + fontSize: typography.md, + color: colors.text, + fontWeight: fontWeight.medium, + }, + + // texto general de apoyo + // usado en sobre mi, favoritos vacios y mensajes similares + aboutText: { + fontSize: typography.md, + color: colors.textSecondary, + lineHeight: 20, + }, + + // texto de error en secciones concretas + errorText: { + fontSize: typography.md, + color: colors.error, + }, + + // bloque de favoritos + // fila resumen de favoritos coloca numero y texto en la misma linea + favoriteSummaryRow: { + flexDirection: 'row', + alignItems: 'baseline', + gap: spacing.sm, + marginBottom: spacing.xs, + }, + + // numero grande de favoritos + favoriteCount: { + fontSize: typography.xxxl, + fontWeight: fontWeight.semibold, + color: colors.text, + }, + + // texto pequeno junto al numero + favoriteSummaryText: { + fontSize: typography.sm, + color: colors.textSecondary, + }, + + // lista interna de favoritos + favoritesList: { + gap: spacing.sm, + marginTop: spacing.xs, + }, + + // fila individual de favorito + favoriteRow: { + flexDirection: 'row', + alignItems: 'center', + gap: spacing.md, + paddingVertical: spacing.sm, + paddingHorizontal: spacing.sm, + borderRadius: radius.md, + backgroundColor: colors.background, + borderWidth: 1, + borderColor: colors.border, + }, + + // contenedor del icono del favorito + favoriteIconWrap: { + width: 28, + height: 28, + borderRadius: 14, + backgroundColor: colors.primarySoft, + alignItems: 'center', + justifyContent: 'center', + }, + + // bloque de texto del favorito + favoriteTextBlock: { + flex: 1, + gap: 2, + }, + + // texto del nombre de la oficina favorita + favoriteItemText: { + fontSize: typography.md, + color: colors.text, + fontWeight: fontWeight.medium, + }, + + // texto secundario pequeno del favorito + favoriteItemMeta: { + fontSize: typography.sm, + color: colors.textSecondary, + }, + + // boton / enlace visual para ver todos los favoritos + viewAllButton: { + marginTop: spacing.xs, + alignSelf: 'flex-start', + }, + + // texto del enlace ver todos + viewAllText: { + fontSize: typography.sm, + color: colors.primary, + fontWeight: fontWeight.medium, }, - value: { - fontSize: 16, - color: '#111', + + // formulario de edicion + // etiqueta de cada input + label: { + fontSize: typography.md, + fontWeight: fontWeight.semibold, + color: colors.text, }, + + // input de texto para campos editables input: { borderWidth: 1, - borderColor: '#ccc', - borderRadius: 10, - paddingHorizontal: 14, - paddingVertical: 12, + borderColor: colors.border, + borderRadius: radius.md, + paddingHorizontal: spacing.lg, + paddingVertical: spacing.md, + backgroundColor: colors.surface, }, + + // boton principal de guardar cambios button: { - backgroundColor: '#1f6feb', - paddingVertical: 14, - borderRadius: 10, + backgroundColor: colors.primary, + paddingVertical: spacing.lg, + borderRadius: radius.md, + alignItems: 'center', + marginTop: spacing.sm, + }, + + // texto del boton principal + buttonText: { + color: colors.white, + fontWeight: fontWeight.semibold, + }, + + // bloque de enlaces secundarios + // cada fila del bloque + linkItem: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + paddingVertical: spacing.md, + }, + + // parte izquierda del enlace: icono + texto + linkLeft: { + flexDirection: 'row', alignItems: 'center', + gap: spacing.md, + }, + + // texto del enlace + linkText: { + fontSize: typography.md, + color: colors.text, + }, + + // flecha simple a la derecha + chevron: { + fontSize: typography.md, + color: colors.textSecondary, }, + + // boton de cerrar sesion logoutButton: { - backgroundColor: '#c62828', - paddingVertical: 14, - borderRadius: 10, + borderWidth: 1, + borderColor: '#f3b4b4', + backgroundColor: colors.surface, + paddingVertical: spacing.md, + borderRadius: radius.md, alignItems: 'center', + marginTop: spacing.sm, }, - buttonText: { - color: '#fff', - fontWeight: '600', + + // texto del boton cerrar sesion + logoutButtonText: { + color: colors.error, + fontWeight: fontWeight.regular, + }, + // contenido interno del boton cerrar sesion + // alinea icono y texto en horizontal + logoutContent: { + flexDirection: 'row', + alignItems: 'center', + gap: spacing.sm, }, + + // texto inferior de version + footerText: { + textAlign: 'center', + color: colors.muted, + fontSize: typography.sm, + marginTop: spacing.sm, + }, + + // error general de pantalla error: { - color: '#9f1d35', + color: colors.error, textAlign: 'center', }, -}); +}); \ No newline at end of file diff --git a/src/theme/index.ts b/src/theme/index.ts new file mode 100644 index 0000000..c7fc54a --- /dev/null +++ b/src/theme/index.ts @@ -0,0 +1,76 @@ +export const theme = { + // estilos globales para las pantallas + colors: { + primary: '#1f6feb', + primaryDark: '#243b53', + primarySoft: '#e7f0ff', + + background: '#f8fafc', + surface: '#ffffff', + + text: '#13293d', + textSecondary: '#66788a', + muted: '#5a7188', + + border: '#dde3ea', + divider: '#e5e7eb', + + successBg: '#d1fae5', + successText: '#065f46', + + error: '#9f1d35', + white: '#ffffff', + }, + + spacing: { + xs: 4, + sm: 6, + md: 8, + lg: 12, + xl: 16, + xxl: 20, + xxxl: 24, + }, + + radius: { + sm: 8, + md: 10, + lg: 12, + xl: 14, + xxl: 16, + }, + + typography: { + xs: 9, + sm: 12, + md: 13, + lg: 14, + xl: 16, + xxl: 20, + xxxl: 26, + }, + + fontWeight: { + light: '200' as const, + regular: '400' as const, + medium: '500' as const, + semibold: '600' as const, + }, + + layout: { + contentWidth: 448, + tabBarHeight: 64, + }, + + shadows: { + card: { + shadowColor: '#000', + shadowOpacity: 0.05, + shadowRadius: 10, + shadowOffset: { width: 0, height: 4 }, + elevation: 2, + }, + }, +}; + +export default theme; \ No newline at end of file -- cgit v1.2.3-54-g00ecf