From bcaa0caf27bd66a702e58b146e7f1739f4fa8c0c Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 19:51:05 +0000 Subject: [PATCH] Update src/app/login/page.tsx --- src/app/login/page.tsx | 266 ++++++++++++++++++++++++++++------------- 1 file changed, 180 insertions(+), 86 deletions(-) diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 7a1bd0a..6bf040a 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -1,47 +1,60 @@ "use client"; +import { useState } from "react"; import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered'; -import { useState } from "react"; -import { Eye, EyeOff, Mail, Lock } from 'lucide-react'; +import FooterBase from '@/components/sections/footer/FooterBase'; import Input from '@/components/form/Input'; +import ButtonElasticEffect from '@/components/button/ButtonElasticEffect/ButtonElasticEffect'; +import { LogIn, Mail, Lock, Eye, EyeOff } from 'lucide-react'; export default function LoginPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); - const [errors, setErrors] = useState<{ email?: string; password?: string }>({}); - const [isSubmitted, setIsSubmitted] = useState(false); + const [isLoading, setIsLoading] = useState(false); + const [error, setError] = useState(""); + const [rememberMe, setRememberMe] = useState(false); - const validateForm = () => { - const newErrors: { email?: string; password?: string } = {}; - - if (!email) { - newErrors.email = "Email é obrigatório"; - } else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { - newErrors.email = "Email inválido"; - } - - if (!password) { - newErrors.password = "Senha é obrigatória"; - } else if (password.length < 6) { - newErrors.password = "Senha deve ter no mínimo 6 caracteres"; - } - - return newErrors; - }; - - const handleSubmit = (e: React.FormEvent) => { + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); - const newErrors = validateForm(); - setErrors(newErrors); - - if (Object.keys(newErrors).length === 0) { - setIsSubmitted(true); - console.log("Login attempt:", { email, password }); - setTimeout(() => { - setIsSubmitted(false); - }, 2000); + setError(""); + setIsLoading(true); + + try { + // Simulate API call + if (!email || !password) { + setError("Por favor, preencha todos os campos."); + return; + } + + if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { + setError("Por favor, insira um email válido."); + return; + } + + if (password.length < 6) { + setError("A senha deve ter no mínimo 6 caracteres."); + return; + } + + // Simulate successful login + const response = { success: true, token: "user_token_123" }; + + if (response.success) { + // Store session + sessionStorage.setItem("authToken", response.token); + sessionStorage.setItem("userEmail", email); + if (rememberMe) { + localStorage.setItem("userEmail", email); + } + // Redirect to dashboard + window.location.href = "/dashboard"; + } + } catch (err) { + setError("Erro ao fazer login. Tente novamente."); + } finally { + setIsLoading(false); } }; @@ -61,100 +74,181 @@ export default function LoginPage() { -
+
-
-
-

Bem-vindo de Volta

-

Faça login para acessar seu progresso

+
+ {/* Header */} +
+
+
+ +
+
+

+ Bem-vindo de Volta +

+

+ Faça login na sua conta FitFlow Pro +

-
-
- - - {errors.email && ( -

{errors.email}

- )} + {/* Error Message */} + {error && ( +
+ {error}
+ )} -
-
+ + {/* Submit Button */} + - {isSubmitted ? "Entrando..." : "Entrar"} - + className="w-full" + /> -
-

- Não tem conta?{" "} - - Criar conta - -

+ {/* Divider */} +
+
+ ou +
-
-

Teste gratuito por 30 dias. Sem cartão de crédito necessário.

+ {/* Social Login */} +
+ + +
+ + {/* Sign Up Link */} +
+ Não tem conta?{" "} + + Inscreva-se aqui +
+ + {/* Security Note */} +

+ Sua senha está sempre protegida. Nunca compartilhamos seus dados com terceiros. +

+ + ); }