summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app/(auth)/login.tsx208
-rw-r--r--src/app/(auth)/register.tsx214
-rw-r--r--src/app/(auth)/welcome.tsx237
-rw-r--r--src/app/(protected)/(tabs)/_layout.tsx2
-rw-r--r--src/app/(protected)/(tabs)/home.tsx6
5 files changed, 534 insertions, 133 deletions
diff --git a/src/app/(auth)/login.tsx b/src/app/(auth)/login.tsx
index 7457b54..bf4eda7 100644
--- a/src/app/(auth)/login.tsx
+++ b/src/app/(auth)/login.tsx
@@ -1,78 +1,194 @@
import { Link } from 'expo-router';
import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
+import { MaterialIcons } from '@expo/vector-icons';
+import theme from '@/theme';
import { useLogin } from '@/features/auth/hooks/useLogin';
import { StatusMessage } from '@/shared/ui/StatusMessage';
+const { colors, spacing, radius, typography, fontWeight, layout, shadows } = theme;
+
export default function LoginScreen() {
+ // hook de login
const { email, password, setEmail, setPassword, submit, isSubmitting, error } = useLogin();
return (
<View style={styles.container}>
- <Text style={styles.title}>Iniciar sesión</Text>
-
- <TextInput
- style={styles.input}
- placeholder="Correo electrónico"
- autoCapitalize="none"
- keyboardType="email-address"
- value={email}
- onChangeText={setEmail}
- />
-
- <TextInput
- style={styles.input}
- placeholder="Contraseña"
- secureTextEntry
- value={password}
- onChangeText={setPassword}
- />
-
- {error ? <StatusMessage message={error} /> : null}
-
- <Pressable style={styles.button} onPress={submit} disabled={isSubmitting}>
- <Text style={styles.buttonText}>
- {isSubmitting ? 'Entrando...' : 'Entrar'}
- </Text>
- </Pressable>
-
- <Link href="/(auth)/register" style={styles.link}>
- ¿No tienes cuenta? Regístrate
- </Link>
+ {/* contenido central acotado */}
+ <View style={styles.content}>
+ {/* icono superior */}
+ <View style={styles.iconBox}>
+ <MaterialIcons name="business" size={28} color={colors.white} />
+ </View>
+
+ {/* titulo principal */}
+ <Text style={styles.title}>Iniciar sesión</Text>
+
+ {/* subtitulo */}
+ <Text style={styles.subtitle}>Accede a tu cuenta de App Oficina</Text>
+
+ {/* tarjeta del formulario */}
+ <View style={styles.formCard}>
+ {/* campo correo */}
+ <Text style={styles.label}>Correo electrónico</Text>
+ <TextInput
+ style={styles.input}
+ placeholder="tu@email.com"
+ placeholderTextColor={colors.textSecondary}
+ autoCapitalize="none"
+ keyboardType="email-address"
+ value={email}
+ onChangeText={setEmail}
+ />
+
+ {/* campo contraseña */}
+ <Text style={styles.label}>Contraseña</Text>
+ <TextInput
+ style={styles.input}
+ placeholder="••••••••"
+ placeholderTextColor={colors.textSecondary}
+ secureTextEntry
+ value={password}
+ onChangeText={setPassword}
+ />
+
+ {/* enlace visual de recuperar contraseña */}
+ <Text style={styles.forgotPassword}>¿Olvidaste tu contraseña?</Text>
+
+ {/* mensaje de error */}
+ {error ? <StatusMessage message={error} /> : null}
+
+ {/* boton principal */}
+ <Pressable style={styles.button} onPress={submit} disabled={isSubmitting}>
+ <Text style={styles.buttonText}>
+ {isSubmitting ? 'Entrando...' : 'Acceder'}
+ </Text>
+ </Pressable>
+ </View>
+
+ {/* enlace inferior a registro */}
+ <Link href="/(auth)/register" style={styles.link}>
+ ¿No tienes cuenta? <Text style={styles.linkHighlight}>Regístrate aquí</Text>
+ </Link>
+ </View>
</View>
);
}
const styles = StyleSheet.create({
+ // contenedor principal de la pantalla
container: {
flex: 1,
+ backgroundColor: colors.background,
+ },
+
+ // contenido central acotado y centrado
+ content: {
+ flex: 1,
+ justifyContent: 'center',
+ alignItems: 'center',
+ paddingHorizontal: spacing.xl,
+ paddingTop: spacing.xl,
+ paddingBottom: spacing.xl,
+ gap: spacing.lg,
+ maxWidth: layout.contentWidth,
+ width: '100%',
+ alignSelf: 'center',
+ },
+
+ // caja azul del icono superior
+ iconBox: {
+ width: 56,
+ height: 56,
+ borderRadius: radius.lg,
+ backgroundColor: colors.primary,
+ alignItems: 'center',
justifyContent: 'center',
- padding: 24,
- gap: 12,
+ alignSelf: 'center',
+ ...shadows.card,
},
+
+ // titulo principal
title: {
- fontSize: 28,
- fontWeight: '700',
- marginBottom: 16,
+ fontSize: 36,
+ fontWeight: fontWeight.semibold,
+ color: colors.text,
+ textAlign: 'center',
+ },
+
+ // subtitulo explicativo
+ subtitle: {
+ fontSize: typography.md,
+ color: colors.textSecondary,
+ textAlign: 'center',
+ lineHeight: 22,
},
+
+ // tarjeta del formulario de login
+ formCard: {
+ width: '100%',
+ backgroundColor: colors.surface,
+ borderRadius: radius.xxl,
+ borderWidth: 1,
+ borderColor: colors.border,
+ padding: spacing.lg,
+ gap: spacing.md,
+ ...shadows.card,
+ },
+
+ // texto de etiqueta de los inputs
+ label: {
+ fontSize: typography.sm,
+ color: colors.text,
+ fontWeight: fontWeight.medium,
+ },
+
+ // input de formulario
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.background,
+ color: colors.text,
},
+
+ // texto de recuperar contraseña
+ forgotPassword: {
+ fontSize: typography.sm,
+ color: colors.primary,
+ textAlign: 'right',
+ marginTop: spacing.xs,
+ },
+
+ // boton principal
button: {
- backgroundColor: '#1f6feb',
- paddingVertical: 14,
- borderRadius: 10,
+ backgroundColor: colors.primary,
+ paddingVertical: spacing.lg,
+ borderRadius: radius.md,
alignItems: 'center',
- marginTop: 8,
+ justifyContent: 'center',
+ marginTop: spacing.sm,
},
+
+ // texto del boton principal
buttonText: {
- color: '#fff',
- fontWeight: '600',
+ color: colors.white,
+ fontWeight: fontWeight.semibold,
+ fontSize: typography.md,
},
+
+ // enlace inferior
link: {
- marginTop: 12,
+ marginTop: spacing.sm,
+ fontSize: typography.md,
+ color: colors.textSecondary,
+ textAlign: 'center',
+ },
+
+ // parte destacada del enlace
+ linkHighlight: {
+ color: colors.primary,
+ fontWeight: fontWeight.medium,
},
});
diff --git a/src/app/(auth)/register.tsx b/src/app/(auth)/register.tsx
index 0eeb058..0b57ce5 100644
--- a/src/app/(auth)/register.tsx
+++ b/src/app/(auth)/register.tsx
@@ -1,9 +1,14 @@
import { Link } from 'expo-router';
import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
+import { MaterialIcons } from '@expo/vector-icons';
+import theme from '@/theme';
import { useRegister } from '@/features/auth/hooks/useRegister';
import { StatusMessage } from '@/shared/ui/StatusMessage';
+const { colors, spacing, radius, typography, fontWeight, layout, shadows } = theme;
+
export default function RegisterScreen() {
+ // hook de registro
const {
displayName,
email,
@@ -18,78 +23,181 @@ export default function RegisterScreen() {
return (
<View style={styles.container}>
- <Text style={styles.title}>Registrarse</Text>
-
- <TextInput
- style={styles.input}
- placeholder="Nombre"
- value={displayName}
- onChangeText={setDisplayName}
- />
-
- <TextInput
- style={styles.input}
- placeholder="Correo electrónico"
- autoCapitalize="none"
- keyboardType="email-address"
- value={email}
- onChangeText={setEmail}
- />
-
- <TextInput
- style={styles.input}
- placeholder="Contraseña"
- secureTextEntry
- value={password}
- onChangeText={setPassword}
- />
-
- {error ? <StatusMessage message={error} /> : null}
-
- <Pressable style={styles.button} onPress={submit} disabled={isSubmitting}>
- <Text style={styles.buttonText}>
- {isSubmitting ? 'Registrando...' : 'Crear cuenta'}
- </Text>
- </Pressable>
-
- <Link href="/(auth)/login" style={styles.link}>
- ¿Ya tienes cuenta? Inicia sesión
- </Link>
+ {/* contenido central acotado */}
+ <View style={styles.content}>
+ {/* icono superior */}
+ <View style={styles.iconBox}>
+ <MaterialIcons name="business" size={28} color={colors.white} />
+ </View>
+
+ {/* titulo principal */}
+ <Text style={styles.title}>Crear cuenta</Text>
+
+ {/* subtitulo */}
+ <Text style={styles.subtitle}>Únete a App Oficina hoy mismo</Text>
+
+ {/* tarjeta del formulario */}
+ <View style={styles.formCard}>
+ {/* campo nombre */}
+ <Text style={styles.label}>Nombre completo</Text>
+ <TextInput
+ style={styles.input}
+ placeholder="Ej: Juan Pérez"
+ placeholderTextColor={colors.textSecondary}
+ value={displayName}
+ onChangeText={setDisplayName}
+ />
+
+ {/* campo correo */}
+ <Text style={styles.label}>Correo electrónico</Text>
+ <TextInput
+ style={styles.input}
+ placeholder="tu@email.com"
+ placeholderTextColor={colors.textSecondary}
+ autoCapitalize="none"
+ keyboardType="email-address"
+ value={email}
+ onChangeText={setEmail}
+ />
+
+ {/* campo contraseña */}
+ <Text style={styles.label}>Contraseña</Text>
+ <TextInput
+ style={styles.input}
+ placeholder="Mínimo 8 caracteres"
+ placeholderTextColor={colors.textSecondary}
+ secureTextEntry
+ value={password}
+ onChangeText={setPassword}
+ />
+
+ {/* mensaje de error */}
+ {error ? <StatusMessage message={error} /> : null}
+
+ {/* boton principal */}
+ <Pressable style={styles.button} onPress={submit} disabled={isSubmitting}>
+ <Text style={styles.buttonText}>
+ {isSubmitting ? 'Registrando...' : 'Crear cuenta'}
+ </Text>
+ </Pressable>
+ </View>
+
+ {/* enlace inferior a login */}
+ <Link href="/(auth)/login" style={styles.link}>
+ ¿Ya tienes cuenta? <Text style={styles.linkHighlight}>Inicia sesión</Text>
+ </Link>
+ </View>
</View>
);
}
const styles = StyleSheet.create({
+ // contenedor principal de la pantalla
container: {
flex: 1,
+ backgroundColor: colors.background,
+ },
+
+ // contenido central acotado y centrado
+ content: {
+ flex: 1,
+ justifyContent: 'center',
+ alignItems: 'center',
+ paddingHorizontal: spacing.xl,
+ paddingTop: spacing.xl,
+ paddingBottom: spacing.xl,
+ gap: spacing.lg,
+ maxWidth: layout.contentWidth,
+ width: '100%',
+ alignSelf: 'center',
+ },
+
+ // caja azul del icono superior
+ iconBox: {
+ width: 56,
+ height: 56,
+ borderRadius: radius.lg,
+ backgroundColor: colors.primary,
+ alignItems: 'center',
justifyContent: 'center',
- padding: 24,
- gap: 12,
+ alignSelf: 'center',
+ ...shadows.card,
},
+
+ // titulo principal
title: {
- fontSize: 28,
- fontWeight: '700',
- marginBottom: 16,
+ fontSize: 36,
+ fontWeight: fontWeight.semibold,
+ color: colors.text,
+ textAlign: 'center',
+ },
+
+ // subtitulo explicativo
+ subtitle: {
+ fontSize: typography.md,
+ color: colors.textSecondary,
+ textAlign: 'center',
+ lineHeight: 22,
+ },
+
+ // tarjeta del formulario de registro
+ formCard: {
+ width: '100%',
+ backgroundColor: colors.surface,
+ borderRadius: radius.xxl,
+ borderWidth: 1,
+ borderColor: colors.border,
+ padding: spacing.lg,
+ gap: spacing.md,
+ ...shadows.card,
+ },
+
+ // texto de etiqueta de los inputs
+ label: {
+ fontSize: typography.sm,
+ color: colors.text,
+ fontWeight: fontWeight.medium,
},
+
+ // input de formulario
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.background,
+ color: colors.text,
},
+
+ // boton principal
button: {
- backgroundColor: '#1f6feb',
- paddingVertical: 14,
- borderRadius: 10,
+ backgroundColor: colors.primary,
+ paddingVertical: spacing.lg,
+ borderRadius: radius.md,
alignItems: 'center',
- marginTop: 8,
+ justifyContent: 'center',
+ marginTop: spacing.sm,
},
+
+ // texto del boton principal
buttonText: {
- color: '#fff',
- fontWeight: '600',
+ color: colors.white,
+ fontWeight: fontWeight.semibold,
+ fontSize: typography.md,
},
+
+ // enlace inferior
link: {
- marginTop: 12,
+ marginTop: spacing.sm,
+ fontSize: typography.md,
+ color: colors.textSecondary,
+ textAlign: 'center',
+ },
+
+ // parte destacada del enlace
+ linkHighlight: {
+ color: colors.primary,
+ fontWeight: fontWeight.medium,
},
});
diff --git a/src/app/(auth)/welcome.tsx b/src/app/(auth)/welcome.tsx
index 9b00154..1d16688 100644
--- a/src/app/(auth)/welcome.tsx
+++ b/src/app/(auth)/welcome.tsx
@@ -1,58 +1,235 @@
import { Link } from 'expo-router';
-import { StyleSheet, Text, View, Pressable } from 'react-native';
+import { Pressable, StyleSheet, Text, View } from 'react-native';
+import theme from '@/theme';
+import { Feather, MaterialIcons } from '@expo/vector-icons';
+
+const { colors, spacing, radius, typography, fontWeight, layout, shadows } = theme;
export default function WelcomeScreen() {
return (
<View style={styles.container}>
- <Text style={styles.title}>App Oficina</Text>
- <Text style={styles.subtitle}>Reserva de espacios de trabajo</Text>
-
- <Link href="/(auth)/login" asChild>
- <Pressable style={styles.button}>
- <Text style={styles.buttonText}>Iniciar sesión</Text>
- </Pressable>
- </Link>
-
- <Link href="/(auth)/register" asChild>
- <Pressable style={styles.buttonSecondary}>
- <Text style={styles.buttonText}>Registrarse</Text>
- </Pressable>
- </Link>
+ {/* bloque central de bienvenida */}
+ <View style={styles.content}>
+ {/* icono superior */}
+ <View style={styles.iconBox}>
+ <MaterialIcons name="business" size={28} color={colors.white} />
+ </View>
+
+ {/* titulo principal */}
+ <Text style={styles.title}>App Oficina</Text>
+
+ {/* subtitulo descriptivo */}
+ <Text style={styles.subtitle}>
+ Reserva oficinas, despachos y puestos de trabajo de forma rápida y sencilla
+ </Text>
+
+ {/* tarjeta de ventajas */}
+ <View style={styles.featuresCard}>
+ {/* ventaja 1 */}
+ <View style={styles.featureItem}>
+ <View style={styles.featureIconWrap}>
+ <MaterialIcons name="business" size={16} color={colors.primary} />
+ </View>
+
+ <View style={styles.featureTextBlock}>
+ <Text style={styles.featureTitle}>Espacios flexibles</Text>
+ <Text style={styles.featureDescription}>
+ Oficinas privadas, despachos y puestos individuales
+ </Text>
+ </View>
+ </View>
+
+ {/* ventaja 2 */}
+ <View style={styles.featureItem}>
+ <View style={styles.featureIconWrap}>
+ <Feather name="calendar" size={16} color={colors.primary} />
+ </View>
+
+ <View style={styles.featureTextBlock}>
+ <Text style={styles.featureTitle}>Reserva en tiempo real</Text>
+ <Text style={styles.featureDescription}>
+ Comprueba disponibilidad y reserva al instante
+ </Text>
+ </View>
+ </View>
+
+ {/* ventaja 3 */}
+ <View style={styles.featureItem}>
+ <View style={styles.featureIconWrap}>
+ <MaterialIcons name="access-time" size={16} color={colors.primary} />
+ </View>
+
+ <View style={styles.featureTextBlock}>
+ <Text style={styles.featureTitle}>Gestión sencilla</Text>
+ <Text style={styles.featureDescription}>
+ Administra todas tus reservas desde un solo lugar
+ </Text>
+ </View>
+ </View>
+ </View>
+
+ {/* boton principal */}
+ <Link href="/(auth)/login" asChild>
+ <Pressable style={styles.button}>
+ <Text style={styles.buttonText}>Iniciar sesión</Text>
+ </Pressable>
+ </Link>
+
+ {/* boton secundario */}
+ <Link href="/(auth)/register" asChild>
+ <Pressable style={styles.buttonSecondary}>
+ <Text style={styles.buttonSecondaryText}>Registrarse</Text>
+ </Pressable>
+ </Link>
+
+ {/* texto inferior */}
+ <Text style={styles.footerText}>
+ Diseñado para profesionales y equipos modernos
+ </Text>
+ </View>
</View>
);
}
const styles = StyleSheet.create({
+ // el ancho queda acotado igual que en home y profile
container: {
flex: 1,
+ backgroundColor: colors.background,
+ },
+
+ // contenido central de bienvenida controlando el ancho maximo, el centrado y el espaciado
+ content: {
+ flex: 1,
+ justifyContent: 'center',
+ paddingHorizontal: spacing.xl,
+ paddingTop: spacing.xl,
+ paddingBottom: spacing.xl,
+ gap: spacing.lg,
+ maxWidth: layout.contentWidth,
+ width: '100%',
+ alignSelf: 'center',
+ },
+
+ // caja azul del icono superior
+ iconBox: {
+ width: 56,
+ height: 56,
+ borderRadius: radius.lg,
+ backgroundColor: colors.primary,
+ alignItems: 'center',
justifyContent: 'center',
- padding: 24,
- gap: 16,
+ alignSelf: 'center',
+ ...shadows.card,
},
+
+ // titulo principal
title: {
- fontSize: 32,
- fontWeight: '700',
+ fontSize: 36,
+ fontWeight: fontWeight.semibold,
+ color: colors.text,
textAlign: 'center',
},
+
+ // subtitulo
subtitle: {
- fontSize: 16,
+ fontSize: typography.md,
+ color: colors.textSecondary,
textAlign: 'center',
- marginBottom: 24,
+ lineHeight: 22,
+ maxWidth: 300,
+ },
+
+ // tarjeta de ventajas
+ featuresCard: {
+ width: '100%',
+ backgroundColor: colors.surface,
+ borderRadius: radius.xxl,
+ borderWidth: 1,
+ borderColor: colors.border,
+ padding: spacing.lg,
+ gap: spacing.lg,
+ ...shadows.card,
+ },
+
+ // fila de cada ventaja
+ featureItem: {
+ flexDirection: 'row',
+ alignItems: 'flex-start',
+ gap: spacing.md,
+ },
+
+ // fondo del icono de cada ventaja
+ featureIconWrap: {
+ width: 32,
+ height: 32,
+ borderRadius: radius.md,
+ backgroundColor: colors.primarySoft,
+ alignItems: 'center',
+ justifyContent: 'center',
+ },
+
+ // bloque de textos de cada ventaja
+ featureTextBlock: {
+ flex: 1,
+ gap: 2,
+ },
+
+ // titulo de la ventaja
+ featureTitle: {
+ fontSize: typography.md,
+ fontWeight: fontWeight.semibold,
+ color: colors.text,
+ },
+
+ // descripcion de la ventaja
+ featureDescription: {
+ fontSize: typography.sm,
+ color: colors.textSecondary,
+ lineHeight: 18,
},
+
+ // boton principal
button: {
- backgroundColor: '#1f6feb',
- paddingVertical: 14,
- borderRadius: 10,
+ width: '100%',
+ backgroundColor: colors.primary,
+ paddingVertical: spacing.lg,
+ borderRadius: radius.md,
alignItems: 'center',
+ justifyContent: 'center',
+ },
+
+ // texto del boton principal
+ buttonText: {
+ color: colors.white,
+ fontWeight: fontWeight.semibold,
+ fontSize: typography.md,
},
+
+ // boton secundario con borde
buttonSecondary: {
- backgroundColor: '#444',
- paddingVertical: 14,
- borderRadius: 10,
+ width: '100%',
+ backgroundColor: colors.surface,
+ paddingVertical: spacing.lg,
+ borderRadius: radius.md,
alignItems: 'center',
+ justifyContent: 'center',
+ borderWidth: 1,
+ borderColor: colors.border,
},
- buttonText: {
- color: '#fff',
- fontWeight: '600',
+
+ // texto del boton secundario
+ buttonSecondaryText: {
+ color: colors.text,
+ fontWeight: fontWeight.medium,
+ fontSize: typography.md,
+ },
+
+ // texto inferior discreto
+ footerText: {
+ marginTop: spacing.sm,
+ fontSize: typography.sm,
+ color: colors.textSecondary,
+ textAlign: 'center',
},
});
diff --git a/src/app/(protected)/(tabs)/_layout.tsx b/src/app/(protected)/(tabs)/_layout.tsx
index a4e0445..c19cbff 100644
--- a/src/app/(protected)/(tabs)/_layout.tsx
+++ b/src/app/(protected)/(tabs)/_layout.tsx
@@ -48,7 +48,7 @@ export default function TabsLayout() {
title: 'Espacios',
tabBarLabel: 'Espacios',
tabBarIcon: ({ color, size }) => (
- <MaterialIcons name="apartment" size={size} color={color} />
+ <MaterialIcons name="business" size={size} color={color} />
),
}}
/>
diff --git a/src/app/(protected)/(tabs)/home.tsx b/src/app/(protected)/(tabs)/home.tsx
index 523283c..5a8a04e 100644
--- a/src/app/(protected)/(tabs)/home.tsx
+++ b/src/app/(protected)/(tabs)/home.tsx
@@ -8,7 +8,7 @@ import { ActivityIndicator, Pressable, StyleSheet, Text, View } from 'react-nati
function formatDate(date: string): string {
const parsedDate = new Date(date);
-
+ // formato fecha
return parsedDate.toLocaleDateString('es-ES', {
day: '2-digit',
month: 'short',
@@ -82,7 +82,7 @@ export default function HomeScreen() {
<Link href="/(protected)/reservations/create" asChild>
<Pressable style={styles.quickAccessButton}>
<View style={styles.quickAccessIconContainerLight}>
- <MaterialIcons name="apartment" size={28} color="#fff" />
+ <MaterialIcons name="business" size={28} color="#fff" />
</View>
<Text style={styles.quickAccessButtonText}>
Reservar{"\n"}espacio
@@ -124,7 +124,7 @@ export default function HomeScreen() {
<View style={styles.reservationContent}>
<View style={styles.reservationIconContainer}>
- <MaterialIcons name="apartment" size={22} color={colors.primary} />
+ <MaterialIcons name="business" size={22} color={colors.primary} />
</View>
<View style={styles.reservationInfo}>