diff --git a/app.rar b/app.rar deleted file mode 100644 index a885024..0000000 Binary files a/app.rar and /dev/null differ diff --git a/app/constants/colors.ts b/app/constants/colors.ts index e1486b0..0e15b4c 100644 --- a/app/constants/colors.ts +++ b/app/constants/colors.ts @@ -1,7 +1,7 @@ const COLORS = { background_user: '#FFFFFF', text: '#FFFFFF', - primary: '#B07B2C', + primary: '#B17741', }; export default COLORS; diff --git a/app/screens/auth/SignInScreen.tsx b/app/screens/auth/SignInScreen.tsx index 200539a..d8d86c5 100644 --- a/app/screens/auth/SignInScreen.tsx +++ b/app/screens/auth/SignInScreen.tsx @@ -1,34 +1,299 @@ -import React from 'react'; -import { View, Text, StyleSheet, Button } from 'react-native'; -import { router } from 'expo-router'; +import { useState } from "react"; +import { + View, + Text, + TextInput, + Pressable, + StyleSheet, + Image, + Alert, + TouchableOpacity, +} from "react-native"; +import { Eye, EyeOff } from "lucide-react-native"; +import { router } from "expo-router"; +import { signIn } from "../../../firebase/auth"; // Assure-toi que le chemin est correct +import { Link } from "expo-router"; + + + const SignInScreen = () => { + const [form, setForm] = useState({ + email: "", + password: "", + rememberMe: false, + }); + + const [errors, setErrors] = useState({ + email: "", + password: "", + }); + + const [showPassword, setShowPassword] = useState(false); + + const validateForm = () => { + let valid = true; + const newErrors = { email: "", password: "" }; + + if (!form.email) { + newErrors.email = "L'e-mail est requis."; + valid = false; + } + + if (!form.password) { + newErrors.password = "Le mot de passe est requis."; + valid = false; + } + + setErrors(newErrors); + return valid; + }; + + const handleLogin = async () => { + if (!validateForm()) return; + + try { + const { user } = await signIn(form.email, form.password); // Destructure to get user + console.log("Connexion réussie :", user.email); // Access the email directly + router.replace("/screens/user/UserHomeScreen"); // You can route based on role later + } catch (error: any) { + Alert.alert("Erreur", error.message); // Display the error message + } + }; + return ( - Sign In Screen -