Merge branch 'main' of https://git.mdnd-it.cc/Donat/SerpentRace into user-resetpass
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useRef, useState } from "react"
|
||||
import { Link } from "react-router-dom"
|
||||
import Logo from "../../assets/pictures/Logo"
|
||||
import HandleNavigate from "../../utils/HandleNavigate/HandleNavigate"
|
||||
|
||||
const ArrowUpIcon = () => <span style={{ fontSize: "1.25rem" }}>↑</span>
|
||||
|
||||
@@ -8,6 +8,9 @@ const Footer = () => {
|
||||
const [isVisible, setIsVisible] = useState(false)
|
||||
const footerRef = useRef(null)
|
||||
|
||||
// ✅ Használjuk a navigációs függvényeket
|
||||
const { goLanding, goAbout, goContacts } = HandleNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
@@ -16,14 +19,10 @@ const Footer = () => {
|
||||
{ threshold: 0.3 }
|
||||
)
|
||||
|
||||
if (footerRef.current) {
|
||||
observer.observe(footerRef.current)
|
||||
}
|
||||
if (footerRef.current) observer.observe(footerRef.current)
|
||||
|
||||
return () => {
|
||||
if (footerRef.current) {
|
||||
observer.unobserve(footerRef.current)
|
||||
}
|
||||
if (footerRef.current) observer.unobserve(footerRef.current)
|
||||
}
|
||||
}, [])
|
||||
|
||||
@@ -40,10 +39,18 @@ const Footer = () => {
|
||||
<div className="max-w-6xl mx-auto flex flex-wrap justify-between items-start gap-8 px-4">
|
||||
{/* Logó */}
|
||||
<div className="flex flex-col items-center">
|
||||
<a href="/" className="hover:scale-105 hover:brightness-110">
|
||||
<button
|
||||
onClick={goLanding}
|
||||
className="hover:scale-105 hover:brightness-110 transition-transform"
|
||||
>
|
||||
<Logo size={100} />
|
||||
</a>
|
||||
<span className="font-extrabold text-xl mt-2 tracking-wide">SerpentRace</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={goLanding}
|
||||
className="font-extrabold text-xl mt-2 tracking-wide text-white hover:text-green-500 transition-colors"
|
||||
>
|
||||
SerpentRace
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Oldalak */}
|
||||
@@ -51,15 +58,24 @@ const Footer = () => {
|
||||
<span className="text-lg font-semibold text-green-600 underline underline-offset-4 mb-2 drop-shadow-sm">
|
||||
Oldalak
|
||||
</span>
|
||||
<a href="/" className="hover:underline hover:text-green-500">
|
||||
<button
|
||||
onClick={goLanding}
|
||||
className="text-left hover:underline hover:text-green-500 transition-colors"
|
||||
>
|
||||
Főoldal
|
||||
</a>
|
||||
<a href="/about" className="hover:underline hover:text-green-500">
|
||||
</button>
|
||||
<button
|
||||
onClick={goAbout}
|
||||
className="text-left hover:underline hover:text-green-500 transition-colors"
|
||||
>
|
||||
Rólunk
|
||||
</a>
|
||||
<a href="/contacts" className="hover:underline hover:text-green-500">
|
||||
</button>
|
||||
<button
|
||||
onClick={goContacts}
|
||||
className="text-left hover:underline hover:text-green-500 transition-colors"
|
||||
>
|
||||
Kapcsolat
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Közösség */}
|
||||
@@ -103,7 +119,7 @@ const Footer = () => {
|
||||
{isVisible && (
|
||||
<button
|
||||
onClick={scrollToTop}
|
||||
className="fixed bottom-6 right-6 bg-green-500 hover:bg-green-600 text-white p-3 rounded-full shadow-lg hover:scale-110"
|
||||
className="fixed bottom-6 right-6 bg-green-500 hover:bg-green-600 text-white p-3 rounded-full shadow-lg hover:scale-110 transition-transform"
|
||||
aria-label="Ugrás az oldal tetejére"
|
||||
>
|
||||
<ArrowUpIcon />
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
import React, { useState } from "react"
|
||||
import Logo from "../../assets/pictures/Logo"
|
||||
import { Link, useNavigate } from "react-router-dom"
|
||||
import { Link } from "react-router-dom"
|
||||
import HandleNavigate from "../../utils/HandleNavigate/HandleNavigate"// ✅ importáld a navigációs hookot
|
||||
|
||||
const navLinkClass = "px-3 py-2 rounded-lg text-white transition-all duration-200 hover:bg-white/10"
|
||||
const navLinkClass =
|
||||
"px-3 py-2 rounded-lg text-white transition-all duration-200 hover:bg-white/10"
|
||||
const navLinkClassPlay =
|
||||
"px-4 py-2 rounded-lg text-white bg-white/12 hover:bg-white/20 transition-all duration-200"
|
||||
|
||||
const Navbar = () => {
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
const navigate = useNavigate()
|
||||
const isLoggedIn = Boolean(localStorage.getItem("authLevel") && localStorage.getItem("username"))
|
||||
const isLoggedIn = Boolean(
|
||||
localStorage.getItem("authLevel") && localStorage.getItem("username")
|
||||
)
|
||||
|
||||
// ✅ Használjuk a HandleNavigate hookot
|
||||
const { goLanding, goAbout, goHome, goLogin, goContacts } = HandleNavigate()
|
||||
|
||||
// ✅ Logout logika
|
||||
const handleLogout = () => {
|
||||
localStorage.removeItem("authLevel")
|
||||
localStorage.removeItem("username")
|
||||
navigate("/")
|
||||
localStorage.clear()
|
||||
goLanding()
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -23,20 +29,29 @@ const Navbar = () => {
|
||||
<div className="flex justify-between h-16 items-center">
|
||||
{/* Logo + Brand */}
|
||||
<div className="flex-shrink-0 flex items-center gap-2">
|
||||
<Link to="/" className="flex items-center mt-1 h-9">
|
||||
<button onClick={goLanding} className="flex items-center mt-1 h-9">
|
||||
<Logo size={36} />
|
||||
</Link>
|
||||
<Link to="/" className="flex items-center h-9 text-white font-bold text-2xl tracking-tight">
|
||||
</button>
|
||||
<button
|
||||
onClick={goLanding}
|
||||
className="flex items-center h-9 text-white font-bold text-2xl tracking-tight"
|
||||
>
|
||||
SerpentRace
|
||||
</Link>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Desktop Menu */}
|
||||
<div className="hidden md:flex items-center space-x-6">
|
||||
{/* Bal oldali linkek */}
|
||||
<Link to="/" className={navLinkClass}>Főoldal</Link>
|
||||
<Link to="/about" className={navLinkClass}>Rólunk</Link>
|
||||
<Link to="/contacts" className={navLinkClass}>Kapcsolat</Link>
|
||||
<button onClick={goLanding} className={navLinkClass}>
|
||||
Főoldal
|
||||
</button>
|
||||
<button onClick={goAbout} className={navLinkClass}>
|
||||
Rólunk
|
||||
</button>
|
||||
<button onClick={goContacts} className={navLinkClass}>
|
||||
Kapcsolat
|
||||
</button>
|
||||
|
||||
{/* Csak bejelentkezve */}
|
||||
{isLoggedIn && (
|
||||
@@ -48,17 +63,19 @@ const Navbar = () => {
|
||||
)}
|
||||
|
||||
{/* Játék gomb */}
|
||||
<Link to="/home" className={navLinkClassPlay}>Játék</Link>
|
||||
<button onClick={goHome} className={navLinkClassPlay}>
|
||||
Játék
|
||||
</button>
|
||||
|
||||
{/* Jobb oldali akciók */}
|
||||
{!isLoggedIn ? (
|
||||
<div className="flex items-center space-x-4">
|
||||
<Link
|
||||
to="/login"
|
||||
<button
|
||||
onClick={goLogin}
|
||||
className="px-4 py-2 rounded-lg hover:bg-white/20 text-white font-semibold transition-all"
|
||||
>
|
||||
Bejelentkezés
|
||||
</Link>
|
||||
</button>
|
||||
|
||||
{/* Elválasztó vonal */}
|
||||
<div className="w-px h-10 bg-white/100"></div>
|
||||
@@ -109,9 +126,19 @@ const Navbar = () => {
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
{menuOpen ? (
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M6 18L18 6M6 6l12 12"
|
||||
/>
|
||||
) : (
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 8h16M4 16h16" />
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M4 8h16M4 16h16"
|
||||
/>
|
||||
)}
|
||||
</svg>
|
||||
</button>
|
||||
@@ -122,9 +149,10 @@ const Navbar = () => {
|
||||
{/* Mobile Menu */}
|
||||
{menuOpen && (
|
||||
<div className="md:hidden bg-emerald-600 px-2 pt-2 pb-3 space-y-1">
|
||||
<Link to="/" onClick={() => setMenuOpen(false)} className={navLinkClass}>Főoldal</Link>
|
||||
<Link to="/about" onClick={() => setMenuOpen(false)} className={navLinkClass}>Rólunk</Link>
|
||||
<Link to="/contacts" onClick={() => setMenuOpen(false)} className={navLinkClass}>Kapcsolat</Link>
|
||||
<button onClick={() => { goLanding(); setMenuOpen(false) }} className={navLinkClass}>Főoldal</button>
|
||||
<button onClick={() => { goAbout(); setMenuOpen(false) }} className={navLinkClass}>Rólunk</button>
|
||||
<button onClick={() => { goContacts(); setMenuOpen(false) }} className={navLinkClass}>Kapcsolat</button>
|
||||
|
||||
{isLoggedIn && (
|
||||
<>
|
||||
<Link to="/decks" onClick={() => setMenuOpen(false)} className={navLinkClass}>Paklik</Link>
|
||||
@@ -132,17 +160,17 @@ const Navbar = () => {
|
||||
<Link to="/profile" onClick={() => setMenuOpen(false)} className={navLinkClass}>Profil</Link>
|
||||
</>
|
||||
)}
|
||||
<Link to="/home" onClick={() => setMenuOpen(false)} className={navLinkClassPlay}>Játék</Link>
|
||||
|
||||
<button onClick={() => { goHome(); setMenuOpen(false) }} className={navLinkClassPlay}>Játék</button>
|
||||
|
||||
{!isLoggedIn ? (
|
||||
<div className="flex flex-col space-y-2">
|
||||
<Link
|
||||
to="/login"
|
||||
onClick={() => setMenuOpen(false)}
|
||||
<button
|
||||
onClick={() => { goLogin(); setMenuOpen(false) }}
|
||||
className="block px-3 py-2 rounded-lg hover:bg-white/20 text-white font-semibold transition-all"
|
||||
>
|
||||
Bejelentkezés
|
||||
</Link>
|
||||
</button>
|
||||
|
||||
{/* Elválasztó vonal mobilon */}
|
||||
<div className="w-full h-px bg-white/30"></div>
|
||||
|
||||
Reference in New Issue
Block a user