From 20f01dccb32d7b10d2ad827967d532a8ae8041e1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 25 Jun 2025 06:20:58 -0600 Subject: [PATCH] GUI validada final --- src/app/(auth)/page.tsx | 114 ++++++++++++++++++++++++++----- src/app/carga/page.tsx | 1 - src/app/landing/IconCircle.css | 25 +++++-- src/app/landing/IconCircle.tsx | 74 ++++++++++++++------ src/app/landing/globals.css | 4 +- src/app/landing/landing_body.tsx | 11 +-- src/app/landing/new_header.tsx | 50 ++++++++++++-- src/app/page.tsx | 93 +++++++++++++++++++++++++ src/components/password.tsx | 18 ++++- 9 files changed, 331 insertions(+), 59 deletions(-) create mode 100644 src/app/page.tsx diff --git a/src/app/(auth)/page.tsx b/src/app/(auth)/page.tsx index 1d31a6b..5368192 100644 --- a/src/app/(auth)/page.tsx +++ b/src/app/(auth)/page.tsx @@ -1,24 +1,85 @@ +"use client"; + import Button from "@/components/button"; import SimpleInput from "@/components/input"; import PasswordInput from "@/components/password"; -import React from "react"; - - +import React, { useState } from "react"; +import axios from "axios"; +import { useRouter } from "next/navigation"; import { motion } from "framer-motion"; +// Estilos CSS adicionales para el input group +const inputGroupStyles = ` + .auth-page .input-group { + display: flex !important; + align-items: stretch !important; + } + + .auth-page .input-group .form-control { + border-right: none !important; + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; + } + + .auth-page .input-group .btn { + border-left: none !important; + border-top-left-radius: 0 !important; + border-bottom-left-radius: 0 !important; + padding: 0.375rem 0.75rem !important; + display: flex !important; + align-items: center !important; + justify-content: center !important; + min-width: 40px !important; + } +`; + export default function Page() { + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [error, setError] = useState(''); + const router = useRouter(); + + const handleLogin = async () => { + try { + const response = await axios.post('http://localhost:4000/login', { + email: email, + password: password, + }); + + const token = response.data.access_token; + localStorage.setItem('token', token); + + // Disparar evento personalizado para notificar cambio de token + window.dispatchEvent(new Event('tokenChanged')); + + // Limpiar formulario + setEmail(''); + setPassword(''); + setError(''); + + // Opcional: mostrar mensaje de éxito + alert('Login exitoso. Ahora puedes acceder a Carga y Visualización.'); + } catch (err: any) { + const message = + err.response?.data?.message || + err.message || + 'Error al iniciar sesión'; + setError(message); + } + }; + return ( - - - - - + <> + {/* Inyectar estilos CSS */} +