-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70059c7
commit 7903b95
Showing
32 changed files
with
2,914 additions
and
2,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,128 @@ | ||
import React, { useState } from 'react'; | ||
import { useAuth0 } from '@auth0/auth0-react'; | ||
import '../styles/navbar.css'; // Asegúrate de que la ruta del CSS es correcta | ||
import { Link } from 'react-router-dom'; | ||
import logo from '../assets/logoo.png'; | ||
import whatsapp from '../assets/whatsapp.png'; | ||
import { FaBars } from 'react-icons/fa'; // Importar el icono de hamburguesa | ||
// import React, { useState } from 'react'; | ||
// import { useAuth0 } from '@auth0/auth0-react'; | ||
// import '../styles/navbar.css'; // Asegúrate de que la ruta del CSS es correcta | ||
// import { Link } from 'react-router-dom'; | ||
// import logo from '../assets/logoo.png'; | ||
// import whatsapp from '../assets/whatsapp.png'; | ||
// import { FaBars } from 'react-icons/fa'; // Importar el icono de hamburguesa | ||
|
||
// function NavBar() { | ||
// const { loginWithRedirect, isAuthenticated } = useAuth0(); | ||
// const [menuOpen, setMenuOpen] = useState(false); // Estado para manejar el menú | ||
|
||
// const toggleMenu = () => { | ||
// setMenuOpen(!menuOpen); // Alternar estado del menú | ||
// }; | ||
|
||
// return ( | ||
// <div className="navbar"> | ||
// <div className="navbar-content"> | ||
// <Link to="/"> | ||
// <img src={logo} className="navbar-logo" alt="Logo" /> | ||
// </Link> | ||
// <div className="navbar-links"> | ||
// <Link to="/inicio" className="footer-link">Inicio</Link> | ||
// <Link to="/mapa-navegacion" className="footer-link">Mapa</Link> | ||
// <Link to="/servicios" className="footer-link">Servicios</Link> | ||
// <Link to="/cerca" className="footer-link">A mi alrededor</Link> | ||
|
||
function NavBar() { | ||
const { loginWithRedirect, isAuthenticated } = useAuth0(); | ||
const [menuOpen, setMenuOpen] = useState(false); // Estado para manejar el menú | ||
// {isAuthenticated && ( | ||
// <> | ||
// <Link to="/mi-perfil" className="footer-link">Mi Perfil</Link> | ||
// <Link to="/publicaciones" className="footer-link">Mis Publicaciones</Link> | ||
// <Link to="/favoritos" className="footer-link">Mis Favoritos</Link> | ||
// <Link to="/notificaciones" className="footer-link">Enviar notificaciones a usuarios</Link> | ||
// <Link to="/gestion-solicitudes" className="footer-link">Gestión de Solicitudes</Link> | ||
|
||
const toggleMenu = () => { | ||
setMenuOpen(!menuOpen); // Alternar estado del menú | ||
}; | ||
// </> | ||
// )} | ||
|
||
return ( | ||
<div className="navbar"> | ||
<div className="navbar-content"> | ||
<Link to="/"> | ||
<img src={logo} className="navbar-logo" alt="Logo" /> | ||
</Link> | ||
<div className="navbar-links"> | ||
<Link to="/inicio" className="footer-link">Inicio</Link> | ||
<Link to="/mapa-navegacion" className="footer-link">Mapa</Link> | ||
<Link to="/servicios" className="footer-link">Servicios</Link> | ||
<Link to="/cerca" className="footer-link">A mi alrededor</Link> | ||
// {!isAuthenticated && ( | ||
// <a className="footer-link" onClick={loginWithRedirect}>Iniciar sesión</a> | ||
// )} | ||
// </div> | ||
// <FaBars className="navbar-hamburger" onClick={toggleMenu} /> {/* Icono de hamburguesa */} | ||
// </div> | ||
// <div className="whatsapp-container" onClick={() => alert('Connecting to WhatsApp')}> | ||
// <img src={whatsapp} className="whatsapp-icon" alt="WhatsApp" /> | ||
// </div> | ||
// {menuOpen && ( // Mostrar el menú si está abierto | ||
// <div className="navbar-dropdown"> | ||
// <Link to="/inicio" className="footer-link" onClick={toggleMenu}>Inicio</Link> | ||
// <Link to="/mapa-navegacion" className="footer-link" onClick={toggleMenu}>Mapa</Link> | ||
// <Link to="/servicios" className="footer-link" onClick={toggleMenu}>Servicios</Link> | ||
// <Link to="/cerca" className="footer-link" onClick={toggleMenu}>A mi alrededor</Link> | ||
|
||
{isAuthenticated && ( | ||
<> | ||
<Link to="/mi-perfil" className="footer-link">Mi Perfil</Link> | ||
<Link to="/publicaciones" className="footer-link">Mis Publicaciones</Link> | ||
<Link to="/favoritos" className="footer-link">Mis Favoritos</Link> | ||
<Link to="/notificaciones" className="footer-link">Enviar notificaciones a usuarios</Link> | ||
<Link to="/gestion-solicitudes" className="footer-link">Gestión de Solicitudes</Link> | ||
// {isAuthenticated && ( | ||
// <> | ||
// <Link to="/mi-perfil" className="footer-link" onClick={toggleMenu}>Mi Perfil</Link> | ||
// <Link to="/publicaciones" className="footer-link" onClick={toggleMenu}>Mis Publicaciones</Link> | ||
// <Link to="/favoritos" className="footer-link" onClick={toggleMenu}>Mis Favoritos</Link> | ||
// <Link to="/notificaciones" className="footer-link" onClick={toggleMenu}>Enviar notificaciones a usuarios</Link> | ||
// </> | ||
// )} | ||
|
||
</> | ||
)} | ||
// {!isAuthenticated && ( | ||
// <a className="footer-link" onClick={() => { loginWithRedirect(); toggleMenu(); }}>Iniciar sesión</a> | ||
// )} | ||
// </div> | ||
// )} | ||
// </div> | ||
// ); | ||
// } | ||
// export default NavBar; | ||
|
||
{!isAuthenticated && ( | ||
<a className="footer-link" onClick={loginWithRedirect}>Iniciar sesión</a> | ||
)} | ||
</div> | ||
<FaBars className="navbar-hamburger" onClick={toggleMenu} /> {/* Icono de hamburguesa */} | ||
</div> | ||
<div className="whatsapp-container" onClick={() => alert('Connecting to WhatsApp')}> | ||
<img src={whatsapp} className="whatsapp-icon" alt="WhatsApp" /> | ||
</div> | ||
{menuOpen && ( // Mostrar el menú si está abierto | ||
<div className="navbar-dropdown"> | ||
<Link to="/inicio" className="footer-link" onClick={toggleMenu}>Inicio</Link> | ||
<Link to="/mapa-navegacion" className="footer-link" onClick={toggleMenu}>Mapa</Link> | ||
<Link to="/servicios" className="footer-link" onClick={toggleMenu}>Servicios</Link> | ||
<Link to="/cerca" className="footer-link" onClick={toggleMenu}>A mi alrededor</Link> | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import '../styles/navbar.css'; | ||
import { useAuth0 } from '@auth0/auth0-react'; | ||
import logo from '../assets/logo_oficial.png'; | ||
|
||
export default function NavBar() { | ||
const { user, isLoading, loginWithRedirect, logout, isAuthenticated } = useAuth0(); | ||
console.log(user) | ||
const getUserRoles = () => { | ||
// Adjust this based on your Auth0 configuration | ||
return user?.['https://your-namespace/roles'] || user?.roles || []; | ||
}; | ||
const userRoles = getUserRoles(); | ||
|
||
return ( | ||
<div className="navbar"> | ||
<div className="navbar-content"> | ||
<img className="logo-image" src={logo}></img> | ||
<Link to="/" className="navbar-logo">GEOMAPP</Link> | ||
|
||
<div className="navbar-links"> | ||
<Link to="/inicio" className="nav-link">Inicio</Link> | ||
<Link to="/mapa-navegacion" className="nav-link">Mapa</Link> | ||
<Link to="/servicios" className="nav-link">Servicios</Link> | ||
{/* <Link to="/hire-designers" className="nav-link">Hire Designers</Link> */} | ||
{isAuthenticated && (<Link to="/publicaciones" className="nav-link">Publicaciones</Link>)} | ||
{isAuthenticated && userRoles.includes('administrador') && (<Link to="/notificaciones" className="nav-link">Notificaciones</Link>)} | ||
</div> | ||
|
||
|
||
</div> | ||
<div className="navbar-actions"> | ||
|
||
{isAuthenticated && ( | ||
<> | ||
<Link to="/mi-perfil" className="footer-link" onClick={toggleMenu}>Mi Perfil</Link> | ||
<Link to="/publicaciones" className="footer-link" onClick={toggleMenu}>Mis Publicaciones</Link> | ||
<Link to="/favoritos" className="footer-link" onClick={toggleMenu}>Mis Favoritos</Link> | ||
<Link to="/notificaciones" className="footer-link" onClick={toggleMenu}>Enviar notificaciones a usuarios</Link> | ||
</> | ||
)} | ||
{!isAuthenticated ? ( | ||
<a className="sign-up" onClick={loginWithRedirect}>Iniciar sesión</a> | ||
) : ( | ||
<div className="profile-container"> | ||
<Link to="/mi-perfil"> | ||
<img | ||
src={user.picture} | ||
className="profile-avatar" | ||
/> | ||
</Link> | ||
|
||
</div> | ||
)} | ||
|
||
{!isAuthenticated && ( | ||
<a className="footer-link" onClick={() => { loginWithRedirect(); toggleMenu(); }}>Iniciar sesión</a> | ||
)} | ||
</div> | ||
)} | ||
|
||
</div> | ||
); | ||
|
||
</div> | ||
); | ||
} | ||
export default NavBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.